Commit 29c6443d authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Linus Torvalds

[PATCH] small cleanup for VIA 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_via82cxxx(),
init_dma_via82cxxx() and via82cxxx_tune_drive() (hwif->tuneproc will be
NULL for disabled port).

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

Acked by Vojtech
parent fb16cbc2
/* /*
* *
* Version 3.37 * Version 3.38
* *
* VIA IDE driver for Linux. Supported southbridges: * VIA IDE driver for Linux. Supported southbridges:
* *
...@@ -96,7 +96,6 @@ static struct via_isa_bridge { ...@@ -96,7 +96,6 @@ static struct via_isa_bridge {
}; };
static struct via_isa_bridge *via_config; static struct via_isa_bridge *via_config;
static unsigned char via_enabled;
static unsigned int via_80w; static unsigned int via_80w;
static unsigned int via_clock; static unsigned int via_clock;
static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" }; static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" };
...@@ -146,7 +145,7 @@ static int via_get_info(char *buffer, char **addr, off_t offset, int count) ...@@ -146,7 +145,7 @@ static int via_get_info(char *buffer, char **addr, off_t offset, int count)
via_print("----------VIA BusMastering IDE Configuration" via_print("----------VIA BusMastering IDE Configuration"
"----------------"); "----------------");
via_print("Driver Version: 3.37"); via_print("Driver Version: 3.38");
via_print("South Bridge: VIA %s", via_print("South Bridge: VIA %s",
via_config->name); via_config->name);
...@@ -370,9 +369,6 @@ static int via_set_drive(ide_drive_t *drive, u8 speed) ...@@ -370,9 +369,6 @@ static int via_set_drive(ide_drive_t *drive, u8 speed)
static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio) static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio)
{ {
if (!((via_enabled >> HWIF(drive)->channel) & 1))
return;
if (pio == 255) { if (pio == 255) {
via_set_drive(drive, via_set_drive(drive,
ide_find_best_mode(drive, XFER_PIO | XFER_EPIO)); ide_find_best_mode(drive, XFER_PIO | XFER_EPIO));
...@@ -506,7 +502,6 @@ static unsigned int __init init_chipset_via82cxxx(struct pci_dev *dev, const cha ...@@ -506,7 +502,6 @@ static unsigned int __init init_chipset_via82cxxx(struct pci_dev *dev, const cha
*/ */
pci_read_config_byte(dev, VIA_IDE_ENABLE, &v); pci_read_config_byte(dev, VIA_IDE_ENABLE, &v);
via_enabled = ((v & 1) ? 2 : 0) | ((v & 2) ? 1 : 0);
/* /*
* Set up FIFO sizes and thresholds. * Set up FIFO sizes and thresholds.
...@@ -523,9 +518,9 @@ static unsigned int __init init_chipset_via82cxxx(struct pci_dev *dev, const cha ...@@ -523,9 +518,9 @@ static unsigned int __init init_chipset_via82cxxx(struct pci_dev *dev, const cha
/* Fix FIFO split between channels */ /* Fix FIFO split between channels */
if (via_config->flags & VIA_SET_FIFO) { if (via_config->flags & VIA_SET_FIFO) {
t &= (t & 0x9f); t &= (t & 0x9f);
switch (via_enabled) { switch (v & 3) {
case 1: t |= 0x00; break; /* 16 on primary */ case 2: t |= 0x00; break; /* 16 on primary */
case 2: t |= 0x60; break; /* 16 on secondary */ case 1: t |= 0x60; break; /* 16 on secondary */
case 3: t |= 0x20; break; /* 8 pri 8 sec */ case 3: t |= 0x20; break; /* 8 pri 8 sec */
} }
} }
...@@ -603,8 +598,8 @@ static void __init init_hwif_via82cxxx(ide_hwif_t *hwif) ...@@ -603,8 +598,8 @@ static void __init init_hwif_via82cxxx(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 = ((via_enabled & via_80w) >> hwif->channel) & 1; hwif->udma_four = (via_80w >> hwif->channel) & 1;
hwif->ide_dma_check = &via82cxxx_ide_dma_check; hwif->ide_dma_check = &via82cxxx_ide_dma_check;
if (!noautodma) if (!noautodma)
hwif->autodma = 1; hwif->autodma = 1;
...@@ -612,20 +607,6 @@ static void __init init_hwif_via82cxxx(ide_hwif_t *hwif) ...@@ -612,20 +607,6 @@ static void __init init_hwif_via82cxxx(ide_hwif_t *hwif)
hwif->drives[1].autodma = hwif->autodma; hwif->drives[1].autodma = hwif->autodma;
} }
/**
* init_dma_via82cxxx - set up for IDE DMA
* @hwif: IDE interface
* @dmabase: DMA base address
*
* We allow the BM-DMA driver to only work on enabled interfaces.
*/
static void __init init_dma_via82cxxx(ide_hwif_t *hwif, unsigned long dmabase)
{
if ((via_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 via_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id)
......
...@@ -27,7 +27,6 @@ static ide_pci_host_proc_t via_procs[] __initdata = { ...@@ -27,7 +27,6 @@ static ide_pci_host_proc_t via_procs[] __initdata = {
static unsigned int init_chipset_via82cxxx(struct pci_dev *, const char *); static unsigned int init_chipset_via82cxxx(struct pci_dev *, const char *);
static void init_hwif_via82cxxx(ide_hwif_t *); static void init_hwif_via82cxxx(ide_hwif_t *);
static void init_dma_via82cxxx(ide_hwif_t *, unsigned long);
static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = {
{ /* 0 */ { /* 0 */
...@@ -35,9 +34,7 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { ...@@ -35,9 +34,7 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_VIA_82C576_1, .device = PCI_DEVICE_ID_VIA_82C576_1,
.name = "VP_IDE", .name = "VP_IDE",
.init_chipset = init_chipset_via82cxxx, .init_chipset = init_chipset_via82cxxx,
.init_iops = NULL,
.init_hwif = init_hwif_via82cxxx, .init_hwif = init_hwif_via82cxxx,
.init_dma = init_dma_via82cxxx,
.channels = 2, .channels = 2,
.autodma = NOAUTODMA, .autodma = NOAUTODMA,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
...@@ -48,9 +45,7 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { ...@@ -48,9 +45,7 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_VIA_82C586_1, .device = PCI_DEVICE_ID_VIA_82C586_1,
.name = "VP_IDE", .name = "VP_IDE",
.init_chipset = init_chipset_via82cxxx, .init_chipset = init_chipset_via82cxxx,
.init_iops = NULL,
.init_hwif = init_hwif_via82cxxx, .init_hwif = init_hwif_via82cxxx,
.init_dma = init_dma_via82cxxx,
.channels = 2, .channels = 2,
.autodma = NOAUTODMA, .autodma = NOAUTODMA,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, .enablebits = {{0x40,0x02,0x02}, {0x40,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