* [PATCH 0/4] Drop casting to void in dev_set_drvdata
@ 2024-03-03 22:34 Javier Carrasco
2024-03-03 22:34 ` [PATCH 1/4] char: xilinx_hwicap: drop " Javier Carrasco
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Javier Carrasco @ 2024-03-03 22:34 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman, Michal Simek, Jonathan Cameron,
Lars-Peter Clausen, Lorenzo Bianconi
Cc: linux-arm-kernel, linux-kernel, linux-iio, Javier Carrasco
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,
--
Javier Carrasco <javier.carrasco.cruz@gmail.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] char: xilinx_hwicap: drop casting to void in dev_set_drvdata
2024-03-03 22:34 [PATCH 0/4] Drop casting to void in dev_set_drvdata Javier Carrasco
@ 2024-03-03 22:34 ` Javier Carrasco
2024-03-03 22:34 ` [PATCH 2/4] io: light: st_uvis25: " Javier Carrasco
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Javier Carrasco @ 2024-03-03 22:34 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman, Michal Simek, Jonathan Cameron,
Lars-Peter Clausen, Lorenzo Bianconi
Cc: linux-arm-kernel, linux-kernel, linux-iio, Javier Carrasco
The C standard specifies that there is no need to cast from a pointer to
void [1]. Therefore, it can be safely dropped.
[1] C Standard Committee: https://c0x.shape-of-code.com/6.3.2.3.html
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
drivers/char/xilinx_hwicap/xilinx_hwicap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 019cf6079cec..3aaa4b4d9f08 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -636,7 +636,7 @@ static int hwicap_setup(struct platform_device *pdev, int id,
retval = -ENOMEM;
goto failed;
}
- dev_set_drvdata(dev, (void *)drvdata);
+ dev_set_drvdata(dev, drvdata);
drvdata->base_address = devm_platform_ioremap_resource(pdev, 0);
if (!drvdata->base_address) {
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] io: light: st_uvis25: drop casting to void in dev_set_drvdata
2024-03-03 22:34 [PATCH 0/4] Drop casting to void in dev_set_drvdata Javier Carrasco
2024-03-03 22:34 ` [PATCH 1/4] char: xilinx_hwicap: drop " Javier Carrasco
@ 2024-03-03 22:34 ` Javier Carrasco
2024-03-03 22:34 ` [PATCH 3/4] iio: humidity: hts211: " Javier Carrasco
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Javier Carrasco @ 2024-03-03 22:34 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman, Michal Simek, Jonathan Cameron,
Lars-Peter Clausen, Lorenzo Bianconi
Cc: linux-arm-kernel, linux-kernel, linux-iio, Javier Carrasco
The C standard specifies that there is no need to cast from a pointer to
void [1]. Therefore, it can be safely dropped.
[1] C Standard Committee: https://c0x.shape-of-code.com/6.3.2.3.html
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
drivers/iio/light/st_uvis25_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/light/st_uvis25_core.c b/drivers/iio/light/st_uvis25_core.c
index 50f95c5d2060..d4e17079b2f4 100644
--- a/drivers/iio/light/st_uvis25_core.c
+++ b/drivers/iio/light/st_uvis25_core.c
@@ -291,7 +291,7 @@ int st_uvis25_probe(struct device *dev, int irq, struct regmap *regmap)
if (!iio_dev)
return -ENOMEM;
- dev_set_drvdata(dev, (void *)iio_dev);
+ dev_set_drvdata(dev, iio_dev);
hw = iio_priv(iio_dev);
hw->irq = irq;
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] iio: humidity: hts211: drop casting to void in dev_set_drvdata
2024-03-03 22:34 [PATCH 0/4] Drop casting to void in dev_set_drvdata Javier Carrasco
2024-03-03 22:34 ` [PATCH 1/4] char: xilinx_hwicap: drop " Javier Carrasco
2024-03-03 22:34 ` [PATCH 2/4] io: light: st_uvis25: " Javier Carrasco
@ 2024-03-03 22:34 ` Javier Carrasco
2024-03-03 22:34 ` [PATCH 4/4] iio: imu: st_lsm6dsx: " Javier Carrasco
2024-03-09 18:33 ` [PATCH 0/4] Drop " Jonathan Cameron
4 siblings, 0 replies; 6+ messages in thread
From: Javier Carrasco @ 2024-03-03 22:34 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman, Michal Simek, Jonathan Cameron,
Lars-Peter Clausen, Lorenzo Bianconi
Cc: linux-arm-kernel, linux-kernel, linux-iio, Javier Carrasco
The C standard specifies that there is no need to cast from a pointer to
void [1]. Therefore, it can be safely dropped.
[1] C Standard Committee: https://c0x.shape-of-code.com/6.3.2.3.html
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
drivers/iio/humidity/hts221_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
index 2a413da87b76..87627d116eff 100644
--- a/drivers/iio/humidity/hts221_core.c
+++ b/drivers/iio/humidity/hts221_core.c
@@ -573,7 +573,7 @@ int hts221_probe(struct device *dev, int irq, const char *name,
if (!iio_dev)
return -ENOMEM;
- dev_set_drvdata(dev, (void *)iio_dev);
+ dev_set_drvdata(dev, iio_dev);
hw = iio_priv(iio_dev);
hw->name = name;
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] iio: imu: st_lsm6dsx: drop casting to void in dev_set_drvdata
2024-03-03 22:34 [PATCH 0/4] Drop casting to void in dev_set_drvdata Javier Carrasco
` (2 preceding siblings ...)
2024-03-03 22:34 ` [PATCH 3/4] iio: humidity: hts211: " Javier Carrasco
@ 2024-03-03 22:34 ` Javier Carrasco
2024-03-09 18:33 ` [PATCH 0/4] Drop " Jonathan Cameron
4 siblings, 0 replies; 6+ messages in thread
From: Javier Carrasco @ 2024-03-03 22:34 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman, Michal Simek, Jonathan Cameron,
Lars-Peter Clausen, Lorenzo Bianconi
Cc: linux-arm-kernel, linux-kernel, linux-iio, Javier Carrasco
The C standard specifies that there is no need to cast from a pointer to
void [1]. Therefore, it can be safely dropped.
[1] C Standard Committee: https://c0x.shape-of-code.com/6.3.2.3.html
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index b6e6b1df8a61..5bd1295c05ff 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -2705,7 +2705,7 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
if (!hw)
return -ENOMEM;
- dev_set_drvdata(dev, (void *)hw);
+ dev_set_drvdata(dev, hw);
mutex_init(&hw->fifo_lock);
mutex_init(&hw->conf_lock);
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] Drop casting to void in dev_set_drvdata
2024-03-03 22:34 [PATCH 0/4] Drop casting to void in dev_set_drvdata Javier Carrasco
` (3 preceding siblings ...)
2024-03-03 22:34 ` [PATCH 4/4] iio: imu: st_lsm6dsx: " Javier Carrasco
@ 2024-03-09 18:33 ` Jonathan Cameron
4 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2024-03-09 18:33 UTC (permalink / raw)
To: Javier Carrasco
Cc: Arnd Bergmann, Greg Kroah-Hartman, Michal Simek,
Lars-Peter Clausen, Lorenzo Bianconi, linux-arm-kernel,
linux-kernel, linux-iio
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-09 18:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-03 22:34 [PATCH 0/4] Drop casting to void in dev_set_drvdata Javier Carrasco
2024-03-03 22:34 ` [PATCH 1/4] char: xilinx_hwicap: drop " Javier Carrasco
2024-03-03 22:34 ` [PATCH 2/4] io: light: st_uvis25: " Javier Carrasco
2024-03-03 22:34 ` [PATCH 3/4] iio: humidity: hts211: " Javier Carrasco
2024-03-03 22:34 ` [PATCH 4/4] iio: imu: st_lsm6dsx: " Javier Carrasco
2024-03-09 18:33 ` [PATCH 0/4] Drop " Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox