Re: [PATCH 2/3] serial: 8250_pci: remove unnecessary pci_set_drvdata()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
> ---
>  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.
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux