ide: add struct ide_dma_ops
PATCH 3/4 ide: add struct ide_dma_ops
Add struct ide_dma_ops and convert core code + drivers to use it.
While at it:
* Drop "ide_" prefix from ->ide_dma_end and ->ide_dma_test_irq methods.
* siimage.c:
- add siimage_ide_dma_test_irq() helper
- print SATA warning in siimage_init_one()
* Remove no longer needed ->init_hwif implementations.
--- drivers/ide/arm/icside.c | 24 ++++++--- drivers/ide/arm/palm_bk3710.c | 2 drivers/ide/cris/ide-cris.c | 23 ++++----- drivers/ide/ide-cd.c | 6 +- drivers/ide/ide-dma.c | 59 +++++++++++++++--------- drivers/ide/ide-floppy.c | 6 +- drivers/ide/ide-io.c | 8 +-- drivers/ide/ide-iops.c | 10 ++-- drivers/ide/ide-probe.c | 5 +- drivers/ide/ide-tape.c | 6 +- drivers/ide/ide-taskfile.c | 7 +- drivers/ide/ide.c | 2 drivers/ide/mips/au1xxx-ide.c | 31 ++++++------ drivers/ide/pci/alim15x3.c | 32 ++++--------- drivers/ide/pci/cmd64x.c | 100 +++++++++++++++++++---------------------- drivers/ide/pci/cs5520.c | 14 ++--- drivers/ide/pci/hpt366.c | 35 ++++++++------ drivers/ide/pci/it821x.c | 8 ++- drivers/ide/pci/ns87415.c | 8 ++- drivers/ide/pci/pdc202xx_old.c | 35 ++++++-------- drivers/ide/pci/sc1200.c | 20 ++------ drivers/ide/pci/scc_pata.c | 11 ++-- drivers/ide/pci/sgiioc4.c | 26 ++++------ drivers/ide/pci/siimage.c | 68 ++++++++++++--------------- drivers/ide/pci/sl82c105.c | 27 +++-------- drivers/ide/pci/tc86c001.c | 7 ++ drivers/ide/pci/trm290.c | 16 ++++-- drivers/ide/ppc/pmac.c | 25 ++++++---- drivers/ide/setup-pci.c | 2 drivers/scsi/ide-scsi.c | 6 +- include/linux/ide.h | 23 +++++---- 31 files changed, 333 insertions(+), 319 deletions(-)
drivers/ide/arm/icside.c +15 -9
@@ -389,17 +389,21 @@ static int icside_dma_init(ide_hwif_t *h hwif->dmatable_cpu =NULL ; hwif->dmatable_dma =0 ; - hwif->dma_host_set = icside_dma_host_set; - hwif->dma_setup = icside_dma_setup; - hwif->dma_exec_cmd = icside_dma_exec_cmd; - hwif->dma_start = icside_dma_start; - hwif->ide_dma_end = icside_dma_end; - hwif->ide_dma_test_irq = icside_dma_test_irq; - hwif->dma_timeout = icside_dma_timeout; - hwif->dma_lost_irq = icside_dma_lost_irq; - return 0; } + +static struct ide_dma_ops icside_v6_dma_ops = { + .dma_host_set = icside_dma_host_set, + .dma_setup = icside_dma_setup, + .dma_exec_cmd = icside_dma_exec_cmd, + .dma_start = icside_dma_start, + .dma_end = icside_dma_end, + .dma_test_irq = icside_dma_test_irq, + .dma_timeout = icside_dma_timeout, + .dma_lost_irq = icside_dma_lost_irq, +}; +#else +#define icside_v6_dma_ops NULL#endif static int icside_dma_off_init (ide_hwif_t *hwif,const struct ide_port_info *d)
@@ -475,6 +479,7 @@ icside_register_v5(struct icside_state *static const struct ide_port_info icside_v6_port_info__initdata = { .init_dma = icside_dma_off_init, .port_ops = &icside_v6_no_dma_port_ops, + .dma_ops = &icside_v6_dma_ops, .host_flags =IDE_HFLAG_SERIALIZE |IDE_HFLAG_NO_AUTOTUNE , .mwdma_mask =ATA_MWDMA2 ,
@@ -550,6 +555,7 @@ icside_register_v6(struct icside_state *if (ec->dma !=NO_DMA && !request_dma (ec->dma, hwif->name)) { d.init_dma = icside_dma_init; d.port_ops = &icside_v6_dma_port_ops; + d.dma_ops =NULL ; } idx[0 ] = hwif->index;
drivers/ide/arm/palm_bk3710.c +1 -1
@@ -328,7 +328,7 @@ static int __devinit palm_bk3710_init_dmif (ide_allocate_dma_engine (hwif))return -1 ; -ide_setup_dma (hwif, base); +ide_setup_dma (hwif, base, d);return 0 ; }
drivers/ide/cris/ide-cris.c +12 -11
@@ -673,11 +673,6 @@ cris_ide_inb(unsigned long reg)return (unsigned char )cris_ide_inw (reg); } -static int cris_dma_end (ide_drive_t *drive); -static int cris_dma_setup (ide_drive_t *drive); -static void cris_dma_exec_cmd (ide_drive_t *drive,u8 command); -static int cris_dma_test_irq (ide_drive_t *drive); -static void cris_dma_start (ide_drive_t *drive);static void cris_ide_input_data (ide_drive_t *drive,void *,unsigned int );static void cris_ide_output_data (ide_drive_t *drive,void *,unsigned int );static void cris_atapi_input_bytes (ide_drive_t *drive,void *,unsigned int );
@@ -787,9 +782,12 @@ static const struct ide_port_ops cris_po .set_dma_mode = cris_set_dma_mode, }; +static struct ide_dma_ops cris_dma_ops; +static const struct ide_port_info cris_port_info__initdata = { .chipset = ide_etrax100, .port_ops = &cris_port_ops, + .dma_ops = &cris_dma_ops, .host_flags =IDE_HFLAG_NO_ATAPI_DMA |IDE_HFLAG_NO_DMA ,/* no SFF-style DMA */ .pio_mask =ATA_PIO4 ,
@@ -820,12 +818,6 @@ static int __init init_e100_ide(void) hwif->ata_output_data = &cris_ide_output_data; hwif->atapi_input_bytes = &cris_atapi_input_bytes; hwif->atapi_output_bytes = &cris_atapi_output_bytes; - hwif->dma_host_set = &cris_dma_host_set; - hwif->ide_dma_end = &cris_dma_end; - hwif->dma_setup = &cris_dma_setup; - hwif->dma_exec_cmd = &cris_dma_exec_cmd; - hwif->ide_dma_test_irq = &cris_dma_test_irq; - hwif->dma_start = &cris_dma_start; hwif->OUTB = &cris_ide_outb; hwif->OUTW = &cris_ide_outw; hwif->OUTBSYNC = &cris_ide_outbsync;
@@ -1080,4 +1072,13 @@ static void cris_dma_start(ide_drive_t * } } +static struct ide_dma_ops cris_dma_ops = { + .dma_host_set = cris_dma_host_set, + .dma_setup = cris_dma_setup, + .dma_exec_cmd = cris_dma_exec_cmd, + .dma_start = cris_dma_start, + .dma_end = cris_dma_end, + .dma_test_irq = cris_dma_test_irq, +}; +module_init (init_e100_ide);
drivers/ide/ide-cd.c +3 -3
@@ -539,7 +539,7 @@ static ide_startstop_t cdrom_start_packe/* FIXME: for Virtual DMA we must check harder */ if (info->dma) - info->dma = !hwif->dma_setup (drive); + info->dma = !hwif->dma_ops->dma_setup (drive);/* set up the controller registers */ ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL |
@@ -617,7 +617,7 @@ static ide_startstop_t cdrom_transfer_pa/* start the DMA if need be */ if (info->dma) - hwif->dma_start (drive); + hwif->dma_ops->dma_start (drive);return ide_started; }
@@ -929,7 +929,7 @@ static ide_startstop_t cdrom_newpc_intr( dma = info->dma;if (dma) { info->dma =0 ; - dma_error =HWIF (drive)->ide_dma_end (drive); + dma_error = hwif->dma_ops->dma_end (drive);if (dma_error) {printk (KERN_ERR "%s: DMA %s error\n" , drive->name, write ?"write" :"read" );
drivers/ide/ide-dma.c +37 -22
98 lines not on this page · raw message
drivers/ide/ide-floppy.c +3 -3
@@ -411,7 +411,7 @@ static ide_startstop_t idefloppy_pc_intrdebug_log ("Reached %s interrupt handler\n" , __func__);if (pc->flags &PC_FLAG_DMA_IN_PROGRESS ) { - dma_error = hwif->ide_dma_end (drive); + dma_error = drive->hwif->dma_ops->dma_end (drive);if (dma_error) {printk (KERN_ERR "%s: DMA %s error\n" , drive->name,rq_data_dir (rq) ?"write" :"read" );
@@ -663,7 +663,7 @@ static ide_startstop_t idefloppy_issue_p dma =0 ;if ((pc->flags &PC_FLAG_DMA_RECOMMENDED ) && drive->using_dma) - dma = !hwif->dma_setup (drive); + dma = !hwif->dma_ops->dma_setup (drive);ide_pktcmd_tf_load (drive,IDE_TFLAG_NO_SELECT_MASK |IDE_TFLAG_OUT_DEVICE , bcount, dma);
@@ -671,7 +671,7 @@ static ide_startstop_t idefloppy_issue_pif (dma) {/* Begin DMA, if necessary */ pc->flags |=PC_FLAG_DMA_IN_PROGRESS ; - hwif->dma_start (drive); + hwif->dma_ops->dma_start (drive); }/* Can we transfer the packet when we get the interrupt or wait? */
drivers/ide/ide-io.c +4 -4
@@ -218,7 +218,7 @@ static ide_startstop_t ide_start_power_s* we could be smarter and check for current xfer_speed * in struct drive etc... */ -if (drive->hwif->dma_host_set ==NULL ) +if (drive->hwif->dma_ops ==NULL )break ;/* * TODO: respect ->using_dma setting
@@ -1238,12 +1238,12 @@ static ide_startstop_t ide_dma_timeout_rif (error <0 ) {printk (KERN_WARNING "%s: DMA timeout error\n" , drive->name); - (void )HWIF (drive)->ide_dma_end (drive); + (void )hwif->dma_ops->dma_end (drive); ret =ide_error (drive,"dma timeout error" ,ide_read_status (drive)); }else {printk (KERN_WARNING "%s: DMA timeout retry\n" , drive->name); - hwif->dma_timeout (drive); + hwif->dma_ops->dma_timeout (drive); }/*
@@ -1355,7 +1355,7 @@ void ide_timer_expiry (unsigned long dat startstop =handler (drive); }else if (drive_is_ready (drive)) {if (drive->waiting_for_dma) - hwgroup->hwif->dma_lost_irq (drive); + hwif->dma_ops->dma_lost_irq (drive); (void )ide_ack_intr (hwif);printk (KERN_WARNING "%s: lost interrupt\n" , drive->name); startstop =handler (drive);
drivers/ide/ide-iops.c +5 -5
@@ -432,7 +432,7 @@ int drive_is_ready (ide_drive_t *drive)u8 stat =0 ;if (drive->waiting_for_dma) -return hwif->ide_dma_test_irq (drive); +return hwif->dma_ops->dma_test_irq (drive);#if 0 /* need to guarantee 400ns since last command was issued */
@@ -702,8 +702,8 @@ int ide_config_drive_speed(ide_drive_t *// msleep(50); #ifdef CONFIG_BLK_DEV_IDEDMA -if (hwif->dma_host_set)/* check if host supports DMA */ - hwif->dma_host_set (drive,0 ); +if (hwif->dma_ops)/* check if host supports DMA */ + hwif->dma_ops->dma_host_set (drive,0 );#endif /* Skip setting PIO flow-control modes on pre-EIDE drives */
@@ -761,8 +761,8 @@ int ide_config_drive_speed(ide_drive_t *#ifdef CONFIG_BLK_DEV_IDEDMA if ((speed >=XFER_SW_DMA_0 || (hwif->host_flags &IDE_HFLAG_VDMA )) && drive->using_dma) - hwif->dma_host_set (drive,1 ); -else if (hwif->dma_host_set)/* check if host supports DMA */ + hwif->dma_ops->dma_host_set (drive,1 ); +else if (hwif->dma_ops)/* check if host supports DMA */ ide_dma_off_quietly (drive);#endif
drivers/ide/ide-probe.c +3 -2
@@ -842,7 +842,7 @@ static void ide_port_tune_devices(ide_hw drive->nice1 =1 ; -if (hwif->dma_host_set) +if (hwif->dma_ops)ide_set_dma (drive); } }
@@ -1387,7 +1387,8 @@ static void ide_init_port(ide_hwif_t *hw hwif->swdma_mask =0 ; hwif->mwdma_mask =0 ; hwif->ultra_mask =0 ; - } + }else if (d->dma_ops) + hwif->dma_ops = d->dma_ops; }if (d->host_flags &IDE_HFLAG_RQSIZE_256 )
drivers/ide/ide-tape.c +3 -3
@@ -993,7 +993,7 @@ static ide_startstop_t idetape_pc_intr(i stat =ide_read_status (drive);if (pc->flags &PC_FLAG_DMA_IN_PROGRESS ) { -if (hwif->ide_dma_end (drive) || (stat &ERR_STAT )) { +if (hwif->dma_ops->dma_end (drive) || (stat &ERR_STAT )) {/* * A DMA error is sometimes expected. For example, * if the tape is crossing a filemark during a
@@ -1213,7 +1213,7 @@ static ide_startstop_t idetape_transfer_#ifdef CONFIG_BLK_DEV_IDEDMA /* Begin DMA, if necessary */ if (pc->flags &PC_FLAG_DMA_IN_PROGRESS ) - hwif->dma_start (drive); + hwif->dma_ops->dma_start (drive);#endif /* Send the actual packet */ HWIF (drive)->atapi_output_bytes (drive, pc->c,12 );
@@ -1279,7 +1279,7 @@ static ide_startstop_t idetape_issue_pc(ide_dma_off (drive); }if ((pc->flags &PC_FLAG_DMA_RECOMMENDED ) && drive->using_dma) - dma_ok = !hwif->dma_setup (drive); + dma_ok = !hwif->dma_ops->dma_setup (drive);ide_pktcmd_tf_load (drive,IDE_TFLAG_NO_SELECT_MASK |IDE_TFLAG_OUT_DEVICE , bcount, dma_ok);
drivers/ide/ide-taskfile.c +4 -3
@@ -135,6 +135,7 @@ ide_startstop_t do_rw_taskfile (ide_drivide_hwif_t *hwif =HWIF (drive);struct ide_taskfile *tf = &task->tf;ide_handler_t *handler =NULL ; +struct ide_dma_ops *dma_ops = hwif->dma_ops;if (task->data_phase ==TASKFILE_MULTI_IN || task->data_phase ==TASKFILE_MULTI_OUT ) {
@@ -178,10 +179,10 @@ ide_startstop_t do_rw_taskfile (ide_drivreturn ide_started;default :if (task_dma_ok (task) ==0 || drive->using_dma ==0 || - hwif->dma_setup (drive)) + dma_ops->dma_setup (drive))return ide_stopped; - hwif->dma_exec_cmd (drive, tf->command); - hwif->dma_start (drive); + dma_ops->dma_exec_cmd (drive, tf->command); + dma_ops->dma_start (drive);return ide_started; } }
drivers/ide/ide.c +1 -1
@@ -471,7 +471,7 @@ int set_using_dma(ide_drive_t *drive, inif (!drive->id || !(drive->id->capability &1 )) goto out; -if (hwif->dma_host_set ==NULL ) +if (hwif->dma_ops ==NULL ) goto out; err = -EBUSY ;
drivers/ide/mips/au1xxx-ide.c +17 -14
@@ -371,21 +371,31 @@ static void auide_init_dbdma_dev(dbdev_t dev->dev_devwidth = devwidth; dev->dev_flags = flags; } - -#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA ) +#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA static void auide_dma_timeout (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive);printk (KERN_ERR "%s: DMA timeout occurred: " , drive->name); -if (hwif->ide_dma_test_irq (drive)) +if (auide_dma_test_irq (drive))return ; - hwif->ide_dma_end (drive); +auide_dma_end (drive); } +static struct ide_dma_ops auide_dma_ops = { + .dma_host_set = auide_dma_host_set, + .dma_setup = auide_dma_setup, + .dma_exec_cmd = auide_dma_exec_cmd, + .dma_start = auide_dma_start, + .dma_end = auide_dma_end, + .dma_test_irq = auide_dma_test_irq, + .dma_lost_irq = auide_dma_lost_irq, + .dma_timeout = auide_dma_timeout, +}; +static int auide_ddma_init (ide_hwif_t *hwif,const struct ide_port_info *d) {_auide_hwif *auide = (_auide_hwif *)hwif->hwif_data;
@@ -516,6 +526,9 @@ static const struct ide_port_ops au1xxx_static const struct ide_port_info au1xxx_port_info = { .init_dma = auide_ddma_init, .port_ops = &au1xxx_port_ops, +#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA + .dma_ops = &au1xxx_dma_ops, +#endif .host_flags =IDE_HFLAG_POST_SET_MODE |IDE_HFLAG_NO_IO_32BIT |IDE_HFLAG_UNMASK_IRQS ,
@@ -593,16 +606,6 @@ static int au_ide_probe(struct device *d hwif->INSW = auide_insw; hwif->OUTSW = auide_outsw;#endif -#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA - hwif->dma_timeout = &auide_dma_timeout; - hwif->dma_host_set = &auide_dma_host_set; - hwif->dma_exec_cmd = &auide_dma_exec_cmd; - hwif->dma_start = &auide_dma_start; - hwif->ide_dma_end = &auide_dma_end; - hwif->dma_setup = &auide_dma_setup; - hwif->ide_dma_test_irq = &auide_dma_test_irq; - hwif->dma_lost_irq = &auide_dma_lost_irq; -#endif hwif->select_data =0 ;/* no chipset-specific code */ hwif->config_data =0 ;/* no chipset-specific code */
drivers/ide/pci/alim15x3.c +11 -21
@@ -652,21 +652,7 @@ static u8 __devinit ali_cable_detect(idereturn cbl; } -/** -* init_hwif_common_ali15x3 - Set up ALI IDE hardware -* @hwif: IDE interface -* -* Initialize the IDE structure side of the ALi 15x3 driver. -*/ - -static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif) -{ -if (hwif->dma_base ==0 ) -return ; - - hwif->dma_setup = &ali15x3_dma_setup; -} - +#ifndef CONFIG_SPARC64 /** * init_hwif_ali15x3 - Initialize the ALI IDE x86 stuff * @hwif: interface to configure
@@ -716,9 +702,8 @@ static void __devinit init_hwif_ali15x3if (irq >=0 ) hwif->irq = irq; } - -init_hwif_common_ali15x3 (hwif); } +#endif /** * init_dma_ali15x3 - set up DMA on ALi15x3
@@ -746,7 +731,7 @@ static int __devinit init_dma_ali15x3(idif (ide_allocate_dma_engine (hwif))return -1 ; -ide_setup_dma (hwif, base); +ide_setup_dma (hwif, base, d);return 0 ; }
@@ -758,10 +743,16 @@ static const struct ide_port_ops ali_por .cable_detect = ali_cable_detect, }; +static struct ide_dma_ops ali_dma_ops = { + .dma_setup = ali15x3_dma_setup, +}; +static const struct ide_port_info ali15x3_chipset__devinitdata = { .name ="ALI15X3" , .init_chipset = init_chipset_ali15x3, +#ifndef CONFIG_SPARC64 .init_hwif = init_hwif_ali15x3, +#endif .init_dma = init_dma_ali15x3, .port_ops = &ali_port_ops, .pio_mask =ATA_PIO5 ,
@@ -806,6 +797,8 @@ static int __devinit alim15x3_init_one(s d.udma_mask =ATA_UDMA5 ; else d.udma_mask = ATA_UDMA6; + + d.dma_ops = &ali_dma_ops; }else { d.host_flags |=IDE_HFLAG_NO_DMA ;
@@ -815,9 +808,6 @@ static int __devinit alim15x3_init_one(sif (idx ==0 ) d.host_flags |=IDE_HFLAG_CLEAR_SIMPLEX ; -#if defined(CONFIG_SPARC64 ) - d.init_hwif = init_hwif_common_ali15x3; -#endif /* CONFIG_SPARC64 */ return ide_setup_pci_device (dev, &d); }
drivers/ide/pci/cmd64x.c +47 -53
149 lines not on this page · raw message
drivers/ide/pci/cs5520.c +5 -9
@@ -103,24 +103,20 @@ static void cs5520_dma_host_set(ide_drivide_dma_host_set (drive, on); } -static void __devinit init_hwif_cs5520 (ide_hwif_t *hwif) -{ -if (hwif->dma_base ==0 ) -return ; - - hwif->dma_host_set = &cs5520_dma_host_set; -} -static const struct ide_port_ops cs5520_port_ops = { .set_pio_mode = cs5520_set_pio_mode, .set_dma_mode = cs5520_set_dma_mode, }; +static struct ide_dma_ops cs5520_dma_ops = { + .dma_host_set = cs5520_dma_host_set, +}; +#define DECLARE_CS_DEV (name_str) \ { \ .name = name_str, \ - .init_hwif = init_hwif_cs5520, \ .port_ops = &cs5520_port_ops, \ + .dma_ops = &cs5520_dma_ops, \ .host_flags = IDE_HFLAG_ISA_PORTS | \ IDE_HFLAG_CS5520 | \ IDE_HFLAG_VDMA | \
drivers/ide/pci/hpt366.c +21 -14
@@ -1312,19 +1312,6 @@ static void __devinit init_hwif_hpt366(iif (new_mcr != old_mcr)pci_write_config_byte (dev, hwif->select_data +1 , new_mcr); - -if (hwif->dma_base ==0 ) -return ; - -if (chip_type >=HPT374 ) { - hwif->ide_dma_test_irq = &hpt374_ide_dma_test_irq; - hwif->ide_dma_end = &hpt374_ide_dma_end; - }else if (chip_type >=HPT370 ) { - hwif->dma_start = &hpt370_ide_dma_start; - hwif->ide_dma_end = &hpt370_ide_dma_end; - hwif->dma_timeout = &hpt370_dma_timeout; - }else - hwif->dma_lost_irq = &hpt366_dma_lost_irq; } static int __devinit init_dma_hpt366(ide_hwif_t *hwif,
@@ -1360,7 +1347,7 @@ static int __devinit init_dma_hpt366(ideif (ide_allocate_dma_engine (hwif))return -1 ; -ide_setup_dma (hwif, base); +ide_setup_dma (hwif, base, d);return 0 ; }
@@ -1428,6 +1415,21 @@ static const struct ide_port_ops hpt3xx_ .cable_detect = hpt3xx_cable_detect, }; +static struct ide_dma_ops hpt3xxx_dma_ops = { + .dma_end = hpt374_ide_dma_end, + .dma_test_irq = hpt374_ide_dma_test_irq, +}; + +static struct ide_dma_ops hpt370x_dma_ops = { + .dma_start = hpt370_ide_dma_start, + .dma_end = hpt370_ide_dma_end, + .dma_timeout = hpt370_dma_timeout, +}; + +static struct ide_dma_ops hpt36x_dma_ops = { + .dma_lost_irq = hpt366_dma_lost_irq, +}; +static const struct ide_port_info hpt366_chipsets[]__devinitdata = { {/* 0 */ .name ="HPT36x" ,
@@ -1442,6 +1444,7 @@ static const struct ide_port_info hpt366*/ .enablebits = {{0x50,0x10,0x10}, {0x54,0x04,0x04}}, .port_ops = &hpt3xx_port_ops, + .dma_ops = &hpt36x_dma_ops, .host_flags = IDE_HFLAGS_HPT3XX | IDE_HFLAG_SINGLE, .pio_mask = ATA_PIO4, .mwdma_mask = ATA_MWDMA2,
@@ -1452,6 +1455,7 @@ static const struct ide_port_info hpt366 .init_dma = init_dma_hpt366, .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .port_ops = &hpt3xx_port_ops, + .dma_ops = &hpt3xxx_dma_ops, .host_flags = IDE_HFLAGS_HPT3XX, .pio_mask = ATA_PIO4, .mwdma_mask = ATA_MWDMA2,
@@ -1472,6 +1476,7 @@ static const struct ide_port_info hpt366 .init_dma = init_dma_hpt366, .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .port_ops = &hpt3xx_port_ops, + .dma_ops = &hpt370x_dma_ops, .host_flags = IDE_HFLAGS_HPT3XX, .pio_mask = ATA_PIO4, .mwdma_mask = ATA_MWDMA2,
@@ -1483,6 +1488,7 @@ static const struct ide_port_info hpt366 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = ATA_UDMA5, .port_ops = &hpt3xx_port_ops, + .dma_ops = &hpt370x_dma_ops, .host_flags = IDE_HFLAGS_HPT3XX, .pio_mask = ATA_PIO4, .mwdma_mask = ATA_MWDMA2,
@@ -1493,6 +1499,7 @@ static const struct ide_port_info hpt366 .init_dma = init_dma_hpt366, .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .port_ops = &hpt3xx_port_ops, + .dma_ops = &hpt3xxx_dma_ops, .host_flags = IDE_HFLAGS_HPT3XX, .pio_mask = ATA_PIO4, .mwdma_mask = ATA_MWDMA2,
drivers/ide/pci/it821x.c +6 -2
@@ -511,6 +511,11 @@ static void __devinit it821x_quirkproc(i } +static struct ide_dma_ops it821x_smart_dma_ops = { + .dma_start = it821x_dma_start, + .dma_end = it821x_dma_end, +}; +/** * init_hwif_it821x - set up hwif structs * @hwif: interface to set up
@@ -562,8 +567,7 @@ static void __devinit init_hwif_it821x(iif (idev->smart ==0 ) {/* MWDMA/PIO clock switching for pass through mode */ - hwif->dma_start = &it821x_dma_start; - hwif->ide_dma_end = &it821x_dma_end; + hwif->dma_ops = &it821x_smart_dma_ops; }else hwif->host_flags |=IDE_HFLAG_NO_SET_MODE ;
drivers/ide/pci/ns87415.c +6 -2
@@ -252,14 +252,17 @@ static void __devinit init_hwif_ns87415return ;outb (0x60 , hwif->dma_status); - hwif->dma_setup = &ns87415_ide_dma_setup; - hwif->ide_dma_end = &ns87415_ide_dma_end; }static const struct ide_port_ops ns87415_port_ops = { .selectproc = ns87415_selectproc, }; +static struct ide_dma_ops ns87415_dma_ops = { + .dma_setup = ns87415_ide_dma_setup, + .dma_end = ns87415_ide_dma_end, +}; +static const struct ide_port_info ns87415_chipset__devinitdata = { .name ="NS87415" , #ifdef CONFIG_SUPERIO
@@ -267,6 +270,7 @@ static const struct ide_port_info ns8741#endif .init_hwif = init_hwif_ns87415, .port_ops = &ns87415_port_ops, + .dma_ops = &ns87415_dma_ops, .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | IDE_HFLAG_NO_ATAPI_DMA, };
drivers/ide/pci/pdc202xx_old.c +16 -19
@@ -263,23 +263,6 @@ static void pdc202xx_dma_timeout(ide_driide_dma_timeout (drive); } -static void __devinit init_hwif_pdc202xx (ide_hwif_t *hwif) -{ -struct pci_dev *dev =to_pci_dev (hwif->dev); - -if (hwif->dma_base ==0 ) -return ; - - hwif->dma_lost_irq = &pdc202xx_dma_lost_irq; - hwif->dma_timeout = &pdc202xx_dma_timeout; - -if (dev->device !=PCI_DEVICE_ID_PROMISE_20246 ) { - hwif->dma_start = &pdc202xx_old_ide_dma_start; - hwif->ide_dma_end = &pdc202xx_old_ide_dma_end; - } - hwif->ide_dma_test_irq = &pdc202xx_old_ide_dma_test_irq; -} -static unsigned int __devinit init_chipset_pdc202xx (struct pci_dev *dev,const char *name) {
@@ -346,12 +329,26 @@ static const struct ide_port_ops pdc2026 .cable_detect = pdc2026x_cable_detect, }; +static struct ide_dma_ops pdc20246_dma_ops = { + .dma_test_irq = pdc202xx_old_ide_dma_test_irq, + .dma_lost_irq = pdc202xx_dma_lost_irq, + .dma_timeout = pdc202xx_dma_timeout, +}; + +static struct ide_dma_ops pdc2026x_dma_ops = { + .dma_start = pdc202xx_old_ide_dma_start, + .dma_end = pdc202xx_old_ide_dma_end, + .dma_test_irq = pdc202xx_old_ide_dma_test_irq, + .dma_lost_irq = pdc202xx_dma_lost_irq, + .dma_timeout = pdc202xx_dma_timeout, +}; +#define DECLARE_PDC2026X_DEV (name_str, udma, extra_flags) \ { \ .name = name_str, \ .init_chipset = init_chipset_pdc202xx, \ - .init_hwif = init_hwif_pdc202xx, \ .port_ops = &pdc2026x_port_ops, \ + .dma_ops = &pdc2026x_dma_ops, \ .host_flags = IDE_HFLAGS_PDC202XX | extra_flags, \ .pio_mask = ATA_PIO4, \ .mwdma_mask = ATA_MWDMA2, \
@@ -362,8 +359,8 @@ static const struct ide_port_info pdc202 {/* 0 */ .name = "PDC20246", .init_chipset = init_chipset_pdc202xx, - .init_hwif = init_hwif_pdc202xx, .port_ops = &pdc20246_port_ops, + .dma_ops = &pdc20246_dma_ops, .host_flags = IDE_HFLAGS_PDC202XX, .pio_mask = ATA_PIO4, .mwdma_mask = ATA_MWDMA2,
drivers/ide/pci/sc1200.c +6 -14
@@ -214,7 +214,7 @@ static void sc1200_set_pio_mode(ide_drivprintk ("SC1200: %s: changing (U)DMA mode\n" , drive->name);ide_dma_off_quietly (drive);if (ide_set_dma_mode (drive, mode) ==0 && drive->using_dma) - hwif->dma_host_set (drive,1 ); + hwif->dma_ops->dma_host_set (drive,1 );return ; }
@@ -286,28 +286,20 @@ static int sc1200_resume (struct pci_dev }#endif -/* -* This gets invoked by the IDE driver once for each channel, -* and performs channel-specific pre-initialization before drive probing. -*/ -static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif) -{ -if (hwif->dma_base ==0 ) -return ; - - hwif->ide_dma_end = &sc1200_ide_dma_end; -} -static const struct ide_port_ops sc1200_port_ops = { .set_pio_mode = sc1200_set_pio_mode, .set_dma_mode = sc1200_set_dma_mode, .udma_filter = sc1200_udma_filter, }; +static struct ide_dma_ops sc1200_dma_ops = { + .dma_end = sc1200_ide_dma_end, +}; +static const struct ide_port_info sc1200_chipset__devinitdata = { .name ="SC1200" , - .init_hwif = init_hwif_sc1200, .port_ops = &sc1200_port_ops, + .dma_ops = &sc1200_dma_ops, .host_flags =IDE_HFLAG_SERIALIZE |IDE_HFLAG_POST_SET_MODE |IDE_HFLAG_ABUSE_DMA_MODES ,
drivers/ide/pci/scc_pata.c +7 -4
@@ -659,10 +659,6 @@ static void __devinit init_hwif_scc(ide_/* PTERADD */ out_be32 ((void __iomem *)(hwif->dma_base +0x018 ), hwif->dmatable_dma); - hwif->dma_setup = scc_dma_setup; - hwif->ide_dma_end = scc_ide_dma_end; - hwif->ide_dma_test_irq = scc_dma_test_irq; -if (in_be32 ((void __iomem *)(hwif->config_data +0xff0 )) &CCKCTRL_ATACLKOEN ) hwif->ultra_mask =ATA_UDMA6 ;/* 133MHz */ else
@@ -676,12 +672,19 @@ static const struct ide_port_ops scc_por .cable_detect = scc_cable_detect, }; +static struct ide_dma_ops scc_dma_ops = { + .dma_setup = scc_dma_setup, + .dma_end = scc_ide_dma_end, + .dma_test_irq = scc_dma_test_irq, +}; +#define DECLARE_SCC_DEV (name_str) \ { \ .name = name_str, \ .init_iops = init_iops_scc, \ .init_hwif = init_hwif_scc, \ .port_ops = &scc_port_ops, \ + .dma_ops = &scc_dma_ops, \ .host_flags = IDE_HFLAG_SINGLE, \ .pio_mask = ATA_PIO4, \ }
drivers/ide/pci/sgiioc4.c +11 -15
@@ -327,8 +327,6 @@ sgiioc4_INB(unsigned long port)return reg; } -static void __devinit ide_init_sgiioc4 (ide_hwif_t *); -/* Creates a dma map for the scatter-gather list entries */ static int __devinit ide_dma_sgiioc4 (ide_hwif_t *hwif,const struct ide_port_info *d)
@@ -377,7 +375,6 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, constif (pad) {ide_set_hwifdata (hwif, pad); -ide_init_sgiioc4 (hwif);return 0 ; }
@@ -555,18 +552,6 @@ static int sgiioc4_ide_dma_setup(ide_drireturn 0 ; } -static void __devinit -ide_init_sgiioc4 (ide_hwif_t * hwif) -{ - hwif->dma_host_set = &sgiioc4_dma_host_set; - hwif->dma_setup = &sgiioc4_ide_dma_setup; - hwif->dma_start = &sgiioc4_ide_dma_start; - hwif->ide_dma_end = &sgiioc4_ide_dma_end; - hwif->ide_dma_test_irq = &sgiioc4_ide_dma_test_irq; - hwif->dma_lost_irq = &sgiioc4_dma_lost_irq; - hwif->dma_timeout = &ide_dma_timeout; -} -static const struct ide_port_ops sgiioc4_port_ops = { .set_dma_mode = sgiioc4_set_dma_mode,/* reset DMA engine, clear IRQs */
@@ -575,10 +560,21 @@ static const struct ide_port_ops sgiioc4 .maskproc = sgiioc4_maskproc, }; +static struct ide_dma_ops sgiioc4_dma_ops = { + .dma_host_set = sgiioc4_dma_host_set, + .dma_setup = sgiioc4_ide_dma_setup, + .dma_start = sgiioc4_ide_dma_start, + .dma_end = sgiioc4_ide_dma_end, + .dma_test_irq = sgiioc4_ide_dma_test_irq, + .dma_lost_irq = sgiioc4_dma_lost_irq, + .dma_timeout = ide_dma_timeout, +}; +static const struct ide_port_info sgiioc4_port_info__devinitdata = { .chipset = ide_pci, .init_dma = ide_dma_sgiioc4, .port_ops = &sgiioc4_port_ops, + .dma_ops = &sgiioc4_dma_ops, .host_flags =IDE_HFLAG_NO_AUTOTUNE , .mwdma_mask =ATA_MWDMA2_ONLY , };
drivers/ide/pci/siimage.c +31 -37
98 lines not on this page · raw message
drivers/ide/pci/sl82c105.c +9 -18
@@ -282,34 +282,25 @@ static unsigned int __devinit init_chipsreturn dev->irq; } -/* -* Initialise IDE channel -*/ -static void __devinit init_hwif_sl82c105 (ide_hwif_t *hwif) -{ -DBG (("init_hwif_sl82c105(hwif: ide%d)\n" , hwif->index)); - -if (!hwif->dma_base) -return ; - - hwif->dma_lost_irq = &sl82c105_dma_lost_irq; - hwif->dma_start = &sl82c105_dma_start; - hwif->ide_dma_end = &sl82c105_dma_end; - hwif->dma_timeout = &sl82c105_dma_timeout; -} -static const struct ide_port_ops sl82c105_port_ops = { .set_pio_mode = sl82c105_set_pio_mode, .set_dma_mode = sl82c105_set_dma_mode, .resetproc = sl82c105_resetproc, }; +static struct ide_dma_ops sl82c105_dma_ops = { + .dma_start = sl82c105_dma_start, + .dma_end = sl82c105_dma_end, + .dma_lost_irq = sl82c105_dma_lost_irq, + .dma_timeout = sl82c105_dma_timeout, +}; +static const struct ide_port_info sl82c105_chipset__devinitdata = { .name ="W82C105" , .init_chipset = init_chipset_sl82c105, - .init_hwif = init_hwif_sl82c105, .enablebits = {{0x40 ,0x01 ,0x01 }, {0x40 ,0x10 ,0x10 }}, .port_ops = &sl82c105_port_ops, + .dma_ops = &sl82c105_dma_ops, .host_flags =IDE_HFLAG_IO_32BIT | IDE_HFLAG_UNMASK_IRQS | /* FIXME: check for Compatibility mode in generic IDE PCI code */
@@ -334,7 +325,7 @@ static int __devinit sl82c105_init_one(s*/ printk (KERN_INFO "W82C105_IDE: Winbond W83C553 bridge " "revision %d, BM-DMA disabled\n" , rev); - d.init_hwif =NULL ; + d.dma_ops =NULL ; d.mwdma_mask =0 ; d.host_flags &= ~IDE_HFLAG_SERIALIZE_DMA ; }
drivers/ide/pci/tc86c001.c +5 -2
@@ -168,8 +168,6 @@ static void __devinit init_hwif_tc86c001/* Sector Count Register limit */ hwif->rqsize =0xffff ; - - hwif->dma_start = &tc86c001_dma_start; } static unsigned int __devinit init_chipset_tc86c001(struct pci_dev *dev,
@@ -188,11 +186,16 @@ static const struct ide_port_ops tc86c00 .cable_detect = tc86c001_cable_detect, }; +static struct ide_dma_ops tc86c001_dma_ops = { + .dma_start = tc86c001_dma_start, +}; +static const struct ide_port_info tc86c001_chipset__devinitdata = { .name ="TC86C001" , .init_chipset = init_chipset_tc86c001, .init_hwif = init_hwif_tc86c001, .port_ops = &tc86c001_port_ops, + .dma_ops = &tc86c001_dma_ops, .host_flags =IDE_HFLAG_SINGLE |IDE_HFLAG_OFF_BOARD |IDE_HFLAG_ABUSE_SET_DMA_MODE , .pio_mask =ATA_PIO4 ,
drivers/ide/pci/trm290.c +10 -6
@@ -280,12 +280,6 @@ static void __devinit init_hwif_trm290(i/* sharing IRQ with mate */ hwif->irq = hwif->mate->irq; - hwif->dma_host_set = &trm290_dma_host_set; - hwif->dma_setup = &trm290_dma_setup; - hwif->dma_exec_cmd = &trm290_dma_exec_cmd; - hwif->dma_start = &trm290_dma_start; - hwif->ide_dma_end = &trm290_ide_dma_end; - hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq;#if 1 {/*
@@ -319,11 +313,21 @@ static const struct ide_port_ops trm290_ .selectproc = trm290_selectproc, }; +static struct ide_dma_ops trm290_dma_ops = { + .dma_host_set = trm290_dma_host_set, + .dma_setup = trm290_dma_setup, + .dma_exec_cmd = trm290_dma_exec_cmd, + .dma_start = trm290_dma_start, + .dma_end = trm290_ide_dma_end, + .dma_test_irq = trm290_ide_dma_test_irq, +}; +static const struct ide_port_info trm290_chipset__devinitdata = { .name ="TRM290" , .init_hwif = init_hwif_trm290, .chipset = ide_trm290, .port_ops = &trm290_port_ops, + .dma_ops = &trm290_dma_ops, .host_flags =IDE_HFLAG_NO_ATAPI_DMA | #if 0 /* play it safe for now */ IDE_HFLAG_TRUST_BIOS_FOR_DMA |
drivers/ide/ppc/pmac.c +16 -9
@@ -930,9 +930,14 @@ static const struct ide_port_ops pmac_id .selectproc = pmac_ide_selectproc, }; +static struct ide_dma_ops pmac_dma_ops; +static const struct ide_port_info pmac_port_info = { .init_dma = pmac_ide_init_dma, .chipset = ide_pmac, +#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC + .dma_ops = &pmac_dma_ops, +#endif .port_ops = &pmac_ide_port_ops, .host_flags =IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | IDE_HFLAG_POST_SET_MODE |
@@ -1670,6 +1675,17 @@ pmac_ide_dma_lost_irq (ide_drive_t *drivprintk (KERN_ERR "ide-pmac lost interrupt, dma status: %lx\n" , status); } +static struct ide_dma_ops pmac_dma_ops = { + .dma_host_set = pmac_ide_dma_host_set, + .dma_setup = pmac_ide_dma_setup, + .dma_exec_cmd = pmac_ide_dma_exec_cmd, + .dma_start = pmac_ide_dma_start, + .dma_end = pmac_ide_dma_end, + .dma_test_irq = pmac_ide_dma_test_irq, + .dma_timeout = ide_dma_timeout, + .dma_lost_irq = pmac_ide_dma_lost_irq, +}; +/* * Allocate the data structures needed for using DMA with an interface * and fill the proper list of functions pointers
@@ -1702,15 +1718,6 @@ static int __devinit pmac_ide_init_dma(i hwif->sg_max_nents =MAX_DCMDS ; - hwif->dma_host_set = &pmac_ide_dma_host_set; - hwif->dma_setup = &pmac_ide_dma_setup; - hwif->dma_exec_cmd = &pmac_ide_dma_exec_cmd; - hwif->dma_start = &pmac_ide_dma_start; - hwif->ide_dma_end = &pmac_ide_dma_end; - hwif->ide_dma_test_irq = &pmac_ide_dma_test_irq; - hwif->dma_timeout = &ide_dma_timeout; - hwif->dma_lost_irq = &pmac_ide_dma_lost_irq; - return 0; }#else
drivers/ide/setup-pci.c +1 -1
@@ -384,7 +384,7 @@ int ide_hwif_setup_dma(ide_hwif_t *hwif,if (ide_allocate_dma_engine (hwif))return -1 ; -ide_setup_dma (hwif, base); +ide_setup_dma (hwif, base, d); }return 0 ;
drivers/scsi/ide-scsi.c +3 -3
@@ -393,7 +393,7 @@ static ide_startstop_t idescsi_pc_intr (printk ("ide-scsi: %s: DMA complete\n" , drive->name);#endif /* IDESCSI_DEBUG_LOG */ pc->xferred = pc->req_xfer; - (void )HWIF (drive)->ide_dma_end (drive); + (void )hwif->dma_ops->dma_end (drive); }/* Clear the interrupt */
@@ -498,7 +498,7 @@ static ide_startstop_t idescsi_transfer_ drive->hwif->atapi_output_bytes (drive, scsi->pc->c,12 );if (pc->flags &PC_FLAG_DMA_OK ) { pc->flags |=PC_FLAG_DMA_IN_PROGRESS ; - hwif->dma_start (drive); + hwif->dma_ops->dma_start (drive); }return ide_started; }
@@ -560,7 +560,7 @@ static ide_startstop_t idescsi_issue_pc(if (drive->using_dma && !idescsi_map_sg (drive, pc)) { hwif->sg_mapped =1 ; - dma = !hwif->dma_setup (drive); + dma = !hwif->dma_ops->dma_setup (drive); hwif->sg_mapped =0 ; }
include/linux/ide.h +14 -9
@@ -414,6 +414,17 @@ struct ide_port_ops {u8 (*cable_detect)(struct hwif_s *); }; +struct ide_dma_ops { +void (*dma_host_set)(struct ide_drive_s *,int ); +int (*dma_setup)(struct ide_drive_s *); +void (*dma_exec_cmd)(struct ide_drive_s *,u8 ); +void (*dma_start)(struct ide_drive_s *); +int (*dma_end)(struct ide_drive_s *); +int (*dma_test_irq)(struct ide_drive_s *); +void (*dma_lost_irq)(struct ide_drive_s *); +void (*dma_timeout)(struct ide_drive_s *); +}; + typedef struct hwif_s { struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ struct hwif_s *mate; /* other hwif from same PCI chip */
@@ -452,6 +463,7 @@ typedef struct hwif_s {void (*rw_disk)(ide_drive_t *,struct request *);const struct ide_port_ops *port_ops; +struct ide_dma_ops *dma_ops;void (*ata_input_data)(ide_drive_t *,void *,u32 );void (*ata_output_data)(ide_drive_t *,void *,u32 );
@@ -459,15 +471,7 @@ typedef struct hwif_s {void (*atapi_input_bytes)(ide_drive_t *,void *,u32 );void (*atapi_output_bytes)(ide_drive_t *,void *,u32 ); -void (*dma_host_set)(ide_drive_t *,int ); -int (*dma_setup)(ide_drive_t *); -void (*dma_exec_cmd)(ide_drive_t *,u8 ); -void (*dma_start)(ide_drive_t *); -int (*ide_dma_end)(ide_drive_t *drive); -int (*ide_dma_test_irq)(ide_drive_t *drive);void (*ide_dma_clear_irq)(ide_drive_t *drive); -void (*dma_lost_irq)(ide_drive_t *drive); -void (*dma_timeout)(ide_drive_t *drive);void (*OUTB )(u8 addr,unsigned long port);void (*OUTBSYNC )(ide_drive_t *drive,u8 addr,unsigned long port);
@@ -1113,6 +1117,7 @@ struct ide_port_info { const struct ide_port_info *);const struct ide_port_ops *port_ops; +struct ide_dma_ops *dma_ops;ide_pci_enablebit_t enablebits[2 ];hwif_chipset_t chipset;
@@ -1164,7 +1169,7 @@ void ide_destroy_dmatable(ide_drive_t *)extern int ide_build_dmatable (ide_drive_t *,struct request *);int ide_allocate_dma_engine (ide_hwif_t *);void ide_release_dma_engine (ide_hwif_t *); -extern void ide_setup_dma (ide_hwif_t *,unsigned long ); +void ide_setup_dma (ide_hwif_t *,unsigned long ,const struct ide_port_info *);void ide_dma_host_set (ide_drive_t *,int );extern int ide_dma_setup (ide_drive_t *);
Hello again. :-)
Quoted 5 lines · Bartlomiej Zolnierkiewicz
Add struct
ide_dma_opsand convert core code + drivers to use it.While at it:
* Drop "
ide_" prefix from ->ide_dma_end and ->ide_dma_test_irq methods.
I have expect you to drop the prefix from the method implementations which
didn't happen...
Quoted 2 lines
*
siimage.c:
- addsiimage_ide_dma_test_irq()helper
... at least you shouldn't have added the new ones. :-)
Quoted 5 lines
- print SATA warning in
siimage_init_one()* Remove no longer needed ->init_hwif implementations.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
I'd expect some init code weight loss at the expense of one more
indirection when calling the methods... :-)
Unfortunately, the patch is not entirely correct...
Quoted 4 lines
Index:
b/drivers/ide/ide-cd.c
===================================================================drivers/ide/ide-cd.c +0
-0
[...]
drivers/ide/ide-cd.c static ide_startstop_t cdrom_newpc_intr( · line 932
Quoted 6 lines
drivers/ide/ide-cd.c +1
-1@@ -929,7 +929,7 @@ static ide_startstop_t cdrom_newpc_intr( dma = info->dma;if (dma) { info->dma =0 ; - dma_error =HWIF (drive)->ide_dma_end (drive); + dma_error = hwif->dma_ops->dma_end (drive);
Erm, I don't see 'hwif' declared in that function -- this won't compile.
Though wait, some patch adds it... OK.
drivers/ide/ide-floppy.c static ide_startstop_t idefloppy_pc_intr · line 414
Quoted 10 lines
Index:
b/drivers/ide/ide-floppy.c
===================================================================drivers/ide/ide-floppy.c +1
-1@@ -411,7 +411,7 @@ static ide_startstop_t idefloppy_pc_intrdebug_log ("Reached %s interrupt handler\n" , __func__);if (pc->flags &PC_FLAG_DMA_IN_PROGRESS ) { - dma_error = hwif->ide_dma_end (drive); + dma_error = drive->hwif->dma_ops->dma_end (drive);
Here we, contrarily, already have 'hwif', so no need for extra indirection...
Quoted 15 lines
Index:
b/drivers/ide/mips/au1xxx-ide.c
===================================================================drivers/ide/mips/au1xxx-ide.c +1
-2@@ -371,21 +371,31 @@ static void auide_init_dbdma_dev(dbdev_t dev->dev_devwidth = devwidth; dev->dev_flags = flags; } - -#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA ) +#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA static void auide_dma_timeout (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive);
drivers/ide/mips/au1xxx-ide.c static void auide_init_dbdma_dev(dbdev_t · line 386
Quoted 10 lines
drivers/ide/mips/au1xxx-ide.c +2
-2printk (KERN_ERR "%s: DMA timeout occurred: " , drive->name); -if (hwif->ide_dma_test_irq (drive)) +if (auide_dma_test_irq (drive))return ; - hwif->ide_dma_end (drive); +auide_dma_end (drive); }
Probably worth noting under "while at it"?
Quoted 15 lines
drivers/ide/mips/au1xxx-ide.c +11
-0+static struct ide_dma_ops auide_dma_ops = { + .dma_host_set = auide_dma_host_set, + .dma_setup = auide_dma_setup, + .dma_exec_cmd = auide_dma_exec_cmd, + .dma_start = auide_dma_start, + .dma_end = auide_dma_end, + .dma_test_irq = auide_dma_test_irq, + .dma_lost_irq = auide_dma_lost_irq, + .dma_timeout = auide_dma_timeout, +}; +static int auide_ddma_init (ide_hwif_t *hwif,const struct ide_port_info *d) {_auide_hwif *auide = (_auide_hwif *)hwif->hwif_data;
drivers/ide/mips/au1xxx-ide.c static const struct ide_port_ops au1xxx_ · line 530
Quoted 5 lines
drivers/ide/mips/au1xxx-ide.c +2
-0@@ -516,6 +526,9 @@ static const struct ide_port_ops au1xxx_static const struct ide_port_info au1xxx_port_info = { .init_dma = auide_ddma_init, .port_ops = &au1xxx_port_ops, +#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA + .dma_ops = &au1xxx_dma_ops,
You need to decide between au1xxx_ and auide_ prefixes, or the file won't
compile... ;-)
Quoted 5 lines
Index:
b/drivers/ide/pci/cmd64x.c
===================================================================drivers/ide/pci/cmd64x.c +0
-0@@ -385,62 +385,33 @@ static u8 __devinit cmd64x_cable_detect(
[...]
Quoted 1 line
+static struct
ide_dma_opscmd643_dma_ops= {
Perhaps cmd64x_ prefix would match better here...
drivers/ide/pci/cmd64x.c static u8 __devinit cmd64x_cable_detect( · line 406
Quoted 12 lines
drivers/ide/pci/cmd64x.c +12
-0+ .dma_end = cmd64x_ide_dma_end, + .dma_test_irq = cmd64x_ide_dma_test_irq, +}; + +static struct ide_dma_ops cmd646_rev1_dma_ops = { + .dma_end = cmd646_1_ide_dma_end, +}; + +static struct ide_dma_ops cmd64x_dma_ops = { + .dma_end = cmd648_ide_dma_end, + .dma_test_irq = cmd648_ide_dma_test_irq, +};
... and cmd648_ prefix here.
And why not drop the remaning ide_ "infixes" from functions while at it?
drivers/ide/pci/hpt366.c
Quoted 4 lines
Index:
b/drivers/ide/pci/hpt366.c
===================================================================drivers/ide/pci/hpt366.c +0
-0
Alas, this part looks incorrect...
Quoted 20 lines
drivers/ide/pci/hpt366.c +0
-13@@ -1312,19 +1312,6 @@ static void __devinit init_hwif_hpt366(iif (new_mcr != old_mcr)pci_write_config_byte (dev, hwif->select_data +1 , new_mcr); - -if (hwif->dma_base ==0 ) -return ; - -if (chip_type >=HPT374 ) { - hwif->ide_dma_test_irq = &hpt374_ide_dma_test_irq; - hwif->ide_dma_end = &hpt374_ide_dma_end; - }else if (chip_type >=HPT370 ) { - hwif->dma_start = &hpt370_ide_dma_start; - hwif->ide_dma_end = &hpt370_ide_dma_end; - hwif->dma_timeout = &hpt370_dma_timeout; - }else - hwif->dma_lost_irq = &hpt366_dma_lost_irq; } static int __devinit init_dma_hpt366(ide_hwif_t *hwif,
[...]
drivers/ide/pci/hpt366.c static const struct ide_port_ops hpt3xx_ · line 1418
Quoted 5 lines
drivers/ide/pci/hpt366.c +1
-0@@ -1428,6 +1415,21 @@ static const struct ide_port_ops hpt3xx_ .cable_detect = hpt3xx_cable_detect, }; +static struct ide_dma_ops hpt3xxx_dma_ops = {
HPT3xxx is a RAID chip I heard. :-) Keep the prefix hpt37x_ please
drivers/ide/pci/hpt366.c static const struct ide_port_ops hpt3xx_ · line 1423
Quoted 5 lines
drivers/ide/pci/hpt366.c +5
-0+ .dma_end = hpt374_ide_dma_end, + .dma_test_irq = hpt374_ide_dma_test_irq, +}; + +static struct ide_dma_ops hpt370x_dma_ops = {
... and this one just hpt370_.
Quoted 12 lines
drivers/ide/pci/hpt366.c +9
-0+ .dma_start = hpt370_ide_dma_start, + .dma_end = hpt370_ide_dma_end, + .dma_timeout = hpt370_dma_timeout, +}; + +static struct ide_dma_ops hpt36x_dma_ops = { + .dma_lost_irq = hpt366_dma_lost_irq, +}; +static const struct ide_port_info hpt366_chipsets[]__devinitdata = { {/* 0 */ .name ="HPT36x" ,
[...]
drivers/ide/pci/hpt366.c static const struct ide_port_info hpt366 · line 1458
Quoted 5 lines
drivers/ide/pci/hpt366.c +1
-0@@ -1452,6 +1455,7 @@ static const struct ide_port_info hpt366 .init_dma = init_dma_hpt366, .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .port_ops = &hpt3xx_port_ops, + .dma_ops = &hpt3xxx_dma_ops,
For HPT372A/N it should be hpt37x_. Correct.
drivers/ide/pci/hpt366.c static const struct ide_port_info hpt366 · line 1479
Quoted 8 lines
drivers/ide/pci/hpt366.c +1
-0.host_flags = IDE_HFLAGS_HPT3XX, .pio_mask = ATA_PIO4, .mwdma_mask = ATA_MWDMA2,@@ -1472,6 +1476,7 @@ static const struct ide_port_info hpt366 .init_dma = init_dma_hpt366, .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .port_ops = &hpt3xx_port_ops, + .dma_ops = &hpt370x_dma_ops,
For HPT302/N it should be hpt37x_. Incorrect.
drivers/ide/pci/hpt366.c static const struct ide_port_info hpt366 · line 1491
Quoted 8 lines
drivers/ide/pci/hpt366.c +1
-0.host_flags = IDE_HFLAGS_HPT3XX, .pio_mask = ATA_PIO4, .mwdma_mask = ATA_MWDMA2,@@ -1483,6 +1488,7 @@ static const struct ide_port_info hpt366 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = ATA_UDMA5, .port_ops = &hpt3xx_port_ops, + .dma_ops = &hpt370x_dma_ops,
For HPT371/N it should be hpt37x_. Incorrect.
drivers/ide/pci/hpt366.c static const struct ide_port_info hpt366 · line 1502
Quoted 8 lines
drivers/ide/pci/hpt366.c +1
-0.host_flags = IDE_HFLAGS_HPT3XX, .pio_mask = ATA_PIO4, .mwdma_mask = ATA_MWDMA2,@@ -1493,6 +1499,7 @@ static const struct ide_port_info hpt366 .init_dma = init_dma_hpt366, .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .port_ops = &hpt3xx_port_ops, + .dma_ops = &hpt3xxx_dma_ops,
For HPT34 it should be hpt37x_. Correct.
drivers/ide/pci/hpt366.c static const struct ide_port_info hpt366 · line 1461
Quoted 3 lines
drivers/ide/pci/hpt366.c +0
-0.host_flags = IDE_HFLAGS_HPT3XX, .pio_mask = ATA_PIO4, .mwdma_mask = ATA_MWDMA2,
Now where is the code which selects the correct dma_ops for the
HPT36x/370/372/372N chip with device ID 4 I'm asking you? :-)
drivers/ide/pci/it821x.c static void __devinit it821x_quirkproc(i · line 514
Quoted 9 lines
Index:
b/drivers/ide/pci/it821x.c
===================================================================drivers/ide/pci/it821x.c +1
-0@@ -511,6 +511,11 @@ static void __devinit it821x_quirkproc(i } +static struct ide_dma_ops it821x_smart_dma_ops = {
I've got an impression that the mode is contrarywise -- non-SMART...
Quoted 8 lines
drivers/ide/pci/it821x.c +4
-0+ .dma_start = it821x_dma_start, + .dma_end = it821x_dma_end, +}; +/** * init_hwif_it821x - set up hwif structs * @hwif: interface to set up
drivers/ide/pci/it821x.c static void __devinit init_hwif_it821x(i · line 572
Quoted 8 lines
drivers/ide/pci/it821x.c +1
-2@@ -562,8 +567,7 @@ static void __devinit init_hwif_it821x(iif (idev->smart ==0 ) {/* MWDMA/PIO clock switching for pass through mode */ - hwif->dma_start = &it821x_dma_start; - hwif->ide_dma_end = &it821x_dma_end; + hwif->dma_ops = &it821x_smart_dma_ops; }else hwif->host_flags |=IDE_HFLAG_NO_SET_MODE ;
See for yourself...
Quoted 11 lines
Index:
b/drivers/ide/pci/ns87415.c
===================================================================drivers/ide/pci/ns87415.c +0
-2@@ -252,14 +252,17 @@ static void __devinit init_hwif_ns87415return ;outb (0x60 , hwif->dma_status); - hwif->dma_setup = &ns87415_ide_dma_setup; - hwif->ide_dma_end = &ns87415_ide_dma_end; }
drivers/ide/pci/ns87415.c static void __devinit init_hwif_ns87415 · line 265
Quoted 10 lines
drivers/ide/pci/ns87415.c +5
-0static const struct ide_port_ops ns87415_port_ops = { .selectproc = ns87415_selectproc, }; +static struct ide_dma_ops ns87415_dma_ops = { + .dma_setup = ns87415_ide_dma_setup, + .dma_end = ns87415_ide_dma_end, +}; +
Time to drop ide_ "infixes" here too?
Quoted 29 lines
Index:
b/drivers/ide/pci/pdc202xx_old.c
===================================================================drivers/ide/pci/pdc202xx_old.c +0
-17@@ -263,23 +263,6 @@ static void pdc202xx_dma_timeout(ide_driide_dma_timeout (drive); } -static void __devinit init_hwif_pdc202xx (ide_hwif_t *hwif) -{ -struct pci_dev *dev =to_pci_dev (hwif->dev); - -if (hwif->dma_base ==0 ) -return ; - - hwif->dma_lost_irq = &pdc202xx_dma_lost_irq; - hwif->dma_timeout = &pdc202xx_dma_timeout; - -if (dev->device !=PCI_DEVICE_ID_PROMISE_20246 ) { - hwif->dma_start = &pdc202xx_old_ide_dma_start; - hwif->ide_dma_end = &pdc202xx_old_ide_dma_end; - } - hwif->ide_dma_test_irq = &pdc202xx_old_ide_dma_test_irq; -} -static unsigned int __devinit init_chipset_pdc202xx (struct pci_dev *dev,const char *name) {
drivers/ide/pci/pdc202xx_old.c static const struct ide_port_ops pdc2026 · line 333
Quoted 5 lines
drivers/ide/pci/pdc202xx_old.c +2
-0@@ -346,12 +329,26 @@ static const struct ide_port_ops pdc2026 .cable_detect = pdc2026x_cable_detect, }; +static struct ide_dma_ops pdc20246_dma_ops = { + .dma_test_irq = pdc202xx_old_ide_dma_test_irq,
Infixes galore! I'd killed both old_ and ide_ (but not Old IDE :-).
Much shorter and uniform name.
drivers/ide/pci/pdc202xx_old.c static const struct ide_port_ops pdc2026 · line 341
Quoted 8 lines
drivers/ide/pci/pdc202xx_old.c +8
-0+ .dma_lost_irq = pdc202xx_dma_lost_irq, + .dma_timeout = pdc202xx_dma_timeout, +}; + +static struct ide_dma_ops pdc2026x_dma_ops = { + .dma_start = pdc202xx_old_ide_dma_start, + .dma_end = pdc202xx_old_ide_dma_end, + .dma_test_irq = pdc202xx_old_ide_dma_test_irq,
Drop 'em both! :-)
Quoted 27 lines
Index:
b/drivers/ide/pci/sc1200.c
===================================================================drivers/ide/pci/sc1200.c +1
-11@@ -214,7 +214,7 @@ static void sc1200_set_pio_mode(ide_drivprintk ("SC1200: %s: changing (U)DMA mode\n" , drive->name);ide_dma_off_quietly (drive);if (ide_set_dma_mode (drive, mode) ==0 && drive->using_dma) - hwif->dma_host_set (drive,1 ); + hwif->dma_ops->dma_host_set (drive,1 );return ; }@@ -286,28 +286,20 @@ static int sc1200_resume (struct pci_dev }#endif -/* -* This gets invoked by the IDE driver once for each channel, -* and performs channel-specific pre-initialization before drive probing. -*/ -static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif) -{ -if (hwif->dma_base ==0 ) -return ; - - hwif->ide_dma_end = &sc1200_ide_dma_end;
drivers/ide/pci/sc1200.c static int sc1200_resume (struct pci_dev · line 296
Quoted 10 lines
drivers/ide/pci/sc1200.c +2
-2-} -static const struct ide_port_ops sc1200_port_ops = { .set_pio_mode = sc1200_set_pio_mode, .set_dma_mode = sc1200_set_dma_mode, .udma_filter = sc1200_udma_filter, }; +static struct ide_dma_ops sc1200_dma_ops = { + .dma_end = sc1200_ide_dma_end,
Again, dropping "infix" is possible...
Quoted 16 lines
Index:
b/drivers/ide/pci/scc_pata.c
===================================================================drivers/ide/pci/scc_pata.c +0
-4@@ -659,10 +659,6 @@ static void __devinit init_hwif_scc(ide_/* PTERADD */ out_be32 ((void __iomem *)(hwif->dma_base +0x018 ), hwif->dmatable_dma); - hwif->dma_setup = scc_dma_setup; - hwif->ide_dma_end = scc_ide_dma_end; - hwif->ide_dma_test_irq = scc_dma_test_irq; -if (in_be32 ((void __iomem *)(hwif->config_data +0xff0 )) &CCKCTRL_ATACLKOEN ) hwif->ultra_mask =ATA_UDMA6 ;/* 133MHz */ else
drivers/ide/pci/scc_pata.c static const struct ide_port_ops scc_por · line 677
Quoted 6 lines
drivers/ide/pci/scc_pata.c +3
-0@@ -676,12 +672,19 @@ static const struct ide_port_ops scc_por .cable_detect = scc_cable_detect, }; +static struct ide_dma_ops scc_dma_ops = { + .dma_setup = scc_dma_setup, + .dma_end = scc_ide_dma_end,
And here too.
Quoted 4 lines
Index:
b/drivers/ide/pci/sgiioc4.c
===================================================================drivers/ide/pci/sgiioc4.c +0
-0
[...]
Quoted 4 lines
drivers/ide/pci/sgiioc4.c +0
-0@@ -575,10 +560,21 @@ static const struct ide_port_ops sgiioc4 .maskproc = sgiioc4_maskproc, };
drivers/ide/pci/sgiioc4.c static const struct ide_port_ops sgiioc4 · line 572
Quoted 10 lines
drivers/ide/pci/sgiioc4.c +10
-0+static struct ide_dma_ops sgiioc4_dma_ops = { + .dma_host_set = sgiioc4_dma_host_set, + .dma_setup = sgiioc4_ide_dma_setup, + .dma_start = sgiioc4_ide_dma_start, + .dma_end = sgiioc4_ide_dma_end, + .dma_test_irq = sgiioc4_ide_dma_test_irq, + .dma_lost_irq = sgiioc4_dma_lost_irq, + .dma_timeout = ide_dma_timeout, +}; +
Wow, a lot of survived infixes! :-)
Quoted 6 lines
Index:
b/drivers/ide/pci/siimage.c
===================================================================drivers/ide/pci/siimage.c +0
-0@@ -369,6 +369,14 @@ static int siimage_mmio_ide_dma_test_irqreturn 0 ;
drivers/ide/pci/siimage.c static int siimage_mmio_ide_dma_test_irq · line 379
Quoted 10 lines
drivers/ide/pci/siimage.c +8
-0} +static int siimage_ide_dma_test_irq (ide_drive_t *drive) +{ +if (drive->hwif->mmio) +return siimage_mmio_ide_dma_test_irq (drive); +else +return siimage_io_ide_dma_test_irq (drive); +} +
I suggest removing infixes from the above functions instead of adding
another one...
Quoted 4 lines
Index:
b/include/linux/ide.h
===================================================================include/linux/ide.h +0
-0
[...]
include/linux/ide.h typedef struct hwif_s { · line 474
Quoted 11 lines
include/linux/ide.h +0
-6@@ -459,15 +471,7 @@ typedef struct hwif_s {void (*atapi_input_bytes)(ide_drive_t *,void *,u32 );void (*atapi_output_bytes)(ide_drive_t *,void *,u32 ); -void (*dma_host_set)(ide_drive_t *,int ); -int (*dma_setup)(ide_drive_t *); -void (*dma_exec_cmd)(ide_drive_t *,u8 ); -void (*dma_start)(ide_drive_t *); -int (*ide_dma_end)(ide_drive_t *drive); -int (*ide_dma_test_irq)(ide_drive_t *drive);void (*ide_dma_clear_irq)(ide_drive_t *drive);
Now what about this lonely method? It belongs to dma_ops I think...
MBR, Sergei
Hi,
On Wednesday 12 March 2008, Sergei Shtylyov wrote:
[...]
Quoted 7 lines
Quoted 7 lines
Index:
b/drivers/ide/ide-floppy.c
===================================================================drivers/ide/ide-floppy.c +0
-0@@ -411,7 +411,7 @@ static ide_startstop_t idefloppy_pc_intrdebug_log ("Reached %s interrupt handler\n" , __func__);
Quoted 5 lines
drivers/ide/ide-floppy.c static ide_startstop_t idefloppy_pc_intr · line 414
Quoted 3 lines
drivers/ide/ide-floppy.c +1
-1if (pc->flags &PC_FLAG_DMA_IN_PROGRESS ) { - dma_error = hwif->ide_dma_end (drive); + dma_error = drive->hwif->dma_ops->dma_end (drive);Here we, contrarily, already have 'hwif', so no need for extra indirection...
fixed
Quoted 22 lines
Quoted 22 lines
Index:
b/drivers/ide/mips/au1xxx-ide.c
===================================================================drivers/ide/mips/au1xxx-ide.c +2
-3@@ -371,21 +371,31 @@ static void auide_init_dbdma_dev(dbdev_t dev->dev_devwidth = devwidth; dev->dev_flags = flags; } - -#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA ) +#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA static void auide_dma_timeout (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive);printk (KERN_ERR "%s: DMA timeout occurred: " , drive->name); -if (hwif->ide_dma_test_irq (drive)) +if (auide_dma_test_irq (drive))return ;
Quoted 5 lines
drivers/ide/mips/au1xxx-ide.c static void auide_init_dbdma_dev(dbdev_t · line 386
Quoted 3 lines
drivers/ide/mips/au1xxx-ide.c +1
-1- hwif->ide_dma_end (drive); +auide_dma_end (drive); }Probably worth noting under "while at it"?
done
Quoted 15 lines
Quoted 15 lines
drivers/ide/mips/au1xxx-ide.c +11
-0+static struct ide_dma_ops auide_dma_ops = { + .dma_host_set = auide_dma_host_set, + .dma_setup = auide_dma_setup, + .dma_exec_cmd = auide_dma_exec_cmd, + .dma_start = auide_dma_start, + .dma_end = auide_dma_end, + .dma_test_irq = auide_dma_test_irq, + .dma_lost_irq = auide_dma_lost_irq, + .dma_timeout = auide_dma_timeout, +}; +static int auide_ddma_init (ide_hwif_t *hwif,const struct ide_port_info *d) {_auide_hwif *auide = (_auide_hwif *)hwif->hwif_data;@@ -516,6 +526,9 @@ static const struct ide_port_ops au1xxx_
Quoted 8 lines
drivers/ide/mips/au1xxx-ide.c static const struct ide_port_ops au1xxx_ · line 530
Quoted 5 lines
drivers/ide/mips/au1xxx-ide.c +2
-0static const struct ide_port_info au1xxx_port_info = { .init_dma = auide_ddma_init, .port_ops = &au1xxx_port_ops, +#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA + .dma_ops = &au1xxx_dma_ops,You need to decide between
au1xxx_andauide_prefixes, or the file won't
compile... ;-)
fixed
Quoted 10 lines
Quoted 5 lines
Index:
b/drivers/ide/pci/cmd64x.c
===================================================================drivers/ide/pci/cmd64x.c +0
-0@@ -385,62 +385,33 @@ static u8 __devinit cmd64x_cable_detect([...]
Quoted 1 line
+static struct
ide_dma_opscmd643_dma_ops= {Perhaps
cmd64x_prefix would match better here...
fixed
Quoted 6 lines
Quoted 6 lines
drivers/ide/pci/cmd64x.c +6
-0+ .dma_end = cmd64x_ide_dma_end, + .dma_test_irq = cmd64x_ide_dma_test_irq, +}; + +static struct ide_dma_ops cmd646_rev1_dma_ops = { + .dma_end = cmd646_1_ide_dma_end,
Quoted 8 lines
drivers/ide/pci/cmd64x.c
Quoted 6 lines
drivers/ide/pci/cmd64x.c +6
-0+}; + +static struct ide_dma_ops cmd64x_dma_ops = { + .dma_end = cmd648_ide_dma_end, + .dma_test_irq = cmd648_ide_dma_test_irq, +};... and cmd648_ prefix here.
fixed
Quoted 1 line
And why not drop the remaning
ide_"infixes" from functions while at it?
done for ide_ "infixes" in all host drivers
(together with old_ "infixes" in pdc202xx_old.c)
Quoted 6 lines
drivers/ide/pci/hpt366.c
Quoted 4 lines
Index:
b/drivers/ide/pci/hpt366.c
===================================================================drivers/ide/pci/hpt366.c +0
-0Alas, this part looks incorrect...
[...]
Quoted 7 lines
drivers/ide/pci/hpt366.c static const struct ide_port_ops hpt3xx_ · line 1418
Quoted 5 lines
drivers/ide/pci/hpt366.c +1
-0@@ -1428,6 +1415,21 @@ static const struct ide_port_ops hpt3xx_ .cable_detect = hpt3xx_cable_detect, }; +static struct ide_dma_ops hpt3xxx_dma_ops = {HPT3xxx is a RAID chip I heard. :-) Keep the prefix
hpt37x_please
done
Quoted 7 lines
drivers/ide/pci/hpt366.c static const struct ide_port_ops hpt3xx_ · line 1423
Quoted 5 lines
drivers/ide/pci/hpt366.c +5
-0+ .dma_end = hpt374_ide_dma_end, + .dma_test_irq = hpt374_ide_dma_test_irq, +}; + +static struct ide_dma_ops hpt370x_dma_ops = {... and this one just hpt370_.
done
[...]
Quoted 10 lines
drivers/ide/pci/hpt366.c static const struct ide_port_info hpt366 · line 1479
Quoted 8 lines
drivers/ide/pci/hpt366.c +1
-0.host_flags = IDE_HFLAGS_HPT3XX, .pio_mask = ATA_PIO4, .mwdma_mask = ATA_MWDMA2,@@ -1472,6 +1476,7 @@ static const struct ide_port_info hpt366 .init_dma = init_dma_hpt366, .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .port_ops = &hpt3xx_port_ops, + .dma_ops = &hpt370x_dma_ops,For HPT302/N it should be
hpt37x_. Incorrect.
fixed
Quoted 10 lines
drivers/ide/pci/hpt366.c static const struct ide_port_info hpt366 · line 1491
Quoted 8 lines
drivers/ide/pci/hpt366.c +1
-0.host_flags = IDE_HFLAGS_HPT3XX, .pio_mask = ATA_PIO4, .mwdma_mask = ATA_MWDMA2,@@ -1483,6 +1488,7 @@ static const struct ide_port_info hpt366 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = ATA_UDMA5, .port_ops = &hpt3xx_port_ops, + .dma_ops = &hpt370x_dma_ops,For HPT371/N it should be
hpt37x_. Incorrect.
fixed
[...]
Quoted 2 lines
Now where is the code which selects the correct
dma_opsfor the
HPT36x/370/372/372N chip with device ID 4 I'm asking you? :-)
fixed
Quoted 11 lines
drivers/ide/pci/it821x.c static void __devinit it821x_quirkproc(i · line 514
Quoted 9 lines
Index:
b/drivers/ide/pci/it821x.c
===================================================================drivers/ide/pci/it821x.c +1
-0@@ -511,6 +511,11 @@ static void __devinit it821x_quirkproc(i } +static struct ide_dma_ops it821x_smart_dma_ops = {I've got an impression that the mode is contrarywise -- non-SMART...
fixed
[...]
Quoted 9 lines
Quoted 4 lines
Index:
b/include/linux/ide.h
===================================================================include/linux/ide.h +0
-0[...]
Quoted 4 lines
include/linux/ide.h +0
-0@@ -459,15 +471,7 @@ typedef struct hwif_s {void (*atapi_input_bytes)(ide_drive_t *,void *,u32 );void (*atapi_output_bytes)(ide_drive_t *,void *,u32 );
Quoted 9 lines
include/linux/ide.h typedef struct hwif_s { · line 474
Quoted 7 lines
include/linux/ide.h +0
-6-void (*dma_host_set)(ide_drive_t *,int ); -int (*dma_setup)(ide_drive_t *); -void (*dma_exec_cmd)(ide_drive_t *,u8 ); -void (*dma_start)(ide_drive_t *); -int (*ide_dma_end)(ide_drive_t *drive); -int (*ide_dma_test_irq)(ide_drive_t *drive);void (*ide_dma_clear_irq)(ide_drive_t *drive);Now what about this lonely method? It belongs to
dma_opsI think...
It is needed also when DMA is not used so it was left alone (it probably should be renamed to ->clear_irq later).
Thanks for the review, "take 2" below
(please verify that all issues were addressed).
From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: add struct ide_dma_ops (take 2)
Add struct ide_dma_ops and convert core code + drivers to use it.
While at it:
* Drop "ide_" prefix from ->ide_dma_end and ->ide_dma_test_irq methods.
* Drop "ide_" "infixes" from DMA methods.
* au1xxx-ide.c:
- use auide_dma_{test_irq,end}() directly in auide_dma_timeout()
* pdc202xx_old.c:
- drop "old_" "infixes" from DMA methods
* siimage.c:
- add siimage_dma_test_irq() helper
- print SATA warning in siimage_init_one()
* Remove no longer needed ->init_hwif implementations.
v2:
* Changes based on review from Sergei:
- s/siimage_ide_dma_test_irq/siimage_dma_test_irq/
- s/drive->hwif/hwif/ in idefloppy_pc_intr().
- fix patch description w.r.t. au1xxx-ide changes
- fix au1xxx-ide build
- fix naming for cmd64*_dma_ops
- drop "ide_" and "old_" infixes
- s/hpt3xxx_dma_ops/hpt37x_dma_ops/
- s/hpt370x_dma_ops/hpt370_dma_ops/
- use correct DMA ops for HPT302/N, HPT371/N and HPT374
- s/it821x_smart_dma_ops/it821x_pass_through_dma_ops/
--- drivers/ide/arm/icside.c | 24 +++++--- drivers/ide/arm/palm_bk3710.c | 2 drivers/ide/cris/ide-cris.c | 23 ++++---- drivers/ide/ide-cd.c | 6 +- drivers/ide/ide-dma.c | 59 +++++++++++++-------- drivers/ide/ide-floppy.c | 6 +- drivers/ide/ide-io.c | 8 +- drivers/ide/ide-iops.c | 10 +-- drivers/ide/ide-probe.c | 5 + drivers/ide/ide-tape.c | 6 +- drivers/ide/ide-taskfile.c | 7 +- drivers/ide/ide.c | 2 drivers/ide/mips/au1xxx-ide.c | 31 ++++++----- drivers/ide/pci/alim15x3.c | 32 ++++------- drivers/ide/pci/cmd64x.c | 110 +++++++++++++++++++---------------------- drivers/ide/pci/cs5520.c | 14 +---- drivers/ide/pci/hpt366.c | 44 +++++++++------- drivers/ide/pci/it821x.c | 8 ++ drivers/ide/pci/ns87415.c | 12 ++-- drivers/ide/pci/pdc202xx_old.c | 41 +++++++-------- drivers/ide/pci/sc1200.c | 22 ++------ drivers/ide/pci/scc_pata.c | 15 +++-- drivers/ide/pci/sgiioc4.c | 38 +++++--------- drivers/ide/pci/siimage.c | 76 +++++++++++++--------------- drivers/ide/pci/sl82c105.c | 27 +++------- drivers/ide/pci/tc86c001.c | 7 +- drivers/ide/pci/trm290.c | 20 ++++--- drivers/ide/ppc/pmac.c | 25 +++++---- drivers/ide/setup-pci.c | 2 drivers/scsi/ide-scsi.c | 6 +- include/linux/ide.h | 23 +++++--- 31 files changed, 362 insertions(+), 349 deletions(-)
drivers/ide/arm/icside.c +15 -9
@@ -389,17 +389,21 @@ static int icside_dma_init(ide_hwif_t *h hwif->dmatable_cpu =NULL ; hwif->dmatable_dma =0 ; - hwif->dma_host_set = icside_dma_host_set; - hwif->dma_setup = icside_dma_setup; - hwif->dma_exec_cmd = icside_dma_exec_cmd; - hwif->dma_start = icside_dma_start; - hwif->ide_dma_end = icside_dma_end; - hwif->ide_dma_test_irq = icside_dma_test_irq; - hwif->dma_timeout = icside_dma_timeout; - hwif->dma_lost_irq = icside_dma_lost_irq; - return 0; } + +static struct ide_dma_ops icside_v6_dma_ops = { + .dma_host_set = icside_dma_host_set, + .dma_setup = icside_dma_setup, + .dma_exec_cmd = icside_dma_exec_cmd, + .dma_start = icside_dma_start, + .dma_end = icside_dma_end, + .dma_test_irq = icside_dma_test_irq, + .dma_timeout = icside_dma_timeout, + .dma_lost_irq = icside_dma_lost_irq, +}; +#else +#define icside_v6_dma_ops NULL#endif static int icside_dma_off_init (ide_hwif_t *hwif,const struct ide_port_info *d)
@@ -475,6 +479,7 @@ icside_register_v5(struct icside_state *static const struct ide_port_info icside_v6_port_info__initdata = { .init_dma = icside_dma_off_init, .port_ops = &icside_v6_no_dma_port_ops, + .dma_ops = &icside_v6_dma_ops, .host_flags =IDE_HFLAG_SERIALIZE |IDE_HFLAG_NO_AUTOTUNE , .mwdma_mask =ATA_MWDMA2 ,
@@ -550,6 +555,7 @@ icside_register_v6(struct icside_state *if (ec->dma !=NO_DMA && !request_dma (ec->dma, hwif->name)) { d.init_dma = icside_dma_init; d.port_ops = &icside_v6_dma_port_ops; + d.dma_ops =NULL ; } idx[0 ] = hwif->index;
drivers/ide/arm/palm_bk3710.c +1 -1
@@ -328,7 +328,7 @@ static int __devinit palm_bk3710_init_dmif (ide_allocate_dma_engine (hwif))return -1 ; -ide_setup_dma (hwif, base); +ide_setup_dma (hwif, base, d);return 0 ; }
drivers/ide/cris/ide-cris.c +12 -11
@@ -673,11 +673,6 @@ cris_ide_inb(unsigned long reg)return (unsigned char )cris_ide_inw (reg); } -static int cris_dma_end (ide_drive_t *drive); -static int cris_dma_setup (ide_drive_t *drive); -static void cris_dma_exec_cmd (ide_drive_t *drive,u8 command); -static int cris_dma_test_irq (ide_drive_t *drive); -static void cris_dma_start (ide_drive_t *drive);static void cris_ide_input_data (ide_drive_t *drive,void *,unsigned int );static void cris_ide_output_data (ide_drive_t *drive,void *,unsigned int );static void cris_atapi_input_bytes (ide_drive_t *drive,void *,unsigned int );
@@ -787,9 +782,12 @@ static const struct ide_port_ops cris_po .set_dma_mode = cris_set_dma_mode, }; +static struct ide_dma_ops cris_dma_ops; +static const struct ide_port_info cris_port_info__initdata = { .chipset = ide_etrax100, .port_ops = &cris_port_ops, + .dma_ops = &cris_dma_ops, .host_flags =IDE_HFLAG_NO_ATAPI_DMA |IDE_HFLAG_NO_DMA ,/* no SFF-style DMA */ .pio_mask =ATA_PIO4 ,
@@ -820,12 +818,6 @@ static int __init init_e100_ide(void) hwif->ata_output_data = &cris_ide_output_data; hwif->atapi_input_bytes = &cris_atapi_input_bytes; hwif->atapi_output_bytes = &cris_atapi_output_bytes; - hwif->dma_host_set = &cris_dma_host_set; - hwif->ide_dma_end = &cris_dma_end; - hwif->dma_setup = &cris_dma_setup; - hwif->dma_exec_cmd = &cris_dma_exec_cmd; - hwif->ide_dma_test_irq = &cris_dma_test_irq; - hwif->dma_start = &cris_dma_start; hwif->OUTB = &cris_ide_outb; hwif->OUTW = &cris_ide_outw; hwif->OUTBSYNC = &cris_ide_outbsync;
@@ -1080,4 +1072,13 @@ static void cris_dma_start(ide_drive_t * } } +static struct ide_dma_ops cris_dma_ops = { + .dma_host_set = cris_dma_host_set, + .dma_setup = cris_dma_setup, + .dma_exec_cmd = cris_dma_exec_cmd, + .dma_start = cris_dma_start, + .dma_end = cris_dma_end, + .dma_test_irq = cris_dma_test_irq, +}; +module_init (init_e100_ide);
drivers/ide/ide-cd.c +3 -3
@@ -539,7 +539,7 @@ static ide_startstop_t cdrom_start_packe/* FIXME: for Virtual DMA we must check harder */ if (info->dma) - info->dma = !hwif->dma_setup (drive); + info->dma = !hwif->dma_ops->dma_setup (drive);/* set up the controller registers */ ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL |
@@ -617,7 +617,7 @@ static ide_startstop_t cdrom_transfer_pa/* start the DMA if need be */ if (info->dma) - hwif->dma_start (drive); + hwif->dma_ops->dma_start (drive);return ide_started; }
@@ -929,7 +929,7 @@ static ide_startstop_t cdrom_newpc_intr( dma = info->dma;if (dma) { info->dma =0 ; - dma_error =HWIF (drive)->ide_dma_end (drive); + dma_error = hwif->dma_ops->dma_end (drive);if (dma_error) {printk (KERN_ERR "%s: DMA %s error\n" , drive->name, write ?"write" :"read" );
drivers/ide/ide-dma.c +37 -22
98 lines not on this page · raw message
drivers/ide/ide-floppy.c +3 -3
@@ -411,7 +411,7 @@ static ide_startstop_t idefloppy_pc_intrdebug_log ("Reached %s interrupt handler\n" , __func__);if (pc->flags &PC_FLAG_DMA_IN_PROGRESS ) { - dma_error = hwif->ide_dma_end (drive); + dma_error = hwif->dma_ops->dma_end (drive);if (dma_error) {printk (KERN_ERR "%s: DMA %s error\n" , drive->name,rq_data_dir (rq) ?"write" :"read" );
@@ -663,7 +663,7 @@ static ide_startstop_t idefloppy_issue_p dma =0 ;if ((pc->flags &PC_FLAG_DMA_RECOMMENDED ) && drive->using_dma) - dma = !hwif->dma_setup (drive); + dma = !hwif->dma_ops->dma_setup (drive);ide_pktcmd_tf_load (drive,IDE_TFLAG_NO_SELECT_MASK |IDE_TFLAG_OUT_DEVICE , bcount, dma);
@@ -671,7 +671,7 @@ static ide_startstop_t idefloppy_issue_pif (dma) {/* Begin DMA, if necessary */ pc->flags |=PC_FLAG_DMA_IN_PROGRESS ; - hwif->dma_start (drive); + hwif->dma_ops->dma_start (drive); }/* Can we transfer the packet when we get the interrupt or wait? */
drivers/ide/ide-io.c +4 -4
@@ -218,7 +218,7 @@ static ide_startstop_t ide_start_power_s* we could be smarter and check for current xfer_speed * in struct drive etc... */ -if (drive->hwif->dma_host_set ==NULL ) +if (drive->hwif->dma_ops ==NULL )break ;/* * TODO: respect ->using_dma setting
@@ -1238,12 +1238,12 @@ static ide_startstop_t ide_dma_timeout_rif (error <0 ) {printk (KERN_WARNING "%s: DMA timeout error\n" , drive->name); - (void )HWIF (drive)->ide_dma_end (drive); + (void )hwif->dma_ops->dma_end (drive); ret =ide_error (drive,"dma timeout error" ,ide_read_status (drive)); }else {printk (KERN_WARNING "%s: DMA timeout retry\n" , drive->name); - hwif->dma_timeout (drive); + hwif->dma_ops->dma_timeout (drive); }/*
@@ -1355,7 +1355,7 @@ void ide_timer_expiry (unsigned long dat startstop =handler (drive); }else if (drive_is_ready (drive)) {if (drive->waiting_for_dma) - hwgroup->hwif->dma_lost_irq (drive); + hwif->dma_ops->dma_lost_irq (drive); (void )ide_ack_intr (hwif);printk (KERN_WARNING "%s: lost interrupt\n" , drive->name); startstop =handler (drive);
drivers/ide/ide-iops.c +5 -5
@@ -432,7 +432,7 @@ int drive_is_ready (ide_drive_t *drive)u8 stat =0 ;if (drive->waiting_for_dma) -return hwif->ide_dma_test_irq (drive); +return hwif->dma_ops->dma_test_irq (drive);#if 0 /* need to guarantee 400ns since last command was issued */
@@ -702,8 +702,8 @@ int ide_config_drive_speed(ide_drive_t *// msleep(50); #ifdef CONFIG_BLK_DEV_IDEDMA -if (hwif->dma_host_set)/* check if host supports DMA */ - hwif->dma_host_set (drive,0 ); +if (hwif->dma_ops)/* check if host supports DMA */ + hwif->dma_ops->dma_host_set (drive,0 );#endif /* Skip setting PIO flow-control modes on pre-EIDE drives */
@@ -761,8 +761,8 @@ int ide_config_drive_speed(ide_drive_t *#ifdef CONFIG_BLK_DEV_IDEDMA if ((speed >=XFER_SW_DMA_0 || (hwif->host_flags &IDE_HFLAG_VDMA )) && drive->using_dma) - hwif->dma_host_set (drive,1 ); -else if (hwif->dma_host_set)/* check if host supports DMA */ + hwif->dma_ops->dma_host_set (drive,1 ); +else if (hwif->dma_ops)/* check if host supports DMA */ ide_dma_off_quietly (drive);#endif
drivers/ide/ide-probe.c +3 -2
@@ -842,7 +842,7 @@ static void ide_port_tune_devices(ide_hw drive->nice1 =1 ; -if (hwif->dma_host_set) +if (hwif->dma_ops)ide_set_dma (drive); } }
@@ -1389,7 +1389,8 @@ static void ide_init_port(ide_hwif_t *hw hwif->swdma_mask =0 ; hwif->mwdma_mask =0 ; hwif->ultra_mask =0 ; - } + }else if (d->dma_ops) + hwif->dma_ops = d->dma_ops; }if (d->host_flags &IDE_HFLAG_RQSIZE_256 )
drivers/ide/ide-tape.c +3 -3
@@ -993,7 +993,7 @@ static ide_startstop_t idetape_pc_intr(i stat =ide_read_status (drive);if (pc->flags &PC_FLAG_DMA_IN_PROGRESS ) { -if (hwif->ide_dma_end (drive) || (stat &ERR_STAT )) { +if (hwif->dma_ops->dma_end (drive) || (stat &ERR_STAT )) {/* * A DMA error is sometimes expected. For example, * if the tape is crossing a filemark during a
@@ -1213,7 +1213,7 @@ static ide_startstop_t idetape_transfer_#ifdef CONFIG_BLK_DEV_IDEDMA /* Begin DMA, if necessary */ if (pc->flags &PC_FLAG_DMA_IN_PROGRESS ) - hwif->dma_start (drive); + hwif->dma_ops->dma_start (drive);#endif /* Send the actual packet */ HWIF (drive)->atapi_output_bytes (drive, pc->c,12 );
@@ -1279,7 +1279,7 @@ static ide_startstop_t idetape_issue_pc(ide_dma_off (drive); }if ((pc->flags &PC_FLAG_DMA_RECOMMENDED ) && drive->using_dma) - dma_ok = !hwif->dma_setup (drive); + dma_ok = !hwif->dma_ops->dma_setup (drive);ide_pktcmd_tf_load (drive,IDE_TFLAG_NO_SELECT_MASK |IDE_TFLAG_OUT_DEVICE , bcount, dma_ok);
drivers/ide/ide-taskfile.c +4 -3
@@ -135,6 +135,7 @@ ide_startstop_t do_rw_taskfile (ide_drivide_hwif_t *hwif =HWIF (drive);struct ide_taskfile *tf = &task->tf;ide_handler_t *handler =NULL ; +struct ide_dma_ops *dma_ops = hwif->dma_ops;if (task->data_phase ==TASKFILE_MULTI_IN || task->data_phase ==TASKFILE_MULTI_OUT ) {
@@ -178,10 +179,10 @@ ide_startstop_t do_rw_taskfile (ide_drivreturn ide_started;default :if (task_dma_ok (task) ==0 || drive->using_dma ==0 || - hwif->dma_setup (drive)) + dma_ops->dma_setup (drive))return ide_stopped; - hwif->dma_exec_cmd (drive, tf->command); - hwif->dma_start (drive); + dma_ops->dma_exec_cmd (drive, tf->command); + dma_ops->dma_start (drive);return ide_started; } }
drivers/ide/ide.c +1 -1
@@ -469,7 +469,7 @@ int set_using_dma(ide_drive_t *drive, inif (!drive->id || !(drive->id->capability &1 )) goto out; -if (hwif->dma_host_set ==NULL ) +if (hwif->dma_ops ==NULL ) goto out; err = -EBUSY ;
drivers/ide/mips/au1xxx-ide.c +17 -14
@@ -371,21 +371,31 @@ static void auide_init_dbdma_dev(dbdev_t dev->dev_devwidth = devwidth; dev->dev_flags = flags; } - -#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA ) +#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA static void auide_dma_timeout (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive);printk (KERN_ERR "%s: DMA timeout occurred: " , drive->name); -if (hwif->ide_dma_test_irq (drive)) +if (auide_dma_test_irq (drive))return ; - hwif->ide_dma_end (drive); +auide_dma_end (drive); } +static struct ide_dma_ops au1xxx_dma_ops = { + .dma_host_set = auide_dma_host_set, + .dma_setup = auide_dma_setup, + .dma_exec_cmd = auide_dma_exec_cmd, + .dma_start = auide_dma_start, + .dma_end = auide_dma_end, + .dma_test_irq = auide_dma_test_irq, + .dma_lost_irq = auide_dma_lost_irq, + .dma_timeout = auide_dma_timeout, +}; +static int auide_ddma_init (ide_hwif_t *hwif,const struct ide_port_info *d) {_auide_hwif *auide = (_auide_hwif *)hwif->hwif_data;
@@ -516,6 +526,9 @@ static const struct ide_port_ops au1xxx_static const struct ide_port_info au1xxx_port_info = { .init_dma = auide_ddma_init, .port_ops = &au1xxx_port_ops, +#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA + .dma_ops = &au1xxx_dma_ops, +#endif .host_flags =IDE_HFLAG_POST_SET_MODE |IDE_HFLAG_NO_IO_32BIT |IDE_HFLAG_UNMASK_IRQS ,
@@ -593,16 +606,6 @@ static int au_ide_probe(struct device *d hwif->INSW = auide_insw; hwif->OUTSW = auide_outsw;#endif -#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA - hwif->dma_timeout = &auide_dma_timeout; - hwif->dma_host_set = &auide_dma_host_set; - hwif->dma_exec_cmd = &auide_dma_exec_cmd; - hwif->dma_start = &auide_dma_start; - hwif->ide_dma_end = &auide_dma_end; - hwif->dma_setup = &auide_dma_setup; - hwif->ide_dma_test_irq = &auide_dma_test_irq; - hwif->dma_lost_irq = &auide_dma_lost_irq; -#endif hwif->select_data =0 ;/* no chipset-specific code */ hwif->config_data =0 ;/* no chipset-specific code */
drivers/ide/pci/alim15x3.c +11 -21
@@ -652,21 +652,7 @@ static u8 __devinit ali_cable_detect(idereturn cbl; } -/** -* init_hwif_common_ali15x3 - Set up ALI IDE hardware -* @hwif: IDE interface -* -* Initialize the IDE structure side of the ALi 15x3 driver. -*/ - -static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif) -{ -if (hwif->dma_base ==0 ) -return ; - - hwif->dma_setup = &ali15x3_dma_setup; -} - +#ifndef CONFIG_SPARC64 /** * init_hwif_ali15x3 - Initialize the ALI IDE x86 stuff * @hwif: interface to configure
@@ -716,9 +702,8 @@ static void __devinit init_hwif_ali15x3if (irq >=0 ) hwif->irq = irq; } - -init_hwif_common_ali15x3 (hwif); } +#endif /** * init_dma_ali15x3 - set up DMA on ALi15x3
@@ -746,7 +731,7 @@ static int __devinit init_dma_ali15x3(idif (ide_allocate_dma_engine (hwif))return -1 ; -ide_setup_dma (hwif, base); +ide_setup_dma (hwif, base, d);return 0 ; }
@@ -758,10 +743,16 @@ static const struct ide_port_ops ali_por .cable_detect = ali_cable_detect, }; +static struct ide_dma_ops ali_dma_ops = { + .dma_setup = ali15x3_dma_setup, +}; +static const struct ide_port_info ali15x3_chipset__devinitdata = { .name ="ALI15X3" , .init_chipset = init_chipset_ali15x3, +#ifndef CONFIG_SPARC64 .init_hwif = init_hwif_ali15x3, +#endif .init_dma = init_dma_ali15x3, .port_ops = &ali_port_ops, .pio_mask =ATA_PIO5 ,
@@ -806,6 +797,8 @@ static int __devinit alim15x3_init_one(s d.udma_mask =ATA_UDMA5 ; else d.udma_mask = ATA_UDMA6; + + d.dma_ops = &ali_dma_ops; }else { d.host_flags |=IDE_HFLAG_NO_DMA ;
@@ -815,9 +808,6 @@ static int __devinit alim15x3_init_one(sif (idx ==0 ) d.host_flags |=IDE_HFLAG_CLEAR_SIMPLEX ; -#if defined(CONFIG_SPARC64 ) - d.init_hwif = init_hwif_common_ali15x3; -#endif /* CONFIG_SPARC64 */ return ide_setup_pci_device (dev, &d); }
drivers/ide/pci/cmd64x.c +52 -58
189 lines not on this page · raw message
drivers/ide/pci/cs5520.c +5 -9
@@ -103,24 +103,20 @@ static void cs5520_dma_host_set(ide_drivide_dma_host_set (drive, on); } -static void __devinit init_hwif_cs5520 (ide_hwif_t *hwif) -{ -if (hwif->dma_base ==0 ) -return ; - - hwif->dma_host_set = &cs5520_dma_host_set; -} -static const struct ide_port_ops cs5520_port_ops = { .set_pio_mode = cs5520_set_pio_mode, .set_dma_mode = cs5520_set_dma_mode, }; +static struct ide_dma_ops cs5520_dma_ops = { + .dma_host_set = cs5520_dma_host_set, +}; +#define DECLARE_CS_DEV (name_str) \ { \ .name = name_str, \ - .init_hwif = init_hwif_cs5520, \ .port_ops = &cs5520_port_ops, \ + .dma_ops = &cs5520_dma_ops, \ .host_flags = IDE_HFLAG_ISA_PORTS | \ IDE_HFLAG_CS5520 | \ IDE_HFLAG_VDMA | \
drivers/ide/pci/hpt366.c +26 -18
122 lines not on this page · raw message
drivers/ide/pci/it821x.c +6 -2
@@ -511,6 +511,11 @@ static void __devinit it821x_quirkproc(i } +static struct ide_dma_ops it821x_pass_through_dma_ops = { + .dma_start = it821x_dma_start, + .dma_end = it821x_dma_end, +}; +/** * init_hwif_it821x - set up hwif structs * @hwif: interface to set up
@@ -562,8 +567,7 @@ static void __devinit init_hwif_it821x(iif (idev->smart ==0 ) {/* MWDMA/PIO clock switching for pass through mode */ - hwif->dma_start = &it821x_dma_start; - hwif->ide_dma_end = &it821x_dma_end; + hwif->dma_ops = &it821x_pass_through_dma_ops; }else hwif->host_flags |=IDE_HFLAG_NO_SET_MODE ;
drivers/ide/pci/ns87415.c +8 -4
@@ -150,7 +150,7 @@ static void ns87415_selectproc (ide_drivns87415_prepare_drive (drive, drive->using_dma); } -static int ns87415_ide_dma_end (ide_drive_t *drive) +static int ns87415_dma_end (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive);u8 dma_stat =0 , dma_cmd =0 ;
@@ -170,7 +170,7 @@ static int ns87415_ide_dma_end (ide_drivreturn (dma_stat &7 ) !=4 ; } -static int ns87415_ide_dma_setup (ide_drive_t *drive) +static int ns87415_dma_setup (ide_drive_t *drive) {/* select DMA xfer */ ns87415_prepare_drive (drive,1 );
@@ -252,14 +252,17 @@ static void __devinit init_hwif_ns87415return ;outb (0x60 , hwif->dma_status); - hwif->dma_setup = &ns87415_ide_dma_setup; - hwif->ide_dma_end = &ns87415_ide_dma_end; }static const struct ide_port_ops ns87415_port_ops = { .selectproc = ns87415_selectproc, }; +static struct ide_dma_ops ns87415_dma_ops = { + .dma_setup = ns87415_dma_setup, + .dma_end = ns87415_dma_end, +}; +static const struct ide_port_info ns87415_chipset__devinitdata = { .name ="NS87415" , #ifdef CONFIG_SUPERIO
@@ -267,6 +270,7 @@ static const struct ide_port_info ns8741#endif .init_hwif = init_hwif_ns87415, .port_ops = &ns87415_port_ops, + .dma_ops = &ns87415_dma_ops, .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | IDE_HFLAG_NO_ATAPI_DMA, };
drivers/ide/pci/pdc202xx_old.c +19 -22
83 lines not on this page · raw message
drivers/ide/pci/sc1200.c +7 -15
@@ -165,7 +165,7 @@ static void sc1200_set_dma_mode(ide_driv* * returns 1 on error, 0 otherwise */ -static int sc1200_ide_dma_end (ide_drive_t *drive) +static int sc1200_dma_end (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive);unsigned long dma_base = hwif->dma_base;
@@ -214,7 +214,7 @@ static void sc1200_set_pio_mode(ide_drivprintk ("SC1200: %s: changing (U)DMA mode\n" , drive->name);ide_dma_off_quietly (drive);if (ide_set_dma_mode (drive, mode) ==0 && drive->using_dma) - hwif->dma_host_set (drive,1 ); + hwif->dma_ops->dma_host_set (drive,1 );return ; }
@@ -286,28 +286,20 @@ static int sc1200_resume (struct pci_dev }#endif -/* -* This gets invoked by the IDE driver once for each channel, -* and performs channel-specific pre-initialization before drive probing. -*/ -static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif) -{ -if (hwif->dma_base ==0 ) -return ; - - hwif->ide_dma_end = &sc1200_ide_dma_end; -} -static const struct ide_port_ops sc1200_port_ops = { .set_pio_mode = sc1200_set_pio_mode, .set_dma_mode = sc1200_set_dma_mode, .udma_filter = sc1200_udma_filter, }; +static struct ide_dma_ops sc1200_dma_ops = { + .dma_end = sc1200_dma_end, +}; +static const struct ide_port_info sc1200_chipset__devinitdata = { .name ="SC1200" , - .init_hwif = init_hwif_sc1200, .port_ops = &sc1200_port_ops, + .dma_ops = &sc1200_dma_ops, .host_flags =IDE_HFLAG_SERIALIZE |IDE_HFLAG_POST_SET_MODE |IDE_HFLAG_ABUSE_DMA_MODES ,
drivers/ide/pci/scc_pata.c +9 -6
@@ -317,14 +317,14 @@ static int scc_dma_setup(ide_drive_t *dr/** -* scc_ide_dma_end - Stop DMA +* scc_dma_end - Stop DMA * @drive: IDE drive * * Check and clear INT Status register. * Then call __ide_dma_end(). */ -static int scc_ide_dma_end (ide_drive_t * drive) +static int scc_dma_end (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive);unsigned long intsts_port = hwif->dma_base +0x014 ;
@@ -659,10 +659,6 @@ static void __devinit init_hwif_scc(ide_/* PTERADD */ out_be32 ((void __iomem *)(hwif->dma_base +0x018 ), hwif->dmatable_dma); - hwif->dma_setup = scc_dma_setup; - hwif->ide_dma_end = scc_ide_dma_end; - hwif->ide_dma_test_irq = scc_dma_test_irq; -if (in_be32 ((void __iomem *)(hwif->config_data +0xff0 )) &CCKCTRL_ATACLKOEN ) hwif->ultra_mask =ATA_UDMA6 ;/* 133MHz */ else
@@ -676,12 +672,19 @@ static const struct ide_port_ops scc_por .cable_detect = scc_cable_detect, }; +static struct ide_dma_ops scc_dma_ops = { + .dma_setup = scc_dma_setup, + .dma_end = scc_dma_end, + .dma_test_irq = scc_dma_test_irq, +}; +#define DECLARE_SCC_DEV (name_str) \ { \ .name = name_str, \ .init_iops = init_iops_scc, \ .init_hwif = init_hwif_scc, \ .port_ops = &scc_port_ops, \ + .dma_ops = &scc_dma_ops, \ .host_flags = IDE_HFLAG_SINGLE, \ .pio_mask = ATA_PIO4, \ }
drivers/ide/pci/sgiioc4.c +16 -22
@@ -188,7 +188,7 @@ sgiioc4_clearirq(ide_drive_t * drive)return intr_reg &3 ; } -static void sgiioc4_ide_dma_start (ide_drive_t * drive) +static void sgiioc4_dma_start (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive);unsigned long ioc4_dma_addr = hwif->dma_base +IOC4_DMA_CTRL *4 ;
@@ -215,8 +215,7 @@ sgiioc4_ide_dma_stop(ide_hwif_t *hwif, u }/* Stops the IOC4 DMA Engine */ -static int -sgiioc4_ide_dma_end (ide_drive_t * drive) +static int sgiioc4_dma_end (ide_drive_t *drive) {u32 ioc4_dma, bc_dev, bc_mem, num, valid =0 , cnt =0 ;ide_hwif_t *hwif =HWIF (drive);
@@ -279,8 +278,7 @@ static void sgiioc4_set_dma_mode(ide_dri }/* returns 1 if dma irq issued, 0 otherwise */ -static int -sgiioc4_ide_dma_test_irq (ide_drive_t * drive) +static int sgiioc4_dma_test_irq (ide_drive_t *drive) {return sgiioc4_checkirq (HWIF (drive)); }
@@ -294,7 +292,7 @@ static void sgiioc4_dma_host_set(ide_dristatic void sgiioc4_resetproc (ide_drive_t * drive) { -sgiioc4_ide_dma_end (drive); +sgiioc4_dma_end (drive);sgiioc4_clearirq (drive); }
@@ -327,8 +325,6 @@ sgiioc4_INB(unsigned long port)return reg; } -static void __devinit ide_init_sgiioc4 (ide_hwif_t *); -/* Creates a dma map for the scatter-gather list entries */ static int __devinit ide_dma_sgiioc4 (ide_hwif_t *hwif,const struct ide_port_info *d)
@@ -377,7 +373,6 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, constif (pad) {ide_set_hwifdata (hwif, pad); -ide_init_sgiioc4 (hwif);return 0 ; }
@@ -526,7 +521,7 @@ use_pio_instead:return 0 ;/* revert to PIO for this request */ } -static int sgiioc4_ide_dma_setup (ide_drive_t *drive) +static int sgiioc4_dma_setup (ide_drive_t *drive) {struct request *rq =HWGROUP (drive)->rq;unsigned int count =0 ;
@@ -555,18 +550,6 @@ static int sgiioc4_ide_dma_setup(ide_drireturn 0 ; } -static void __devinit -ide_init_sgiioc4 (ide_hwif_t * hwif) -{ - hwif->dma_host_set = &sgiioc4_dma_host_set; - hwif->dma_setup = &sgiioc4_ide_dma_setup; - hwif->dma_start = &sgiioc4_ide_dma_start; - hwif->ide_dma_end = &sgiioc4_ide_dma_end; - hwif->ide_dma_test_irq = &sgiioc4_ide_dma_test_irq; - hwif->dma_lost_irq = &sgiioc4_dma_lost_irq; - hwif->dma_timeout = &ide_dma_timeout; -} -static const struct ide_port_ops sgiioc4_port_ops = { .set_dma_mode = sgiioc4_set_dma_mode,/* reset DMA engine, clear IRQs */
@@ -575,10 +558,21 @@ static const struct ide_port_ops sgiioc4 .maskproc = sgiioc4_maskproc, }; +static struct ide_dma_ops sgiioc4_dma_ops = { + .dma_host_set = sgiioc4_dma_host_set, + .dma_setup = sgiioc4_dma_setup, + .dma_start = sgiioc4_dma_start, + .dma_end = sgiioc4_dma_end, + .dma_test_irq = sgiioc4_dma_test_irq, + .dma_lost_irq = sgiioc4_dma_lost_irq, + .dma_timeout = ide_dma_timeout, +}; +static const struct ide_port_info sgiioc4_port_info__devinitdata = { .chipset = ide_pci, .init_dma = ide_dma_sgiioc4, .port_ops = &sgiioc4_port_ops, + .dma_ops = &sgiioc4_dma_ops, .host_flags =IDE_HFLAG_NO_AUTOTUNE , .mwdma_mask =ATA_MWDMA2_ONLY , };
drivers/ide/pci/siimage.c +35 -41
123 lines not on this page · raw message
drivers/ide/pci/sl82c105.c +9 -18
@@ -282,34 +282,25 @@ static unsigned int __devinit init_chipsreturn dev->irq; } -/* -* Initialise IDE channel -*/ -static void __devinit init_hwif_sl82c105 (ide_hwif_t *hwif) -{ -DBG (("init_hwif_sl82c105(hwif: ide%d)\n" , hwif->index)); - -if (!hwif->dma_base) -return ; - - hwif->dma_lost_irq = &sl82c105_dma_lost_irq; - hwif->dma_start = &sl82c105_dma_start; - hwif->ide_dma_end = &sl82c105_dma_end; - hwif->dma_timeout = &sl82c105_dma_timeout; -} -static const struct ide_port_ops sl82c105_port_ops = { .set_pio_mode = sl82c105_set_pio_mode, .set_dma_mode = sl82c105_set_dma_mode, .resetproc = sl82c105_resetproc, }; +static struct ide_dma_ops sl82c105_dma_ops = { + .dma_start = sl82c105_dma_start, + .dma_end = sl82c105_dma_end, + .dma_lost_irq = sl82c105_dma_lost_irq, + .dma_timeout = sl82c105_dma_timeout, +}; +static const struct ide_port_info sl82c105_chipset__devinitdata = { .name ="W82C105" , .init_chipset = init_chipset_sl82c105, - .init_hwif = init_hwif_sl82c105, .enablebits = {{0x40 ,0x01 ,0x01 }, {0x40 ,0x10 ,0x10 }}, .port_ops = &sl82c105_port_ops, + .dma_ops = &sl82c105_dma_ops, .host_flags =IDE_HFLAG_IO_32BIT | IDE_HFLAG_UNMASK_IRQS | /* FIXME: check for Compatibility mode in generic IDE PCI code */
@@ -334,7 +325,7 @@ static int __devinit sl82c105_init_one(s*/ printk (KERN_INFO "W82C105_IDE: Winbond W83C553 bridge " "revision %d, BM-DMA disabled\n" , rev); - d.init_hwif =NULL ; + d.dma_ops =NULL ; d.mwdma_mask =0 ; d.host_flags &= ~IDE_HFLAG_SERIALIZE_DMA ; }
drivers/ide/pci/tc86c001.c +5 -2
@@ -168,8 +168,6 @@ static void __devinit init_hwif_tc86c001/* Sector Count Register limit */ hwif->rqsize =0xffff ; - - hwif->dma_start = &tc86c001_dma_start; } static unsigned int __devinit init_chipset_tc86c001(struct pci_dev *dev,
@@ -188,11 +186,16 @@ static const struct ide_port_ops tc86c00 .cable_detect = tc86c001_cable_detect, }; +static struct ide_dma_ops tc86c001_dma_ops = { + .dma_start = tc86c001_dma_start, +}; +static const struct ide_port_info tc86c001_chipset__devinitdata = { .name ="TC86C001" , .init_chipset = init_chipset_tc86c001, .init_hwif = init_hwif_tc86c001, .port_ops = &tc86c001_port_ops, + .dma_ops = &tc86c001_dma_ops, .host_flags =IDE_HFLAG_SINGLE |IDE_HFLAG_OFF_BOARD |IDE_HFLAG_ABUSE_SET_DMA_MODE , .pio_mask =ATA_PIO4 ,
drivers/ide/pci/trm290.c +12 -8
@@ -214,7 +214,7 @@ static void trm290_dma_start(ide_drive_t { } -static int trm290_ide_dma_end (ide_drive_t *drive) +static int trm290_dma_end (ide_drive_t *drive) {u16 status;
@@ -225,7 +225,7 @@ static int trm290_ide_dma_end (ide_drivereturn status !=0x00ff ; } -static int trm290_ide_dma_test_irq (ide_drive_t *drive) +static int trm290_dma_test_irq (ide_drive_t *drive) {u16 status;
@@ -280,12 +280,6 @@ static void __devinit init_hwif_trm290(i/* sharing IRQ with mate */ hwif->irq = hwif->mate->irq; - hwif->dma_host_set = &trm290_dma_host_set; - hwif->dma_setup = &trm290_dma_setup; - hwif->dma_exec_cmd = &trm290_dma_exec_cmd; - hwif->dma_start = &trm290_dma_start; - hwif->ide_dma_end = &trm290_ide_dma_end; - hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq;#if 1 {/*
@@ -319,11 +313,21 @@ static const struct ide_port_ops trm290_ .selectproc = trm290_selectproc, }; +static struct ide_dma_ops trm290_dma_ops = { + .dma_host_set = trm290_dma_host_set, + .dma_setup = trm290_dma_setup, + .dma_exec_cmd = trm290_dma_exec_cmd, + .dma_start = trm290_dma_start, + .dma_end = trm290_dma_end, + .dma_test_irq = trm290_dma_test_irq, +}; +static const struct ide_port_info trm290_chipset__devinitdata = { .name ="TRM290" , .init_hwif = init_hwif_trm290, .chipset = ide_trm290, .port_ops = &trm290_port_ops, + .dma_ops = &trm290_dma_ops, .host_flags =IDE_HFLAG_NO_ATAPI_DMA | #if 0 /* play it safe for now */ IDE_HFLAG_TRUST_BIOS_FOR_DMA |
drivers/ide/ppc/pmac.c +16 -9
@@ -930,9 +930,14 @@ static const struct ide_port_ops pmac_id .selectproc = pmac_ide_selectproc, }; +static struct ide_dma_ops pmac_dma_ops; +static const struct ide_port_info pmac_port_info = { .init_dma = pmac_ide_init_dma, .chipset = ide_pmac, +#ifdef CONFIG_BLK_DEV_IDEDMA_PMAC + .dma_ops = &pmac_dma_ops, +#endif .port_ops = &pmac_ide_port_ops, .host_flags =IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | IDE_HFLAG_POST_SET_MODE |
@@ -1670,6 +1675,17 @@ pmac_ide_dma_lost_irq (ide_drive_t *drivprintk (KERN_ERR "ide-pmac lost interrupt, dma status: %lx\n" , status); } +static struct ide_dma_ops pmac_dma_ops = { + .dma_host_set = pmac_ide_dma_host_set, + .dma_setup = pmac_ide_dma_setup, + .dma_exec_cmd = pmac_ide_dma_exec_cmd, + .dma_start = pmac_ide_dma_start, + .dma_end = pmac_ide_dma_end, + .dma_test_irq = pmac_ide_dma_test_irq, + .dma_timeout = ide_dma_timeout, + .dma_lost_irq = pmac_ide_dma_lost_irq, +}; +/* * Allocate the data structures needed for using DMA with an interface * and fill the proper list of functions pointers
@@ -1702,15 +1718,6 @@ static int __devinit pmac_ide_init_dma(i hwif->sg_max_nents =MAX_DCMDS ; - hwif->dma_host_set = &pmac_ide_dma_host_set; - hwif->dma_setup = &pmac_ide_dma_setup; - hwif->dma_exec_cmd = &pmac_ide_dma_exec_cmd; - hwif->dma_start = &pmac_ide_dma_start; - hwif->ide_dma_end = &pmac_ide_dma_end; - hwif->ide_dma_test_irq = &pmac_ide_dma_test_irq; - hwif->dma_timeout = &ide_dma_timeout; - hwif->dma_lost_irq = &pmac_ide_dma_lost_irq; - return 0; }#else
drivers/ide/setup-pci.c +1 -1
@@ -384,7 +384,7 @@ int ide_hwif_setup_dma(ide_hwif_t *hwif,if (ide_allocate_dma_engine (hwif))return -1 ; -ide_setup_dma (hwif, base); +ide_setup_dma (hwif, base, d); }return 0 ;
drivers/scsi/ide-scsi.c +3 -3
@@ -393,7 +393,7 @@ static ide_startstop_t idescsi_pc_intr (printk ("ide-scsi: %s: DMA complete\n" , drive->name);#endif /* IDESCSI_DEBUG_LOG */ pc->xferred = pc->req_xfer; - (void )HWIF (drive)->ide_dma_end (drive); + (void )hwif->dma_ops->dma_end (drive); }/* Clear the interrupt */
@@ -498,7 +498,7 @@ static ide_startstop_t idescsi_transfer_ drive->hwif->atapi_output_bytes (drive, scsi->pc->c,12 );if (pc->flags &PC_FLAG_DMA_OK ) { pc->flags |=PC_FLAG_DMA_IN_PROGRESS ; - hwif->dma_start (drive); + hwif->dma_ops->dma_start (drive); }return ide_started; }
@@ -560,7 +560,7 @@ static ide_startstop_t idescsi_issue_pc(if (drive->using_dma && !idescsi_map_sg (drive, pc)) { hwif->sg_mapped =1 ; - dma = !hwif->dma_setup (drive); + dma = !hwif->dma_ops->dma_setup (drive); hwif->sg_mapped =0 ; }
include/linux/ide.h +14 -9
@@ -414,6 +414,17 @@ struct ide_port_ops {u8 (*cable_detect)(struct hwif_s *); }; +struct ide_dma_ops { +void (*dma_host_set)(struct ide_drive_s *,int ); +int (*dma_setup)(struct ide_drive_s *); +void (*dma_exec_cmd)(struct ide_drive_s *,u8 ); +void (*dma_start)(struct ide_drive_s *); +int (*dma_end)(struct ide_drive_s *); +int (*dma_test_irq)(struct ide_drive_s *); +void (*dma_lost_irq)(struct ide_drive_s *); +void (*dma_timeout)(struct ide_drive_s *); +}; + typedef struct hwif_s { struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ struct hwif_s *mate; /* other hwif from same PCI chip */
@@ -452,6 +463,7 @@ typedef struct hwif_s {void (*rw_disk)(ide_drive_t *,struct request *);const struct ide_port_ops *port_ops; +struct ide_dma_ops *dma_ops;void (*ata_input_data)(ide_drive_t *,void *,u32 );void (*ata_output_data)(ide_drive_t *,void *,u32 );
@@ -459,15 +471,7 @@ typedef struct hwif_s {void (*atapi_input_bytes)(ide_drive_t *,void *,u32 );void (*atapi_output_bytes)(ide_drive_t *,void *,u32 ); -void (*dma_host_set)(ide_drive_t *,int ); -int (*dma_setup)(ide_drive_t *); -void (*dma_exec_cmd)(ide_drive_t *,u8 ); -void (*dma_start)(ide_drive_t *); -int (*ide_dma_end)(ide_drive_t *drive); -int (*ide_dma_test_irq)(ide_drive_t *drive);void (*ide_dma_clear_irq)(ide_drive_t *drive); -void (*dma_lost_irq)(ide_drive_t *drive); -void (*dma_timeout)(ide_drive_t *drive);void (*OUTB )(u8 addr,unsigned long port);void (*OUTBSYNC )(ide_drive_t *drive,u8 addr,unsigned long port);
@@ -1115,6 +1119,7 @@ struct ide_port_info { const struct ide_port_info *);const struct ide_port_ops *port_ops; +struct ide_dma_ops *dma_ops;ide_pci_enablebit_t enablebits[2 ];hwif_chipset_t chipset;
@@ -1166,7 +1171,7 @@ void ide_destroy_dmatable(ide_drive_t *)extern int ide_build_dmatable (ide_drive_t *,struct request *);int ide_allocate_dma_engine (ide_hwif_t *);void ide_release_dma_engine (ide_hwif_t *); -extern void ide_setup_dma (ide_hwif_t *,unsigned long ); +void ide_setup_dma (ide_hwif_t *,unsigned long ,const struct ide_port_info *);void ide_dma_host_set (ide_drive_t *,int );extern int ide_dma_setup (ide_drive_t *);
Hello.
Quoted 4 lines · Bartlomiej Zolnierkiewicz
Quoted 2 lines
Now where is the code which selects the correct
dma_opsfor theQuoted 1 line
HPT36x/370/372/372N chip with device ID 4 I'm asking you? :-)
fixed
Not actually... :-/
Quoted 36 lines
From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: add structide_dma_ops(take 2)Add struct
ide_dma_opsand convert core code + drivers to use it.While at it:
* Drop "
ide_" prefix from ->ide_dma_end and ->ide_dma_test_irq methods.* Drop "
ide_" "infixes" from DMA methods.*
au1xxx-ide.c:
- use auide_dma_{test_irq,end}() directly inauide_dma_timeout()*
pdc202xx_old.c:
- drop "old_" "infixes" from DMA methods*
siimage.c:
- addsiimage_dma_test_irq()helper
- print SATA warning insiimage_init_one()* Remove no longer needed ->init_hwif implementations.
v2:
* Changes based on review from Sergei:
- s/siimage_ide_dma_test_irq/siimage_dma_test_irq/
- s/drive->hwif/hwif/ inidefloppy_pc_intr().
- fix patch description w.r.t. au1xxx-ide changes
- fix au1xxx-ide build
- fix naming for cmd64*_dma_ops
- drop "ide_" and "old_" infixes
- s/hpt3xxx_dma_ops/hpt37x_dma_ops/
- s/hpt370x_dma_ops/hpt370_dma_ops/
- use correct DMA ops for HPT302/N, HPT371/N and HPT374
- s/it821x_smart_dma_ops/it821x_pass_through_dma_ops/
Quoted 2 lines
Cc Sergei Shtylyov <[email protected]>Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
Unfortunately, you'll have to try one more... ;-)
Quoted 4 lines
Index:
b/drivers/ide/pci/hpt366.c
===================================================================drivers/ide/pci/hpt366.c +0
-0
[...]
Quoted 23 lines
drivers/ide/pci/hpt366.c +15
-0@@ -1428,6 +1415,21 @@ static const struct ide_port_ops hpt3xx_ .cable_detect = hpt3xx_cable_detect, }; +static struct ide_dma_ops hpt37x_dma_ops = { + .dma_end = hpt374_dma_end, + .dma_test_irq = hpt374_dma_test_irq, +}; + +static struct ide_dma_ops hpt370_dma_ops = { + .dma_start = hpt370_dma_start, + .dma_end = hpt370_dma_end, + .dma_timeout = hpt370_dma_timeout, +}; + +static struct ide_dma_ops hpt36x_dma_ops = { + .dma_lost_irq = hpt366_dma_lost_irq, +}; +static const struct ide_port_info hpt366_chipsets[]__devinitdata = { {/* 0 */ .name ="HPT36x" ,
drivers/ide/pci/hpt366.c static const struct ide_port_info hpt366 · line 1450
Quoted 7 lines
drivers/ide/pci/hpt366.c +1
-0@@ -1442,6 +1444,7 @@ static const struct ide_port_info hpt366*/ .enablebits = {{0x50,0x10,0x10}, {0x54,0x04,0x04}}, .port_ops = &hpt3xx_port_ops, + .dma_ops = &hpt36x_dma_ops, .host_flags = IDE_HFLAGS_HPT3XX | IDE_HFLAG_SINGLE, .pio_mask = ATA_PIO4, .mwdma_mask = ATA_MWDMA2,
I'm still not seeing the code to deals with the PCI device ID 4 which may
be HPT36x, or HPT370, or HPT372[N] depending on revision -- you're always giving hpt36x_dma_ops to it...
drivers/ide/pci/hpt366.c static const struct ide_port_info hpt366 · line 1492
Quoted 5 lines
drivers/ide/pci/hpt366.c +1
-0@@ -1483,6 +1489,7 @@ static const struct ide_port_info hpt366 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = ATA_UDMA5, .port_ops = &hpt3xx_port_ops, + .dma_ops = &hpt370_dma_ops,
Wrong -- HPT374 should have hpt37x_dma_ops...
MBR, Sergei
Hi,
Quoted 10 lines · Sergei Shtylyov
Hello.
Quoted 4 lines · Bartlomiej Zolnierkiewicz
Quoted 2 lines
Now where is the code which selects the correct
dma_opsfor theQuoted 1 line
HPT36x/370/372/372N chip with device ID 4 I'm asking you? :-)
fixed
Not actually... :-/
Arghhh. I see now that the HPT370/370A needs a special handling... (HPT372/372N has already been handled by 'idx++')
[...]
Quoted 7 lines
Review static const struct ide_port_info hpt366 · line 1492
Quoted 5 lines
(quoted diff) +1
-0@@ -1483,6 +1489,7 @@ static const struct ide_port_info hpt366 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = ATA_UDMA5, .port_ops = &hpt3xx_port_ops, + .dma_ops = &hpt370_dma_ops,Wrong -- HPT374 should have hpt37x_dma_ops...
Yep, thanks for catching it.
interdiff between v2->v3:
[...]
v3:
* Two bugs slipped in v2 (noticed by Sergei):
- use correct DMA ops for HPT374 (for real this time)
- handle HPT370/HPT370A properly
[...]
drivers/ide/pci/hpt366.c +5 -1
@@ -1489,7 +1489,7 @@ .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = ATA_UDMA5, .port_ops = &hpt3xx_port_ops, - .dma_ops = &hpt370_dma_ops, + .dma_ops = &hpt37x_dma_ops, .host_flags = IDE_HFLAGS_HPT3XX, .pio_mask = ATA_PIO4, .mwdma_mask = ATA_MWDMA2,
@@ -1563,6 +1563,10 @@ d.name = info->chip_name; d.udma_mask = info->udma_mask; +/* fixup ->dma_ops for HPT370/HPT370A */ +if (info == &hpt370 || info == &hpt370a) + d.dma_ops = &hpt370_dma_ops; +pci_set_drvdata (dev, (void *)info);if (info == &hpt36x || info == &hpt374)
Sergei Shtylyov
Acked-byHello.
Quoted 9 lines · Bartlomiej Zolnierkiewicz
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Now where is the code which selects the correct
dma_opsfor theQuoted 1 line
HPT36x/370/372/372N chip with device ID 4 I'm asking you? :-)
fixed
Not actually... :-/Arghhh. I see now that the HPT370/370A needs a special handling...
Yes, and a lot of. :-)
Quoted 1 line
(HPT372/372N has already been handled by 'idx++')
Didn't grasp this at first - the init. code grew somewhat convoluted...
Quoted 12 lines
[...]
Quoted 7 lines
drivers/ide/pci/hpt366.c static const struct ide_port_info hpt366 · line 1492
Quoted 5 lines
drivers/ide/pci/hpt366.c +1
-0@@ -1483,6 +1489,7 @@ static const struct ide_port_info hpt366 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, .udma_mask = ATA_UDMA5, .port_ops = &hpt3xx_port_ops, + .dma_ops = &hpt370_dma_ops,Wrong -- HPT374 should have hpt37x_dma_ops...Yep, thanks for catching it.
Quoted 7 lines
interdiff between
v2->v3:[...]
v3:
* Two bugs slipped in v2 (noticed by Sergei):
- use correct DMA ops for HPT374 (for real this time)
- handle HPT370/HPT370A properly
MBR, Sergei