backlight: ipaq_micro: Make structure micro_bl_props constant
diff mbox series

Message ID 20190813085855.8302-1-nishkadg.linux@gmail.com
State New
Headers show
Series
  • backlight: ipaq_micro: Make structure micro_bl_props constant
Related show

Commit Message

Nishka Dasgupta Aug. 13, 2019, 8:58 a.m. UTC
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(-)

Comments

Daniel Thompson Aug. 13, 2019, 9:12 a.m. UTC | #1
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
>

Patch
diff mbox series

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,