diff options
Diffstat (limited to 'drivers/ide/legacy/ide_platform.c')
-rw-r--r-- | drivers/ide/legacy/ide_platform.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c index 3d71e336a221..58a942c6a131 100644 --- a/drivers/ide/legacy/ide_platform.c +++ b/drivers/ide/legacy/ide_platform.c | |||
@@ -52,11 +52,10 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
52 | { | 52 | { |
53 | struct resource *res_base, *res_alt, *res_irq; | 53 | struct resource *res_base, *res_alt, *res_irq; |
54 | void __iomem *base, *alt_base; | 54 | void __iomem *base, *alt_base; |
55 | ide_hwif_t *hwif; | ||
56 | struct pata_platform_info *pdata; | 55 | struct pata_platform_info *pdata; |
56 | struct ide_host *host; | ||
57 | int ret = 0, mmio = 0; | 57 | int ret = 0, mmio = 0; |
58 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; | 58 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
59 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
60 | struct ide_port_info d = platform_ide_port_info; | 59 | struct ide_port_info d = platform_ide_port_info; |
61 | 60 | ||
62 | pdata = pdev->dev.platform_data; | 61 | pdata = pdev->dev.platform_data; |
@@ -93,12 +92,6 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
93 | res_alt->start, res_alt->end - res_alt->start + 1); | 92 | res_alt->start, res_alt->end - res_alt->start + 1); |
94 | } | 93 | } |
95 | 94 | ||
96 | hwif = ide_find_port(); | ||
97 | if (!hwif) { | ||
98 | ret = -ENODEV; | ||
99 | goto out; | ||
100 | } | ||
101 | |||
102 | memset(&hw, 0, sizeof(hw)); | 95 | memset(&hw, 0, sizeof(hw)); |
103 | plat_ide_setup_ports(&hw, base, alt_base, pdata, res_irq->start); | 96 | plat_ide_setup_ports(&hw, base, alt_base, pdata, res_irq->start); |
104 | hw.dev = &pdev->dev; | 97 | hw.dev = &pdev->dev; |
@@ -106,11 +99,15 @@ static int __devinit plat_ide_probe(struct platform_device *pdev) | |||
106 | if (mmio) | 99 | if (mmio) |
107 | d.host_flags |= IDE_HFLAG_MMIO; | 100 | d.host_flags |= IDE_HFLAG_MMIO; |
108 | 101 | ||
109 | idx[0] = hwif->index; | 102 | host = ide_host_alloc(&d, hws); |
103 | if (host == NULL) { | ||
104 | ret = -ENODEV; | ||
105 | goto out; | ||
106 | } | ||
110 | 107 | ||
111 | ide_device_add(idx, &d, hws); | 108 | ide_host_register(host, &d, hws); |
112 | 109 | ||
113 | platform_set_drvdata(pdev, hwif); | 110 | platform_set_drvdata(pdev, host); |
114 | 111 | ||
115 | return 0; | 112 | return 0; |
116 | 113 | ||
@@ -120,9 +117,9 @@ out: | |||
120 | 117 | ||
121 | static int __devexit plat_ide_remove(struct platform_device *pdev) | 118 | static int __devexit plat_ide_remove(struct platform_device *pdev) |
122 | { | 119 | { |
123 | ide_hwif_t *hwif = pdev->dev.driver_data; | 120 | struct ide_host *host = pdev->dev.driver_data; |
124 | 121 | ||
125 | ide_unregister(hwif); | 122 | ide_host_remove(host); |
126 | 123 | ||
127 | return 0; | 124 | return 0; |
128 | } | 125 | } |