Re: [PATCH] drm/i915: logical-not-parenthesis gcc 5.0 fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Feb 22, 2015 at 08:10:11PM +0100, François Tigeot wrote:
> * This change prevents "logical not is only applied to the left hand side of comparison"
>   gcc 5.0 warnings.
> 
> * Originally added by John Marino in DragonFly's eecf6c3c3b6f7127edd8b8f8c2a83e2f882ed0da
>   commit.
> 
> Signed-off-by: François Tigeot <ftigeot@xxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_gem_tiling.c | 2 +-
>  drivers/gpu/drm/i915/intel_display.c   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
> index 7a24bd1..402179c 100644
> --- a/drivers/gpu/drm/i915/i915_gem_tiling.c
> +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
> @@ -512,7 +512,7 @@ i915_gem_object_do_bit_17_swizzle(struct drm_i915_gem_object *obj)
>  		struct page *page = sg_page_iter_page(&sg_iter);
>  		char new_bit_17 = page_to_phys(page) >> 17;
>  		if ((new_bit_17 & 0x1) !=
> -		    (test_bit(i, obj->bit_17) != 0)) {
> +		    (test_bit(i, obj->bit_17) ? 1 : 0)) {

That doesn't improve the code, and here it looks like gcc's warning is
simply misleading.

static inline bool new_page_needs_bit17_swizzle(struct page *page)
{
	return page_to_phys(page) & (1 << 17);
}

static inline bool old_page_has_bit7_swizzle(struct drm_i915_gem_object *obj, 
					     int page)
{
	return test_bit(page, obj->bit_17);
}

if (new_page_needs_bit17_swizzle(page) != old_page_has_bit17_swizzle(obj, i)) {

Should be clearer.

>  			i915_gem_swizzle_page(page);
>  			set_page_dirty(page);
>  		}
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 3b0fe9f..91264b2 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -13299,7 +13299,7 @@ intel_check_plane_mapping(struct intel_crtc *crtc)
>  	val = I915_READ(reg);
>  
>  	if ((val & DISPLAY_PLANE_ENABLE) &&
> -	    (!!(val & DISPPLANE_SEL_PIPE_MASK) == crtc->pipe))
> +	    (!!( (val & DISPPLANE_SEL_PIPE_MASK) == crtc->pipe) ))

That's wrong.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux