All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] staging: Remove unnecessary *_set_drvdata()
@ 2016-02-25  5:37 Amitoj Kaur Chawla
  2016-02-25  5:37 ` [PATCH 1/6] staging: fbtft: Remove unnecessary spi_set_drvdata() Amitoj Kaur Chawla
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-25  5:37 UTC (permalink / raw)
  To: outreachy-kernel

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(-)

-- 
1.9.1



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

* [PATCH 1/6] staging: fbtft: Remove unnecessary spi_set_drvdata()
  2016-02-25  5:37 [PATCH 0/6] staging: Remove unnecessary *_set_drvdata() Amitoj Kaur Chawla
@ 2016-02-25  5:37 ` Amitoj Kaur Chawla
  2016-02-25  5:37 ` [PATCH 2/6] staging: sm750fb: Remove unnecessary pci_set_drvdata() Amitoj Kaur Chawla
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-25  5:37 UTC (permalink / raw)
  To: outreachy-kernel

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`

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/staging/fbtft/fbtft-core.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index 6c9cdd2..574c148 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -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);
-- 
1.9.1



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

* [PATCH 2/6] staging: sm750fb: Remove unnecessary pci_set_drvdata()
  2016-02-25  5:37 [PATCH 0/6] staging: Remove unnecessary *_set_drvdata() Amitoj Kaur Chawla
  2016-02-25  5:37 ` [PATCH 1/6] staging: fbtft: Remove unnecessary spi_set_drvdata() Amitoj Kaur Chawla
@ 2016-02-25  5:37 ` Amitoj Kaur Chawla
  2016-02-25  5:37 ` [PATCH 3/6] staging: media: omap4iss: Remove unnecessary platform_set_drvdata() Amitoj Kaur Chawla
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-25  5:37 UTC (permalink / raw)
  To: outreachy-kernel

Unnecessary 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>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/staging/sm750fb/sm750.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index b889409..de996a6 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -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)
-- 
1.9.1



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

* [PATCH 3/6] staging: media: omap4iss: Remove unnecessary platform_set_drvdata()
  2016-02-25  5:37 [PATCH 0/6] staging: Remove unnecessary *_set_drvdata() Amitoj Kaur Chawla
  2016-02-25  5:37 ` [PATCH 1/6] staging: fbtft: Remove unnecessary spi_set_drvdata() Amitoj Kaur Chawla
  2016-02-25  5:37 ` [PATCH 2/6] staging: sm750fb: Remove unnecessary pci_set_drvdata() Amitoj Kaur Chawla
@ 2016-02-25  5:37 ` Amitoj Kaur Chawla
  2016-02-25  5:37 ` [PATCH 4/6] staging: unisys: visorbus: Remove unnecessary dev_set_drvdata() Amitoj Kaur Chawla
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-25  5:37 UTC (permalink / raw)
  To: outreachy-kernel

Unnecessary 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>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/staging/media/omap4iss/iss.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
index 30b473c..dea67d9 100644
--- a/drivers/staging/media/omap4iss/iss.c
+++ b/drivers/staging/media/omap4iss/iss.c
@@ -1527,8 +1527,6 @@ error_modules:
 error_iss:
 	omap4iss_put(iss);
 error:
-	platform_set_drvdata(pdev, NULL);
-
 	mutex_destroy(&iss->iss_mutex);
 
 	return ret;
-- 
1.9.1



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

* [PATCH 4/6] staging: unisys: visorbus: Remove unnecessary dev_set_drvdata()
  2016-02-25  5:37 [PATCH 0/6] staging: Remove unnecessary *_set_drvdata() Amitoj Kaur Chawla
                   ` (2 preceding siblings ...)
  2016-02-25  5:37 ` [PATCH 3/6] staging: media: omap4iss: Remove unnecessary platform_set_drvdata() Amitoj Kaur Chawla
@ 2016-02-25  5:37 ` Amitoj Kaur Chawla
  2016-02-25  5:38 ` [PATCH 5/6] staging: rdma: hfi1: Remove unnecessary pci_set_drvdata() Amitoj Kaur Chawla
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-25  5:37 UTC (permalink / raw)
  To: outreachy-kernel

Unnecessary 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>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index a301385..ec8ff85 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -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);
 }
 
-- 
1.9.1



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

* [PATCH 5/6] staging: rdma: hfi1: Remove unnecessary pci_set_drvdata()
  2016-02-25  5:37 [PATCH 0/6] staging: Remove unnecessary *_set_drvdata() Amitoj Kaur Chawla
                   ` (3 preceding siblings ...)
  2016-02-25  5:37 ` [PATCH 4/6] staging: unisys: visorbus: Remove unnecessary dev_set_drvdata() Amitoj Kaur Chawla
@ 2016-02-25  5:38 ` Amitoj Kaur Chawla
  2016-02-25  5:38 ` [PATCH 6/6] staging: rts5208: " Amitoj Kaur Chawla
  2016-02-25  7:09 ` [Outreachy kernel] [PATCH 0/6] staging: Remove unnecessary *_set_drvdata() Julia Lawall
  6 siblings, 0 replies; 10+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-25  5:38 UTC (permalink / raw)
  To: outreachy-kernel

Unnecessary 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>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/staging/rdma/hfi1/pcie.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/pcie.c b/drivers/staging/rdma/hfi1/pcie.c
index b2f553d8..47ca631 100644
--- a/drivers/staging/rdma/hfi1/pcie.c
+++ b/drivers/staging/rdma/hfi1/pcie.c
@@ -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);
 }
 
 /*
-- 
1.9.1



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

* [PATCH 6/6] staging: rts5208: Remove unnecessary pci_set_drvdata()
  2016-02-25  5:37 [PATCH 0/6] staging: Remove unnecessary *_set_drvdata() Amitoj Kaur Chawla
                   ` (4 preceding siblings ...)
  2016-02-25  5:38 ` [PATCH 5/6] staging: rdma: hfi1: Remove unnecessary pci_set_drvdata() Amitoj Kaur Chawla
@ 2016-02-25  5:38 ` Amitoj Kaur Chawla
  2016-02-25  7:09 ` [Outreachy kernel] [PATCH 0/6] staging: Remove unnecessary *_set_drvdata() Julia Lawall
  6 siblings, 0 replies; 10+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-25  5:38 UTC (permalink / raw)
  To: outreachy-kernel

Unnecessary 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>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/staging/rts5208/rtsx.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index 7882193..b231946 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -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 */
-- 
1.9.1



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

* Re: [Outreachy kernel] [PATCH 0/6] staging: Remove unnecessary *_set_drvdata()
  2016-02-25  5:37 [PATCH 0/6] staging: Remove unnecessary *_set_drvdata() Amitoj Kaur Chawla
                   ` (5 preceding siblings ...)
  2016-02-25  5:38 ` [PATCH 6/6] staging: rts5208: " Amitoj Kaur Chawla
@ 2016-02-25  7:09 ` Julia Lawall
  2016-02-25  7:15   ` Amitoj Kaur Chawla
  6 siblings, 1 reply; 10+ messages in thread
From: Julia Lawall @ 2016-02-25  7:09 UTC (permalink / raw)
  To: Amitoj Kaur Chawla; +Cc: outreachy-kernel



On Thu, 25 Feb 2016, Amitoj Kaur Chawla wrote:

> 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

> 
> 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(-)
> 
> -- 
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
> 


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

* Re: [Outreachy kernel] [PATCH 0/6] staging: Remove unnecessary *_set_drvdata()
  2016-02-25  7:09 ` [Outreachy kernel] [PATCH 0/6] staging: Remove unnecessary *_set_drvdata() Julia Lawall
@ 2016-02-25  7:15   ` Amitoj Kaur Chawla
  2016-02-25  7:29     ` Julia Lawall
  0 siblings, 1 reply; 10+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-25  7:15 UTC (permalink / raw)
  To: Julia Lawall; +Cc: outreachy-kernel

On Thu, Feb 25, 2016 at 12:39 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>> 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

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


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

* Re: [Outreachy kernel] [PATCH 0/6] staging: Remove unnecessary *_set_drvdata()
  2016-02-25  7:15   ` Amitoj Kaur Chawla
@ 2016-02-25  7:29     ` Julia Lawall
  0 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2016-02-25  7:29 UTC (permalink / raw)
  To: Amitoj Kaur Chawla; +Cc: outreachy-kernel



On Thu, 25 Feb 2016, Amitoj Kaur Chawla wrote:

> On Thu, Feb 25, 2016 at 12:39 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> >
> >> 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
> 
> 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

> 
> Amitoj
> 
> -- 
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
> 


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

end of thread, other threads:[~2016-02-25  7:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-25  5:37 [PATCH 0/6] staging: Remove unnecessary *_set_drvdata() Amitoj Kaur Chawla
2016-02-25  5:37 ` [PATCH 1/6] staging: fbtft: Remove unnecessary spi_set_drvdata() Amitoj Kaur Chawla
2016-02-25  5:37 ` [PATCH 2/6] staging: sm750fb: Remove unnecessary pci_set_drvdata() Amitoj Kaur Chawla
2016-02-25  5:37 ` [PATCH 3/6] staging: media: omap4iss: Remove unnecessary platform_set_drvdata() Amitoj Kaur Chawla
2016-02-25  5:37 ` [PATCH 4/6] staging: unisys: visorbus: Remove unnecessary dev_set_drvdata() Amitoj Kaur Chawla
2016-02-25  5:38 ` [PATCH 5/6] staging: rdma: hfi1: Remove unnecessary pci_set_drvdata() Amitoj Kaur Chawla
2016-02-25  5:38 ` [PATCH 6/6] staging: rts5208: " Amitoj Kaur Chawla
2016-02-25  7:09 ` [Outreachy kernel] [PATCH 0/6] staging: Remove unnecessary *_set_drvdata() Julia Lawall
2016-02-25  7:15   ` Amitoj Kaur Chawla
2016-02-25  7:29     ` Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.