backlight: ipaq_micro: Make structure micro_bl_props constant
Subsystems (2)
PATCH 1/1 backlight: ipaq_micro: Make structure micro_bl_props constant
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.
--- drivers/video/backlight/ipaq_micro_bl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/backlight/ipaq_micro_bl.c +1 -1
@@ -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 ,
Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · Nishka Dasgupta
Static structure
micro_bl_props, having typebacklight_properties, is used only once, when it is passed as the last argument to functiondevm_backlight_device_register().devm_backlight_device_register()is defined with its last parameter being declared constant. Hence makemicro_bl_propsitself 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.
Quoted 22 lines
Signed-off-by Nishka Dasgupta <[email protected]>--- drivers/video/backlight/ipaq_micro_bl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/video/backlight/ipaq_micro_bl.c +1
-1@@ -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 ,Signature · 1 line
2.19.1
Quoted 11 lines · Daniel Thompson
Quoted 6 lines · Nishka Dasgupta
Static structure
micro_bl_props, having typebacklight_properties, is used only once, when it is passed as the last argument to functiondevm_backlight_device_register().devm_backlight_device_register()is defined with its last parameter being declared constant. Hence makemicro_bl_propsitself 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.
Quoted 21 lines
Quoted 21 lines
Signed-off-by Nishka Dasgupta <[email protected]>--- drivers/video/backlight/ipaq_micro_bl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/video/backlight/ipaq_micro_bl.c +1
-1@@ -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 ,Signature · 1 line
2.19.1
Quoted 10 lines · Daniel Thompson
Quoted 8 lines · Daniel Thompson
Quoted 6 lines · Nishka Dasgupta
Static structure
micro_bl_props, having typebacklight_properties, is used only once, when it is passed as the last argument to functiondevm_backlight_device_register().devm_backlight_device_register()is defined with its last parameter being declared constant. Hence makemicro_bl_propsitself constant as well.
Issue found with Coccinelle.
Quoted 5 lines
Quoted 3 lines
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
Quoted 18 lines
Daniel.
Quoted 13 lines
Quoted 13 lines
Signed-off-by Nishka Dasgupta <[email protected]>--- drivers/video/backlight/ipaq_micro_bl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/video/backlight/ipaq_micro_bl.c +0
-0@@ -44,7 +44,7 @@ static const struct backlight_ops micro_bl_ops = { .update_status = micro_bl_update_status, };
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/video/backlight/ipaq_micro_bl.c +1
-2-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
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · Nishka Dasgupta
Static structure
micro_bl_props, having typebacklight_properties, is used only once, when it is passed as the last argument to functiondevm_backlight_device_register().devm_backlight_device_register()is defined with its last parameter being declared constant. Hence makemicro_bl_propsitself constant as well.
Issue found with Coccinelle.Signed-off-by Nishka Dasgupta <[email protected]>
Quoted 19 lines
--- drivers/video/backlight/ipaq_micro_bl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/video/backlight/ipaq_micro_bl.c +1
-1@@ -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 ,Signature · 1 line
2.19.1