Skip to contentSkip to conversation

serial: arc_uart: Remove casting the return value which is a void pointer

PATCH In review Jingoo Han 3 participants 9 messages Sep 9, 2013

Subsystems (3)
lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/7 serial: arc_uart: Remove casting the return value which is a void pointer

Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language.

---
 drivers/tty/serial/arc_uart.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/arc_uart.c +1 -1
index 569872f..c9f5c9d 100644
@@ -533,7 +533,7 @@ arc_uart_init_one(struct platform_device *pdev, int dev_id)
 	unsigned long *plat_data;
 	struct arc_uart_port *uart = &arc_uart_ports[dev_id];
 
-	plat_data = (unsigned long *)dev_get_platdata(&pdev->dev);
+	plat_data = dev_get_platdata(&pdev->dev);
 	if (!plat_data)
 		return -ENODEV;
 
Signature · 1 line
1.7.10.4
author
#1 lore raw

PATCH 2/7 serial: mpsc: Remove casting the return value which is a void pointer

Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language.

---
 drivers/tty/serial/mpsc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/mpsc.c +1 -1
index 8d70267..e30a3ca 100644
@@ -2030,7 +2030,7 @@ static void mpsc_drv_get_platform_data(struct mpsc_port_info *pi,
 {
 	struct mpsc_pdata	*pdata;
 
-	pdata = (struct mpsc_pdata *)dev_get_platdata(&pd->dev);
+	pdata = dev_get_platdata(&pd->dev);
 
 	pi->port.uartclk = pdata->brg_clk_freq;
 	pi->port.iotype = UPIO_MEM;
Signature · 1 line
1.7.10.4
author
#2 lore raw

PATCH 3/7 serial: bfin_uart: Remove casting the return value which is a void pointer

In reply to Jingoo Han

Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language.

---
 drivers/tty/serial/bfin_uart.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/tty/serial/bfin_uart.c +6 -9
index 3c75e8e..74749a6 100644
@@ -1240,7 +1240,7 @@ static int bfin_serial_probe(struct platform_device *pdev)
 			 */
 #endif
 		ret = peripheral_request_list(
-			(unsigned short *)dev_get_platdata(&pdev->dev),
+			dev_get_platdata(&pdev->dev),
 			DRIVER_NAME);
 		if (ret) {
 			dev_err(&pdev->dev,
@@ -1358,8 +1358,7 @@ static int bfin_serial_probe(struct platform_device *pdev)
 out_error_unmap:
 		iounmap(uart->port.membase);
 out_error_free_peripherals:
-		peripheral_free_list(
-			(unsigned short *)dev_get_platdata(&pdev->dev));
+		peripheral_free_list(dev_get_platdata(&pdev->dev));
 out_error_free_mem:
 		kfree(uart);
 		bfin_serial_ports[pdev->id] = NULL;
@@ -1377,8 +1376,7 @@ static int bfin_serial_remove(struct platform_device *pdev)
 	if (uart) {
 		uart_remove_one_port(&bfin_serial_reg, &uart->port);
 		iounmap(uart->port.membase);
-		peripheral_free_list(
-			(unsigned short *)dev_get_platdata(&pdev->dev));
+		peripheral_free_list(dev_get_platdata(&pdev->dev));
 		kfree(uart);
 		bfin_serial_ports[pdev->id] = NULL;
 	}
@@ -1432,8 +1430,8 @@ static int bfin_earlyprintk_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	ret = peripheral_request_list(
-		(unsigned short *)dev_get_platdata(&pdev->dev), DRIVER_NAME);
+	ret = peripheral_request_list(dev_get_platdata(&pdev->dev),
+					DRIVER_NAME);
 	if (ret) {
 		dev_err(&pdev->dev,
 				"fail to request bfin serial peripherals\n");
@@ -1463,8 +1461,7 @@ static int bfin_earlyprintk_probe(struct platform_device *pdev)
 	return 0;
 
 out_error_free_peripherals:
-	peripheral_free_list(
-		(unsigned short *)dev_get_platdata(&pdev->dev));
+	peripheral_free_list(dev_get_platdata(&pdev->dev));
 
 	return ret;
 }
Signature · 1 line
1.7.10.4
Acked-by on v1 3/7
#3 lore raw

RE: [PATCH 3/7] serial: bfin_uart: Remove casting the return value which is a void pointer

Quoted 76 lines

-----Original Message-----
From: Jingoo Han [mailto:[email protected]]
Sent: Monday, September 09, 2013 1:09 PM
To: 'Greg Kroah-Hartman'
Cc: [email protected]; Zhang, Sonic; 'Jingoo Han'
Subject: [PATCH 3/7] serial: bfin_uart: Remove casting the return value which is a void pointer

Casting the return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is guaranteed by the C programming language.

---
drivers/tty/serial/bfin_uart.c | 15 ++++++---------

1 file changed, 6 insertions(+), 9 deletions(-)
drivers/tty/serial/bfin_uart.c index renamed from drivers/tty/serial/bfin_uart.c +0 -0

3c75e8e..74749a6 100644

drivers/tty/serial/bfin_uart.c +1 -1
@@ -1240,7 +1240,7 @@ static int bfin_serial_probe(struct platform_device *pdev)
                       */
 #endif
              ret = peripheral_request_list(
-                      (unsigned short *)dev_get_platdata(&pdev->dev),
+                      dev_get_platdata(&pdev->dev),
                      DRIVER_NAME);
              if (ret) {
                      dev_err(&pdev->dev,
@@ -1358,8 +1358,7 @@ static int bfin_serial_probe(struct platform_device *pdev)

out_error_unmap:

              iounmap(uart->port.membase);

out_error_free_peripherals:

drivers/tty/serial/bfin_uart.c +1 -2
-              peripheral_free_list(
-                      (unsigned short *)dev_get_platdata(&pdev->dev));
+              peripheral_free_list(dev_get_platdata(&pdev->dev));

out_error_free_mem:

              kfree(uart);
              bfin_serial_ports[pdev->id] = NULL;
drivers/tty/serial/bfin_uart.c +3 -4
@@ -1377,8 +1376,7 @@ static int bfin_serial_remove(struct platform_device *pdev)
      if (uart) {
              uart_remove_one_port(&bfin_serial_reg, &uart->port);
              iounmap(uart->port.membase);
-              peripheral_free_list(
-                      (unsigned short *)dev_get_platdata(&pdev->dev));
+              peripheral_free_list(dev_get_platdata(&pdev->dev));
              kfree(uart);
              bfin_serial_ports[pdev->id] = NULL;
      }
@@ -1432,8 +1430,8 @@ static int bfin_earlyprintk_probe(struct platform_device
 *pdev)
              return -ENOENT;
      }
 
-      ret = peripheral_request_list(
-              (unsigned short *)dev_get_platdata(&pdev->dev), DRIVER_NAME);
+      ret = peripheral_request_list(dev_get_platdata(&pdev->dev),
+                                      DRIVER_NAME);
      if (ret) {
              dev_err(&pdev->dev,

"fail to request bfin serial peripherals\n"); @@ -1463,8
+1461,7 @@ static int bfin_earlyprintk_probe(struct platform_device *pdev)

      return 0;

out_error_free_peripherals:

drivers/tty/serial/bfin_uart.c +1 -2
-      peripheral_free_list(
-              (unsigned short *)dev_get_platdata(&pdev->dev));
+      peripheral_free_list(dev_get_platdata(&pdev->dev));
 
      return ret;

}
--
1.7.10.4

author
#4 lore raw

PATCH 4/7 serial: bfin_sport_uart: Remove casting the return value which is a void pointer

In reply to Jingoo Han

Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language.

---
 drivers/tty/serial/bfin_sport_uart.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/tty/serial/bfin_sport_uart.c +4 -7
index 87636cc..4f22970 100644
@@ -766,9 +766,8 @@ static int sport_uart_probe(struct platform_device *pdev)
 			return -ENOMEM;
 		}
 
-		ret = peripheral_request_list(
-			(unsigned short *)dev_get_platdata(&pdev->dev),
-			DRV_NAME);
+		ret = peripheral_request_list(dev_get_platdata(&pdev->dev),
+						DRV_NAME);
 		if (ret) {
 			dev_err(&pdev->dev,
 				"Fail to request SPORT peripherals\n");
@@ -844,8 +843,7 @@ static int sport_uart_probe(struct platform_device *pdev)
 out_error_unmap:
 		iounmap(sport->port.membase);
 out_error_free_peripherals:
-		peripheral_free_list(
-			(unsigned short *)dev_get_platdata(&pdev->dev));
+		peripheral_free_list(dev_get_platdata(&pdev->dev));
 out_error_free_mem:
 		kfree(sport);
 		bfin_sport_uart_ports[pdev->id] = NULL;
@@ -864,8 +862,7 @@ static int sport_uart_remove(struct platform_device *pdev)
 	if (sport) {
 		uart_remove_one_port(&sport_uart_reg, &sport->port);
 		iounmap(sport->port.membase);
-		peripheral_free_list(
-			(unsigned short *)dev_get_platdata(&pdev->dev));
+		peripheral_free_list(dev_get_platdata(&pdev->dev));
 		kfree(sport);
 		bfin_sport_uart_ports[pdev->id] = NULL;
 	}
Signature · 1 line
1.7.10.4
author
#5 lore raw

PATCH 5/7 serial: ifx6x60: Remove casting the return value which is a void pointer

In reply to Jingoo Han

Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language.

---
 drivers/tty/serial/ifx6x60.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/ifx6x60.c +1 -1
index af286e6..5903909 100644
@@ -1008,7 +1008,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
 		return -ENODEV;
 	}
 
-	pl_data = (struct ifx_modem_platform_data *)dev_get_platdata(&spi->dev);
+	pl_data = dev_get_platdata(&spi->dev);
 	if (!pl_data) {
 		dev_err(&spi->dev, "missing platform data!");
 		return -ENODEV;
Signature · 1 line
1.7.10.4
author
#6 lore raw

PATCH 6/7 serial: samsung: Remove casting the return value which is a void pointer

In reply to Jingoo Han

Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language.

---
 drivers/tty/serial/samsung.c |    2 +-
 drivers/tty/serial/samsung.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/samsung.c +1 -1
index f3dfa19..81f3dba 100644
@@ -1254,7 +1254,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
 	ourport->baudclk = ERR_PTR(-EINVAL);
 	ourport->info = ourport->drv_data->info;
 	ourport->cfg = (dev_get_platdata(&pdev->dev)) ?
-			(struct s3c2410_uartcfg *)dev_get_platdata(&pdev->dev) :
+			dev_get_platdata(&pdev->dev) :
 			ourport->drv_data->def_cfg;
 
 	ourport->port.fifosize = (ourport->info->fifosize) ?
drivers/tty/serial/samsung.h +1 -1
index aaa617a..8827e54 100644
@@ -63,7 +63,7 @@ struct s3c24xx_uart_port {
 
 /* conversion functions */
 
-#define s3c24xx_dev_to_port(__dev) (struct uart_port *)dev_get_drvdata(__dev)
+#define s3c24xx_dev_to_port(__dev) dev_get_drvdata(__dev)
 
 /* register access controls */
 
Signature · 1 line
1.7.10.4
author
#7 lore raw

PATCH 7/7 serial: mpc512x: Remove casting the return value which is a void pointer

In reply to Jingoo Han

Casting the return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language.

---
 drivers/tty/serial/mpc52xx_uart.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/mpc52xx_uart.c +2 -2
index 5be1df3..e05a3b1 100644
@@ -1766,7 +1766,7 @@ mpc52xx_uart_of_remove(struct platform_device *op)
 static int
 mpc52xx_uart_of_suspend(struct platform_device *op, pm_message_t state)
 {
-	struct uart_port *port = (struct uart_port *) platform_get_drvdata(op);
+	struct uart_port *port = platform_get_drvdata(op);
 
 	if (port)
 		uart_suspend_port(&mpc52xx_uart_driver, port);
@@ -1777,7 +1777,7 @@ mpc52xx_uart_of_suspend(struct platform_device *op, pm_message_t state)
 static int
 mpc52xx_uart_of_resume(struct platform_device *op)
 {
-	struct uart_port *port = (struct uart_port *) platform_get_drvdata(op);
+	struct uart_port *port = platform_get_drvdata(op);
 
 	if (port)
 		uart_resume_port(&mpc52xx_uart_driver, port);
Signature · 1 line
1.7.10.4