small cleanup for VIA IDE driver
PATCH 1/1 small cleanup for VIA IDE driver
Hi Vojtech,
Can you take a look?
Patch was tested on vt8235 with one port disabled, worked okay.
--bartlomiej
[IDE] 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.
drivers/ide/pci/via82cxxx.c | 33 +++++++-------------------------- drivers/ide/pci/via82cxxx.h | 5 ----- 2 files changed, 7 insertions(+), 31 deletions(-)
drivers/ide/pci/via82cxxx.c renamed from drivers/ide/pci/via82cxxx.c~ide-via-enabled-cleanup +7 -26
@@ -1,6 +1,6 @@/* * -* Version 3.37 +* Version 3.38 * * VIA IDE driver for Linux. Supported southbridges: *
@@ -96,7 +96,6 @@ static struct via_isa_bridge { };static struct via_isa_bridge *via_config; -static unsigned char via_enabled;static unsigned int via_80w;static unsigned int via_clock;static char *via_dma[] = {"MWDMA16" ,"UDMA33" ,"UDMA66" ,"UDMA100" ,"UDMA133" };
@@ -146,7 +145,7 @@ static int via_get_info(char *buffer, chvia_print ("----------VIA BusMastering IDE Configuration" "----------------" ); -via_print ("Driver Version: 3.37" ); +via_print ("Driver Version: 3.38" );via_print ("South Bridge: VIA %s" , via_config->name);
@@ -370,9 +369,6 @@ static int via_set_drive(ide_drive_t *drstatic void via82cxxx_tune_drive (ide_drive_t *drive,u8 pio) { -if (!((via_enabled >>HWIF (drive)->channel) &1 )) -return ; -if (pio ==255 ) {via_set_drive (drive,ide_find_best_mode (drive,XFER_PIO |XFER_EPIO ));
@@ -506,7 +502,6 @@ static unsigned int __init init_chipset_*/ 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.
@@ -523,9 +518,9 @@ static unsigned int __init init_chipset_/* Fix FIFO split between channels */ if (via_config->flags &VIA_SET_FIFO ) { t &= (t &0x9f ); -switch (via_enabled) { -case 1 : t |=0x00 ;break ;/* 16 on primary */ -case 2 : t |=0x60 ;break ;/* 16 on secondary */ +switch (v &3 ) { +case 2 : t |=0x00 ;break ;/* 16 on primary */ +case 1 : t |=0x60 ;break ;/* 16 on secondary */ case 3 : t |=0x20 ;break ;/* 8 pri 8 sec */ } }
@@ -603,8 +598,8 @@ static void __init init_hwif_via82cxxx(i hwif->mwdma_mask =0x07 ; hwif->swdma_mask =0x07 ; -if (!(hwif->udma_four)) - hwif->udma_four = ((via_enabled & via_80w) >> hwif->channel) &1 ; +if (!hwif->udma_four) + hwif->udma_four = (via_80w >> hwif->channel) &1 ; hwif->ide_dma_check = &via82cxxx_ide_dma_check;if (!noautodma) hwif->autodma =1 ;
@@ -612,20 +607,6 @@ static void __init init_hwif_via82cxxx(i 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 *);static int __devinit via_init_one (struct pci_dev *dev,const struct pci_device_id *id)
drivers/ide/pci/via82cxxx.h renamed from drivers/ide/pci/via82cxxx.h~ide-via-enabled-cleanup +0 -5
@@ -27,7 +27,6 @@ static ide_pci_host_proc_t via_procs[] _static unsigned int init_chipset_via82cxxx (struct pci_dev *,const char *);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 = { {/* 0 */
@@ -35,9 +34,7 @@ static ide_pci_device_t via82cxxx_chipse .device = PCI_DEVICE_ID_VIA_82C576_1, .name = "VP_IDE", .init_chipset = init_chipset_via82cxxx, - .init_iops = NULL, .init_hwif = init_hwif_via82cxxx, - .init_dma = init_dma_via82cxxx, .channels = 2, .autodma = NOAUTODMA, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
@@ -48,9 +45,7 @@ static ide_pci_device_t via82cxxx_chipse .device = PCI_DEVICE_ID_VIA_82C586_1, .name = "VP_IDE", .init_chipset = init_chipset_via82cxxx, - .init_iops = NULL, .init_hwif = init_hwif_via82cxxx, - .init_dma = init_dma_via82cxxx, .channels = 2, .autodma = NOAUTODMA, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
_