linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] serial: mfd: remove unnecessary pci_set_drvdata()
@ 2013-09-12  6:31 Jingoo Han
  2013-09-12  6:33 ` [PATCH 2/3] serial: 8250_pci: " Jingoo Han
  2013-09-12  6:35 ` [PATCH 3/3] serial: txx9: " Jingoo Han
  0 siblings, 2 replies; 4+ messages in thread
From: Jingoo Han @ 2013-09-12  6:31 UTC (permalink / raw)
  To: 'Greg Kroah-Hartman'
  Cc: linux-serial, 'Jingoo Han', 'Feng Tang'

The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/tty/serial/mfd.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c
index d3db042..ead43dd 100644
--- a/drivers/tty/serial/mfd.c
+++ b/drivers/tty/serial/mfd.c
@@ -1451,7 +1451,6 @@ static void serial_hsu_remove(struct pci_dev *pdev)
 		uart_remove_one_port(&serial_hsu_reg, &up->port);
 	}
 
-	pci_set_drvdata(pdev, NULL);
 	free_irq(pdev->irq, priv);
 	pci_disable_device(pdev);
 }
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] serial: 8250_pci: remove unnecessary pci_set_drvdata()
  2013-09-12  6:31 [PATCH 1/3] serial: mfd: remove unnecessary pci_set_drvdata() Jingoo Han
@ 2013-09-12  6:33 ` Jingoo Han
  2013-09-12 14:47   ` Wang YanQing
  2013-09-12  6:35 ` [PATCH 3/3] serial: txx9: " Jingoo Han
  1 sibling, 1 reply; 4+ messages in thread
From: Jingoo Han @ 2013-09-12  6:33 UTC (permalink / raw)
  To: 'Greg Kroah-Hartman'
  Cc: linux-serial, 'Jingoo Han', 'Ian Abbott',
	'Wang YanQing', 'Stephen Chivers',
	'Stephen Hurd'

The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/tty/serial/8250/8250_pci.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index c810da7..515fd0f 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -3520,8 +3520,6 @@ static void pciserial_remove_one(struct pci_dev *dev)
 {
 	struct serial_private *priv = pci_get_drvdata(dev);
 
-	pci_set_drvdata(dev, NULL);
-
 	pciserial_remove_ports(priv);
 
 	pci_disable_device(dev);
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] serial: txx9: remove unnecessary pci_set_drvdata()
  2013-09-12  6:31 [PATCH 1/3] serial: mfd: remove unnecessary pci_set_drvdata() Jingoo Han
  2013-09-12  6:33 ` [PATCH 2/3] serial: 8250_pci: " Jingoo Han
@ 2013-09-12  6:35 ` Jingoo Han
  1 sibling, 0 replies; 4+ messages in thread
From: Jingoo Han @ 2013-09-12  6:35 UTC (permalink / raw)
  To: 'Greg Kroah-Hartman'; +Cc: linux-serial, 'Jingoo Han'

The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/tty/serial/serial_txx9.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c
index 440a962..90a080b 100644
--- a/drivers/tty/serial/serial_txx9.c
+++ b/drivers/tty/serial/serial_txx9.c
@@ -1220,8 +1220,6 @@ static void pciserial_txx9_remove_one(struct pci_dev *dev)
 {
 	struct uart_txx9_port *up = pci_get_drvdata(dev);
 
-	pci_set_drvdata(dev, NULL);
-
 	if (up) {
 		serial_txx9_unregister_port(up->port.line);
 		pci_disable_device(dev);
-- 
1.7.10.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/3] serial: 8250_pci: remove unnecessary pci_set_drvdata()
  2013-09-12  6:33 ` [PATCH 2/3] serial: 8250_pci: " Jingoo Han
@ 2013-09-12 14:47   ` Wang YanQing
  0 siblings, 0 replies; 4+ messages in thread
From: Wang YanQing @ 2013-09-12 14:47 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'Greg Kroah-Hartman', linux-serial, 'Ian Abbott',
	'Stephen Chivers', 'Stephen Hurd'

On Thu, Sep 12, 2013 at 03:33:48PM +0900, Jingoo Han wrote:
> The driver core clears the driver data to NULL after device_release
> or on probe failure. Thus, it is not needed to manually clear the
> device driver data to NULL.
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
>  drivers/tty/serial/8250/8250_pci.c |    2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
> index c810da7..515fd0f 100644
> --- a/drivers/tty/serial/8250/8250_pci.c
> +++ b/drivers/tty/serial/8250/8250_pci.c
> @@ -3520,8 +3520,6 @@ static void pciserial_remove_one(struct pci_dev *dev)
>  {
>  	struct serial_private *priv = pci_get_drvdata(dev);
>  
> -	pci_set_drvdata(dev, NULL);
> -
>  	pciserial_remove_ports(priv);
>  
>  	pci_disable_device(dev);
> -- 
> 1.7.10.4
> 
Hi All
Below shell give me 1267 result for 3.10.11:

"find drivers/ -name "*.[ch]" | xargs grep set_drvdata | grep NULL"

The results include somethings look like below:
drivers/net/wan/dscc4.c:        pci_set_drvdata(pdev, NULL);
drivers/net/wan/wanxl.c:        pci_set_drvdata(pdev, NULL);
drivers/net/wan/lmc/lmc_main.c: pci_set_drvdata(pdev, NULL);
drivers/net/wan/lmc/lmc_main.c:         pci_set_drvdata(pdev, NULL);
drivers/net/wan/ixp4xx_hss.c:   platform_set_drvdata(pdev, NULL);
drivers/net/xen-netback/xenbus.c:       dev_set_drvdata(&dev->dev, NULL);
drivers/net/xen-netfront.c:     dev_set_drvdata(&dev->dev, NULL);
drivers/net/ieee802154/at86rf230.c:     spi_set_drvdata(spi, NULL);
drivers/net/ieee802154/at86rf230.c:     spi_set_drvdata(spi, NULL);
drivers/net/ieee802154/mrf24j40.c:      spi_set_drvdata(spi, NULL);
drivers/net/vmxnet3/vmxnet3_drv.c:      pci_set_drvdata(pdev, NULL);

After a quick search platform_set_drvdata|spi_set_drvdata|pci_set_drvdata,
I found they are just a wrapper for drv_set_drvdata, and almost all drivers
use them in the .remove function in the same pattern *_set_drvdata(DEV, NULL).

Yes, I find driver core in dd.c will call drv_set_drvdata(dev, NULL) after
.remove function. So if all guys think this patch is acceptable, maybe we
could dig into deeper.

Note: I don't say this patch is right or wrong, I hope someone could tell me :)

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-12 14:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-12  6:31 [PATCH 1/3] serial: mfd: remove unnecessary pci_set_drvdata() Jingoo Han
2013-09-12  6:33 ` [PATCH 2/3] serial: 8250_pci: " Jingoo Han
2013-09-12 14:47   ` Wang YanQing
2013-09-12  6:35 ` [PATCH 3/3] serial: txx9: " Jingoo Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).