Commit 9b1c0e63 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Linus Torvalds

[PATCH] small cleanup for AMD/nVidia IDE driver

ide_pci_setup_ports() from setup-pci.c checks if port is disabled, if so
d->init_setup_dma() and d->init_hwif() won't be called.  There is no need
to check it once again inside init_hwif_amd74xx(), init_dma_amd74xx()
and amd74xx_tune_drive() (hwif->tuneproc will be NULL for disabled port).

Therefore remove amd_enabled variable and now unnecessary init_dma_amd74xx().
Also do not set .init_{iops, dma} to NULL in amd74xx.h (amd74xx_chipsets[]
is declared static).  Bump driver's version number to reflect changes.

Almost identical to the previous VIA case.
parent ca2fd036
/* /*
* Version 2.9 * Version 2.11
* *
* AMD 755/756/766/8111 and nVidia nForce IDE driver for Linux. * AMD 755/756/766/8111 and nVidia nForce IDE driver for Linux.
* *
...@@ -65,7 +65,6 @@ static struct amd_ide_chip { ...@@ -65,7 +65,6 @@ static struct amd_ide_chip {
}; };
static struct amd_ide_chip *amd_config; static struct amd_ide_chip *amd_config;
static unsigned char amd_enabled;
static unsigned int amd_80w; static unsigned int amd_80w;
static unsigned int amd_clock; static unsigned int amd_clock;
...@@ -103,7 +102,7 @@ static int amd74xx_get_info(char *buffer, char **addr, off_t offset, int count) ...@@ -103,7 +102,7 @@ static int amd74xx_get_info(char *buffer, char **addr, off_t offset, int count)
amd_print("----------AMD BusMastering IDE Configuration----------------"); amd_print("----------AMD BusMastering IDE Configuration----------------");
amd_print("Driver Version: 2.9"); amd_print("Driver Version: 2.11");
amd_print("South Bridge: %s", pci_name(bmide_dev)); amd_print("South Bridge: %s", pci_name(bmide_dev));
pci_read_config_byte(dev, PCI_REVISION_ID, &t); pci_read_config_byte(dev, PCI_REVISION_ID, &t);
...@@ -250,9 +249,6 @@ static int amd_set_drive(ide_drive_t *drive, u8 speed) ...@@ -250,9 +249,6 @@ static int amd_set_drive(ide_drive_t *drive, u8 speed)
static void amd74xx_tune_drive(ide_drive_t *drive, u8 pio) static void amd74xx_tune_drive(ide_drive_t *drive, u8 pio)
{ {
if (!((amd_enabled >> HWIF(drive)->channel) & 1))
return;
if (pio == 255) { if (pio == 255) {
amd_set_drive(drive, ide_find_best_mode(drive, XFER_PIO | XFER_EPIO)); amd_set_drive(drive, ide_find_best_mode(drive, XFER_PIO | XFER_EPIO));
return; return;
...@@ -330,9 +326,6 @@ static unsigned int __init init_chipset_amd74xx(struct pci_dev *dev, const char ...@@ -330,9 +326,6 @@ static unsigned int __init init_chipset_amd74xx(struct pci_dev *dev, const char
break; break;
} }
pci_read_config_dword(dev, AMD_IDE_ENABLE, &u);
amd_enabled = ((u & 1) ? 2 : 0) | ((u & 2) ? 1 : 0);
/* /*
* Take care of prefetch & postwrite. * Take care of prefetch & postwrite.
*/ */
...@@ -408,8 +401,8 @@ static void __init init_hwif_amd74xx(ide_hwif_t *hwif) ...@@ -408,8 +401,8 @@ static void __init init_hwif_amd74xx(ide_hwif_t *hwif)
hwif->mwdma_mask = 0x07; hwif->mwdma_mask = 0x07;
hwif->swdma_mask = 0x07; hwif->swdma_mask = 0x07;
if (!(hwif->udma_four)) if (!hwif->udma_four)
hwif->udma_four = ((amd_enabled & amd_80w) >> hwif->channel) & 1; hwif->udma_four = (amd_80w >> hwif->channel) & 1;
hwif->ide_dma_check = &amd74xx_ide_dma_check; hwif->ide_dma_check = &amd74xx_ide_dma_check;
if (!noautodma) if (!noautodma)
hwif->autodma = 1; hwif->autodma = 1;
...@@ -417,16 +410,6 @@ static void __init init_hwif_amd74xx(ide_hwif_t *hwif) ...@@ -417,16 +410,6 @@ static void __init init_hwif_amd74xx(ide_hwif_t *hwif)
hwif->drives[1].autodma = hwif->autodma; hwif->drives[1].autodma = hwif->autodma;
} }
/*
* We allow the BM-DMA driver only work on enabled interfaces.
*/
static void __init init_dma_amd74xx(ide_hwif_t *hwif, unsigned long dmabase)
{
if ((amd_enabled >> hwif->channel) & 1)
ide_setup_dma(hwif, dmabase, 8);
}
extern void ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *); extern void ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *);
static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id) static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id)
......
...@@ -27,7 +27,6 @@ static ide_pci_host_proc_t amd74xx_procs[] __initdata = { ...@@ -27,7 +27,6 @@ static ide_pci_host_proc_t amd74xx_procs[] __initdata = {
static unsigned int init_chipset_amd74xx(struct pci_dev *, const char *); static unsigned int init_chipset_amd74xx(struct pci_dev *, const char *);
static void init_hwif_amd74xx(ide_hwif_t *); static void init_hwif_amd74xx(ide_hwif_t *);
static void init_dma_amd74xx(ide_hwif_t *, unsigned long);
static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
{ /* 0 */ { /* 0 */
...@@ -35,9 +34,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { ...@@ -35,9 +34,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_AMD_COBRA_7401, .device = PCI_DEVICE_ID_AMD_COBRA_7401,
.name = "AMD7401", .name = "AMD7401",
.init_chipset = init_chipset_amd74xx, .init_chipset = init_chipset_amd74xx,
.init_iops = NULL,
.init_hwif = init_hwif_amd74xx, .init_hwif = init_hwif_amd74xx,
.init_dma = init_dma_amd74xx,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
...@@ -48,9 +45,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { ...@@ -48,9 +45,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_AMD_VIPER_7409, .device = PCI_DEVICE_ID_AMD_VIPER_7409,
.name = "AMD7409", .name = "AMD7409",
.init_chipset = init_chipset_amd74xx, .init_chipset = init_chipset_amd74xx,
.init_iops = NULL,
.init_hwif = init_hwif_amd74xx, .init_hwif = init_hwif_amd74xx,
.init_dma = init_dma_amd74xx,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
...@@ -61,9 +56,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { ...@@ -61,9 +56,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_AMD_VIPER_7411, .device = PCI_DEVICE_ID_AMD_VIPER_7411,
.name = "AMD7411", .name = "AMD7411",
.init_chipset = init_chipset_amd74xx, .init_chipset = init_chipset_amd74xx,
.init_iops = NULL,
.init_hwif = init_hwif_amd74xx, .init_hwif = init_hwif_amd74xx,
.init_dma = init_dma_amd74xx,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
...@@ -74,9 +67,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { ...@@ -74,9 +67,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_AMD_OPUS_7441, .device = PCI_DEVICE_ID_AMD_OPUS_7441,
.name = "AMD7441", .name = "AMD7441",
.init_chipset = init_chipset_amd74xx, .init_chipset = init_chipset_amd74xx,
.init_iops = NULL,
.init_hwif = init_hwif_amd74xx, .init_hwif = init_hwif_amd74xx,
.init_dma = init_dma_amd74xx,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
...@@ -87,9 +78,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { ...@@ -87,9 +78,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_AMD_8111_IDE, .device = PCI_DEVICE_ID_AMD_8111_IDE,
.name = "AMD8111", .name = "AMD8111",
.init_chipset = init_chipset_amd74xx, .init_chipset = init_chipset_amd74xx,
.init_iops = NULL,
.init_hwif = init_hwif_amd74xx, .init_hwif = init_hwif_amd74xx,
.init_dma = init_dma_amd74xx,
.autodma = AUTODMA, .autodma = AUTODMA,
.channels = 2, .channels = 2,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
...@@ -101,9 +90,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { ...@@ -101,9 +90,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_NVIDIA_NFORCE_IDE, .device = PCI_DEVICE_ID_NVIDIA_NFORCE_IDE,
.name = "NFORCE", .name = "NFORCE",
.init_chipset = init_chipset_amd74xx, .init_chipset = init_chipset_amd74xx,
.init_iops = NULL,
.init_hwif = init_hwif_amd74xx, .init_hwif = init_hwif_amd74xx,
.init_dma = init_dma_amd74xx,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}},
...@@ -115,9 +102,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { ...@@ -115,9 +102,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE, .device = PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE,
.name = "NFORCE2", .name = "NFORCE2",
.init_chipset = init_chipset_amd74xx, .init_chipset = init_chipset_amd74xx,
.init_iops = NULL,
.init_hwif = init_hwif_amd74xx, .init_hwif = init_hwif_amd74xx,
.init_dma = init_dma_amd74xx,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment