aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2015-01-28 18:30:30 -0500
committerTejun Heo <tj@kernel.org>2015-01-28 18:45:23 -0500
commit17263905399471016cda6c1975044d14291c5ba5 (patch)
tree4ba57184e91e25a23d63519930fd0154e0c8dd2a /drivers/ata
parent018d5ef2048fcab339467bcbebccf588c9bd2531 (diff)
ata: pata_platform: fix owner module reference mismatch for scsi host
The owner module reference of the pata_of_platform's scsi_host is initialized to pata_platform's one, because pata_of_platform driver use a scsi_host_template defined in pata_platform. So this drivers can be unloaded even if the scsi device is being accessed. This fixes it by propagating the scsi_host_template to pata_of_platform driver. The scsi_host_template is passed through a new argument of __pata_platform_probe(). Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Christoph Hellwig <hch@lst.de> Cc: "James E.J. Bottomley" <JBottomley@parallels.com> Cc: linux-ide@vger.kernel.org Cc: linux-scsi@vger.kernel.org
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/pata_of_platform.c10
-rw-r--r--drivers/ata/pata_platform.c8
2 files changed, 13 insertions, 5 deletions
diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c
index dcc408abe171..b6b7af894d9d 100644
--- a/drivers/ata/pata_of_platform.c
+++ b/drivers/ata/pata_of_platform.c
@@ -16,6 +16,12 @@
16#include <linux/ata_platform.h> 16#include <linux/ata_platform.h>
17#include <linux/libata.h> 17#include <linux/libata.h>
18 18
19#define DRV_NAME "pata_of_platform"
20
21static struct scsi_host_template pata_platform_sht = {
22 ATA_PIO_SHT(DRV_NAME),
23};
24
19static int pata_of_platform_probe(struct platform_device *ofdev) 25static int pata_of_platform_probe(struct platform_device *ofdev)
20{ 26{
21 int ret; 27 int ret;
@@ -63,7 +69,7 @@ static int pata_of_platform_probe(struct platform_device *ofdev)
63 pio_mask |= (1 << pio_mode) - 1; 69 pio_mask |= (1 << pio_mode) - 1;
64 70
65 return __pata_platform_probe(&ofdev->dev, &io_res, &ctl_res, irq_res, 71 return __pata_platform_probe(&ofdev->dev, &io_res, &ctl_res, irq_res,
66 reg_shift, pio_mask); 72 reg_shift, pio_mask, &pata_platform_sht);
67} 73}
68 74
69static struct of_device_id pata_of_platform_match[] = { 75static struct of_device_id pata_of_platform_match[] = {
@@ -74,7 +80,7 @@ MODULE_DEVICE_TABLE(of, pata_of_platform_match);
74 80
75static struct platform_driver pata_of_platform_driver = { 81static struct platform_driver pata_of_platform_driver = {
76 .driver = { 82 .driver = {
77 .name = "pata_of_platform", 83 .name = DRV_NAME,
78 .of_match_table = pata_of_platform_match, 84 .of_match_table = pata_of_platform_match,
79 }, 85 },
80 .probe = pata_of_platform_probe, 86 .probe = pata_of_platform_probe,
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index 1eedfe46d7c8..c503ded87bb8 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -78,6 +78,7 @@ static void pata_platform_setup_port(struct ata_ioports *ioaddr,
78 * @irq_res: Resource representing IRQ and its flags 78 * @irq_res: Resource representing IRQ and its flags
79 * @ioport_shift: I/O port shift 79 * @ioport_shift: I/O port shift
80 * @__pio_mask: PIO mask 80 * @__pio_mask: PIO mask
81 * @sht: scsi_host_template to use when registering
81 * 82 *
82 * Register a platform bus IDE interface. Such interfaces are PIO and we 83 * Register a platform bus IDE interface. Such interfaces are PIO and we
83 * assume do not support IRQ sharing. 84 * assume do not support IRQ sharing.
@@ -99,7 +100,8 @@ static void pata_platform_setup_port(struct ata_ioports *ioaddr,
99 */ 100 */
100int __pata_platform_probe(struct device *dev, struct resource *io_res, 101int __pata_platform_probe(struct device *dev, struct resource *io_res,
101 struct resource *ctl_res, struct resource *irq_res, 102 struct resource *ctl_res, struct resource *irq_res,
102 unsigned int ioport_shift, int __pio_mask) 103 unsigned int ioport_shift, int __pio_mask,
104 struct scsi_host_template *sht)
103{ 105{
104 struct ata_host *host; 106 struct ata_host *host;
105 struct ata_port *ap; 107 struct ata_port *ap;
@@ -170,7 +172,7 @@ int __pata_platform_probe(struct device *dev, struct resource *io_res,
170 172
171 /* activate */ 173 /* activate */
172 return ata_host_activate(host, irq, irq ? ata_sff_interrupt : NULL, 174 return ata_host_activate(host, irq, irq ? ata_sff_interrupt : NULL,
173 irq_flags, &pata_platform_sht); 175 irq_flags, sht);
174} 176}
175EXPORT_SYMBOL_GPL(__pata_platform_probe); 177EXPORT_SYMBOL_GPL(__pata_platform_probe);
176 178
@@ -216,7 +218,7 @@ static int pata_platform_probe(struct platform_device *pdev)
216 218
217 return __pata_platform_probe(&pdev->dev, io_res, ctl_res, irq_res, 219 return __pata_platform_probe(&pdev->dev, io_res, ctl_res, irq_res,
218 pp_info ? pp_info->ioport_shift : 0, 220 pp_info ? pp_info->ioport_shift : 0,
219 pio_mask); 221 pio_mask, &pata_platform_sht);
220} 222}
221 223
222static struct platform_driver pata_platform_driver = { 224static struct platform_driver pata_platform_driver = {