Message ID | 20240313154857.12949-2-tzimmermann@suse.de (mailing list archive) |
---|---|
State | Handled Elsewhere, archived |
Headers | show |
Series | backlight: Remove struct backlight_properties.fb_blank | expand |
Hi Thomas, Thanks for this! Cc'ing Andy and Geert -- the new maintainer and reviewer. Also, a couple quick notes below since I am here... On Wed, Mar 13, 2024 at 4:49 PM Thomas Zimmermann <tzimmermann@suse.de> wrote: > > Replace the use of struct backlight_properties.fb_blank with a > call to backlight_get_brightness(). The helper implement the same > logic as the driver's function. It is not exactly the same logic since `backlight_is_blank` accounts for `BL_CORE_SUSPENDED`. > - int brightness = bl->props.brightness; > + int brightness = backlight_get_brightness(bl); This can be `const` now (or even removed and have the call embedded below). Cheers, Miguel
On Wed, Mar 13, 2024 at 05:08:08PM +0100, Miguel Ojeda wrote: > > - int brightness = bl->props.brightness; > > + int brightness = backlight_get_brightness(bl); > > This can be `const` now (or even removed and have the call embedded below). > Is there an advantage to making this const? regards, dan carpenter
On Wed, Mar 13, 2024 at 04:45:00PM +0100, Thomas Zimmermann wrote: > Replace the use of struct backlight_properties.fb_blank with a > call to backlight_get_brightness(). The helper implement the same > logic as the driver's function. If you end up resending there is a typo s/implement/implements/. regards, dan carpenter
On Wed, Mar 13, 2024 at 6:11 PM Dan Carpenter <dan.carpenter@linaro.org> wrote: > > Is there an advantage to making this const? Not much in this case -- it is more about trying to be const-correct where possible. Cheers, Miguel
Hi Miguel. On Wed, Mar 13, 2024 at 05:08:08PM +0100, Miguel Ojeda wrote: > Hi Thomas, > > Thanks for this! > > Cc'ing Andy and Geert -- the new maintainer and reviewer. > > Also, a couple quick notes below since I am here... > > On Wed, Mar 13, 2024 at 4:49 PM Thomas Zimmermann <tzimmermann@suse.de> wrote: > > > > Replace the use of struct backlight_properties.fb_blank with a > > call to backlight_get_brightness(). The helper implement the same > > logic as the driver's function. > > It is not exactly the same logic since `backlight_is_blank` accounts > for `BL_CORE_SUSPENDED`. The driver does not set BL_CORE_SUSPENDRESUME so that part is a nop. Sam
On Wed, Mar 13, 2024 at 04:45:00PM +0100, Thomas Zimmermann wrote: > Replace the use of struct backlight_properties.fb_blank with a > call to backlight_get_brightness(). The helper implement the same > logic as the driver's function. > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> > Cc: Robin van der Gracht <robin@protonic.nl> > Cc: Miguel Ojeda <ojeda@kernel.org> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> > --- > drivers/auxdisplay/ht16k33.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c > index a90430b7d07ba..83db829b97a5e 100644 > --- a/drivers/auxdisplay/ht16k33.c > +++ b/drivers/auxdisplay/ht16k33.c > @@ -314,14 +314,9 @@ static int ht16k33_initialize(struct ht16k33_priv *priv) > > static int ht16k33_bl_update_status(struct backlight_device *bl) > { > - int brightness = bl->props.brightness; > + int brightness = backlight_get_brightness(bl); > struct ht16k33_priv *priv = bl_get_data(bl); > > - if (bl->props.power != FB_BLANK_UNBLANK || > - bl->props.fb_blank != FB_BLANK_UNBLANK || > - bl->props.state & BL_CORE_FBBLANK) > - brightness = 0; > - > return ht16k33_brightness_set(priv, brightness); > } > > -- > 2.44.0
Hi Am 13.03.24 um 17:08 schrieb Miguel Ojeda: > Hi Thomas, > > Thanks for this! > > Cc'ing Andy and Geert -- the new maintainer and reviewer. Ah, sorry. They are not yet in my MAINTAINERS file. > > Also, a couple quick notes below since I am here... > > On Wed, Mar 13, 2024 at 4:49 PM Thomas Zimmermann <tzimmermann@suse.de> wrote: >> Replace the use of struct backlight_properties.fb_blank with a >> call to backlight_get_brightness(). The helper implement the same >> logic as the driver's function. > It is not exactly the same logic since `backlight_is_blank` accounts > for `BL_CORE_SUSPENDED`. As Sam already said, it doesn't seem to make different in practice. I'd mention it in the commit message and that's it. Ok? Best regards Thomas > >> - int brightness = bl->props.brightness; >> + int brightness = backlight_get_brightness(bl); > This can be `const` now (or even removed and have the call embedded below). > > Cheers, > Miguel
On Wed, Mar 13, 2024 at 4:49 PM Thomas Zimmermann <tzimmermann@suse.de> wrote: > Replace the use of struct backlight_properties.fb_blank with a > call to backlight_get_brightness(). The helper implement the same > logic as the driver's function. > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Gr{oetje,eeting}s, Geert
On Wed, Mar 13, 2024 at 6:54 PM Sam Ravnborg <sam@ravnborg.org> wrote: > > The driver does not set BL_CORE_SUSPENDRESUME so that part is a nop. The driver may not set it now, but it is still not the same logic (and unless I am missing something it would not generate the same code either, so not sure I would say it is a "nop" in that sense). But, yeah, I only meant to say that the commit message could be more accurate (e.g. mention why the difference does not matter) -- that is why I quoted the message instead of the code. Apologies if that was unclear. Cheers, Miguel
On Thu, Mar 14, 2024 at 9:09 AM Thomas Zimmermann <tzimmermann@suse.de> wrote: > > As Sam already said, it doesn't seem to make different in practice. I'd > mention it in the commit message and that's it. Ok? Yeah, that is what I meant -- thanks a lot! Reviewed-by: Miguel Ojeda <ojeda@kernel.org> Cheers, Miguel
Hi Thomas, Thank you for submitting your patch, it looks fine to me. Reviewed-by: Robin van der Gracht <robin@protonic.nl> On Wed, 13 Mar 2024 16:45:00 +0100 Thomas Zimmermann <tzimmermann@suse.de> wrote: > Replace the use of struct backlight_properties.fb_blank with a > call to backlight_get_brightness(). The helper implement the same > logic as the driver's function. > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> > Cc: Robin van der Gracht <robin@protonic.nl> > Cc: Miguel Ojeda <ojeda@kernel.org> > --- > drivers/auxdisplay/ht16k33.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/drivers/auxdisplay/ht16k33.c > b/drivers/auxdisplay/ht16k33.c index a90430b7d07ba..83db829b97a5e > 100644 --- a/drivers/auxdisplay/ht16k33.c > +++ b/drivers/auxdisplay/ht16k33.c > @@ -314,14 +314,9 @@ static int ht16k33_initialize(struct > ht16k33_priv *priv) > static int ht16k33_bl_update_status(struct backlight_device *bl) > { > - int brightness = bl->props.brightness; > + int brightness = backlight_get_brightness(bl); > struct ht16k33_priv *priv = bl_get_data(bl); > > - if (bl->props.power != FB_BLANK_UNBLANK || > - bl->props.fb_blank != FB_BLANK_UNBLANK || > - bl->props.state & BL_CORE_FBBLANK) > - brightness = 0; > - > return ht16k33_brightness_set(priv, brightness); > } >
diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c index a90430b7d07ba..83db829b97a5e 100644 --- a/drivers/auxdisplay/ht16k33.c +++ b/drivers/auxdisplay/ht16k33.c @@ -314,14 +314,9 @@ static int ht16k33_initialize(struct ht16k33_priv *priv) static int ht16k33_bl_update_status(struct backlight_device *bl) { - int brightness = bl->props.brightness; + int brightness = backlight_get_brightness(bl); struct ht16k33_priv *priv = bl_get_data(bl); - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & BL_CORE_FBBLANK) - brightness = 0; - return ht16k33_brightness_set(priv, brightness); }
Replace the use of struct backlight_properties.fb_blank with a call to backlight_get_brightness(). The helper implement the same logic as the driver's function. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Cc: Robin van der Gracht <robin@protonic.nl> Cc: Miguel Ojeda <ojeda@kernel.org> --- drivers/auxdisplay/ht16k33.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)