Re: [PATCH] auxdisplay: constify charlcd_ops.
From: Andy Shevchenko
Date: Fri Jul 14 2017 - 12:42:42 EST
On Fri, 2017-07-14 at 22:04 +0530, Arvind Yadav wrote:
> charlcd_ops are not supposed to change at runtime. All functions
> working with charlcd_ops provided by <misc/charlcd.h> work with
> const charlcd_ops. So mark the non-const structs as const.
>
> File size before:
> ÂÂÂtext ÂÂÂdata ÂÂÂÂbss ÂÂÂÂdec ÂÂÂÂhex
> filename
> Â 12750 ÂÂÂÂ560 ÂÂÂÂ362 ÂÂ13672 ÂÂÂ3568
> drivers/auxdisplay/panel.o
>
> File size After adding 'const':
> ÂÂÂtext ÂÂÂdata ÂÂÂÂbss ÂÂÂÂdec ÂÂÂÂhex
> filename
> Â 12942 ÂÂÂÂ368 ÂÂÂÂ362 ÂÂ13672 ÂÂÂ3568
> drivers/auxdisplay/panel.o
>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
(As long as it has been compile tested)
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@xxxxxxxxx>
> ---
> Âdrivers/auxdisplay/panel.c | 6 +++---
> Â1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c
> index 7a8b8fb..df126dc 100644
> --- a/drivers/auxdisplay/panel.c
> +++ b/drivers/auxdisplay/panel.c
> @@ -877,21 +877,21 @@ static void lcd_clear_fast_tilcd(struct charlcd
> *charlcd)
> Â spin_unlock_irq(&pprt_lock);
> Â}
> Â
> -static struct charlcd_ops charlcd_serial_ops = {
> +static const struct charlcd_ops charlcd_serial_ops = {
> Â .write_cmd = lcd_write_cmd_s,
> Â .write_data = lcd_write_data_s,
> Â .clear_fast = lcd_clear_fast_s,
> Â .backlight = lcd_backlight,
> Â};
> Â
> -static struct charlcd_ops charlcd_parallel_ops = {
> +static const struct charlcd_ops charlcd_parallel_ops = {
> Â .write_cmd = lcd_write_cmd_p8,
> Â .write_data = lcd_write_data_p8,
> Â .clear_fast = lcd_clear_fast_p8,
> Â .backlight = lcd_backlight,
> Â};
> Â
> -static struct charlcd_ops charlcd_tilcd_ops = {
> +static const struct charlcd_ops charlcd_tilcd_ops = {
> Â .write_cmd = lcd_write_cmd_tilcd,
> Â .write_data = lcd_write_data_tilcd,
> Â .clear_fast = lcd_clear_fast_tilcd,
--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy