Skip to contentSkip to conversation

iio: light: apds9306: remove redundant explicit pointer cast

PATCH In review SAJJA EASWAR SAI 3 participants 3 messages Jan 29 – Jan 31

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: light: apds9306: remove redundant explicit pointer cast

C allows implicit conversion from void * to struct apds9306_data *, so the explicit cast on 'ptr' is unnecessary. Removing it improves readability.

---
 drivers/iio/light/apds9306.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/apds9306.c +1 -1
index 7e68cca0e..5d18eabd9 100644
@@ -1176,7 +1176,7 @@ static int apds9306_init_iio_gts(struct apds9306_data *data)
 
 static void apds9306_powerdown(void *ptr)
 {
-	struct apds9306_data *data = (struct apds9306_data *)ptr;
+	struct apds9306_data *data = ptr;
 	struct apds9306_regfields *rf = &data->rf;
 	int ret;
 
Signature · 1 line
2.52.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · SAJJA EASWAR SAI

C allows implicit conversion from void * to struct apds9306_data *, so the explicit cast on 'ptr' is unnecessary. Removing it improves readability.

---
  drivers/iio/light/apds9306.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/apds9306.c +0 -0
index 7e68cca0e..5d18eabd9 100644

drivers/iio/light/apds9306.c static int apds9306_init_iio_gts(struct apds9306_data *data) · line 1182

Quoted 8 lines
drivers/iio/light/apds9306.c +1 -1
@@ -1176,7 +1176,7 @@ static int apds9306_init_iio_gts(struct apds9306_data *data)
 
  static void apds9306_powerdown(void *ptr)
  {
-	struct apds9306_data *data = (struct apds9306_data *)ptr;
+	struct apds9306_data *data = ptr;
  	struct apds9306_regfields *rf = &data->rf;
  	int ret;
 

Looks good. Thank you.

Regards,
Subhajit Ghosh

maintainer
#2 lore raw
Quoted 5 lines · On Fri, 30 Jan 2026 09:14:41 +1030 Subhajit Ghosh…
Quoted 4 lines · SAJJA EASWAR SAI

C allows implicit conversion from void * to struct apds9306_data *, so the explicit cast on 'ptr' is unnecessary. Removing it improves readability.

Applied to the testing branch of iio.git.

Thanks,

Jonathan

Quoted 23 lines
Quoted 9 lines
---
  drivers/iio/light/apds9306.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/apds9306.c +0 -0
index 7e68cca0e..5d18eabd9 100644

drivers/iio/light/apds9306.c static int apds9306_init_iio_gts(struct apds9306_data *data) · line 1182

Quoted 8 lines
drivers/iio/light/apds9306.c +1 -1
@@ -1176,7 +1176,7 @@ static int apds9306_init_iio_gts(struct apds9306_data *data)
 
  static void apds9306_powerdown(void *ptr)
  {
-	struct apds9306_data *data = (struct apds9306_data *)ptr;
+	struct apds9306_data *data = ptr;
  	struct apds9306_regfields *rf = &data->rf;
  	int ret;
 

Looks good. Thank you.

Regards,
Subhajit Ghosh