* [PATCH] drm/radeon: Use hweight32
@ 2012-11-09 12:10 Akinobu Mita
2012-11-09 12:10 ` [PATCH] drm: use memchr_inv() Akinobu Mita
2012-11-09 12:10 ` [PATCH] drm/ttm: remove unneeded preempt_disable/enable Akinobu Mita
0 siblings, 2 replies; 4+ messages in thread
From: Akinobu Mita @ 2012-11-09 12:10 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, David Airlie, dri-devel
Use hweight32 instead of counting for each bit
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
---
drivers/gpu/drm/radeon/r600.c | 8 +-------
drivers/gpu/drm/radeon/r600_cp.c | 7 +------
2 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index cda280d..169ecc9 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1424,13 +1424,7 @@ u32 r6xx_remap_render_backend(struct radeon_device *rdev,
int r600_count_pipe_bits(uint32_t val)
{
- int i, ret = 0;
-
- for (i = 0; i < 32; i++) {
- ret += val & 1;
- val >>= 1;
- }
- return ret;
+ return hweight32(val);
}
static void r600_gpu_init(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/r600_cp.c b/drivers/gpu/drm/radeon/r600_cp.c
index 2514123..be85f75 100644
--- a/drivers/gpu/drm/radeon/r600_cp.c
+++ b/drivers/gpu/drm/radeon/r600_cp.c
@@ -721,12 +721,7 @@ static u32 r600_get_tile_pipe_to_backend_map(u32 num_tile_pipes,
static int r600_count_pipe_bits(uint32_t val)
{
- int i, ret = 0;
- for (i = 0; i < 32; i++) {
- ret += val & 1;
- val >>= 1;
- }
- return ret;
+ return hweight32(val);
}
static void r600_gfx_init(struct drm_device *dev,
--
1.7.11.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] drm: use memchr_inv()
2012-11-09 12:10 [PATCH] drm/radeon: Use hweight32 Akinobu Mita
@ 2012-11-09 12:10 ` Akinobu Mita
2012-11-09 12:10 ` [PATCH] drm/ttm: remove unneeded preempt_disable/enable Akinobu Mita
1 sibling, 0 replies; 4+ messages in thread
From: Akinobu Mita @ 2012-11-09 12:10 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, David Airlie, dri-devel
Use memchr_inv() to check the specified memory region is filled with zero.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
---
drivers/gpu/drm/drm_edid.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index fadcd44..59260bf 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -307,12 +307,9 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf,
static bool drm_edid_is_zero(u8 *in_edid, int length)
{
- int i;
- u32 *raw_edid = (u32 *)in_edid;
+ if (memchr_inv(in_edid, 0, length))
+ return false;
- for (i = 0; i < length / 4; i++)
- if (*(raw_edid + i) != 0)
- return false;
return true;
}
--
1.7.11.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] drm/ttm: remove unneeded preempt_disable/enable
2012-11-09 12:10 [PATCH] drm/radeon: Use hweight32 Akinobu Mita
2012-11-09 12:10 ` [PATCH] drm: use memchr_inv() Akinobu Mita
@ 2012-11-09 12:10 ` Akinobu Mita
2012-11-14 8:54 ` Thomas Hellstrom
1 sibling, 1 reply; 4+ messages in thread
From: Akinobu Mita @ 2012-11-09 12:10 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, dri-devel, David Airlie
It is unnecessary to disable preemption explicitly while calling
copy_highpage(). Because copy_highpage() will do it again through
kmap_atomic/kunmap_atomic.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
---
drivers/gpu/drm/ttm/ttm_tt.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index bf82601..7d759a4 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -308,9 +308,7 @@ int ttm_tt_swapin(struct ttm_tt *ttm)
if (unlikely(to_page == NULL))
goto out_err;
- preempt_disable();
copy_highpage(to_page, from_page);
- preempt_enable();
page_cache_release(from_page);
}
@@ -358,9 +356,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage)
ret = PTR_ERR(to_page);
goto out_err;
}
- preempt_disable();
copy_highpage(to_page, from_page);
- preempt_enable();
set_page_dirty(to_page);
mark_page_accessed(to_page);
page_cache_release(to_page);
--
1.7.11.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/ttm: remove unneeded preempt_disable/enable
2012-11-09 12:10 ` [PATCH] drm/ttm: remove unneeded preempt_disable/enable Akinobu Mita
@ 2012-11-14 8:54 ` Thomas Hellstrom
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Hellstrom @ 2012-11-14 8:54 UTC (permalink / raw)
To: Akinobu Mita; +Cc: linux-kernel, akpm, dri-devel
On 11/09/2012 01:10 PM, Akinobu Mita wrote:
> It is unnecessary to disable preemption explicitly while calling
> copy_highpage(). Because copy_highpage() will do it again through
> kmap_atomic/kunmap_atomic.
>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> Cc: dri-devel@lists.freedesktop.org
> Cc: David Airlie <airlied@linux.ie>
> ---
> drivers/gpu/drm/ttm/ttm_tt.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> index bf82601..7d759a4 100644
> --- a/drivers/gpu/drm/ttm/ttm_tt.c
> +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> @@ -308,9 +308,7 @@ int ttm_tt_swapin(struct ttm_tt *ttm)
> if (unlikely(to_page == NULL))
> goto out_err;
>
> - preempt_disable();
> copy_highpage(to_page, from_page);
> - preempt_enable();
> page_cache_release(from_page);
> }
>
> @@ -358,9 +356,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage)
> ret = PTR_ERR(to_page);
> goto out_err;
> }
> - preempt_disable();
> copy_highpage(to_page, from_page);
> - preempt_enable();
> set_page_dirty(to_page);
> mark_page_accessed(to_page);
> page_cache_release(to_page);
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-11-14 8:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-09 12:10 [PATCH] drm/radeon: Use hweight32 Akinobu Mita
2012-11-09 12:10 ` [PATCH] drm: use memchr_inv() Akinobu Mita
2012-11-09 12:10 ` [PATCH] drm/ttm: remove unneeded preempt_disable/enable Akinobu Mita
2012-11-14 8:54 ` Thomas Hellstrom
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).