* [PATCH] backlight: ipaq_micro: Make structure micro_bl_props constant
@ 2019-08-13 8:59 Nishka Dasgupta
2019-08-13 9:12 ` Daniel Thompson
2019-09-12 10:15 ` Daniel Thompson
0 siblings, 2 replies; 5+ messages in thread
From: Nishka Dasgupta @ 2019-08-13 8:59 UTC (permalink / raw)
To: lee.jones, daniel.thompson, jingoohan1, b.zolnierkie, dri-devel,
linux-fbdev
Cc: Nishka Dasgupta
Static structure micro_bl_props, having type backlight_properties, is
used only once, when it is passed as the last argument to function
devm_backlight_device_register(). devm_backlight_device_register() is
defined with its last parameter being declared constant. Hence make
micro_bl_props itself constant as well.
Issue found with Coccinelle.
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
drivers/video/backlight/ipaq_micro_bl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/backlight/ipaq_micro_bl.c b/drivers/video/backlight/ipaq_micro_bl.c
index 1123f67c12b3..85b16cc82878 100644
--- a/drivers/video/backlight/ipaq_micro_bl.c
+++ b/drivers/video/backlight/ipaq_micro_bl.c
@@ -44,7 +44,7 @@ static const struct backlight_ops micro_bl_ops = {
.update_status = micro_bl_update_status,
};
-static struct backlight_properties micro_bl_props = {
+static const struct backlight_properties micro_bl_props = {
.type = BACKLIGHT_RAW,
.max_brightness = 255,
.power = FB_BLANK_UNBLANK,
--
2.19.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] backlight: ipaq_micro: Make structure micro_bl_props constant
2019-08-13 8:59 [PATCH] backlight: ipaq_micro: Make structure micro_bl_props constant Nishka Dasgupta
@ 2019-08-13 9:12 ` Daniel Thompson
2019-09-03 16:19 ` Daniel Thompson
2019-09-12 10:15 ` Daniel Thompson
1 sibling, 1 reply; 5+ messages in thread
From: Daniel Thompson @ 2019-08-13 9:12 UTC (permalink / raw)
To: Nishka Dasgupta
Cc: jingoohan1, linux-fbdev, lee.jones, dri-devel, b.zolnierkie
On Tue, Aug 13, 2019 at 02:28:55PM +0530, Nishka Dasgupta wrote:
> Static structure micro_bl_props, having type backlight_properties, is
> used only once, when it is passed as the last argument to function
> devm_backlight_device_register(). devm_backlight_device_register() is
> defined with its last parameter being declared constant. Hence make
> micro_bl_props itself constant as well.
> Issue found with Coccinelle.
Did you do any review to see if this pattern occurs in other backlight
drivers (it looks to me like the same pattern appears in
rave-sp-backlight.c... do the tools bring that one out as well).
Daniel.
>
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> ---
> drivers/video/backlight/ipaq_micro_bl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/video/backlight/ipaq_micro_bl.c b/drivers/video/backlight/ipaq_micro_bl.c
> index 1123f67c12b3..85b16cc82878 100644
> --- a/drivers/video/backlight/ipaq_micro_bl.c
> +++ b/drivers/video/backlight/ipaq_micro_bl.c
> @@ -44,7 +44,7 @@ static const struct backlight_ops micro_bl_ops = {
> .update_status = micro_bl_update_status,
> };
>
> -static struct backlight_properties micro_bl_props = {
> +static const struct backlight_properties micro_bl_props = {
> .type = BACKLIGHT_RAW,
> .max_brightness = 255,
> .power = FB_BLANK_UNBLANK,
> --
> 2.19.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] backlight: ipaq_micro: Make structure micro_bl_props constant
2019-08-13 9:12 ` Daniel Thompson
@ 2019-09-03 16:19 ` Daniel Thompson
2019-09-04 3:53 ` Nishka Dasgupta
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Thompson @ 2019-09-03 16:19 UTC (permalink / raw)
To: Nishka Dasgupta
Cc: jingoohan1, linux-fbdev, lee.jones, dri-devel, b.zolnierkie
On Tue, Aug 13, 2019 at 10:12:51AM +0100, Daniel Thompson wrote:
> On Tue, Aug 13, 2019 at 02:28:55PM +0530, Nishka Dasgupta wrote:
> > Static structure micro_bl_props, having type backlight_properties, is
> > used only once, when it is passed as the last argument to function
> > devm_backlight_device_register(). devm_backlight_device_register() is
> > defined with its last parameter being declared constant. Hence make
> > micro_bl_props itself constant as well.
> > Issue found with Coccinelle.
>
> Did you do any review to see if this pattern occurs in other backlight
> drivers (it looks to me like the same pattern appears in
> rave-sp-backlight.c... do the tools bring that one out as well).
Ping?
Daniel.
> > Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> > ---
> > drivers/video/backlight/ipaq_micro_bl.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/video/backlight/ipaq_micro_bl.c b/drivers/video/backlight/ipaq_micro_bl.c
> > index 1123f67c12b3..85b16cc82878 100644
> > --- a/drivers/video/backlight/ipaq_micro_bl.c
> > +++ b/drivers/video/backlight/ipaq_micro_bl.c
> > @@ -44,7 +44,7 @@ static const struct backlight_ops micro_bl_ops = {
> > .update_status = micro_bl_update_status,
> > };
> >
> > -static struct backlight_properties micro_bl_props = {
> > +static const struct backlight_properties micro_bl_props = {
> > .type = BACKLIGHT_RAW,
> > .max_brightness = 255,
> > .power = FB_BLANK_UNBLANK,
> > --
> > 2.19.1
> >
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] backlight: ipaq_micro: Make structure micro_bl_props constant
2019-09-03 16:19 ` Daniel Thompson
@ 2019-09-04 3:53 ` Nishka Dasgupta
0 siblings, 0 replies; 5+ messages in thread
From: Nishka Dasgupta @ 2019-09-04 3:53 UTC (permalink / raw)
To: Daniel Thompson
Cc: jingoohan1, linux-fbdev, Lee Jones, dri-devel, b.zolnierkie
On Tue, 3 Sep 2019 at 21:49, Daniel Thompson <daniel.thompson@linaro.org> wrote:
>
> On Tue, Aug 13, 2019 at 10:12:51AM +0100, Daniel Thompson wrote:
> > On Tue, Aug 13, 2019 at 02:28:55PM +0530, Nishka Dasgupta wrote:
> > > Static structure micro_bl_props, having type backlight_properties, is
> > > used only once, when it is passed as the last argument to function
> > > devm_backlight_device_register(). devm_backlight_device_register() is
> > > defined with its last parameter being declared constant. Hence make
> > > micro_bl_props itself constant as well.
> > > Issue found with Coccinelle.
> >
> > Did you do any review to see if this pattern occurs in other backlight
> > drivers (it looks to me like the same pattern appears in
> > rave-sp-backlight.c... do the tools bring that one out as well).
>
> Ping?
Sorry, did my reply not go through?
I had said:
No, the Coccinelle script I'm using doesn't flag any other backlight
drivers. It's possible that the script just missed something. Which
structure in rave-sp-backlight.c could potentially be made const?
Thanking you,
Nishka
>
>
> Daniel.
>
>
> > > Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> > > ---
> > > drivers/video/backlight/ipaq_micro_bl.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/video/backlight/ipaq_micro_bl.c b/drivers/video/backlight/ipaq_micro_bl.c
> > > index 1123f67c12b3..85b16cc82878 100644
> > > --- a/drivers/video/backlight/ipaq_micro_bl.c
> > > +++ b/drivers/video/backlight/ipaq_micro_bl.c
> > > @@ -44,7 +44,7 @@ static const struct backlight_ops micro_bl_ops = {
> > > .update_status = micro_bl_update_status,
> > > };
> > >
> > > -static struct backlight_properties micro_bl_props = {
> > > +static const struct backlight_properties micro_bl_props = {
> > > .type = BACKLIGHT_RAW,
> > > .max_brightness = 255,
> > > .power = FB_BLANK_UNBLANK,
> > > --
> > > 2.19.1
> > >
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] backlight: ipaq_micro: Make structure micro_bl_props constant
2019-08-13 8:59 [PATCH] backlight: ipaq_micro: Make structure micro_bl_props constant Nishka Dasgupta
2019-08-13 9:12 ` Daniel Thompson
@ 2019-09-12 10:15 ` Daniel Thompson
1 sibling, 0 replies; 5+ messages in thread
From: Daniel Thompson @ 2019-09-12 10:15 UTC (permalink / raw)
To: Nishka Dasgupta
Cc: jingoohan1, linux-fbdev, lee.jones, dri-devel, b.zolnierkie
On Tue, Aug 13, 2019 at 02:28:55PM +0530, Nishka Dasgupta wrote:
> Static structure micro_bl_props, having type backlight_properties, is
> used only once, when it is passed as the last argument to function
> devm_backlight_device_register(). devm_backlight_device_register() is
> defined with its last parameter being declared constant. Hence make
> micro_bl_props itself constant as well.
> Issue found with Coccinelle.
>
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
> ---
> drivers/video/backlight/ipaq_micro_bl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/video/backlight/ipaq_micro_bl.c b/drivers/video/backlight/ipaq_micro_bl.c
> index 1123f67c12b3..85b16cc82878 100644
> --- a/drivers/video/backlight/ipaq_micro_bl.c
> +++ b/drivers/video/backlight/ipaq_micro_bl.c
> @@ -44,7 +44,7 @@ static const struct backlight_ops micro_bl_ops = {
> .update_status = micro_bl_update_status,
> };
>
> -static struct backlight_properties micro_bl_props = {
> +static const struct backlight_properties micro_bl_props = {
> .type = BACKLIGHT_RAW,
> .max_brightness = 255,
> .power = FB_BLANK_UNBLANK,
> --
> 2.19.1
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-09-12 10:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-13 8:59 [PATCH] backlight: ipaq_micro: Make structure micro_bl_props constant Nishka Dasgupta
2019-08-13 9:12 ` Daniel Thompson
2019-09-03 16:19 ` Daniel Thompson
2019-09-04 3:53 ` Nishka Dasgupta
2019-09-12 10:15 ` Daniel Thompson
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).