[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250118180916.433bb73c@pumpkin>
Date: Sat, 18 Jan 2025 18:09:16 +0000
From: David Laight <david.laight.linux@...il.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: David Laight <David.Laight@...lab.com>, Linus Torvalds
<torvalds@...ux-foundation.org>, 'Arnd Bergmann' <arnd@...nel.org>,
"'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>, 'Jens
Axboe' <axboe@...nel.dk>, 'Matthew Wilcox' <willy@...radead.org>,
'Christoph Hellwig' <hch@...radead.org>, 'Andrew Morton'
<akpm@...ux-foundation.org>, 'Andy Shevchenko'
<andriy.shevchenko@...ux.intel.com>, 'Dan Carpenter'
<dan.carpenter@...aro.org>, "'Jason A . Donenfeld'" <Jason@...c4.com>,
"'pedro.falcato@...il.com'" <pedro.falcato@...il.com>, 'Mateusz Guzik'
<mjguzik@...il.com>, "'linux-mm@...ck.org'" <linux-mm@...ck.org>, 'Lorenzo
Stoakes' <lorenzo.stoakes@...cle.com>, intel-xe@...ts.freedesktop.org,
intel-gfx@...ts.freedesktop.org, David Airlie <airlied@...il.com>, Simona
Vetter <simona@...ll.ch>, Jani Nikula <jani.nikula@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>
Subject: Re: Buiild error in i915/xe (was: [PATCH next 4/7] minmax.h: Use
BUILD_BUG_ON_MSG() for the lo < hi test in clamp())
On Sat, 18 Jan 2025 09:49:21 -0800
Guenter Roeck <linux@...ck-us.net> wrote:
> On Sat, Jan 18, 2025 at 05:09:59PM +0000, David Laight wrote:
> > On Sat, 18 Jan 2025 08:13:06 -0800
> > Guenter Roeck <linux@...ck-us.net> wrote:
> >
> > > Hi,
> > >
> > > On Mon, Nov 18, 2024 at 07:13:31PM +0000, David Laight wrote:
> > > > Use BUILD_BUG_ON_MSG(statically_true(ulo > uhi), ...) for the sanity
> > > > check of the bounds in clamp().
> > > > Gives better error coverage and one less expansion of the arguments.
> > > >
> > > > Signed-off-by: David Laight <david.laight@...lab.com>
> > >
> > > This patch triggers a build error when trying to build parisc:allmodconfig.
> > > See error message and bisect log below.
> > >
> > > I don't think there is anything wrong with the patch. The underlying
> > > problem seems to be that parisc:allmodconfig enables CONFIG_DRM_XE which
> > > tries to build the affected file even though CONFIG_DRM_I915 is not
> > > enabled/supported on parisc.
> >
> > This has appeared before.
> > Any idea which inlined copy of scale() is causing the problem.
> > On the face of it they all look ok.
> >
> > If you can reproduce it maybe try commenting out some of the calls.
> >
>
> See diff below. All three changes are needed.
> No idea why the compiler would know that the values are invalid.
Maybe it isn't even an inlining issue.
Perhaps that compiler just doesn't like the function ?
What happens without the 'static' (and an extra prototype)?
David
>
> Guenter
>
> ---
> diff --git a/drivers/gpu/drm/i915/display/intel_backlight.c b/drivers/gpu/drm/i915/display/intel_backlight.c
> index fc1e517e074a..3b2c8bdfcf8d 100644
> --- a/drivers/gpu/drm/i915/display/intel_backlight.c
> +++ b/drivers/gpu/drm/i915/display/intel_backlight.c
> @@ -76,10 +76,14 @@ static u32 clamp_user_to_hw(struct intel_connector *connector,
> static u32 scale_hw_to_user(struct intel_connector *connector,
> u32 hw_level, u32 user_max)
> {
> +#if 0
> struct intel_panel *panel = &connector->panel;
>
> return scale(hw_level, panel->backlight.min, panel->backlight.max,
> 0, user_max);
> +#else
> + return 0;
> +#endif
> }
>
> u32 intel_backlight_invert_pwm_level(struct intel_connector *connector, u32 val)
> @@ -119,8 +123,10 @@ u32 intel_backlight_level_to_pwm(struct intel_connector *connector, u32 val)
> drm_WARN_ON_ONCE(&i915->drm,
> panel->backlight.max == 0 || panel->backlight.pwm_level_max == 0);
>
> +#if 0
> val = scale(val, panel->backlight.min, panel->backlight.max,
> panel->backlight.pwm_level_min, panel->backlight.pwm_level_max);
> +#endif
>
> return intel_backlight_invert_pwm_level(connector, val);
> }
> @@ -138,8 +144,12 @@ u32 intel_backlight_level_from_pwm(struct intel_connector *connector, u32 val)
> intel_has_quirk(display, QUIRK_INVERT_BRIGHTNESS)))
> val = panel->backlight.pwm_level_max - (val - panel->backlight.pwm_level_min);
>
> +#if 0
> return scale(val, panel->backlight.pwm_level_min, panel->backlight.pwm_level_max,
> panel->backlight.min, panel->backlight.max);
> +#else
> + return 0;
> +#endif
> }
>
> static u32 lpt_get_backlight(struct intel_connector *connector, enum pipe unused)
Powered by blists - more mailing lists