ide: do not access ide_drive_t 'drive_data' field directly
Change ide_drive_t 'drive_data' field from 'unsigned int' type to 'void *' type, allowing a wider range of values/types to be stored in this field. Added 'ide_get_drivedata' and 'ide_set_drivedata' helpers to get and set the 'drive_data' field. Fixed all host drivers to maintain coherency with the change in the 'drive_data' field type. Signed-off-by: Joao Ramos <joao.ramos@inov.pt> [bart: fix qd65xx build, cast to 'unsigned long', minor Coding Style fixups] Acked-by: Sergei Shtylyov <sshtylyov@ru.montavista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:

committed by
Bartlomiej Zolnierkiewicz

parent
3779f818a4
commit
5bfb151f1f
@@ -73,6 +73,7 @@ static unsigned int get_pio_timings(ide_drive_t *drive, u8 pio)
|
||||
static void sl82c105_set_pio_mode(ide_drive_t *drive, const u8 pio)
|
||||
{
|
||||
struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
|
||||
unsigned long timings = (unsigned long)ide_get_drivedata(drive);
|
||||
int reg = 0x44 + drive->dn * 4;
|
||||
u16 drv_ctrl;
|
||||
|
||||
@@ -82,8 +83,9 @@ static void sl82c105_set_pio_mode(ide_drive_t *drive, const u8 pio)
|
||||
* Store the PIO timings so that we can restore them
|
||||
* in case DMA will be turned off...
|
||||
*/
|
||||
drive->drive_data &= 0xffff0000;
|
||||
drive->drive_data |= drv_ctrl;
|
||||
timings &= 0xffff0000;
|
||||
timings |= drv_ctrl;
|
||||
ide_set_drivedata(drive, (void *)timings);
|
||||
|
||||
pci_write_config_word(dev, reg, drv_ctrl);
|
||||
pci_read_config_word (dev, reg, &drv_ctrl);
|
||||
@@ -99,6 +101,7 @@ static void sl82c105_set_pio_mode(ide_drive_t *drive, const u8 pio)
|
||||
static void sl82c105_set_dma_mode(ide_drive_t *drive, const u8 speed)
|
||||
{
|
||||
static u16 mwdma_timings[] = {0x0707, 0x0201, 0x0200};
|
||||
unsigned long timings = (unsigned long)ide_get_drivedata(drive);
|
||||
u16 drv_ctrl;
|
||||
|
||||
DBG(("sl82c105_tune_chipset(drive:%s, speed:%s)\n",
|
||||
@@ -110,8 +113,9 @@ static void sl82c105_set_dma_mode(ide_drive_t *drive, const u8 speed)
|
||||
* Store the DMA timings so that we can actually program
|
||||
* them when DMA will be turned on...
|
||||
*/
|
||||
drive->drive_data &= 0x0000ffff;
|
||||
drive->drive_data |= (unsigned long)drv_ctrl << 16;
|
||||
timings &= 0x0000ffff;
|
||||
timings |= (unsigned long)drv_ctrl << 16;
|
||||
ide_set_drivedata(drive, (void *)timings);
|
||||
}
|
||||
|
||||
static int sl82c105_test_irq(ide_hwif_t *hwif)
|
||||
@@ -194,7 +198,8 @@ static void sl82c105_dma_start(ide_drive_t *drive)
|
||||
|
||||
DBG(("%s(drive:%s)\n", __func__, drive->name));
|
||||
|
||||
pci_write_config_word(dev, reg, drive->drive_data >> 16);
|
||||
pci_write_config_word(dev, reg,
|
||||
(unsigned long)ide_get_drivedata(drive) >> 16);
|
||||
|
||||
sl82c105_reset_host(dev);
|
||||
ide_dma_start(drive);
|
||||
@@ -219,7 +224,8 @@ static int sl82c105_dma_end(ide_drive_t *drive)
|
||||
|
||||
ret = ide_dma_end(drive);
|
||||
|
||||
pci_write_config_word(dev, reg, drive->drive_data);
|
||||
pci_write_config_word(dev, reg,
|
||||
(unsigned long)ide_get_drivedata(drive));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user