ide: even more IDE probing code rework
Subsystems (2)
cover ide: even more IDE probing code rework
Just another bunch of small fixes/cleanups...
diffstat:
drivers/ide/arm/bast-ide.c | 22 +++- drivers/ide/arm/rapide.c | 4 drivers/ide/ide-acpi.c | 60 +++-------- drivers/ide/ide-pnp.c | 9 - drivers/ide/ide-probe.c | 204 +++++++++++++++++++++----------------- drivers/ide/ide-proc.c | 7 - drivers/ide/ide.c | 66 +++++++----- drivers/ide/legacy/dtc2278.c | 10 - drivers/ide/legacy/ht6560b.c | 26 ++-- drivers/ide/legacy/ide-cs.c | 31 +++++ drivers/ide/legacy/ide_platform.c | 4 drivers/ide/legacy/qd65xx.c | 44 ++++++-- drivers/ide/mips/au1xxx-ide.c | 7 - drivers/ide/pci/delkin_cb.c | 40 +++++-- drivers/ide/pci/opti621.c | 10 + drivers/ide/pci/rz1000.c | 3 drivers/ide/pci/scc_pata.c | 4 drivers/macintosh/mediabay.c | 2 include/linux/ide.h | 22 ++-- 19 files changed, 340 insertions(+), 235 deletions(-)
PATCH 1/22 ide: remove redundant hwif->present check from ide_register_hw()
We check earlier for hwif->present and call ide_unregister() if necessary (after ide_unregister() hwif->present will be always cleared).
--- drivers/ide/ide.c | 2 -- 1 file changed, 2 deletions(-)
drivers/ide/ide.c +0 -2
@@ -720,8 +720,6 @@ found:ide_init_port_data (hwif, index);init_hwif_default (hwif, index); } -if (hwif->present) -return -1 ;ide_init_port_hw (hwif, hw); hwif->quirkproc = quirkproc;
PATCH 2/22 ide: remove redundant init_hwif_default() call from ide_register_hw()
In reply to Bartlomiej Zolnierkiewiczide_init_port_hw() call overrides setup done by init_hwif_default().
--- drivers/ide/ide.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/ide/ide.c +1 -3
@@ -716,10 +716,8 @@ int ide_register_hw(hw_regs_t *hw, void found:if (hwif->present)ide_unregister (index); -else if (!hwif->hold) { +else if (!hwif->hold)ide_init_port_data (hwif, index); -init_hwif_default (hwif, index); - }ide_init_port_hw (hwif, hw); hwif->quirkproc = quirkproc;
PATCH 3/22 ide: add 'init_default' and 'restore' arguments to ide_unregister()
In reply to Bartlomiej Zolnierkiewicz* Add 'init_default' (flag for calling init_hwif_default()) and 'restore' (flag for calling ide_hwif_restore()) arguments to ide_unregister().
* Update ide_unregister() users to set 'init_default' and 'restore' flags.
* No need to set 'init_default' flag in ide_register_hw() if the setup done by init_hwif_default() is going to be overridden by ide_init_port_hw().
* No need to set 'init_default' and 'restore' flags in cleanup_module().
There should be no functionality changes caused by this patch.
--- drivers/ide/arm/rapide.c | 2 +- drivers/ide/ide-pnp.c | 7 ++++--- drivers/ide/ide.c | 19 ++++++++++++------- drivers/ide/legacy/ide-cs.c | 2 +- drivers/ide/legacy/ide_platform.c | 2 +- drivers/ide/mips/au1xxx-ide.c | 2 +- drivers/ide/pci/delkin_cb.c | 3 ++- drivers/ide/pci/scc_pata.c | 2 +- drivers/macintosh/mediabay.c | 2 +- include/linux/ide.h | 2 +- 10 files changed, 25 insertions(+), 18 deletions(-)
drivers/ide/arm/rapide.c +1 -1
@@ -76,7 +76,7 @@ static void __devexit rapide_remove(struecard_set_drvdata (ec,NULL ); -ide_unregister (hwif->index); +ide_unregister (hwif->index,1 ,1 );ecard_release_resources (ec); }
drivers/ide/ide-pnp.c +4 -3
@@ -60,9 +60,10 @@ static int idepnp_probe(struct pnp_dev *static void idepnp_remove (struct pnp_dev * dev) {ide_hwif_t *hwif =pnp_get_drvdata (dev); -if (hwif) { -ide_unregister (hwif->index); - }else + +if (hwif) +ide_unregister (hwif->index,1 ,1 ); +else printk (KERN_ERR "idepnp: Unable to remove device, please report.\n" ); }
drivers/ide/ide.c +12 -7
@@ -499,6 +499,8 @@ void ide_remove_port_from_hwgroup(ide_hw/** * ide_unregister - free an IDE interface * @index: index of interface (will change soon to a pointer) +* @init_default: init default hwif flag +* @restore: restore hwif flag * * Perform the final unregister of an IDE interface. At the moment * we don't refcount interfaces so this will also get split up.
@@ -518,7 +520,7 @@ void ide_remove_port_from_hwgroup(ide_hw* This is raving bonkers. */ -void ide_unregister (unsigned int index) +void ide_unregister (unsigned int index,int init_default,int restore) {ide_drive_t *drive;ide_hwif_t *hwif, *g;
@@ -602,9 +604,12 @@ void ide_unregister(unsigned int index)/* restore hwif data to pristine status */ ide_init_port_data (hwif, index); -init_hwif_default (hwif, index); -ide_hwif_restore (hwif, &tmp_hwif); +if (init_default) +init_hwif_default (hwif, index); + +if (restore) +ide_hwif_restore (hwif, &tmp_hwif); abort:spin_unlock_irq (&ide_lock);
@@ -710,12 +715,12 @@ int ide_register_hw(hw_regs_t *hw, void goto found; }for (index =0 ; index <MAX_HWIFS ; index++) -ide_unregister (index); +ide_unregister (index,1 ,1 ); }while (retry--);return -1 ; found:if (hwif->present) -ide_unregister (index); +ide_unregister (index,0 ,1 );else if (!hwif->hold)ide_init_port_data (hwif, index);
@@ -1058,7 +1063,7 @@ int generic_ide_ioctl(ide_drive_t *drivecase HDIO_UNREGISTER_HWIF :if (!capable (CAP_SYS_RAWIO ))return -EACCES ;/* (arg > MAX_HWIFS) checked in function */ -ide_unregister (arg); +ide_unregister (arg,1 ,1 );return 0 ;case HDIO_SET_NICE :if (!capable (CAP_SYS_ADMIN ))return -EACCES ;
@@ -1703,7 +1708,7 @@ void __exit cleanup_module (void)int index;for (index =0 ; index <MAX_HWIFS ; ++index) -ide_unregister (index); +ide_unregister (index,0 ,0 );proc_ide_destroy ();
drivers/ide/legacy/ide-cs.c +1 -1
@@ -337,7 +337,7 @@ void ide_release(struct pcmcia_device *lif (info->ndev) {/* FIXME: if this fails we need to queue the cleanup somehow -- need to investigate the required PCMCIA magic */ -ide_unregister (info->hd); +ide_unregister (info->hd,1 ,1 ); } info->ndev =0 ;
drivers/ide/legacy/ide_platform.c +1 -1
@@ -122,7 +122,7 @@ static int __devexit plat_ide_remove(str {ide_hwif_t *hwif = pdev->dev.driver_data; -ide_unregister (hwif->index); +ide_unregister (hwif->index,1 ,1 );return 0 ; }
drivers/ide/mips/au1xxx-ide.c +1 -1
@@ -678,7 +678,7 @@ static int au_ide_remove(struct device *ide_hwif_t *hwif =dev_get_drvdata (dev);_auide_hwif *ahwif = &auide_hwif; -ide_unregister (hwif->index); +ide_unregister (hwif->index,1 ,1 );iounmap ((void *)ahwif->regbase);
drivers/ide/pci/delkin_cb.c +2 -1
@@ -99,7 +99,8 @@ delkin_cb_remove (struct pci_dev *dev)ide_hwif_t *hwif =pci_get_drvdata (dev);if (hwif) -ide_unregister (hwif->index); +ide_unregister (hwif->index,1 ,1 ); +pci_disable_device (dev); }
drivers/ide/pci/scc_pata.c +1 -1
@@ -736,7 +736,7 @@ static void __devexit scc_remove(struct hwif->dmatable_cpu =NULL ; } -ide_unregister (hwif->index); +ide_unregister (hwif->index,1 ,1 ); hwif->chipset = ide_unknown;iounmap ((void *)ports->dma);
drivers/macintosh/mediabay.c +1 -1
@@ -595,7 +595,7 @@ static void media_bay_step(int i)if (bay->cd_index >=0 ) {printk (KERN_DEBUG "Unregistering mb %d ide, index:%d\n" , i, bay->cd_index); -ide_unregister (bay->cd_index); +ide_unregister (bay->cd_index,1 ,1 ); bay->cd_index =-1 ; }if (bay->cd_retry) {
include/linux/ide.h +1 -1
@@ -1211,7 +1211,7 @@ static inline void ide_acpi_set_state(idvoid ide_remove_port_from_hwgroup (ide_hwif_t *);extern int ide_hwif_request_regions (ide_hwif_t *hwif);extern void ide_hwif_release_regions (ide_hwif_t * hwif); -extern void ide_unregister (unsigned int index); +void ide_unregister (unsigned int ,int ,int );void ide_register_region (struct gendisk *);void ide_unregister_region (struct gendisk *);
PATCH 4/22 ide: add ide_deprecated_find_port() helper
In reply to Bartlomiej Zolnierkiewicz* Factor out code for finding ide_hwifs[] slot from ide_register_hw() to ide_deprecated_find_port().
* Convert bast-ide, ide-cs and delkin_cb host drivers to use ide_device_add() instead of ide_register_hw() (while at it drop doing "ide_unregister()" loop which tries to unregister _all_ IDE interfaces if useable ide_hwifs[] slot cannot be find).
This patch leaves us with only two ide_register_hw() users:
- drivers/macintosh/mediabay.c
- drivers/ide/ide.c
--- drivers/ide/arm/bast-ide.c | 20 +++++++++++++++++++- drivers/ide/ide.c | 41 +++++++++++++++++++++++++++++------------ drivers/ide/legacy/ide-cs.c | 25 ++++++++++++++++++++++++- drivers/ide/pci/delkin_cb.c | 33 +++++++++++++++++++++++++++------ include/linux/ide.h | 1 + 5 files changed, 100 insertions(+), 20 deletions(-)
drivers/ide/arm/bast-ide.c +19 -1
@@ -28,8 +28,10 @@ static int __init bastide_register(unsigned int base, unsigned int aux, int irq, ide_hwif_t **hwif) { + ide_hwif_t *hwif;hw_regs_t hw;int i; +u8 idx[4 ] = {0xff ,0xff ,0xff ,0xff };memset (&hw,0 ,sizeof (hw));
@@ -44,8 +46,24 @@ bastide_register(unsigned int base, unsi hw.io_ports[IDE_CONTROL_OFFSET ] = aux + (6 *0x20 ); hw.irq = irq; -ide_register_hw (&hw,NULL , hwif); + hwif =ide_deprecated_find_port (hw.io_ports[IDE_DATA_OFFSET ]); +if (hwif ==NULL ) + goto out; + i = hwif->index; + +if (hwif->present) +ide_unregister (i,0 ,1 ); +else if (!hwif->hold) +ide_init_port_data (hwif, i); + +ide_init_port_hw (hwif, &hw); + hwif->quirkproc =NULL ; + + idx[0 ] = i; + +ide_device_add (idx,NULL ); +out:return 0 ; }
drivers/ide/ide.c +29 -12
53 lines not on this page · raw message
drivers/ide/legacy/ide-cs.c +24 -1
@@ -145,13 +145,36 @@ static void ide_detach(struct pcmcia_devstatic int idecs_register (unsigned long io,unsigned long ctl,unsigned long irq,struct pcmcia_device *handle) { +ide_hwif_t *hwif;hw_regs_t hw; +int i; +u8 idx[4 ] = {0xff ,0xff ,0xff ,0xff }; +memset (&hw,0 ,sizeof (hw));ide_init_hwif_ports (&hw, io, ctl,NULL ); hw.irq = irq; hw.chipset = ide_pci; hw.dev = &handle->dev; -return ide_register_hw (&hw, &ide_undecoded_slave,NULL ); + + hwif =ide_deprecated_find_port (hw.io_ports[IDE_DATA_OFFSET ]); +if (hwif ==NULL ) +return -1 ; + + i = hwif->index; + +if (hwif->present) +ide_unregister (i,0 ,1 ); +else if (!hwif->hold) +ide_init_port_data (hwif, i); + +ide_init_port_hw (hwif, &hw); + hwif->quirkproc = &ide_undecoded_slave; + + idx[0 ] = i; + +ide_device_add (idx,NULL ); + +return hwif->present ? i :-1 ; }/*======================================================================
drivers/ide/pci/delkin_cb.c +27 -6
@@ -51,6 +51,7 @@ delkin_cb_probe (struct pci_dev *dev, coide_hwif_t *hwif =NULL ;ide_drive_t *drive;int i, rc; +u8 idx[4 ] = {0xff ,0xff ,0xff ,0xff }; rc =pci_enable_device (dev);if (rc) {
@@ -77,12 +78,27 @@ delkin_cb_probe (struct pci_dev *dev, co hw.irq = dev->irq; hw.chipset = ide_pci;/* this enables IRQ sharing */ - rc =ide_register_hw (&hw, &ide_undecoded_slave, &hwif); -if (rc <0 ) { -printk (KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n" , rc); -pci_disable_device (dev); -return -ENODEV ; - } + hwif =ide_deprecated_find_port (hw.io_ports[IDE_DATA_OFFSET ]); +if (hwif ==NULL ) + goto out_disable; + + i = hwif->index; + +if (hwif->present) +ide_unregister (i,0 ,1 ); +else if (!hwif->hold) +ide_init_port_data (hwif, i); + +ide_init_port_hw (hwif, &hw); + hwif->quirkproc = &ide_undecoded_slave; + + idx[0 ] = i; + +ide_device_add (idx,NULL ); + +if (!hwif->present) + goto out_disable; +pci_set_drvdata (dev, hwif); hwif->dev = &dev->dev; drive = &hwif->drives[0 ];
@@ -91,6 +107,11 @@ delkin_cb_probe (struct pci_dev *dev, co drive->unmask =1 ; }return 0 ; + +out_disable: +printk (KERN_ERR "delkin_cb: no IDE devices found\n" ); +pci_disable_device (dev); +return -ENODEV ; } static void
include/linux/ide.h +1 -0
@@ -196,6 +196,7 @@ typedef struct hw_regs_s { } hw_regs_t;struct hwif_s *ide_find_port (unsigned long ); +struct hwif_s *ide_deprecated_find_port (unsigned long );void ide_init_port_data (struct hwif_s *,unsigned int );void ide_init_port_hw (struct hwif_s *,hw_regs_t *);
Re: [PATCH 04/22] ide: add ide_deprecated_find_port() helper
Hello.
Quoted 7 lines · Bartlomiej Zolnierkiewicz
* Factor out code for finding ide_hwifs[] slot from
ide_register_hw()toide_deprecated_find_port().* Convert bast-ide, ide-cs and
delkin_cbhost drivers to useide_device_add()instead ofide_register_hw()(while at it drop doing "ide_unregister()" loop which tries to unregister _all_ IDE interfaces if useable ide_hwifs[] slot cannot be find).
Er... this patch didn't actually drop that loop (late remark :-).
Quoted 3 lines
This patch leaves us with only two
ide_register_hw()users:
-drivers/macintosh/mediabay.c
-drivers/ide/ide.c
I wonder whether ide_register_hw() was much good at all since it didn't
actually permit to register chips using MMIO: you couldn't pass that info via 'hw' and it set 'hwif->noprobe' to 0, thus giving you no chance to skip probing which wouldn't work anyway; for the same reason it was no good for DMA capable chips since you had not time to install ide_dma_check() and other DMA methods. Am I right here?
MBR, Sergei
Re: [PATCH 04/22] ide: add ide_deprecated_find_port() helper
Quoted 18 lines · Sergei Shtylyov
Hello.
Quoted 7 lines · Bartlomiej Zolnierkiewicz
* Factor out code for finding ide_hwifs[] slot from
ide_register_hw()toide_deprecated_find_port().* Convert bast-ide, ide-cs and
delkin_cbhost drivers to useide_device_add()instead ofide_register_hw()(while at it drop doing "ide_unregister()" loop which tries to unregister _all_ IDE interfaces if useable ide_hwifs[] slot cannot be find).Er... this patch didn't actually drop that loop (late remark :-).
Quoted 3 lines
This patch leaves us with only two
ide_register_hw()users:
-drivers/macintosh/mediabay.c
-drivers/ide/ide.c
Quoted 6 lines
I wonder whether
ide_register_hw()was much good at all since it didn't
actually permit to register chips using MMIO: you couldn't pass that info via 'hw' and it set 'hwif->noprobe' to 0, thus giving you no chance to skip probing which wouldn't work anyway; for the same reason it was no good for DMA capable chips since you had not time to installide_dma_check()and other DMA methods. Am I right here?
Yes but please remember that before we started the major surgeries ide_register_hw() operated in two modes:
- "post-init-probe" which worked like described above
- "pre-init-probe" which allowed host drivers to do all setup (as the probing was done later by ide_generic host driver)
and the vast majority of host drivers used "pre-init-probe" mode (which doesn't change the fact that ide_register_hw() was not good anyway since it had a number of other problems).
Thanks,
Bart
PATCH 5/22 ide: fix ide_unregister() usage in host drivers
In reply to Bartlomiej Zolnierkiewiczbast-ide.c/ide-cs.c/delkin_cb.c:
* Don't set 'restore' flag for ide_unregister() when initializing new interface.
rapide.c/ide-pnp.c/ide-cs.c/ide_platform.c/au1xxx-ide.c/delkin_cb.c/scc_pata.c:
* Don't set 'init_default' and 'restore' flags for ide_unregister() when removing interface.
--- drivers/ide/arm/bast-ide.c | 2 +- drivers/ide/arm/rapide.c | 2 +- drivers/ide/ide-pnp.c | 2 +- drivers/ide/legacy/ide-cs.c | 4 ++-- drivers/ide/legacy/ide_platform.c | 2 +- drivers/ide/mips/au1xxx-ide.c | 2 +- drivers/ide/pci/delkin_cb.c | 4 ++-- drivers/ide/pci/scc_pata.c | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-)
drivers/ide/arm/bast-ide.c +1 -1
@@ -53,7 +53,7 @@ bastide_register(unsigned int base, unsi i = hwif->index;if (hwif->present) -ide_unregister (i,0 ,1 ); +ide_unregister (i,0 ,0 );else if (!hwif->hold)ide_init_port_data (hwif, i);
drivers/ide/arm/rapide.c +1 -1
@@ -76,7 +76,7 @@ static void __devexit rapide_remove(struecard_set_drvdata (ec,NULL ); -ide_unregister (hwif->index,1 ,1 ); +ide_unregister (hwif->index,0 ,0 );ecard_release_resources (ec); }
drivers/ide/ide-pnp.c +1 -1
@@ -62,7 +62,7 @@ static void idepnp_remove(struct pnp_devide_hwif_t *hwif =pnp_get_drvdata (dev);if (hwif) -ide_unregister (hwif->index,1 ,1 ); +ide_unregister (hwif->index,0 ,0 );else printk (KERN_ERR "idepnp: Unable to remove device, please report.\n" ); }
drivers/ide/legacy/ide-cs.c +2 -2
@@ -163,7 +163,7 @@ static int idecs_register(unsigned long i = hwif->index;if (hwif->present) -ide_unregister (i,0 ,1 ); +ide_unregister (i,0 ,0 );else if (!hwif->hold)ide_init_port_data (hwif, i);
@@ -360,7 +360,7 @@ void ide_release(struct pcmcia_device *lif (info->ndev) {/* FIXME: if this fails we need to queue the cleanup somehow -- need to investigate the required PCMCIA magic */ -ide_unregister (info->hd,1 ,1 ); +ide_unregister (info->hd,0 ,0 ); } info->ndev =0 ;
drivers/ide/legacy/ide_platform.c +1 -1
@@ -122,7 +122,7 @@ static int __devexit plat_ide_remove(str {ide_hwif_t *hwif = pdev->dev.driver_data; -ide_unregister (hwif->index,1 ,1 ); +ide_unregister (hwif->index,0 ,0 );return 0 ; }
drivers/ide/mips/au1xxx-ide.c +1 -1
@@ -678,7 +678,7 @@ static int au_ide_remove(struct device *ide_hwif_t *hwif =dev_get_drvdata (dev);_auide_hwif *ahwif = &auide_hwif; -ide_unregister (hwif->index,1 ,1 ); +ide_unregister (hwif->index,0 ,0 );iounmap ((void *)ahwif->regbase);
drivers/ide/pci/delkin_cb.c +2 -2
@@ -85,7 +85,7 @@ delkin_cb_probe (struct pci_dev *dev, co i = hwif->index;if (hwif->present) -ide_unregister (i,0 ,1 ); +ide_unregister (i,0 ,0 );else if (!hwif->hold)ide_init_port_data (hwif, i);
@@ -120,7 +120,7 @@ delkin_cb_remove (struct pci_dev *dev)ide_hwif_t *hwif =pci_get_drvdata (dev);if (hwif) -ide_unregister (hwif->index,1 ,1 ); +ide_unregister (hwif->index,0 ,0 );pci_disable_device (dev); }
drivers/ide/pci/scc_pata.c +1 -1
@@ -736,7 +736,7 @@ static void __devexit scc_remove(struct hwif->dmatable_cpu =NULL ; } -ide_unregister (hwif->index,1 ,1 ); +ide_unregister (hwif->index,0 ,0 ); hwif->chipset = ide_unknown;iounmap ((void *)ports->dma);
PATCH 6/22 ide: factor out code initializing devices from ide_init_port()
In reply to Bartlomiej Zolnierkiewicz* Factor out code initializing devices from ide_init_port() to ide_port_init_devices().
* Call the new function from ide_device_add_all().
There should be no functionality changes caused by this patch.
--- drivers/ide/ide-probe.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/ide/ide-probe.c +17 -15
@@ -1289,6 +1289,22 @@ static void hwif_register_devices(ide_hw } } +static void ide_port_init_devices (ide_hwif_t *hwif) +{ +int i; + +for (i =0 ; i <MAX_DRIVES ; i++) { +ide_drive_t *drive = &hwif->drives[i]; + +if (hwif->host_flags &IDE_HFLAG_IO_32BIT ) + drive->io_32bit =1 ; +if (hwif->host_flags &IDE_HFLAG_UNMASK_IRQS ) + drive->unmask =1 ; +if ((hwif->host_flags &IDE_HFLAG_NO_AUTOTUNE ) ==0 ) + drive->autotune =1 ; + } +} +static void ide_init_port (ide_hwif_t *hwif,unsigned int port,const struct ide_port_info *d) {
@@ -1314,16 +1330,6 @@ static void ide_init_port(ide_hwif_t *hwif ((d->host_flags &IDE_HFLAG_SERIALIZE ) && hwif->mate) hwif->mate->serialized = hwif->serialized =1 ; -if (d->host_flags &IDE_HFLAG_IO_32BIT ) { - hwif->drives[0 ].io_32bit =1 ; - hwif->drives[1 ].io_32bit =1 ; - } - -if (d->host_flags &IDE_HFLAG_UNMASK_IRQS ) { - hwif->drives[0 ].unmask =1 ; - hwif->drives[1 ].unmask =1 ; - } - hwif->swdma_mask = d->swdma_mask; hwif->mwdma_mask = d->mwdma_mask; hwif->ultra_mask = d->udma_mask;
@@ -1332,11 +1338,6 @@ static void ide_init_port(ide_hwif_t *hwif ((d->host_flags &&IDE_HFLAG_NO_DMA ) ==0 && hwif->dma_base ==0 ) hwif->swdma_mask = hwif->mwdma_mask = hwif->ultra_mask =0 ; -if ((d->host_flags &IDE_HFLAG_NO_AUTOTUNE ) ==0 ) { - hwif->drives[0 ].autotune =1 ; - hwif->drives[1 ].autotune =1 ; - } -if (d->host_flags &IDE_HFLAG_RQSIZE_256 ) hwif->rqsize =256 ;
@@ -1371,6 +1372,7 @@ int ide_device_add_all(u8 idx[MAX_HWIFS] mate = (i &1 ) ?NULL : hwif;ide_init_port (hwif, i &1 , d); +ide_port_init_devices (hwif); }for (i =0 ; i <MAX_HWIFS ; i++) {
PATCH 7/22 ide: add IDE_HFLAG_NO_{IO32_BIT,UNMASK_IRQS} host flags
In reply to Bartlomiej Zolnierkiewicz* Use the same bit for IDE_HFLAG_CS5520 and IDE_HFLAG_VDMA host flags (both are used only by cs5520 host driver currently).
* Add IDE_HFLAG_NO_IO32_BIT host flag and use it instead of ->no_io_32bit ide_hwif_t field.
* Add IDE_HFLAG_NO_UNMASK_IRQS host flag, then convert dtc2278 and rz1000 host drivers to use it.
There should be no functionality changes caused by this patch.
--- drivers/ide/ide-probe.c | 4 +++- drivers/ide/legacy/dtc2278.c | 10 +++------- drivers/ide/mips/au1xxx-ide.c | 3 +-- drivers/ide/pci/rz1000.c | 3 +-- include/linux/ide.h | 13 ++++++++----- 5 files changed, 16 insertions(+), 17 deletions(-)
drivers/ide/ide-probe.c +3 -1
@@ -822,7 +822,7 @@ static void ide_port_tune_devices(ide_hwfor (unit =0 ; unit <MAX_DRIVES ; ++unit) {ide_drive_t *drive = &hwif->drives[unit]; -if (hwif->no_io_32bit) +if (hwif->host_flags &IDE_HFLAG_NO_IO_32BIT ) drive->no_io_32bit =1 ;else drive->no_io_32bit = drive->id->dword_io ?1 :0 ;
@@ -1300,6 +1300,8 @@ static void ide_port_init_devices(ide_hw drive->io_32bit =1 ;if (hwif->host_flags &IDE_HFLAG_UNMASK_IRQS ) drive->unmask =1 ; +if (hwif->host_flags &IDE_HFLAG_NO_UNMASK_IRQS ) + drive->no_unmask =1 ;if ((hwif->host_flags &IDE_HFLAG_NO_AUTOTUNE ) ==0 ) drive->autotune =1 ; }
drivers/ide/legacy/dtc2278.c +3 -7
@@ -89,7 +89,10 @@ static void dtc2278_set_pio_mode(ide_dristatic const struct ide_port_info dtc2278_port_info__initdata = { .chipset = ide_dtc2278, .host_flags =IDE_HFLAG_SERIALIZE | +IDE_HFLAG_NO_UNMASK_IRQS |IDE_HFLAG_IO_32BIT | +/* disallow ->io_32bit changes */ +IDE_HFLAG_NO_IO_32BIT |IDE_HFLAG_NO_DMA |IDE_HFLAG_NO_AUTOTUNE , .pio_mask =ATA_PIO4 ,
@@ -125,14 +128,7 @@ static int __init dtc2278_probe(void)#endif local_irq_restore (flags); - hwif->no_io_32bit =1 ;/* disallow ->io_32bit changes */ hwif->set_pio_mode = &dtc2278_set_pio_mode; - hwif->drives[0 ].no_unmask =1 ; - hwif->drives[1 ].no_unmask =1 ; - - mate->no_io_32bit =1 ; - mate->drives[0 ].no_unmask =1 ; - mate->drives[1 ].no_unmask =1 ;ide_device_add (idx, &dtc2278_port_info);
drivers/ide/mips/au1xxx-ide.c +1 -2
@@ -551,6 +551,7 @@ static void auide_setup_ports(hw_regs_tstatic const struct ide_port_info au1xxx_port_info = { .host_flags =IDE_HFLAG_POST_SET_MODE |IDE_HFLAG_NO_DMA |/* no SFF-style DMA */ +IDE_HFLAG_NO_IO_32BIT |IDE_HFLAG_UNMASK_IRQS , .pio_mask =ATA_PIO4 , #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
@@ -649,8 +650,6 @@ static int au_ide_probe(struct device *d hwif->select_data =0 ;/* no chipset-specific code */ hwif->config_data =0 ;/* no chipset-specific code */ - hwif->no_io_32bit =1 ; - auide_hwif.hwif = hwif; hwif->hwif_data = &auide_hwif;
drivers/ide/pci/rz1000.c +1 -2
@@ -33,8 +33,7 @@ static void __devinit init_hwif_rz1000 ( }else {if (hwif->mate) hwif->mate->serialized = hwif->serialized =1 ; - hwif->drives[0 ].no_unmask =1 ; - hwif->drives[1 ].no_unmask =1 ; + hwif->host_flags |=IDE_HFLAG_NO_UNMASK_IRQS ;printk (KERN_INFO "%s: serialized, disabled unmasking " "(buggy RZ1000/RZ1001)\n" , hwif->name); }
include/linux/ide.h +8 -5
@@ -607,7 +607,6 @@ typedef struct hwif_s { unsigned reset : 1; /* reset after probe */ unsigned auto_poll : 1; /* supports nop auto-poll */ unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ - unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */ unsigned mmio : 1; /* host uses MMIO */struct device gendev;
@@ -1068,7 +1067,7 @@ enum {IDE_HFLAG_NO_SET_MODE = (1 <<9 ),/* trust BIOS for programming chipset/device for DMA */ IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 <<10 ), -/* host uses VDMA */ +/* host uses VDMA (tied with IDE_HFLAG_CS5520 for now) */ IDE_HFLAG_VDMA = (1 <<11 ),/* ATAPI DMA is unsupported */ IDE_HFLAG_NO_ATAPI_DMA = (1 << 12),
@@ -1078,8 +1077,10 @@ enum {IDE_HFLAG_NO_DMA = (1 <<14 ),/* check if host is PCI IDE device before allowing DMA */ IDE_HFLAG_NO_AUTODMA = (1 <<15 ), +/* don't autotune PIO */ +IDE_HFLAG_NO_AUTOTUNE = (1 <<16 ),/* host is CS5510/CS5520 */ -IDE_HFLAG_CS5520 = (1 <<16 ), +IDE_HFLAG_CS5520 =IDE_HFLAG_VDMA ,/* no LBA48 */ IDE_HFLAG_NO_LBA48 = (1 << 17),/* no LBA48 DMA */
@@ -1105,8 +1106,10 @@ enum {IDE_HFLAG_CLEAR_SIMPLEX = (1 <<28 ),/* DSC overlap is unsupported */ IDE_HFLAG_NO_DSC = (1 <<29 ), -/* don't autotune PIO */ - IDE_HFLAG_NO_AUTOTUNE = (1 << 30), +/* never use 32-bit I/O ops */ +IDE_HFLAG_NO_IO_32BIT = (1 <<30 ), +/* never unmask IRQs */ + IDE_HFLAG_NO_UNMASK_IRQS = (1 << 31), };#ifdef CONFIG_BLK_DEV_OFFBOARD
PATCH 8/22 ide: add ->init_port_devs method to ide_hwif_t
In reply to Bartlomiej Zolnierkiewicz* Add ->init_port_devs method to ide_hwif_t for a host specific initialization of devices on a port. Call the new method from ide_port_init_devices().
* Convert ht6560b, qd65xx and opti621 host drivers to use the new ->init_port_devs method.
There should be no functionality changes caused by this patch.
--- drivers/ide/ide-probe.c | 3 ++ drivers/ide/legacy/ht6560b.c | 26 +++++++++++++------------ drivers/ide/legacy/qd65xx.c | 44 ++++++++++++++++++++++++++++++++----------- drivers/ide/pci/opti621.c | 10 ++++++--- include/linux/ide.h | 2 + 5 files changed, 59 insertions(+), 26 deletions(-)
drivers/ide/ide-probe.c +3 -0
@@ -1305,6 +1305,9 @@ static void ide_port_init_devices(ide_hwif ((hwif->host_flags &IDE_HFLAG_NO_AUTOTUNE ) ==0 ) drive->autotune =1 ; } + +if (hwif->port_init_devs) + hwif->port_init_devs (hwif); } static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
drivers/ide/legacy/ht6560b.c +14 -12
@@ -300,6 +300,18 @@ static void ht6560b_set_pio_mode(ide_dri#endif } +static void __init ht6560b_port_init_devs (ide_hwif_t *hwif) +{ +/* Setting default configurations for drives. */ +int t = (HT_CONFIG_DEFAULT <<8 ) |HT_TIMING_DEFAULT ; + +if (hwif->channel) + t |= (HT_SECONDARY_IF <<8 ); + + hwif->drives[0 ].drive_data = t; + hwif->drives[1 ].drive_data = t; +} +int probe_ht6560b =0 ;module_param_named (probe, probe_ht6560b, bool,0 );
@@ -318,7 +330,6 @@ static int __init ht6560b_init(void) {ide_hwif_t *hwif, *mate;static u8 idx[4 ] = {0 ,1 ,0xff ,0xff }; -int t;if (probe_ht6560b ==0 )return -ENODEV ;
@@ -343,17 +354,8 @@ static int __init ht6560b_init(void) mate->selectproc = &ht6560b_selectproc; mate->set_pio_mode = &ht6560b_set_pio_mode; -/* -* Setting default configurations for drives -*/ - t = (HT_CONFIG_DEFAULT <<8 ); - t |=HT_TIMING_DEFAULT ; - hwif->drives[0 ].drive_data = t; - hwif->drives[1 ].drive_data = t; - - t |= (HT_SECONDARY_IF <<8 ); - mate->drives[0 ].drive_data = t; - mate->drives[1 ].drive_data = t; + hwif->port_init_devs = ht6560b_port_init_devs; + mate->port_init_devs = ht6560b_port_init_devs;ide_device_add (idx, &ht6560b_port_info);
drivers/ide/legacy/qd65xx.c +33 -11
77 lines not on this page · raw message
drivers/ide/pci/opti621.c +7 -3
@@ -315,14 +315,18 @@ static void opti621_set_pio_mode(ide_drispin_unlock_irqrestore (&opti621_lock, flags); } +static void __devinit opti621_port_init_devs (ide_hwif_t *hwif) +{ + hwif->drives[0 ].drive_data =PIO_DONT_KNOW ; + hwif->drives[1 ].drive_data =PIO_DONT_KNOW ; +} +/* * init_hwif_opti621() is called once for each hwif found at boot. */ static void __devinit init_hwif_opti621 (ide_hwif_t *hwif) { - hwif->drives[0 ].drive_data =PIO_DONT_KNOW ; - hwif->drives[1 ].drive_data =PIO_DONT_KNOW ; - + hwif->port_init_devs = opti621_port_init_devs; hwif->set_pio_mode = &opti621_set_pio_mode; }
include/linux/ide.h +2 -0
@@ -514,6 +514,8 @@ typedef struct hwif_s {#if 0 ide_hwif_ops_t *hwifops;#else +/* host specific initialization of devices on a port */ +void (*port_init_devs)(struct hwif_s *);/* routine to program host for PIO mode */ void (*set_pio_mode)(ide_drive_t *,const u8 );/* routine to program host for DMA mode */
PATCH 9/22 ide: remove incorrect init_gendisk() comment
In reply to Bartlomiej Zolnierkiewicz--- drivers/ide/ide-probe.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/ide/ide-probe.c +0 -6
@@ -1182,12 +1182,6 @@ static void drive_release_dev (struct decomplete (&drive->gendev_rel_comp); } -/* -* init_gendisk() (as opposed to ide_geninit) is called for each major device, -* after probing for drives, to allocate partition tables and other data -* structures needed for the routines in genhd.c. ide_geninit() gets called -* somewhat later, during the partition check. -*/ static void init_gendisk (ide_hwif_t *hwif) {unsigned int unit;
PATCH 10/22 ide: skip not present devices in init_gendisk()
In reply to Bartlomiej ZolnierkiewiczNo need to initialize drive->gendev and waste memory on IDE settings for not present devices.
--- drivers/ide/ide-probe.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/ide/ide-probe.c +4 -0
@@ -1194,6 +1194,10 @@ static void init_gendisk (ide_hwif_t *hwfor (unit =0 ; unit <MAX_DRIVES ; ++unit) {ide_drive_t * drive = &hwif->drives[unit]; + +if (!drive->present) +continue ; +ide_add_generic_settings (drive);snprintf (drive->gendev.bus_id,BUS_ID_SIZE ,"%u.%u" , hwif->index,unit);
PATCH 11/22 ide: move blk_register_region() call out from init_gendisk()
In reply to Bartlomiej ZolnierkiewiczMove blk_register_region() call out from init_gendisk() to hwif_init().
There should be no functionality changes caused by this patch.
--- drivers/ide/ide-probe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ide/ide-probe.c +2 -2
@@ -1200,8 +1200,6 @@ static void init_gendisk (ide_hwif_t *hw drive->gendev.driver_data = drive; drive->gendev.release = drive_release_dev; } -blk_register_region (MKDEV (hwif->major,0 ),MAX_DRIVES <<PARTN_BITS , -THIS_MODULE , ata_probe, ata_lock, hwif); }static int hwif_init (ide_hwif_t *hwif)
@@ -1261,6 +1259,8 @@ static int hwif_init(ide_hwif_t *hwif) done:init_gendisk (hwif); +blk_register_region (MKDEV (hwif->major,0 ),MAX_DRIVES <<PARTN_BITS , +THIS_MODULE , ata_probe, ata_lock, hwif);ide_acpi_init (hwif);return 1 ;
PATCH 12/22 ide: call init_gendisk() after ide_acpi_init()
In reply to Bartlomiej ZolnierkiewiczThere should be no functionality changes caused by this patch.
--- drivers/ide/ide-probe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ide/ide-probe.c +1 -1
@@ -1258,10 +1258,10 @@ static int hwif_init(ide_hwif_t *hwif) hwif->name, hwif->irq); done: -init_gendisk (hwif);blk_register_region (MKDEV (hwif->major,0 ),MAX_DRIVES <<PARTN_BITS ,THIS_MODULE , ata_probe, ata_lock, hwif);ide_acpi_init (hwif); +init_gendisk (hwif);return 1 ; out:
PATCH 13/22 ide: merge init_gendisk() into hwif_register_devices()
In reply to Bartlomiej ZolnierkiewiczThere should be no functionality changes caused by this patch.
--- drivers/ide/ide-probe.c | 44 ++++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 28 deletions(-)
drivers/ide/ide-probe.c +16 -28
@@ -1182,26 +1182,6 @@ static void drive_release_dev (struct decomplete (&drive->gendev_rel_comp); } -static void init_gendisk (ide_hwif_t *hwif) -{ -unsigned int unit; - -for (unit =0 ; unit <MAX_DRIVES ; ++unit) { -ide_drive_t * drive = &hwif->drives[unit]; - -if (!drive->present) -continue ; - -ide_add_generic_settings (drive); -snprintf (drive->gendev.bus_id,BUS_ID_SIZE ,"%u.%u" , - hwif->index,unit); - drive->gendev.parent = &hwif->gendev; - drive->gendev.bus = &ide_bus_type; - drive->gendev.driver_data = drive; - drive->gendev.release = drive_release_dev; - } -} -static int hwif_init (ide_hwif_t *hwif) {int old_irq;
@@ -1261,7 +1241,6 @@ done:blk_register_region (MKDEV (hwif->major,0 ),MAX_DRIVES <<PARTN_BITS ,THIS_MODULE , ata_probe, ata_lock, hwif);ide_acpi_init (hwif); -init_gendisk (hwif);return 1 ; out:
@@ -1275,15 +1254,24 @@ static void hwif_register_devices(ide_hwfor (i =0 ; i <MAX_DRIVES ; i++) {ide_drive_t *drive = &hwif->drives[i]; +struct device *dev = &drive->gendev; +int ret; -if (drive->present) { -int ret =device_register (&drive->gendev); +if (!drive->present) +continue ; -if (ret <0 ) -printk (KERN_WARNING "IDE: %s: " -"device_register error: %d\n" , - __FUNCTION__, ret); - } +ide_add_generic_settings (drive); + +snprintf (dev->bus_id,BUS_ID_SIZE ,"%u.%u" , hwif->index, i); + dev->parent = &hwif->gendev; + dev->bus = &ide_bus_type; + dev->driver_data = drive; + dev->release = drive_release_dev; + + ret =device_register (dev); +if (ret <0 ) +printk (KERN_WARNING "IDE: %s: device_register error: " +"%d\n" , __func__, ret); } }
PATCH 14/22 ide: move hwif->rqsize init from ide_init_queue() to init_irq()
In reply to Bartlomiej ZolnierkiewiczMove hwif->rqsize init from ide_init_queue() to init_irq().
There should be no functionality changes caused by this patch.
--- drivers/ide/ide-probe.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/ide/ide-probe.c +8 -7
@@ -881,13 +881,6 @@ static int ide_init_queue(ide_drive_t *d q->queuedata = drive;blk_queue_segment_boundary (q,0xffff ); -if (!hwif->rqsize) { -if ((hwif->host_flags &IDE_HFLAG_NO_LBA48 ) || - (hwif->host_flags &IDE_HFLAG_NO_LBA48_DMA )) - hwif->rqsize =256 ; -else - hwif->rqsize =65536 ; - }if (hwif->rqsize < max_sectors) max_sectors = hwif->rqsize;blk_queue_max_sectors (q, max_sectors);
@@ -1019,6 +1012,14 @@ static int init_irq (ide_hwif_t *hwif) goto out_unlink; } +if (!hwif->rqsize) { +if ((hwif->host_flags &IDE_HFLAG_NO_LBA48 ) || + (hwif->host_flags &IDE_HFLAG_NO_LBA48_DMA )) + hwif->rqsize =256 ; +else + hwif->rqsize =65536 ; + } +/* * For any present drive: * - allocate the block device queue
PATCH 15/22 ide: factor out adding drive to hwgroup from init_irq()
In reply to Bartlomiej ZolnierkiewiczFactor out adding drive to hwgroup from init_irq() to ide_add_drive_to_hwgroup().
There should be no functionality changes caused by this patch.
--- drivers/ide/ide-probe.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)
drivers/ide/ide-probe.c +18 -11
@@ -911,6 +911,23 @@ static int ide_init_queue(ide_drive_t *dreturn 0 ; } +static void ide_add_drive_to_hwgroup (ide_drive_t *drive) +{ +ide_hwgroup_t *hwgroup = drive->hwif->hwgroup; + +spin_lock_irq (&ide_lock); +if (!hwgroup->drive) { +/* first drive for hwgroup. */ + drive->next = drive; + hwgroup->drive = drive; + hwgroup->hwif =HWIF (hwgroup->drive); + }else { + drive->next = hwgroup->drive->next; + hwgroup->drive->next = drive; + } +spin_unlock_irq (&ide_lock); +} +/* * This routine sets up the irq for an ide interface, and creates a new * hwgroup for the irq/hwif if none was previously assigned.
@@ -1033,17 +1050,7 @@ static int init_irq (ide_hwif_t *hwif)printk (KERN_ERR "ide: failed to init %s\n" ,drive->name);continue ; } -spin_lock_irq (&ide_lock); -if (!hwgroup->drive) { -/* first drive for hwgroup. */ - drive->next = drive; - hwgroup->drive = drive; - hwgroup->hwif =HWIF (hwgroup->drive); - }else { - drive->next = hwgroup->drive->next; - hwgroup->drive->next = drive; - } -spin_unlock_irq (&ide_lock); +ide_add_drive_to_hwgroup (drive); }#if !defined(__mc68000__) && !defined(CONFIG_APUS )
PATCH 16/22 ide: factor out devices setup from init_irq()
In reply to Bartlomiej Zolnierkiewicz* Factor out devices setup from init_irq() to ide_port_setup_devices().
While at it:
* Do devices setup after printing port information.
--- drivers/ide/ide-probe.c | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-)
drivers/ide/ide-probe.c +28 -16
@@ -929,6 +929,31 @@ static void ide_add_drive_to_hwgroup(ide }/* +* For any present drive: +* - allocate the block device queue +* - link drive into the hwgroup +*/ +static void ide_port_setup_devices (ide_hwif_t *hwif) +{ +int i; + +for (i =0 ; i <MAX_DRIVES ; i++) { +ide_drive_t *drive = &hwif->drives[i]; + +if (!drive->present) +continue ; + +if (ide_init_queue (drive)) { +printk (KERN_ERR "ide: failed to init %s\n" , + drive->name); +continue ; + } + +ide_add_drive_to_hwgroup (drive); + } +} + +/* * This routine sets up the irq for an ide interface, and creates a new * hwgroup for the irq/hwif if none was previously assigned. *
@@ -1037,22 +1062,6 @@ static int init_irq (ide_hwif_t *hwif) hwif->rqsize =65536 ; } -/* -* For any present drive: -* - allocate the block device queue -* - link drive into the hwgroup -*/ -for (index =0 ; index <MAX_DRIVES ; ++index) { -ide_drive_t *drive = &hwif->drives[index]; -if (!drive->present) -continue ; -if (ide_init_queue (drive)) { -printk (KERN_ERR "ide: failed to init %s\n" ,drive->name); -continue ; - } -ide_add_drive_to_hwgroup (drive); - } -#if !defined(__mc68000__) && !defined(CONFIG_APUS ) printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name, hwif->io_ports[IDE_DATA_OFFSET],
@@ -1066,6 +1075,9 @@ static int init_irq (ide_hwif_t *hwif)printk (" (%sed with %s)" , hwif->sharing_irq ?"shar" :"serializ" , match->name);printk ("\n" ); + +ide_port_setup_devices (hwif); +mutex_unlock (&ide_cfg_mtx);return 0 ; out_unlink:
PATCH 17/22 ide: move ide_acpi_init() call to ide_device_add_all()
In reply to Bartlomiej ZolnierkiewiczThere should be no functionality changes caused by this patch.
--- drivers/ide/ide-probe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/ide/ide-probe.c +2 -1
@@ -1260,7 +1260,6 @@ static int hwif_init(ide_hwif_t *hwif) done:blk_register_region (MKDEV (hwif->major,0 ),MAX_DRIVES <<PARTN_BITS ,THIS_MODULE , ata_probe, ata_lock, hwif); -ide_acpi_init (hwif);return 1 ; out:
@@ -1429,6 +1428,8 @@ int ide_device_add_all(u8 idx[MAX_HWIFS] rc =-1 ;continue ; } + +ide_acpi_init (hwif); }for (i =0 ; i <MAX_HWIFS ; i++) {
PATCH 18/22 ide-acpi: remove needless exports
In reply to Bartlomiej Zolnierkiewicz--- drivers/ide/ide-acpi.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/ide/ide-acpi.c +0 -4
@@ -494,7 +494,6 @@ int ide_acpi_exec_tfs(ide_drive_t *drivereturn ret; } -EXPORT_SYMBOL_GPL (ide_acpi_exec_tfs);/** * ide_acpi_get_timing - get the channel (controller) timings
@@ -580,7 +579,6 @@ void ide_acpi_get_timing(ide_hwif_t *hwikfree (output.pointer); } -EXPORT_SYMBOL_GPL (ide_acpi_get_timing);/** * ide_acpi_push_timing - set the channel (controller) timings
@@ -634,7 +632,6 @@ void ide_acpi_push_timing(ide_hwif_t *hw }DEBPRINT ("_STM status: %d\n" , status); } -EXPORT_SYMBOL_GPL (ide_acpi_push_timing);/** * ide_acpi_set_state - set the channel power state
@@ -762,4 +759,3 @@ void ide_acpi_init(ide_hwif_t *hwif) } } } -EXPORT_SYMBOL_GPL (ide_acpi_init);
PATCH 19/22 ide-acpi: remove dead code from do_drive_get_GTF()
In reply to Bartlomiej ZolnierkiewiczThese pointers are always setup in ide_acpi_init().
--- drivers/ide/ide-acpi.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/ide/ide-acpi.c +0 -10
@@ -280,16 +280,6 @@ static int do_drive_get_GTF(ide_drive_t port = hwif->channel ? drive->dn -2 : drive->dn; -if (!drive->acpidata) { -if (port ==0 ) { - drive->acpidata = &hwif->acpidata->master; - hwif->acpidata->master.drive = drive; - }else { - drive->acpidata = &hwif->acpidata->slave; - hwif->acpidata->slave.drive = drive; - } - } -DEBPRINT ("ENTER: %s at %s, port#: %d, hard_port#: %d\n" , hwif->name, dev->bus_id, port, hwif->channel);
PATCH 20/22 ide: factor out devices setup from ide_acpi_init()
In reply to Bartlomiej Zolnierkiewicz* Factor out devices setup from ide_acpi_init() to ide_acpi_port_init_devices().
* Call ide_acpi_port_init_devices() in ide_device_add_all().
While at it:
* Remove no longer needed 'drive' field from struct ide_acpi_drive_link.
There should be no functionality changes caused by this patch.
--- drivers/ide/ide-acpi.c | 49 +++++++++++++++++++----------------------------- drivers/ide/ide-probe.c | 1 include/linux/ide.h | 2 + 3 files changed, 23 insertions(+), 29 deletions(-)
drivers/ide/ide-acpi.c +20 -29
@@ -39,7 +39,6 @@ struct GTM_buffer { };struct ide_acpi_drive_link { -ide_drive_t *drive;acpi_handle obj_handle;u8 idbuff[512 ]; };
@@ -675,11 +674,6 @@ void ide_acpi_set_state(ide_hwif_t *hwif*/ void ide_acpi_init (ide_hwif_t *hwif) { -int unit; -int err; -struct ide_acpi_drive_link *master; -struct ide_acpi_drive_link *slave; -ide_acpi_blacklist (); hwif->acpidata =kzalloc (sizeof (struct ide_acpi_hwif_link ),GFP_KERNEL );
@@ -691,40 +685,38 @@ void ide_acpi_init(ide_hwif_t *hwif)DEBPRINT ("no ACPI object for %s found\n" , hwif->name);kfree (hwif->acpidata); hwif->acpidata =NULL ; -return ; } +} + +void ide_acpi_port_init_devices (ide_hwif_t *hwif) +{ +ide_drive_t *drive; +int i, err; + +if (hwif->acpidata ==NULL ) +return ;/* * The ACPI spec mandates that we send information * for both drives, regardless whether they are connected * or not. */ - hwif->acpidata->master.drive = &hwif->drives[0 ]; hwif->drives[0 ].acpidata = &hwif->acpidata->master; - master = &hwif->acpidata->master; - - hwif->acpidata->slave.drive = &hwif->drives[1 ]; hwif->drives[1 ].acpidata = &hwif->acpidata->slave; - slave = &hwif->acpidata->slave; -/* * Send IDENTIFY for each drive */ -if (master->drive->present) { - err =taskfile_lib_get_identify (master->drive, master->idbuff); -if (err) { -DEBPRINT ("identify device %s failed (%d)\n" , - master->drive->name, err); - } - } +for (i =0 ; i <MAX_DRIVES ; i++) { + drive = &hwif->drives[i]; + +if (!drive->present) +continue ; -if (slave->drive->present) { - err =taskfile_lib_get_identify (slave->drive, slave->idbuff); -if (err) { + err =taskfile_lib_get_identify (drive, drive->acpidata->idbuff); +if (err)DEBPRINT ("identify device %s failed (%d)\n" , - slave->drive->name, err); - } + drive->name, err); }if (ide_noacpionboot) {
@@ -740,12 +732,11 @@ void ide_acpi_init(ide_hwif_t *hwif)ide_acpi_get_timing (hwif);ide_acpi_push_timing (hwif); -for (unit =0 ; unit <MAX_DRIVES ; ++unit) { -ide_drive_t *drive = &hwif->drives[unit]; +for (i =0 ; i <MAX_DRIVES ; i++) { + drive = &hwif->drives[i]; -if (drive->present) { +if (drive->present)/* Execute ACPI startup code */ ide_acpi_exec_tfs (drive); - } } }
drivers/ide/ide-probe.c +1 -0
@@ -1430,6 +1430,7 @@ int ide_device_add_all(u8 idx[MAX_HWIFS] }ide_acpi_init (hwif); +ide_acpi_port_init_devices (hwif); }for (i =0 ; i <MAX_HWIFS ; i++) {
include/linux/ide.h +2 -0
@@ -1205,12 +1205,14 @@ extern int ide_acpi_exec_tfs(ide_drive_textern void ide_acpi_get_timing (ide_hwif_t *hwif);extern void ide_acpi_push_timing (ide_hwif_t *hwif);extern void ide_acpi_init (ide_hwif_t *hwif); +void ide_acpi_port_init_devices (ide_hwif_t *);extern void ide_acpi_set_state (ide_hwif_t *hwif,int on);#else static inline int ide_acpi_exec_tfs (ide_drive_t *drive) {return 0 ; }static inline void ide_acpi_get_timing (ide_hwif_t *hwif) { ; }static inline void ide_acpi_push_timing (ide_hwif_t *hwif) { ; }static inline void ide_acpi_init (ide_hwif_t *hwif) { ; } +static inline void ide_acpi_port_init_devices (ide_hwif_t *hwif) { ; }static inline void ide_acpi_set_state (ide_hwif_t *hwif,int on) {}#endif
PATCH 21/22 ide: move hwif->present check out from ide_proc_register_port()
In reply to Bartlomiej ZolnierkiewiczMove hwif->present check out from ide_proc_register_port() to ide_device_add_all().
There should be no functionality changes caused by this patch.
--- drivers/ide/ide-probe.c | 9 +++++++-- drivers/ide/ide-proc.c | 3 --- 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/ide/ide-probe.c +7 -2
@@ -1448,8 +1448,13 @@ int ide_device_add_all(u8 idx[MAX_HWIFS] }for (i =0 ; i <MAX_HWIFS ; i++) { -if (idx[i] !=0xff ) -ide_proc_register_port (&ide_hwifs[idx[i]]); +if (idx[i] ==0xff ) +continue ; + + hwif = &ide_hwifs[idx[i]]; + +if (hwif->present) +ide_proc_register_port (hwif); }return rc;
drivers/ide/ide-proc.c +0 -3
@@ -793,9 +793,6 @@ static ide_proc_entry_t hwif_entries[] =void ide_proc_register_port (ide_hwif_t *hwif) { -if (!hwif->present) -return ; -if (!hwif->proc) { hwif->proc =proc_mkdir (hwif->name, proc_ide_root);
PATCH 22/22 ide: move create_proc_ide_drives() call to ide_device_add_all()
In reply to Bartlomiej Zolnierkiewicz* Un-static create_proc_ide_drives() and call it from ide_device_add_all().
While at it:
* Rename create_proc_ide_drives() to ide_proc_port_register_devices().
--- drivers/ide/ide-probe.c | 4 +++- drivers/ide/ide-proc.c | 4 +--- include/linux/ide.h | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-)
drivers/ide/ide-probe.c +3 -1
@@ -1453,8 +1453,10 @@ int ide_device_add_all(u8 idx[MAX_HWIFS] hwif = &ide_hwifs[idx[i]]; -if (hwif->present) +if (hwif->present) {ide_proc_register_port (hwif); +ide_proc_port_register_devices (hwif); + } }return rc;
drivers/ide/ide-proc.c +1 -3
@@ -739,7 +739,7 @@ void ide_proc_unregister_driver(ide_drivEXPORT_SYMBOL (ide_proc_unregister_driver); -static void create_proc_ide_drives (ide_hwif_t *hwif) +void ide_proc_port_register_devices (ide_hwif_t *hwif) {int d;struct proc_dir_entry *ent;
@@ -801,8 +801,6 @@ void ide_proc_register_port(ide_hwif_t *ide_add_proc_entries (hwif->proc, hwif_entries, hwif); } - -create_proc_ide_drives (hwif); }#ifdef CONFIG_BLK_DEV_IDEPCI
include/linux/ide.h +2 -0
@@ -715,6 +715,7 @@ typedef struct {void proc_ide_create (void );void proc_ide_destroy (void );void ide_proc_register_port (ide_hwif_t *); +void ide_proc_port_register_devices (ide_hwif_t *);void ide_proc_unregister_port (ide_hwif_t *);void ide_proc_register_driver (ide_drive_t *,ide_driver_t *);void ide_proc_unregister_driver (ide_drive_t *,ide_driver_t *);
@@ -747,6 +748,7 @@ void ide_pci_create_host_proc(const charstatic inline void proc_ide_create (void ) { ; }static inline void proc_ide_destroy (void ) { ; }static inline void ide_proc_register_port (ide_hwif_t *hwif) { ; } +static inline void ide_proc_port_register_devices (ide_hwif_t *hwif) { ; }static inline void ide_proc_unregister_port (ide_hwif_t *hwif) { ; }static inline void ide_proc_register_driver (ide_drive_t *drive,ide_driver_t *driver) { ; }static inline void ide_proc_unregister_driver (ide_drive_t *drive,ide_driver_t *driver) { ; }