ide: print message on error in ide_find_port_slot()

* Add DRV_NAME define to ide-h8300.c.

* Fix ide-h8300.c, swarm.c and sgiioc4.c to set .name field in
  struct ide_port_info to DRV_NAME, then convert these host drivers
  to use ide_find_port_slot() instead of ide_find_port().

* Print message on error in ide_find_port_slot().
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 7b60fa16
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
#define DRV_NAME "ide-h8300"
#define bswap(d) \ #define bswap(d) \
({ \ ({ \
u16 r; \ u16 r; \
...@@ -196,11 +198,9 @@ static int __init h8300_ide_init(void) ...@@ -196,11 +198,9 @@ static int __init h8300_ide_init(void)
hw_setup(&hw); hw_setup(&hw);
hwif = ide_find_port(); hwif = ide_find_port_slot(&h8300_port_info);
if (hwif == NULL) { if (hwif == NULL)
printk(KERN_ERR "ide-h8300: IDE I/F register failed\n");
return -ENOENT; return -ENOENT;
}
index = hwif->index; index = hwif->index;
ide_init_port_hw(hwif, &hw); ide_init_port_hw(hwif, &hw);
......
...@@ -1490,6 +1490,9 @@ ide_hwif_t *ide_find_port_slot(const struct ide_port_info *d) ...@@ -1490,6 +1490,9 @@ ide_hwif_t *ide_find_port_slot(const struct ide_port_info *d)
} }
} }
printk(KERN_ERR "%s: no free slot for interface\n",
d ? d->name : "ide");
return NULL; return NULL;
out_found: out_found:
......
...@@ -62,6 +62,7 @@ static struct resource swarm_ide_resource = { ...@@ -62,6 +62,7 @@ static struct resource swarm_ide_resource = {
static struct platform_device *swarm_ide_dev; static struct platform_device *swarm_ide_dev;
static const struct ide_port_info swarm_port_info = { static const struct ide_port_info swarm_port_info = {
.name = DRV_NAME,
.host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
}; };
...@@ -81,11 +82,9 @@ static int __devinit swarm_ide_probe(struct device *dev) ...@@ -81,11 +82,9 @@ static int __devinit swarm_ide_probe(struct device *dev)
if (!SIBYTE_HAVE_IDE) if (!SIBYTE_HAVE_IDE)
return -ENODEV; return -ENODEV;
hwif = ide_find_port(); hwif = ide_find_port_slot(&swarm_port_info);
if (hwif == NULL) { if (hwif == NULL)
printk(KERN_ERR DRV_NAME ": no free slot for interface\n");
return -ENOMEM; return -ENOMEM;
}
base = ioremap(A_IO_EXT_BASE, 0x800); base = ioremap(A_IO_EXT_BASE, 0x800);
offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS)); offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS));
......
...@@ -558,12 +558,9 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev, ...@@ -558,12 +558,9 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev,
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
int i; int i;
hwif = ide_find_port(); hwif = ide_find_port_slot(d);
if (hwif == NULL) { if (hwif == NULL)
printk(KERN_ERR "%s: too many IDE interfaces, "
"no room in table\n", SCC_PATA_NAME);
return -ENOMEM; return -ENOMEM;
}
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
for (i = 0; i <= 8; i++) for (i = 0; i <= 8; i++)
......
...@@ -568,6 +568,7 @@ static const struct ide_dma_ops sgiioc4_dma_ops = { ...@@ -568,6 +568,7 @@ static const struct ide_dma_ops sgiioc4_dma_ops = {
}; };
static const struct ide_port_info sgiioc4_port_info __devinitdata = { static const struct ide_port_info sgiioc4_port_info __devinitdata = {
.name = DRV_NAME,
.chipset = ide_pci, .chipset = ide_pci,
.init_dma = ide_dma_sgiioc4, .init_dma = ide_dma_sgiioc4,
.port_ops = &sgiioc4_port_ops, .port_ops = &sgiioc4_port_ops,
...@@ -587,12 +588,9 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev) ...@@ -587,12 +588,9 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
hw_regs_t hw; hw_regs_t hw;
struct ide_port_info d = sgiioc4_port_info; struct ide_port_info d = sgiioc4_port_info;
hwif = ide_find_port(); hwif = ide_find_port_slot(&d);
if (hwif == NULL) { if (hwif == NULL)
printk(KERN_ERR "%s: too many IDE interfaces, no room in table\n",
DRV_NAME);
return -ENOMEM; return -ENOMEM;
}
/* Get the CmdBlk and CtrlBlk Base Registers */ /* Get the CmdBlk and CtrlBlk Base Registers */
bar0 = pci_resource_start(dev, 0); bar0 = pci_resource_start(dev, 0);
......
...@@ -332,11 +332,8 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ...@@ -332,11 +332,8 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
} }
hwif = ide_find_port_slot(d); hwif = ide_find_port_slot(d);
if (hwif == NULL) { if (hwif == NULL)
printk(KERN_ERR "%s: too many IDE interfaces, no room in "
"table\n", d->name);
return NULL; return NULL;
}
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
hw.irq = irq; hw.irq = irq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment