Re: [PATCH 1/5] cdev: make file operations const

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 30, 2017 at 04:09:43PM +0200, Philipp Zabel wrote:
> scripts/checkpatch.pl warns that struct file_operations should be const,
> but cdev->ops is not const, so without this patch we can choose between
> a warning from checkpatch and a warning from the compiler about
> discarding the const attribute when assigning the struct file_operations
> cdev->ops.
> 
> Since there is no reason to modify the contents of cdev->ops after
> probing, make it const.

Applied this one and the second patch.

Sascha

> 
> Signed-off-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
> ---
>  include/driver.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/driver.h b/include/driver.h
> index 52e06f7d62..086e44636b 100644
> --- a/include/driver.h
> +++ b/include/driver.h
> @@ -440,7 +440,7 @@ struct file_operations {
>  #define MAX_PARTUUID_STR	sizeof("00112233-4455-6677-8899-AABBCCDDEEFF")
>  
>  struct cdev {
> -	struct file_operations *ops;
> +	const struct file_operations *ops;
>  	void *priv;
>  	struct device_d *dev;
>  	struct device_node *device_node;
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux