linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] scsi: use platform helper macro and wrapper functions
@ 2013-05-30 12:09 Kefeng Wang
  2013-05-30 12:09 ` [PATCH 1/5] scsi: jazz: use module_platform_driver() and platform_{set,get}_drvdata Kefeng Wang
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Kefeng Wang @ 2013-05-30 12:09 UTC (permalink / raw)
  To: David S. Miller, Thomas Bogendoerfer, James E.J. Bottomley
  Cc: linux-scsi, linux-kernel, guohanjun, Kefeng Wang

use module_platform_driver() and paltform{set,get}_drvdata to simpily code,
and patch 2/5 delete unnecessery drvdate set to null.

Kefeng Wang (5):
  scsi: jazz: use module_platform_driver() and
    platform_{set,get}_drvdata
  scsi: sun: use module_platform_driver() and platform_{set,get}_drvdata
  scsi: qlogicpti: use module_platform_driver() and
    platform_{set,get}_drvdata
  scsi: sun3x: use module_platform_driver() and
    platform_{set,get}_drvdata
  scsi: sni: use module_platform_driver() and platform_{set,get}_drvdata

 drivers/scsi/jazz_esp.c   | 17 +++--------------
 drivers/scsi/qlogicpti.c  | 17 +++--------------
 drivers/scsi/sni_53c710.c | 17 +++--------------
 drivers/scsi/sun3x_esp.c  | 16 +++-------------
 drivers/scsi/sun_esp.c    | 19 +++----------------
 5 files changed, 15 insertions(+), 71 deletions(-)

-- 
1.8.2.1

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

* [PATCH 1/5] scsi: jazz: use module_platform_driver() and platform_{set,get}_drvdata
  2013-05-30 12:09 [PATCH 0/5] scsi: use platform helper macro and wrapper functions Kefeng Wang
@ 2013-05-30 12:09 ` Kefeng Wang
  2013-05-30 12:09 ` [PATCH 2/5] scsi: sun: " Kefeng Wang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Kefeng Wang @ 2013-05-30 12:09 UTC (permalink / raw)
  To: David S. Miller, Thomas Bogendoerfer, James E.J. Bottomley
  Cc: linux-scsi, linux-kernel, guohanjun, Kefeng Wang

Use helper macro and wrapper functions to simpily code.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/scsi/jazz_esp.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c
index 69efbf1..08fa257 100644
--- a/drivers/scsi/jazz_esp.c
+++ b/drivers/scsi/jazz_esp.c
@@ -180,7 +180,7 @@ static int esp_jazz_probe(struct platform_device *dev)
 	esp->scsi_id_mask = (1 << esp->scsi_id);
 	esp->cfreq = 40000000;
 
-	dev_set_drvdata(&dev->dev, esp);
+	platform_set_drvdata(dev, esp);
 
 	err = scsi_esp_register(esp, &dev->dev);
 	if (err)
@@ -203,7 +203,7 @@ fail:
 
 static int esp_jazz_remove(struct platform_device *dev)
 {
-	struct esp *esp = dev_get_drvdata(&dev->dev);
+	struct esp *esp = platform_get_drvdata(dev);
 	unsigned int irq = esp->host->irq;
 
 	scsi_esp_unregister(esp);
@@ -230,20 +230,9 @@ static struct platform_driver esp_jazz_driver = {
 	},
 };
 
-static int __init jazz_esp_init(void)
-{
-	return platform_driver_register(&esp_jazz_driver);
-}
-
-static void __exit jazz_esp_exit(void)
-{
-	platform_driver_unregister(&esp_jazz_driver);
-}
+module_platform_driver(esp_jazz_driver);
 
 MODULE_DESCRIPTION("JAZZ ESP SCSI driver");
 MODULE_AUTHOR("Thomas Bogendoerfer (tsbogend@alpha.franken.de)");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
-
-module_init(jazz_esp_init);
-module_exit(jazz_esp_exit);
-- 
1.8.2.1

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

* [PATCH 2/5] scsi: sun: use module_platform_driver() and platform_{set,get}_drvdata
  2013-05-30 12:09 [PATCH 0/5] scsi: use platform helper macro and wrapper functions Kefeng Wang
  2013-05-30 12:09 ` [PATCH 1/5] scsi: jazz: use module_platform_driver() and platform_{set,get}_drvdata Kefeng Wang
@ 2013-05-30 12:09 ` Kefeng Wang
  2013-05-30 12:09 ` [PATCH 3/5] scsi: qlogicpti: " Kefeng Wang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Kefeng Wang @ 2013-05-30 12:09 UTC (permalink / raw)
  To: David S. Miller, Thomas Bogendoerfer, James E.J. Bottomley
  Cc: linux-scsi, linux-kernel, guohanjun, Kefeng Wang

Use helper macro and wrapper functions to simpily code. Meanwhile,
remove unnecessary drvdata set to null due to commint 0998d0631
(device-core: Ensure drvdata = NULL when no driver is bound).

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/scsi/sun_esp.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c
index f2e6845..b7361a6 100644
--- a/drivers/scsi/sun_esp.c
+++ b/drivers/scsi/sun_esp.c
@@ -538,7 +538,7 @@ static int esp_sbus_probe_one(struct platform_device *op,
 		dma_write32(val & ~DMA_RST_SCSI, DMA_CSR);
 	}
 
-	dev_set_drvdata(&op->dev, esp);
+	platform_set_drvdata(op, esp);
 
 	err = scsi_esp_register(esp, &op->dev);
 	if (err)
@@ -585,7 +585,7 @@ static int esp_sbus_probe(struct platform_device *op)
 
 static int esp_sbus_remove(struct platform_device *op)
 {
-	struct esp *esp = dev_get_drvdata(&op->dev);
+	struct esp *esp = platform_get_drvdata(op);
 	struct platform_device *dma_of = esp->dma;
 	unsigned int irq = esp->host->irq;
 	bool is_hme;
@@ -611,8 +611,6 @@ static int esp_sbus_remove(struct platform_device *op)
 
 	scsi_host_put(esp->host);
 
-	dev_set_drvdata(&op->dev, NULL);
-
 	return 0;
 }
 
@@ -640,20 +638,9 @@ static struct platform_driver esp_sbus_driver = {
 	.remove		= esp_sbus_remove,
 };
 
-static int __init sunesp_init(void)
-{
-	return platform_driver_register(&esp_sbus_driver);
-}
-
-static void __exit sunesp_exit(void)
-{
-	platform_driver_unregister(&esp_sbus_driver);
-}
+module_platform_driver(esp_sbus_driver);
 
 MODULE_DESCRIPTION("Sun ESP SCSI driver");
 MODULE_AUTHOR("David S. Miller (davem@davemloft.net)");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
-
-module_init(sunesp_init);
-module_exit(sunesp_exit);
-- 
1.8.2.1



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

* [PATCH 3/5] scsi: qlogicpti: use module_platform_driver() and platform_{set,get}_drvdata
  2013-05-30 12:09 [PATCH 0/5] scsi: use platform helper macro and wrapper functions Kefeng Wang
  2013-05-30 12:09 ` [PATCH 1/5] scsi: jazz: use module_platform_driver() and platform_{set,get}_drvdata Kefeng Wang
  2013-05-30 12:09 ` [PATCH 2/5] scsi: sun: " Kefeng Wang
@ 2013-05-30 12:09 ` Kefeng Wang
  2013-05-30 12:09 ` [PATCH 4/5] scsi: sun3x: " Kefeng Wang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Kefeng Wang @ 2013-05-30 12:09 UTC (permalink / raw)
  To: David S. Miller, Thomas Bogendoerfer, James E.J. Bottomley
  Cc: linux-scsi, linux-kernel, guohanjun, Kefeng Wang

Use helper macro and wrapper functions to simpily code.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/scsi/qlogicpti.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 6d48d30..1349374 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -1367,7 +1367,7 @@ static int qpti_sbus_probe(struct platform_device *op)
 		goto fail_unmap_queues;
 	}
 
-	dev_set_drvdata(&op->dev, qpti);
+	platform_set_drvdata(op, qpti);
 
 	qpti_chain_add(qpti);
 
@@ -1404,7 +1404,7 @@ fail_unlink:
 
 static int qpti_sbus_remove(struct platform_device *op)
 {
-	struct qlogicpti *qpti = dev_get_drvdata(&op->dev);
+	struct qlogicpti *qpti = platform_get_drvdata(&op->dev);
 
 	qpti_chain_del(qpti);
 
@@ -1462,21 +1462,10 @@ static struct platform_driver qpti_sbus_driver = {
 	.remove		= qpti_sbus_remove,
 };
 
-static int __init qpti_init(void)
-{
-	return platform_driver_register(&qpti_sbus_driver);
-}
-
-static void __exit qpti_exit(void)
-{
-	platform_driver_unregister(&qpti_sbus_driver);
-}
+module_platform_driver(qpti_sbus_driver);
 
 MODULE_DESCRIPTION("QlogicISP SBUS driver");
 MODULE_AUTHOR("David S. Miller (davem@davemloft.net)");
 MODULE_LICENSE("GPL");
 MODULE_VERSION("2.1");
 MODULE_FIRMWARE("qlogic/isp1000.bin");
-
-module_init(qpti_init);
-module_exit(qpti_exit);
-- 
1.8.2.1



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

* [PATCH 4/5] scsi: sun3x: use module_platform_driver() and platform_{set,get}_drvdata
  2013-05-30 12:09 [PATCH 0/5] scsi: use platform helper macro and wrapper functions Kefeng Wang
                   ` (2 preceding siblings ...)
  2013-05-30 12:09 ` [PATCH 3/5] scsi: qlogicpti: " Kefeng Wang
@ 2013-05-30 12:09 ` Kefeng Wang
  2013-05-30 12:09 ` [PATCH 5/5] scsi: sni: " Kefeng Wang
  2013-05-30 14:38 ` [PATCH 0/5] scsi: use platform helper macro and wrapper functions James Bottomley
  5 siblings, 0 replies; 8+ messages in thread
From: Kefeng Wang @ 2013-05-30 12:09 UTC (permalink / raw)
  To: David S. Miller, Thomas Bogendoerfer, James E.J. Bottomley
  Cc: linux-scsi, linux-kernel, guohanjun, Kefeng Wang

Use helper macro and wrapper functions to simpily code.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/scsi/sun3x_esp.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c
index 534eb96..4c9a2b4 100644
--- a/drivers/scsi/sun3x_esp.c
+++ b/drivers/scsi/sun3x_esp.c
@@ -244,7 +244,7 @@ static int esp_sun3x_probe(struct platform_device *dev)
 	esp->scsi_id_mask = (1 << esp->scsi_id);
 	esp->cfreq = 20000000;
 
-	dev_set_drvdata(&dev->dev, esp);
+	platform_set_drvdata(dev, esp);
 
 	err = scsi_esp_register(esp, &dev->dev);
 	if (err)
@@ -270,7 +270,7 @@ fail:
 
 static int esp_sun3x_remove(struct platform_device *dev)
 {
-	struct esp *esp = dev_get_drvdata(&dev->dev);
+	struct esp *esp = platform_get_drvdata(dev);
 	unsigned int irq = esp->host->irq;
 	u32 val;
 
@@ -299,21 +299,11 @@ static struct platform_driver esp_sun3x_driver = {
 	},
 };
 
-static int __init sun3x_esp_init(void)
-{
-	return platform_driver_register(&esp_sun3x_driver);
-}
-
-static void __exit sun3x_esp_exit(void)
-{
-	platform_driver_unregister(&esp_sun3x_driver);
-}
+module_platform_driver(esp_sun3x_driver);
 
 MODULE_DESCRIPTION("Sun3x ESP SCSI driver");
 MODULE_AUTHOR("Thomas Bogendoerfer (tsbogend@alpha.franken.de)");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
 
-module_init(sun3x_esp_init);
-module_exit(sun3x_esp_exit);
 MODULE_ALIAS("platform:sun3x_esp");
-- 
1.8.2.1



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

* [PATCH 5/5] scsi: sni: use module_platform_driver() and platform_{set,get}_drvdata
  2013-05-30 12:09 [PATCH 0/5] scsi: use platform helper macro and wrapper functions Kefeng Wang
                   ` (3 preceding siblings ...)
  2013-05-30 12:09 ` [PATCH 4/5] scsi: sun3x: " Kefeng Wang
@ 2013-05-30 12:09 ` Kefeng Wang
  2013-05-30 14:38 ` [PATCH 0/5] scsi: use platform helper macro and wrapper functions James Bottomley
  5 siblings, 0 replies; 8+ messages in thread
From: Kefeng Wang @ 2013-05-30 12:09 UTC (permalink / raw)
  To: David S. Miller, Thomas Bogendoerfer, James E.J. Bottomley
  Cc: linux-scsi, linux-kernel, guohanjun, Kefeng Wang

Use helper macro and wrapper functions to simpily code.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/scsi/sni_53c710.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/sni_53c710.c b/drivers/scsi/sni_53c710.c
index 52d54e7..eff84c4 100644
--- a/drivers/scsi/sni_53c710.c
+++ b/drivers/scsi/sni_53c710.c
@@ -104,7 +104,7 @@ static int snirm710_probe(struct platform_device *dev)
 		goto out_put_host;
 	}
 
-	dev_set_drvdata(&dev->dev, host);
+	platform_set_drvdata(dev, host);
 	scsi_scan_host(host);
 
 	return 0;
@@ -119,7 +119,7 @@ static int snirm710_probe(struct platform_device *dev)
 
 static int __exit snirm710_driver_remove(struct platform_device *dev)
 {
-	struct Scsi_Host *host = dev_get_drvdata(&dev->dev);
+	struct Scsi_Host *host = platform_get_drvdata(dev);
 	struct NCR_700_Host_Parameters *hostdata =
 		(struct NCR_700_Host_Parameters *)host->hostdata[0];
 
@@ -141,15 +141,4 @@ static struct platform_driver snirm710_driver = {
 	},
 };
 
-static int __init snirm710_init(void)
-{
-	return platform_driver_register(&snirm710_driver);
-}
-
-static void __exit snirm710_exit(void)
-{
-	platform_driver_unregister(&snirm710_driver);
-}
-
-module_init(snirm710_init);
-module_exit(snirm710_exit);
+module_platform_driver(snirm710_driver);
-- 
1.8.2.1



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

* Re: [PATCH 0/5] scsi: use platform helper macro and wrapper functions
  2013-05-30 12:09 [PATCH 0/5] scsi: use platform helper macro and wrapper functions Kefeng Wang
                   ` (4 preceding siblings ...)
  2013-05-30 12:09 ` [PATCH 5/5] scsi: sni: " Kefeng Wang
@ 2013-05-30 14:38 ` James Bottomley
  2013-05-31  1:15   ` Kefeng Wang
  5 siblings, 1 reply; 8+ messages in thread
From: James Bottomley @ 2013-05-30 14:38 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: David S. Miller, Thomas Bogendoerfer, linux-scsi, linux-kernel,
	guohanjun

On Thu, 2013-05-30 at 20:09 +0800, Kefeng Wang wrote:
> use module_platform_driver() and paltform{set,get}_drvdata to simpily code,
> and patch 2/5 delete unnecessery drvdate set to null.
> 
> Kefeng Wang (5):
>   scsi: jazz: use module_platform_driver() and
>     platform_{set,get}_drvdata
>   scsi: sun: use module_platform_driver() and platform_{set,get}_drvdata
>   scsi: qlogicpti: use module_platform_driver() and
>     platform_{set,get}_drvdata
>   scsi: sun3x: use module_platform_driver() and
>     platform_{set,get}_drvdata
>   scsi: sni: use module_platform_driver() and platform_{set,get}_drvdata
> 
>  drivers/scsi/jazz_esp.c   | 17 +++--------------
>  drivers/scsi/qlogicpti.c  | 17 +++--------------
>  drivers/scsi/sni_53c710.c | 17 +++--------------
>  drivers/scsi/sun3x_esp.c  | 16 +++-------------
>  drivers/scsi/sun_esp.c    | 19 +++----------------
>  5 files changed, 15 insertions(+), 71 deletions(-)

There doesn't seem to be much point to these patches since either idiom
is fine and easily understood.  We also try to touch the ancient drivers
as little as possible since it can be months before anyone actually
tries them out and notices that something got broken, so the rule for
them is obvious bug fixes only.

James



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

* Re: [PATCH 0/5] scsi: use platform helper macro and wrapper functions
  2013-05-30 14:38 ` [PATCH 0/5] scsi: use platform helper macro and wrapper functions James Bottomley
@ 2013-05-31  1:15   ` Kefeng Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Kefeng Wang @ 2013-05-31  1:15 UTC (permalink / raw)
  To: James Bottomley
  Cc: David S. Miller, Thomas Bogendoerfer, linux-scsi, linux-kernel,
	guohanjun

On 2013-05-30 22:38, James Bottomley wrote:
> There doesn't seem to be much point to these patches since either idiom
> is fine and easily understood.  We also try to touch the ancient drivers
> as little as possible since it can be months before anyone actually
> tries them out and notices that something got broken, so the rule for
> them is obvious bug fixes only.
> 
> James

hi James,
Thanks for remind, I got it.




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

end of thread, other threads:[~2013-05-31  1:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-30 12:09 [PATCH 0/5] scsi: use platform helper macro and wrapper functions Kefeng Wang
2013-05-30 12:09 ` [PATCH 1/5] scsi: jazz: use module_platform_driver() and platform_{set,get}_drvdata Kefeng Wang
2013-05-30 12:09 ` [PATCH 2/5] scsi: sun: " Kefeng Wang
2013-05-30 12:09 ` [PATCH 3/5] scsi: qlogicpti: " Kefeng Wang
2013-05-30 12:09 ` [PATCH 4/5] scsi: sun3x: " Kefeng Wang
2013-05-30 12:09 ` [PATCH 5/5] scsi: sni: " Kefeng Wang
2013-05-30 14:38 ` [PATCH 0/5] scsi: use platform helper macro and wrapper functions James Bottomley
2013-05-31  1:15   ` Kefeng Wang

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