aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/ide.c36
-rw-r--r--include/linux/ide.h1
2 files changed, 11 insertions, 26 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index b7a040ef12fa..f04b53cb023f 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -251,29 +251,21 @@ static struct resource* hwif_request_region(ide_hwif_t *hwif,
251int ide_hwif_request_regions(ide_hwif_t *hwif) 251int ide_hwif_request_regions(ide_hwif_t *hwif)
252{ 252{
253 unsigned long addr; 253 unsigned long addr;
254 unsigned int i;
255 254
256 if (hwif->mmio) 255 if (hwif->mmio)
257 return 0; 256 return 0;
257
258 addr = hwif->io_ports[IDE_CONTROL_OFFSET]; 258 addr = hwif->io_ports[IDE_CONTROL_OFFSET];
259
259 if (addr && !hwif_request_region(hwif, addr, 1)) 260 if (addr && !hwif_request_region(hwif, addr, 1))
260 goto control_region_busy; 261 goto control_region_busy;
261 hwif->straight8 = 0; 262
262 addr = hwif->io_ports[IDE_DATA_OFFSET]; 263 addr = hwif->io_ports[IDE_DATA_OFFSET];
263 if ((addr | 7) == hwif->io_ports[IDE_STATUS_OFFSET]) { 264 BUG_ON((addr | 7) != hwif->io_ports[IDE_STATUS_OFFSET]);
264 if (!hwif_request_region(hwif, addr, 8)) 265
265 goto data_region_busy; 266 if (!hwif_request_region(hwif, addr, 8))
266 hwif->straight8 = 1; 267 goto data_region_busy;
267 return 0; 268
268 }
269 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
270 addr = hwif->io_ports[i];
271 if (!hwif_request_region(hwif, addr, 1)) {
272 while (--i)
273 release_region(addr, 1);
274 goto data_region_busy;
275 }
276 }
277 return 0; 269 return 0;
278 270
279data_region_busy: 271data_region_busy:
@@ -299,19 +291,13 @@ control_region_busy:
299 291
300void ide_hwif_release_regions(ide_hwif_t *hwif) 292void ide_hwif_release_regions(ide_hwif_t *hwif)
301{ 293{
302 u32 i = 0;
303
304 if (hwif->mmio) 294 if (hwif->mmio)
305 return; 295 return;
296
306 if (hwif->io_ports[IDE_CONTROL_OFFSET]) 297 if (hwif->io_ports[IDE_CONTROL_OFFSET])
307 release_region(hwif->io_ports[IDE_CONTROL_OFFSET], 1); 298 release_region(hwif->io_ports[IDE_CONTROL_OFFSET], 1);
308 if (hwif->straight8) { 299
309 release_region(hwif->io_ports[IDE_DATA_OFFSET], 8); 300 release_region(hwif->io_ports[IDE_DATA_OFFSET], 8);
310 return;
311 }
312 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++)
313 if (hwif->io_ports[i])
314 release_region(hwif->io_ports[i], 1);
315} 301}
316 302
317void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) 303void ide_remove_port_from_hwgroup(ide_hwif_t *hwif)
diff --git a/include/linux/ide.h b/include/linux/ide.h
index cd8deba68cb2..f20410dd4482 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -521,7 +521,6 @@ typedef struct hwif_s {
521 unsigned reset : 1; /* reset after probe */ 521 unsigned reset : 1; /* reset after probe */
522 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 522 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
523 unsigned mmio : 1; /* host uses MMIO */ 523 unsigned mmio : 1; /* host uses MMIO */
524 unsigned straight8 : 1; /* Alan's straight 8 check */
525 524
526 struct device gendev; 525 struct device gendev;
527 struct device *portdev; 526 struct device *portdev;