summaryrefslogtreecommitdiffstats
path: root/drivers/ide/scc_pata.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-01-06 17:20:56 +0100
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-01-06 17:20:56 +0100
commit5e7f3a46690f7f6c9f2781c700ab4370874aa0e8 (patch)
treebe5a50962416bbbc323c24d997ceb3472e3d44b9 /drivers/ide/scc_pata.c
parenta32296f93821497d794ab8e1312d677717479777 (diff)
downloadop-kernel-dev-5e7f3a46690f7f6c9f2781c700ab4370874aa0e8.zip
op-kernel-dev-5e7f3a46690f7f6c9f2781c700ab4370874aa0e8.tar.gz
ide: dynamic allocation of device structures
Allocate device structures dynamically instead of having them embedded in ide_hwif_t: * Remove needless zeroing of port structure from ide_init_port_data(). * Add ide_hwif_t.devices[MAX_DRIVES] (table of pointers to the devices). * Add ide_port_{alloc,free}_devices() helpers and use them respectively in ide_{host,free}_alloc(). * Convert all users of ->drives[] to use ->devices[] instead. While at it: * Use drive->dn for the slave device check in scc_pata.c. As a nice side-effect this patch cuts ~1kB (x86-32) from the resulting code size: text data bss dec hex filename 53963 1244 237 55444 d894 drivers/ide/ide-core.o.before 52981 1244 237 54462 d4be drivers/ide/ide-core.o.after Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/scc_pata.c')
-rw-r--r--drivers/ide/scc_pata.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
index 90574ab..841164d 100644
--- a/drivers/ide/scc_pata.c
+++ b/drivers/ide/scc_pata.c
@@ -259,7 +259,7 @@ static void scc_set_dma_mode(ide_drive_t *drive, const u8 speed)
unsigned long scrcst_port = ctl_base + 0x014;
unsigned long udenvt_port = ctl_base + 0x018;
unsigned long tdvhsel_port = ctl_base + 0x020;
- int is_slave = (&hwif->drives[1] == drive);
+ int is_slave = drive->dn & 1;
int offset, idx;
unsigned long reg;
unsigned long jcactsel;
@@ -413,7 +413,8 @@ static int scc_dma_end(ide_drive_t *drive)
if (rq)
rq->errors |= ERROR_RESET;
for (unit = 0; unit < MAX_DRIVES; unit++) {
- ide_drive_t *drive = &hwif->drives[unit];
+ ide_drive_t *drive = hwif->devices[unit];
+
drive->crc_count++;
}
}
OpenPOWER on IntegriCloud