ide: turn selectproc() method into dev_select() method (take 2)
PATCH 1/2 ide: turn selectproc() method into dev_select() method (take 2)
Turn selectproc() method into dev_select() method by teaching it to write to the device register and moving it from 'struct ide_port_ops' to 'struct ide_tp_ops'.
---
This patch is atop of the latest pata-2.6 series...
Changes since the first take:
- fixed compilation error in ns87415.c;
- added 'ide_dev_select' reference to 'default_tp_ops', fixing kernel oops;
- fixed checkpatch.pl error in trm290.c...
drivers/ide/ht6560b.c | 20 ++++++++++++++-- drivers/ide/ide-io-std.c | 13 ++++++++++ drivers/ide/ide-iops.c | 12 --------- drivers/ide/ns87415.c | 22 +++++++++++++---- drivers/ide/pmac.c | 58 +++++++++++++++++++++++++++++++---------------- drivers/ide/qd65xx.c | 21 ++++++++++++++--- drivers/ide/trm290.c | 20 ++++++++++++---- drivers/ide/tx4939ide.c | 2 - include/linux/ide.h | 5 +--- 9 files changed, 125 insertions(+), 48 deletions(-)
drivers/ide/ht6560b.c +18 -2
@@ -103,7 +103,7 @@/* * This routine is invoked from ide.c to prepare for access to a given drive. */ -static void ht6560b_selectproc (ide_drive_t *drive) +static void ht6560b_dev_select (ide_drive_t *drive) {ide_hwif_t *hwif = drive->hwif;unsigned long flags;
@@ -143,6 +143,8 @@ static void ht6560b_selectproc (ide_driv#endif }local_irq_restore (flags); + +outb (drive->select |ATA_DEVICE_OBS , hwif->io_ports.device_addr); }/*
@@ -305,15 +307,29 @@ static int probe_ht6560b;module_param_named (probe, probe_ht6560b, bool,0 );MODULE_PARM_DESC (probe,"probe for HT6560B chipset" ); +static const struct ide_tp_ops ht6560b_tp_ops = { + .exec_command = ide_exec_command, + .read_status = ide_read_status, + .read_altstatus = ide_read_altstatus, + .write_devctl = ide_write_devctl, + + .dev_select = ht6560b_dev_select, + .tf_load = ide_tf_load, + .tf_read = ide_tf_read, + + .input_data = ide_input_data, + .output_data = ide_output_data, +}; +static const struct ide_port_ops ht6560b_port_ops = { .init_dev = ht6560b_init_dev, .set_pio_mode = ht6560b_set_pio_mode, - .selectproc = ht6560b_selectproc, };static const struct ide_port_info ht6560b_port_info__initdata = { .name =DRV_NAME , .chipset = ide_ht6560b, + .tp_ops = &ht6560b_tp_ops, .port_ops = &ht6560b_port_ops, .host_flags =IDE_HFLAG_SERIALIZE |/* is this needed? */ IDE_HFLAG_NO_DMA |
drivers/ide/ide-io-std.c +13 -0
@@ -73,6 +73,18 @@ void ide_write_devctl(ide_hwif_t *hwif, }EXPORT_SYMBOL_GPL (ide_write_devctl); +void ide_dev_select (ide_drive_t *drive) +{ +ide_hwif_t *hwif = drive->hwif; +u8 select = drive->select |ATA_DEVICE_OBS ; + +if (hwif->host_flags &IDE_HFLAG_MMIO ) +writeb (select, (void __iomem *)hwif->io_ports.device_addr); +else +outb (select, hwif->io_ports.device_addr); +} +EXPORT_SYMBOL_GPL (ide_dev_select); +void ide_tf_load (ide_drive_t *drive,struct ide_cmd *cmd) {ide_hwif_t *hwif = drive->hwif;
@@ -280,6 +292,7 @@ const struct ide_tp_ops default_tp_ops = .read_altstatus = ide_read_altstatus, .write_devctl = ide_write_devctl, + .dev_select = ide_dev_select, .tf_load = ide_tf_load, .tf_read = ide_tf_read,
drivers/ide/ide-iops.c +1 -11
@@ -29,17 +29,7 @@void SELECT_DRIVE (ide_drive_t *drive) { -ide_hwif_t *hwif = drive->hwif; -const struct ide_port_ops *port_ops = hwif->port_ops; -struct ide_cmd cmd; - -if (port_ops && port_ops->selectproc) - port_ops->selectproc (drive); - -memset (&cmd,0 ,sizeof (cmd)); - cmd.tf_flags =IDE_TFLAG_OUT_DEVICE ; - - drive->hwif->tp_ops->tf_load (drive, &cmd); + drive->hwif->tp_ops->dev_select (drive); }void SELECT_MASK (ide_drive_t *drive,int mask)
drivers/ide/ns87415.c +17 -5
@@ -182,10 +182,12 @@ static void ns87415_prepare_drive (ide_dlocal_irq_restore (flags); } -static void ns87415_selectproc (ide_drive_t *drive) +static void ns87415_dev_select (ide_drive_t *drive) {ns87415_prepare_drive (drive, !!(drive->dev_flags &IDE_DFLAG_USING_DMA )); + +outb (drive->select |ATA_DEVICE_OBS , drive->hwif->io_ports.device_addr); }static void ns87415_dma_start (ide_drive_t *drive)
@@ -229,7 +231,7 @@ static void __devinit init_hwif_ns87415* Also, leave IRQ masked during drive probing, to prevent infinite * interrupts from a potentially floating INTA.. * -* IRQs get unmasked in selectproc when drive is first used. +* IRQs get unmasked in dev_select() when drive is first used. */ (void )pci_read_config_dword (dev,0x40 , &ctrl); (void )pci_read_config_byte (dev,0x09 , &progif);
@@ -281,8 +283,18 @@ static void __devinit init_hwif_ns87415outb (0x60 , hwif->dma_base +ATA_DMA_STATUS ); } -static const struct ide_port_ops ns87415_port_ops = { - .selectproc = ns87415_selectproc, +static const struct ide_tp_ops ns87415_tp_ops = { + .exec_command = ide_exec_command, + .read_status = ide_read_status, + .read_altstatus = ide_read_altstatus, + .write_devctl = ide_write_devctl, + + .dev_select = ns87415_dev_select, + .tf_load = ide_tf_load, + .tf_read = ide_tf_read, + + .input_data = ide_input_data, + .output_data = ide_output_data, };static const struct ide_dma_ops ns87415_dma_ops = {
@@ -299,7 +311,7 @@ static const struct ide_dma_ops ns87415_static const struct ide_port_info ns87415_chipset__devinitdata = { .name =DRV_NAME , .init_hwif = init_hwif_ns87415, - .port_ops = &ns87415_port_ops, + .tp_ops = &ns87415_tp_ops, .dma_ops = &ns87415_dma_ops, .host_flags =IDE_HFLAG_TRUST_BIOS_FOR_DMA |IDE_HFLAG_NO_ATAPI_DMA ,
drivers/ide/pmac.c +39 -19
119 lines not on this page · raw message
drivers/ide/qd65xx.c +18 -3
@@ -90,13 +90,15 @@ static int timings[4]={-1,-1,-1,-1}; /** This routine is invoked to prepare for access to a given drive. */ -static void qd65xx_select (ide_drive_t *drive) +static void qd65xx_dev_select (ide_drive_t *drive) {u8 index = (( (QD_TIMREG (drive)) &0x80 ) >>7 ) | (QD_TIMREG (drive) &0x02 );if (timings[index] !=QD_TIMING (drive))outb (timings[index] =QD_TIMING (drive),QD_TIMREG (drive)); + +outb (drive->select |ATA_DEVICE_OBS , drive->hwif->io_ports.device_addr); }/*
@@ -309,20 +311,33 @@ static void __init qd6580_init_dev(ide_d drive->drive_data = (drive->dn &1 ) ? t2 : t1; } +static const struct ide_tp_ops qd65xx_tp_ops = { + .exec_command = ide_exec_command, + .read_status = ide_read_status, + .read_altstatus = ide_read_altstatus, + .write_devctl = ide_write_devctl, + + .dev_select = qd65xx_dev_select, + .tf_load = ide_tf_load, + .tf_read = ide_tf_read, + + .input_data = ide_input_data, + .output_data = ide_output_data, +}; +static const struct ide_port_ops qd6500_port_ops = { .init_dev = qd6500_init_dev, .set_pio_mode = qd6500_set_pio_mode, - .selectproc = qd65xx_select, };static const struct ide_port_ops qd6580_port_ops = { .init_dev = qd6580_init_dev, .set_pio_mode = qd6580_set_pio_mode, - .selectproc = qd65xx_select, };static const struct ide_port_info qd65xx_port_info__initdata = { .name =DRV_NAME , + .tp_ops = &qd65xx_tp_ops, .chipset = ide_qd65xx, .host_flags =IDE_HFLAG_IO_32BIT |IDE_HFLAG_NO_DMA ,
drivers/ide/trm290.c +16 -4
@@ -171,9 +171,11 @@ static void trm290_prepare_drive (ide_drlocal_irq_restore (flags); } -static void trm290_selectproc (ide_drive_t *drive) +static void trm290_dev_select (ide_drive_t *drive) {trm290_prepare_drive (drive, !!(drive->dev_flags &IDE_DFLAG_USING_DMA )); + +outb (drive->select |ATA_DEVICE_OBS , drive->hwif->io_ports.device_addr); }static int trm290_dma_check (ide_drive_t *drive,struct ide_cmd *cmd)
@@ -298,8 +300,18 @@ static void __devinit init_hwif_trm290(i#endif } -static const struct ide_port_ops trm290_port_ops = { - .selectproc = trm290_selectproc, +static const struct ide_tp_ops trm290_tp_ops = { + .exec_command = ide_exec_command, + .read_status = ide_read_status, + .read_altstatus = ide_read_altstatus, + .write_devctl = ide_write_devctl, + + .dev_select = trm290_dev_select, + .tf_load = ide_tf_load, + .tf_read = ide_tf_read, + + .input_data = ide_input_data, + .output_data = ide_output_data, };static struct ide_dma_ops trm290_dma_ops = {
@@ -315,7 +327,7 @@ static struct ide_dma_ops trm290_dma_opsstatic const struct ide_port_info trm290_chipset__devinitdata = { .name =DRV_NAME , .init_hwif = init_hwif_trm290, - .port_ops = &trm290_port_ops, + .tp_ops = &trm290_tp_ops, .dma_ops = &trm290_dma_ops, .host_flags =IDE_HFLAG_TRM290 | IDE_HFLAG_NO_ATAPI_DMA |
drivers/ide/tx4939ide.c +1 -1
@@ -429,7 +429,7 @@ static void tx4939ide_tf_load_fixup(ide_* Fix ATA100 CORE System Control Register. (The write to the * Device/Head register may write wrong data to the System * Control Register) -* While Sys_Ctl is written here, selectproc is not needed. +* While Sys_Ctl is written here, dev_select() is not needed. */ tx4939ide_writew (sysctl, base, TX4939IDE_Sys_Ctl); }
include/linux/ide.h +2 -3
@@ -603,7 +603,7 @@ struct ide_drive_s {unsigned int bios_cyl;/* BIOS/fdisk/LILO number of cyls */ unsigned int cyl;/* "real" number of cyls */ -unsigned int drive_data;/* used by set_pio_mode/selectproc */ +unsigned int drive_data;/* used by set_pio_mode/dev_select() */ unsigned int failures;/* current failure count */ unsigned int max_failures;/* maximum allowed failure count */ u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */
@@ -661,6 +661,7 @@ struct ide_tp_ops {u8 (*read_altstatus)(struct hwif_s *);void (*write_devctl)(struct hwif_s *,u8 ); +void (*dev_select)(ide_drive_t *);void (*tf_load)(ide_drive_t *,struct ide_cmd *);void (*tf_read)(ide_drive_t *,struct ide_cmd *);
@@ -678,7 +679,6 @@ extern const struct ide_tp_ops default_t* @init_dev: host specific initialization of a device * @set_pio_mode: routine to program host for PIO mode * @set_dma_mode: routine to program host for DMA mode -* @selectproc: tweaks hardware to select drive * @reset_poll: chipset polling based on hba specifics * @pre_reset: chipset specific changes to default for device-hba resets * @resetproc: routine to reset controller after a disk reset
@@ -695,7 +695,6 @@ struct ide_port_ops {void (*init_dev)(ide_drive_t *);void (*set_pio_mode)(ide_drive_t *,const u8 );void (*set_dma_mode)(ide_drive_t *,const u8 ); -void (*selectproc)(ide_drive_t *);int (*reset_poll)(ide_drive_t *);void (*pre_reset)(ide_drive_t *);void (*resetproc)(ide_drive_t *);
Bartlomiej Zolnierkiewicz
AppliedQuoted 4 lines · Sergei Shtylyov
Turn
selectproc()method intodev_select()method by teaching it to write to the device register and moving it from 'structide_port_ops' to 'structide_tp_ops'.Signed-off-by Sergei Shtylyov <[email protected]>
applied in place of old patch
Quoted 10 lines · Sergei Shtylyov
Turn
selectproc()method intodev_select()method by teaching it to write to the device register and moving it from 'structide_port_ops' to 'structide_tp_ops'.Signed-off-by Sergei Shtylyov <[email protected]>---
This patch is atop of the latest pata-2.6 series...
Changes since the first take:
- fixed compilation error inns87415.c;
- added 'ide_dev_select' reference to 'default_tp_ops', fixing kernel oops;
yep, oops is fixed.
Signature · 2 lines
Regards/Gruss,
Boris.Quoted 10 lines · Hello, I wrote:
Turn
selectproc()method intodev_select()method by teaching it to write to the device register and moving it from 'structide_port_ops' to 'structide_tp_ops'.Signed-off-by Sergei Shtylyov <[email protected]>---
This patch is atop of the latest pata-2.6 series...
Changes since the first take:
- fixed compilation error inns87415.c;
- added 'ide_dev_select' reference to 'default_tp_ops', fixing kernel oops;
My bad. :-< There are still 'struct ide_tp_ops' instances missing this
reference, so there's going to be another take...
MBR, Sergei