* [PATCH 2/9] ide: set hwif->dev in ide_init_port_hw()
2008-06-02 20:22 [PATCH 1/9] ide: fix host drivers missing hwif->chipset initialization Bartlomiej Zolnierkiewicz
@ 2008-06-02 20:23 ` Bartlomiej Zolnierkiewicz
2008-06-02 20:23 ` [PATCH 3/9] delkin_cb: set proper hwif->gendev.parent value Bartlomiej Zolnierkiewicz
` (6 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-06-02 20:23 UTC (permalink / raw)
To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel
* Add 'parent' field to hw_regs_t for optional parent device pointer (needed
by macio PMAC IDE controllers) and set hwif->dev in ide_init_port_hw().
* Update au1xxx-ide.c, sgiioc4.c, pmac.c and setup-pci.c accordingly.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/ide.c | 3 ++-
drivers/ide/mips/au1xxx-ide.c | 2 --
drivers/ide/pci/sgiioc4.c | 2 --
drivers/ide/ppc/pmac.c | 6 ++----
drivers/ide/setup-pci.c | 2 --
include/linux/ide.h | 2 +-
6 files changed, 5 insertions(+), 12 deletions(-)
Index: b/drivers/ide/ide.c
===================================================================
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -297,7 +297,8 @@ void ide_init_port_hw(ide_hwif_t *hwif,
memcpy(&hwif->io_ports, &hw->io_ports, sizeof(hwif->io_ports));
hwif->irq = hw->irq;
hwif->chipset = hw->chipset;
- hwif->gendev.parent = hw->dev;
+ hwif->dev = hw->dev;
+ hwif->gendev.parent = hw->parent ? hw->parent : hw->dev;
hwif->ack_intr = hw->ack_intr;
}
EXPORT_SYMBOL_GPL(ide_init_port_hw);
Index: b/drivers/ide/mips/au1xxx-ide.c
===================================================================
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -600,8 +600,6 @@ static int au_ide_probe(struct device *d
ide_init_port_hw(hwif, &hw);
- hwif->dev = dev;
-
/* If the user has selected DDMA assisted copies,
then set up a few local I/O function entry points
*/
Index: b/drivers/ide/pci/sgiioc4.c
===================================================================
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -625,8 +625,6 @@ sgiioc4_ide_setup_pci_device(struct pci_
hw.dev = &dev->dev;
ide_init_port_hw(hwif, &hw);
- hwif->dev = &dev->dev;
-
/* The IOC4 uses MMIO rather than Port IO. */
default_hwif_mmiops(hwif);
Index: b/drivers/ide/ppc/pmac.c
===================================================================
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1144,8 +1144,6 @@ pmac_ide_macio_attach(struct macio_dev *
base = ioremap(macio_resource_start(mdev, 0), 0x400);
regbase = (unsigned long) base;
- hwif->dev = &mdev->bus->pdev->dev;
-
pmif->mdev = mdev;
pmif->node = mdev->ofdev.node;
pmif->regbase = regbase;
@@ -1167,7 +1165,8 @@ pmac_ide_macio_attach(struct macio_dev *
memset(&hw, 0, sizeof(hw));
pmac_ide_init_ports(&hw, pmif->regbase);
hw.irq = irq;
- hw.dev = &mdev->ofdev.dev;
+ hw.dev = &mdev->bus->pdev->dev;
+ hw.parent = &mdev->ofdev.dev;
rc = pmac_ide_setup_device(pmif, hwif, &hw);
if (rc != 0) {
@@ -1267,7 +1266,6 @@ pmac_ide_pci_attach(struct pci_dev *pdev
goto out_free_pmif;
}
- hwif->dev = &pdev->dev;
pmif->mdev = NULL;
pmif->node = np;
Index: b/drivers/ide/setup-pci.c
===================================================================
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -346,8 +346,6 @@ static ide_hwif_t *ide_hwif_configure(st
ide_init_port_hw(hwif, &hw);
- hwif->dev = &dev->dev;
-
return hwif;
}
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -171,7 +171,7 @@ typedef struct hw_regs_s {
int irq; /* our irq number */
ide_ack_intr_t *ack_intr; /* acknowledge interrupt */
hwif_chipset_t chipset;
- struct device *dev;
+ struct device *dev, *parent;
} hw_regs_t;
void ide_init_port_data(struct hwif_s *, unsigned int);
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 3/9] delkin_cb: set proper hwif->gendev.parent value
2008-06-02 20:22 [PATCH 1/9] ide: fix host drivers missing hwif->chipset initialization Bartlomiej Zolnierkiewicz
2008-06-02 20:23 ` [PATCH 2/9] ide: set hwif->dev in ide_init_port_hw() Bartlomiej Zolnierkiewicz
@ 2008-06-02 20:23 ` Bartlomiej Zolnierkiewicz
2008-06-04 9:41 ` Sergei Shtylyov
2008-06-02 20:23 ` [PATCH 4/9] delkin_cb: use struct ide_port_info Bartlomiej Zolnierkiewicz
` (5 subsequent siblings)
7 siblings, 1 reply; 12+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-06-02 20:23 UTC (permalink / raw)
To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel
hwif->dev was set too late (after ide_device_add() call)
so hwif->gendev.parent was not initialized properly.
Fix it by setting hw.dev and letting ide_init_port_hw()
do the rest.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/pci/delkin_cb.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: b/drivers/ide/pci/delkin_cb.c
===================================================================
--- a/drivers/ide/pci/delkin_cb.c
+++ b/drivers/ide/pci/delkin_cb.c
@@ -79,6 +79,7 @@ delkin_cb_probe (struct pci_dev *dev, co
memset(&hw, 0, sizeof(hw));
ide_std_init_ports(&hw, base + 0x10, base + 0x1e);
hw.irq = dev->irq;
+ hw.dev = &dev->dev;
hw.chipset = ide_pci; /* this enables IRQ sharing */
hwif = ide_find_port();
@@ -98,7 +99,7 @@ delkin_cb_probe (struct pci_dev *dev, co
goto out_disable;
pci_set_drvdata(dev, hwif);
- hwif->dev = &dev->dev;
+
drive = &hwif->drives[0];
if (drive->present) {
drive->io_32bit = 1;
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 4/9] delkin_cb: use struct ide_port_info
2008-06-02 20:22 [PATCH 1/9] ide: fix host drivers missing hwif->chipset initialization Bartlomiej Zolnierkiewicz
2008-06-02 20:23 ` [PATCH 2/9] ide: set hwif->dev in ide_init_port_hw() Bartlomiej Zolnierkiewicz
2008-06-02 20:23 ` [PATCH 3/9] delkin_cb: set proper hwif->gendev.parent value Bartlomiej Zolnierkiewicz
@ 2008-06-02 20:23 ` Bartlomiej Zolnierkiewicz
2008-06-02 20:23 ` [PATCH 5/9] delkin_cb: add warm-plug support Bartlomiej Zolnierkiewicz
` (4 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-06-02 20:23 UTC (permalink / raw)
To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel
Convert the driver to use struct ide_port_info - as a nice side-effect
this fixes racy setup of ->io_32bit/unmask settings (after ide_device_add()
call device can be already in use).
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/pci/delkin_cb.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
Index: b/drivers/ide/pci/delkin_cb.c
===================================================================
--- a/drivers/ide/pci/delkin_cb.c
+++ b/drivers/ide/pci/delkin_cb.c
@@ -47,13 +47,18 @@ static const struct ide_port_ops delkin_
.quirkproc = ide_undecoded_slave,
};
+static const struct ide_port_info delkin_cb_port_info = {
+ .port_ops = &delkin_cb_port_ops,
+ .host_flags = IDE_HFLAG_IO_32BIT | IDE_HFLAG_UNMASK_IRQS |
+ IDE_HFLAG_NO_DMA,
+};
+
static int __devinit
delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
{
unsigned long base;
hw_regs_t hw;
ide_hwif_t *hwif = NULL;
- ide_drive_t *drive;
int i, rc;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
@@ -89,22 +94,16 @@ delkin_cb_probe (struct pci_dev *dev, co
i = hwif->index;
ide_init_port_hw(hwif, &hw);
- hwif->port_ops = &delkin_cb_port_ops;
idx[0] = i;
- ide_device_add(idx, NULL);
+ ide_device_add(idx, &delkin_cb_port_info);
if (!hwif->present)
goto out_disable;
pci_set_drvdata(dev, hwif);
- drive = &hwif->drives[0];
- if (drive->present) {
- drive->io_32bit = 1;
- drive->unmask = 1;
- }
return 0;
out_disable:
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 5/9] delkin_cb: add warm-plug support
2008-06-02 20:22 [PATCH 1/9] ide: fix host drivers missing hwif->chipset initialization Bartlomiej Zolnierkiewicz
` (2 preceding siblings ...)
2008-06-02 20:23 ` [PATCH 4/9] delkin_cb: use struct ide_port_info Bartlomiej Zolnierkiewicz
@ 2008-06-02 20:23 ` Bartlomiej Zolnierkiewicz
2008-06-02 20:23 ` [PATCH 6/9] delkin_cb: add missing __init/__exit tags Bartlomiej Zolnierkiewicz
` (3 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-06-02 20:23 UTC (permalink / raw)
To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel
Don't fail the probe if there are no devices attached to the controller.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/pci/delkin_cb.c | 4 ----
1 file changed, 4 deletions(-)
Index: b/drivers/ide/pci/delkin_cb.c
===================================================================
--- a/drivers/ide/pci/delkin_cb.c
+++ b/drivers/ide/pci/delkin_cb.c
@@ -99,15 +99,11 @@ delkin_cb_probe (struct pci_dev *dev, co
ide_device_add(idx, &delkin_cb_port_info);
- if (!hwif->present)
- goto out_disable;
-
pci_set_drvdata(dev, hwif);
return 0;
out_disable:
- printk(KERN_ERR "delkin_cb: no IDE devices found\n");
pci_release_regions(dev);
pci_disable_device(dev);
return -ENODEV;
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 6/9] delkin_cb: add missing __init/__exit tags
2008-06-02 20:22 [PATCH 1/9] ide: fix host drivers missing hwif->chipset initialization Bartlomiej Zolnierkiewicz
` (3 preceding siblings ...)
2008-06-02 20:23 ` [PATCH 5/9] delkin_cb: add warm-plug support Bartlomiej Zolnierkiewicz
@ 2008-06-02 20:23 ` Bartlomiej Zolnierkiewicz
2008-06-04 9:42 ` Sergei Shtylyov
2008-06-02 20:23 ` [PATCH 7/9] au1xxx-ide: don't use hwif->hwif_data Bartlomiej Zolnierkiewicz
` (2 subsequent siblings)
7 siblings, 1 reply; 12+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-06-02 20:23 UTC (permalink / raw)
To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/pci/delkin_cb.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
Index: b/drivers/ide/pci/delkin_cb.c
===================================================================
--- a/drivers/ide/pci/delkin_cb.c
+++ b/drivers/ide/pci/delkin_cb.c
@@ -134,14 +134,12 @@ static struct pci_driver driver = {
.remove = delkin_cb_remove,
};
-static int
-delkin_cb_init (void)
+static int __init delkin_cb_init(void)
{
return pci_register_driver(&driver);
}
-static void
-delkin_cb_exit (void)
+static void __exit delkin_cb_exit(void)
{
pci_unregister_driver(&driver);
}
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 7/9] au1xxx-ide: don't use hwif->hwif_data
2008-06-02 20:22 [PATCH 1/9] ide: fix host drivers missing hwif->chipset initialization Bartlomiej Zolnierkiewicz
` (4 preceding siblings ...)
2008-06-02 20:23 ` [PATCH 6/9] delkin_cb: add missing __init/__exit tags Bartlomiej Zolnierkiewicz
@ 2008-06-02 20:23 ` Bartlomiej Zolnierkiewicz
2008-06-04 9:43 ` Sergei Shtylyov
2008-06-02 20:23 ` [PATCH 8/9] ide_4drives: use struct ide_port_info Bartlomiej Zolnierkiewicz
2008-06-02 20:24 ` [PATCH 9/9] ide-cs: " Bartlomiej Zolnierkiewicz
7 siblings, 1 reply; 12+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-06-02 20:23 UTC (permalink / raw)
To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel
* Use &auide_hwif directly instead of using hwif->hwif_data.
While at it:
* No need to initialize hwif->{select,config}_data.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/mips/au1xxx-ide.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
Index: b/drivers/ide/mips/au1xxx-ide.c
===================================================================
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -213,10 +213,8 @@ static int auide_build_dmatable(ide_driv
{
int i, iswrite, count = 0;
ide_hwif_t *hwif = HWIF(drive);
-
struct request *rq = HWGROUP(drive)->rq;
-
- _auide_hwif *ahwif = (_auide_hwif*)hwif->hwif_data;
+ _auide_hwif *ahwif = &auide_hwif;
struct scatterlist *sg;
iswrite = (rq_data_dir(rq) == WRITE);
@@ -402,7 +400,7 @@ static const struct ide_dma_ops au1xxx_d
static int auide_ddma_init(ide_hwif_t *hwif, const struct ide_port_info *d)
{
- _auide_hwif *auide = (_auide_hwif *)hwif->hwif_data;
+ _auide_hwif *auide = &auide_hwif;
dbdev_tab_t source_dev_tab, target_dev_tab;
u32 dev_id, tsize, devwidth, flags;
@@ -463,7 +461,7 @@ static int auide_ddma_init(ide_hwif_t *h
#else
static int auide_ddma_init(ide_hwif_t *hwif, const struct ide_port_info *d)
{
- _auide_hwif *auide = (_auide_hwif *)hwif->hwif_data;
+ _auide_hwif *auide = &auide_hwif;
dbdev_tab_t source_dev_tab;
int flags;
@@ -608,11 +606,8 @@ static int au_ide_probe(struct device *d
hwif->input_data = au1xxx_input_data;
hwif->output_data = au1xxx_output_data;
#endif
- hwif->select_data = 0; /* no chipset-specific code */
- hwif->config_data = 0; /* no chipset-specific code */
auide_hwif.hwif = hwif;
- hwif->hwif_data = &auide_hwif;
idx[0] = hwif->index;
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 8/9] ide_4drives: use struct ide_port_info
2008-06-02 20:22 [PATCH 1/9] ide: fix host drivers missing hwif->chipset initialization Bartlomiej Zolnierkiewicz
` (5 preceding siblings ...)
2008-06-02 20:23 ` [PATCH 7/9] au1xxx-ide: don't use hwif->hwif_data Bartlomiej Zolnierkiewicz
@ 2008-06-02 20:23 ` Bartlomiej Zolnierkiewicz
2008-06-02 20:24 ` [PATCH 9/9] ide-cs: " Bartlomiej Zolnierkiewicz
7 siblings, 0 replies; 12+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-06-02 20:23 UTC (permalink / raw)
To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel
Convert the driver to use struct ide_port_info - as a nice side-effect
this fixes hwif->channel initialization.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/legacy/ide-4drives.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
Index: b/drivers/ide/legacy/ide-4drives.c
===================================================================
--- a/drivers/ide/legacy/ide-4drives.c
+++ b/drivers/ide/legacy/ide-4drives.c
@@ -11,6 +11,23 @@ static int probe_4drives;
module_param_named(probe, probe_4drives, bool, 0);
MODULE_PARM_DESC(probe, "probe for generic IDE chipset with 4 drives/port");
+static void ide_4drives_port_init_devs(ide_hwif_t *hwif)
+{
+ if (hwif->channel) {
+ hwif->drives[0].select.all ^= 0x20;
+ hwif->drives[1].select.all ^= 0x20;
+ }
+}
+
+static const struct ide_port_ops ide_4drives_port_ops = {
+ .port_init_devs = ide_4drives_port_init_devs,
+};
+
+static const struct ide_port_info ide_4drives_port_info = {
+ .port_ops = &ide_4drives_port_ops,
+ .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA,
+};
+
static int __init ide_4drives_init(void)
{
ide_hwif_t *hwif, *mate;
@@ -49,18 +66,10 @@ static int __init ide_4drives_init(void)
mate = ide_find_port();
if (mate) {
ide_init_port_hw(mate, &hw);
- mate->drives[0].select.all ^= 0x20;
- mate->drives[1].select.all ^= 0x20;
idx[1] = mate->index;
-
- if (hwif) {
- hwif->mate = mate;
- mate->mate = hwif;
- hwif->serialized = mate->serialized = 1;
- }
}
- ide_device_add(idx, NULL);
+ ide_device_add(idx, &ide_4drives_port_info);
return 0;
}
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 9/9] ide-cs: use struct ide_port_info
2008-06-02 20:22 [PATCH 1/9] ide: fix host drivers missing hwif->chipset initialization Bartlomiej Zolnierkiewicz
` (6 preceding siblings ...)
2008-06-02 20:23 ` [PATCH 8/9] ide_4drives: use struct ide_port_info Bartlomiej Zolnierkiewicz
@ 2008-06-02 20:24 ` Bartlomiej Zolnierkiewicz
7 siblings, 0 replies; 12+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-06-02 20:24 UTC (permalink / raw)
To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel
Convert the driver to use struct ide_port_info.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ide/legacy/ide-cs.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Index: b/drivers/ide/legacy/ide-cs.c
===================================================================
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -150,6 +150,11 @@ static const struct ide_port_ops idecs_p
.quirkproc = ide_undecoded_slave,
};
+static const struct ide_port_info idecs_port_info = {
+ .port_ops = &idecs_port_ops,
+ .host_flags = IDE_HFLAG_NO_DMA,
+};
+
static ide_hwif_t *idecs_register(unsigned long io, unsigned long ctl,
unsigned long irq, struct pcmcia_device *handle)
{
@@ -184,11 +189,10 @@ static ide_hwif_t *idecs_register(unsign
i = hwif->index;
ide_init_port_hw(hwif, &hw);
- hwif->port_ops = &idecs_port_ops;
idx[0] = i;
- ide_device_add(idx, NULL);
+ ide_device_add(idx, &idecs_port_info);
if (hwif->present)
return hwif;
^ permalink raw reply [flat|nested] 12+ messages in thread