Re: [PATCH] i2c: Drop explicit initialization of struct i2c_device_id::driver_data to 0

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

 



Hi Uwe,

> There is an inconsistency in the different *_device_id structures. Some
> have a kernel_ulong_t for driver private data, others have a void*.
> Depending on how it's used in the drivers, one or the other is better.
> To get the best from both the idea is to do
> 
> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
> index 4338b1b4ac44..594c5ace303a 100644
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -477,7 +477,10 @@ struct rpmsg_device_id {
>  
>  struct i2c_device_id {
>  	char name[I2C_NAME_SIZE];
> -	kernel_ulong_t driver_data;	/* Data private to the driver */
> +	union {
> +		kernel_ulong_t driver_data;	/* Data private to the driver */
> +		const void *data;
> +	};
>  };
>  
>  /* pci_epf */
> 
> which then allows to drop quite a few casts, e.g.

I personally could live with the casts, even though the above looks
clearer, of course. On suggestion, though, can we please have:

 +		const void *data_ptr;

There is no obvious difference between 'driver_data' and 'data' to
determine what is the ulong type and what is void*. 'data_ptr' makes
this instantly recognizable IMO.

Happy hacking,

   Wolfram

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux