staging: Remove unnecessary *_set_drvdata()
Subsystems (4)
cover staging: Remove unnecessary *_set_drvdata()
Unnecessary [platform|pci|spi|dev]_set_drvdata() have been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL.
The Coccinelle semantic patch used to make this change is as follows:
// <smpl>
@@
struct platform_device *pdev;
@@
- platform_set_drvdata(pdev, NULL);
@@
struct pci_dev *pci;
@@
- pci_set_drvdata(pci, NULL);
@@
struct spi_device *spi;
@@
- spi_set_drvdata(spi, NULL);
@@
struct device *dev;
@@
- dev_set_drvdata(dev, NULL);
@@
struct amba_device *dev;
@@
- amba_set_drvdata(dev, NULL);
// </smpl>
Amitoj Kaur Chawla (6):
staging: fbtft: Remove unnecessary spi_set_drvdata()
staging: sm750fb: Remove unnecessary pci_set_drvdata()
staging: media: omap4iss: Remove unnecessary platform_set_drvdata()
staging: unisys: visorbus: Remove unnecessary dev_set_drvdata()
staging: rdma: hfi1: Remove unnecessary pci_set_drvdata()
staging: rts5208: Remove unnecessary pci_set_drvdata()
drivers/staging/fbtft/fbtft-core.c | 5 ----- drivers/staging/media/omap4iss/iss.c | 2 -- drivers/staging/rdma/hfi1/pcie.c | 2 -- drivers/staging/rts5208/rtsx.c | 2 -- drivers/staging/sm750fb/sm750.c | 1 - drivers/staging/unisys/visorbus/visorbus_main.c | 1 - 6 files changed, 13 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/6 staging: fbtft: Remove unnecessary spi_set_drvdata()
Unnecessary spi_set_drvdata() has been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL.
The Coccinelle semantic patch used to make this change is as follows:
@@
struct spi_device *spi;
@@
- spi_set_drvdata(spi, NULL);
// </smpl>
Due to this removal, variable spi was unused so dropped spi
--- drivers/staging/fbtft/fbtft-core.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/staging/fbtft/fbtft-core.c +0 -5
@@ -985,8 +985,6 @@ int fbtft_register_framebuffer(struct fb_info *fb_info) reg_fail:if (par->fbtftops.unregister_backlight) par->fbtftops.unregister_backlight (par); -if (spi) -spi_set_drvdata (spi,NULL );return ret; }
@@ -1004,10 +1002,7 @@ EXPORT_SYMBOL(fbtft_register_framebuffer);int fbtft_unregister_framebuffer (struct fb_info *fb_info) {struct fbtft_par *par = fb_info->par; -struct spi_device *spi = par->spi; -if (spi) -spi_set_drvdata (spi,NULL );if (par->fbtftops.unregister_backlight) par->fbtftops.unregister_backlight (par);fbtft_sysfs_exit (par);
Signature · 1 line
1.9.1
PATCH 2/6 staging: sm750fb: Remove unnecessary pci_set_drvdata()
In reply to Amitoj Kaur ChawlaUnnecessary pci_set_drvdata() has been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL.
The Coccinelle semantic patch used to make this change is as follows:
//<smpl>
@@
struct pci_dev *pci;
@@
- pci_set_drvdata(pci, NULL);
//</smpl>
--- drivers/staging/sm750fb/sm750.c | 1 - 1 file changed, 1 deletion(-)
drivers/staging/sm750fb/sm750.c +0 -1
@@ -1135,7 +1135,6 @@ static void lynxfb_pci_remove(struct pci_dev *pdev)iounmap (sm750_dev->pvMem);kfree (g_settings);kfree (sm750_dev); -pci_set_drvdata (pdev,NULL ); }static int __init lynxfb_setup (char *options)
Signature · 1 line
1.9.1
PATCH 3/6 staging: media: omap4iss: Remove unnecessary platform_set_drvdata()
In reply to Amitoj Kaur ChawlaUnnecessary platform_set_drvdata() has been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL.
The Coccinelle semantic patch used to make this change is as follows:
//<smpl>
@@
struct platform_device *pdev;
@@
- platform_set_drvdata(pdev, NULL);
//</smpl>
--- drivers/staging/media/omap4iss/iss.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/media/omap4iss/iss.c +0 -2
@@ -1527,8 +1527,6 @@ error_modules: error_iss:omap4iss_put (iss); error: -platform_set_drvdata (pdev,NULL ); -mutex_destroy (&iss->iss_mutex);return ret;
Signature · 1 line
1.9.1
PATCH 4/6 staging: unisys: visorbus: Remove unnecessary dev_set_drvdata()
In reply to Amitoj Kaur ChawlaUnnecessary dev_set_drvdata() has been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL.
The Coccinelle semantic patch used to make this change is as follows:
//<smpl>
@@
struct device *dev;
@@
- dev_set_drvdata(dev, NULL);
//</smpl>
--- drivers/staging/unisys/visorbus/visorbus_main.c | 1 - 1 file changed, 1 deletion(-)
drivers/staging/unisys/visorbus/visorbus_main.c +0 -1
@@ -221,7 +221,6 @@ visorbus_release_busdevice(struct device *xdev) {struct visor_device *dev =dev_get_drvdata (xdev); -dev_set_drvdata (xdev,NULL );kfree (dev); }
Signature · 1 line
1.9.1
PATCH 5/6 staging: rdma: hfi1: Remove unnecessary pci_set_drvdata()
In reply to Amitoj Kaur ChawlaUnnecessary pci_set_drvdata() has been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL.
The Coccinelle semantic patch used to make this change is as follows:
//<smpl>
@@
struct pci_dev *pci;
@@
- pci_set_drvdata(pci, NULL);
//</smpl>
--- drivers/staging/rdma/hfi1/pcie.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/rdma/hfi1/pcie.c +0 -2
@@ -247,8 +247,6 @@ void hfi1_pcie_ddcleanup(struct hfi1_devdata *dd)iounmap (dd->rcvarray_wc);if (dd->piobase)iounmap (dd->piobase); - -pci_set_drvdata (dd->pcidev,NULL ); }/*
Signature · 1 line
1.9.1
PATCH 6/6 staging: rts5208: Remove unnecessary pci_set_drvdata()
In reply to Amitoj Kaur ChawlaUnnecessary pci_set_drvdata() has been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL.
The Coccinelle semantic patch used to make this change is as follows:
//<smpl>
@@
struct pci_dev *pci;
@@
- pci_set_drvdata(pci, NULL);
//</smpl>
--- drivers/staging/rts5208/rtsx.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/rts5208/rtsx.c +0 -2
@@ -1001,8 +1001,6 @@ static void rtsx_remove(struct pci_dev *pci)quiesce_and_remove_host (dev);release_everything (dev); - -pci_set_drvdata (pci,NULL ); }/* PCI IDs */
Signature · 1 line
1.9.1
Quoted 4 lines · Amitoj Kaur Chawla
Unnecessary [platform|pci|spi|dev]_set_drvdata() have been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL.
In principle, your semantic patch should check whether the call is in the position of a device release or a probe failure. In practice though, it seems hard to imagine why this code would be in any place other than these cases.
julia
Quoted 51 lines
The Coccinelle semantic patch used to make this change is as follows:
// <smpl>
@@
structplatform_device*pdev;
@@
-platform_set_drvdata(pdev, NULL);
@@
structpci_dev*pci;
@@
-pci_set_drvdata(pci, NULL);
@@
structspi_device*spi;
@@
-spi_set_drvdata(spi, NULL);
@@
struct device *dev;
@@
-dev_set_drvdata(dev, NULL);
@@
structamba_device*dev;
@@
-amba_set_drvdata(dev, NULL);
// </smpl>Amitoj Kaur Chawla (6):
staging: fbtft: Remove unnecessaryspi_set_drvdata()
staging: sm750fb: Remove unnecessarypci_set_drvdata()
staging: media: omap4iss: Remove unnecessaryplatform_set_drvdata()
staging: unisys: visorbus: Remove unnecessarydev_set_drvdata()
staging: rdma: hfi1: Remove unnecessarypci_set_drvdata()
staging: rts5208: Remove unnecessarypci_set_drvdata()drivers/staging/fbtft/fbtft-core.c | 5 ----- drivers/staging/media/omap4iss/iss.c | 2 -- drivers/staging/rdma/hfi1/pcie.c | 2 -- drivers/staging/rts5208/rtsx.c | 2 -- drivers/staging/sm750fb/sm750.c | 1 - drivers/staging/unisys/visorbus/visorbus_main.c | 1 - 6 files changed, 13 deletions(-)Signature · 8 lines
1.9.1 -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/cover.1456377485.git.amitoj1606%40gmail.com. For more options, visit https://groups.google.com/d/optout.
Quoted 6 lines · Julia Lawall
Quoted 5 lines
Unnecessary [platform|pci|spi|dev]_set_drvdata() have been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL.
Quoted 6 lines
In principle, your semantic patch should check whether the call is in the position of a device release or a probe failure. In practice though, it seems hard to imagine why this code would be in any place other than these cases.
julia
Okay, I'll modify the patch, other than that, should I resend the series with the modified patch?
Or just use the modified one for future cases?
Amitoj
Quoted 12 lines · Amitoj Kaur Chawla
Quoted 11 lines · Julia Lawall
Quoted 5 lines
Unnecessary [platform|pci|spi|dev]_set_drvdata() have been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL.
In principle, your semantic patch should check whether the call is in the position of a device release or a probe failure. In practice though, it seems hard to imagine why this code would be in any place other than these cases.
Quoted 6 lines
Quoted 1 line
julia
Okay, I'll modify the patch, other than that, should I resend the series with the modified patch?
Or just use the modified one for future cases?
Future is fine.
julia
Quoted 10 lines
Amitoj
Signature · 5 lines
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CA%2B5yK5H48eiia_r67%3Do%2B-Asimo2_eS4otKSEHBmNcdnxbqNTYw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.