diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:35 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-01 17:09:35 -0500 |
commit | 042449377e0aa559804c2072887c56760c56e079 (patch) | |
tree | 1cc271e6d96daefa9ece06660f2d8d565a9aff77 /drivers | |
parent | 48535651f6a993924115768aa7256c371bf818e6 (diff) |
ide_platform: remove struct hwif_prop
* Remove 'if (hwif != hwif_prop.hwif)' check from plat_ide_remove()
(pdev->dev.driver_data and hwif_prop.hwif are set at the same time
in plat_ide_probe() and are identical).
* Use hwif->index for ide_unregister() in plat_ide_remove().
* Use local variables instead of hwif_prop.plat_ide[_alt]_mapbase in
plat_ide_probe() and remove no longer needed struct hwif_prop.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/legacy/ide_platform.c | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index 69a0fb0e564f..7c3231a21d17 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c | |||
@@ -21,13 +21,6 @@ | |||
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | 23 | ||
24 | static struct { | ||
25 | void __iomem *plat_ide_mapbase; | ||
26 | void __iomem *plat_ide_alt_mapbase; | ||
27 | ide_hwif_t *hwif; | ||
28 | int index; | ||
29 | } hwif_prop; | ||
30 | |||
31 | static void __devinit plat_ide_setup_ports(hw_regs_t *hw, | 24 | static void __devinit plat_ide_setup_ports(hw_regs_t *hw, |
32 | void __iomem *base, | 25 | void __iomem *base, |
33 | void __iomem *ctrl, | 26 | void __iomem *ctrl, |
@@ -54,6 +47,7 @@ static void __devinit plat_ide_setup_ports(hw_regs_t *hw, | |||
54 | static int __devinit plat_ide_probe(struct platform_device *pdev) | 47 | static int __devinit plat_ide_probe(struct platform_device *pdev) |
55 | { | 48 | { |
56 | struct resource *res_base, *res_alt, *res_irq; | 49 | struct resource *res_base, *res_alt, *res_irq; |
50 | void __iomem *base, *alt_base; | ||
57 | ide_hwif_t *hwif; | 51 | ide_hwif_t *hwif; |
58 | struct pata_platform_info *pdata; | 52 | struct pata_platform_info *pdata; |
59 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 53 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
@@ -84,27 +78,25 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
84 | } | 78 | } |
85 | 79 | ||
86 | if (mmio) { | 80 | if (mmio) { |
87 | hwif_prop.plat_ide_mapbase = devm_ioremap(&pdev->dev, | 81 | base = devm_ioremap(&pdev->dev, |
88 | res_base->start, res_base->end - res_base->start + 1); | 82 | res_base->start, res_base->end - res_base->start + 1); |
89 | hwif_prop.plat_ide_alt_mapbase = devm_ioremap(&pdev->dev, | 83 | alt_base = devm_ioremap(&pdev->dev, |
90 | res_alt->start, res_alt->end - res_alt->start + 1); | 84 | res_alt->start, res_alt->end - res_alt->start + 1); |
91 | } else { | 85 | } else { |
92 | hwif_prop.plat_ide_mapbase = devm_ioport_map(&pdev->dev, | 86 | base = devm_ioport_map(&pdev->dev, |
93 | res_base->start, res_base->end - res_base->start + 1); | 87 | res_base->start, res_base->end - res_base->start + 1); |
94 | hwif_prop.plat_ide_alt_mapbase = devm_ioport_map(&pdev->dev, | 88 | alt_base = devm_ioport_map(&pdev->dev, |
95 | res_alt->start, res_alt->end - res_alt->start + 1); | 89 | res_alt->start, res_alt->end - res_alt->start + 1); |
96 | } | 90 | } |
97 | 91 | ||
98 | hwif = ide_find_port((unsigned long)hwif_prop.plat_ide_mapbase); | 92 | hwif = ide_find_port((unsigned long)base); |
99 | if (!hwif) { | 93 | if (!hwif) { |
100 | ret = -ENODEV; | 94 | ret = -ENODEV; |
101 | goto out; | 95 | goto out; |
102 | } | 96 | } |
103 | 97 | ||
104 | memset(&hw, 0, sizeof(hw)); | 98 | memset(&hw, 0, sizeof(hw)); |
105 | plat_ide_setup_ports(&hw, hwif_prop.plat_ide_mapbase, | 99 | plat_ide_setup_ports(&hw, base, alt_base, pdata, res_irq->start); |
106 | hwif_prop.plat_ide_alt_mapbase, | ||
107 | pdata, res_irq->start); | ||
108 | hw.dev = &pdev->dev; | 100 | hw.dev = &pdev->dev; |
109 | 101 | ||
110 | ide_init_port_hw(hwif, &hw); | 102 | ide_init_port_hw(hwif, &hw); |
@@ -114,9 +106,6 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
114 | default_hwif_mmiops(hwif); | 106 | default_hwif_mmiops(hwif); |
115 | } | 107 | } |
116 | 108 | ||
117 | hwif_prop.hwif = hwif; | ||
118 | hwif_prop.index = hwif->index; | ||
119 | |||
120 | idx[0] = hwif->index; | 109 | idx[0] = hwif->index; |
121 | 110 | ||
122 | ide_device_add(idx); | 111 | ide_device_add(idx); |
@@ -133,14 +122,7 @@ static int __devexit plat_ide_remove(struct platform_device *pdev) | |||
133 | { | 122 | { |
134 | ide_hwif_t *hwif = pdev->dev.driver_data; | 123 | ide_hwif_t *hwif = pdev->dev.driver_data; |
135 | 124 | ||
136 | if (hwif != hwif_prop.hwif) { | 125 | ide_unregister(hwif->index); |
137 | dev_printk(KERN_DEBUG, &pdev->dev, "%s: hwif value error", | ||
138 | pdev->name); | ||
139 | } else { | ||
140 | ide_unregister(hwif_prop.index); | ||
141 | hwif_prop.index = 0; | ||
142 | hwif_prop.hwif = NULL; | ||
143 | } | ||
144 | 126 | ||
145 | return 0; | 127 | return 0; |
146 | } | 128 | } |