Message ID | 20240303-void_in_dev_set_drvdata-v1-0-ae39027d740b@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | Drop casting to void in dev_set_drvdata | expand |
On Sun, 03 Mar 2024 23:34:38 +0100 Javier Carrasco <javier.carrasco.cruz@gmail.com> wrote: > The C standard specifies that there is no need to cast from a pointer to > void [1]. > > The vast majority of the users of dev_set_drvdata do not cast their > pointers to void, and the few that do so should be fixed before it > spreads by following bad examples (which I was about to do here [2]). > > The very specific cases where the cast avoids warnings (e.g. droping > const) have been kept as they are. > > [1] C Standard Committee: https://c0x.shape-of-code.com/6.3.2.3.html > [2] https://lore.kernel.org/linux-iio/20240226-hdc3020-pm-v2-0-cec6766086e8@gmail.com/T/#t > > Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> > --- > Javier Carrasco (4): > char: xilinx_hwicap: drop casting to void in dev_set_drvdata > io: light: st_uvis25: drop casting to void in dev_set_drvdata > iio: humidity: hts211: drop casting to void in dev_set_drvdata > iio: imu: st_lsm6dsx: drop casting to void in dev_set_drvdata > > drivers/char/xilinx_hwicap/xilinx_hwicap.c | 2 +- > drivers/iio/humidity/hts221_core.c | 2 +- > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 2 +- > drivers/iio/light/st_uvis25_core.c | 2 +- > 4 files changed, 4 insertions(+), 4 deletions(-) > --- > base-commit: 90d35da658da8cff0d4ecbb5113f5fac9d00eb72 > change-id: 20240303-void_in_dev_set_drvdata-2d8cae908e49 > > Best regards, Thanks for tidying these up. Applied to the togreg-normal branch of iio.git. This will get rebase on rc1 once available and become togreg. Jonathan
The C standard specifies that there is no need to cast from a pointer to void [1]. The vast majority of the users of dev_set_drvdata do not cast their pointers to void, and the few that do so should be fixed before it spreads by following bad examples (which I was about to do here [2]). The very specific cases where the cast avoids warnings (e.g. droping const) have been kept as they are. [1] C Standard Committee: https://c0x.shape-of-code.com/6.3.2.3.html [2] https://lore.kernel.org/linux-iio/20240226-hdc3020-pm-v2-0-cec6766086e8@gmail.com/T/#t Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> --- Javier Carrasco (4): char: xilinx_hwicap: drop casting to void in dev_set_drvdata io: light: st_uvis25: drop casting to void in dev_set_drvdata iio: humidity: hts211: drop casting to void in dev_set_drvdata iio: imu: st_lsm6dsx: drop casting to void in dev_set_drvdata drivers/char/xilinx_hwicap/xilinx_hwicap.c | 2 +- drivers/iio/humidity/hts221_core.c | 2 +- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 2 +- drivers/iio/light/st_uvis25_core.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) --- base-commit: 90d35da658da8cff0d4ecbb5113f5fac9d00eb72 change-id: 20240303-void_in_dev_set_drvdata-2d8cae908e49 Best regards,