Skip to content

Commit eb3aff5

Browse files
committed
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: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
1 parent 7b60fa1 commit eb3aff5

6 files changed

Lines changed: 16 additions & 22 deletions

File tree

‎drivers/ide/h8300/ide-h8300.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include <asm/io.h>
99
#include <asm/irq.h>
1010

11+
#define DRV_NAME "ide-h8300"
12+
1113
#define bswap(d) \
1214
({ \
1315
u16 r; \
@@ -196,11 +198,9 @@ static int __init h8300_ide_init(void)
196198

197199
hw_setup(&hw);
198200

199-
hwif = ide_find_port();
200-
if (hwif == NULL) {
201-
printk(KERN_ERR "ide-h8300: IDE I/F register failed\n");
201+
hwif = ide_find_port_slot(&h8300_port_info);
202+
if (hwif == NULL)
202203
return -ENOENT;
203-
}
204204

205205
index = hwif->index;
206206
ide_init_port_hw(hwif, &hw);

‎drivers/ide/ide-probe.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,6 +1490,9 @@ ide_hwif_t *ide_find_port_slot(const struct ide_port_info *d)
14901490
}
14911491
}
14921492

1493+
printk(KERN_ERR "%s: no free slot for interface\n",
1494+
d ? d->name : "ide");
1495+
14931496
return NULL;
14941497

14951498
out_found:

‎drivers/ide/mips/swarm.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static struct resource swarm_ide_resource = {
6262
static struct platform_device *swarm_ide_dev;
6363

6464
static const struct ide_port_info swarm_port_info = {
65+
.name = DRV_NAME,
6566
.host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
6667
};
6768

@@ -81,11 +82,9 @@ static int __devinit swarm_ide_probe(struct device *dev)
8182
if (!SIBYTE_HAVE_IDE)
8283
return -ENODEV;
8384

84-
hwif = ide_find_port();
85-
if (hwif == NULL) {
86-
printk(KERN_ERR DRV_NAME ": no free slot for interface\n");
85+
hwif = ide_find_port_slot(&swarm_port_info);
86+
if (hwif == NULL)
8787
return -ENOMEM;
88-
}
8988

9089
base = ioremap(A_IO_EXT_BASE, 0x800);
9190
offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS));

‎drivers/ide/pci/scc_pata.c‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -558,12 +558,9 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev,
558558
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
559559
int i;
560560

561-
hwif = ide_find_port();
562-
if (hwif == NULL) {
563-
printk(KERN_ERR "%s: too many IDE interfaces, "
564-
"no room in table\n", SCC_PATA_NAME);
561+
hwif = ide_find_port_slot(d);
562+
if (hwif == NULL)
565563
return -ENOMEM;
566-
}
567564

568565
memset(&hw, 0, sizeof(hw));
569566
for (i = 0; i <= 8; i++)

‎drivers/ide/pci/sgiioc4.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ static const struct ide_dma_ops sgiioc4_dma_ops = {
568568
};
569569

570570
static const struct ide_port_info sgiioc4_port_info __devinitdata = {
571+
.name = DRV_NAME,
571572
.chipset = ide_pci,
572573
.init_dma = ide_dma_sgiioc4,
573574
.port_ops = &sgiioc4_port_ops,
@@ -587,12 +588,9 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
587588
hw_regs_t hw;
588589
struct ide_port_info d = sgiioc4_port_info;
589590

590-
hwif = ide_find_port();
591-
if (hwif == NULL) {
592-
printk(KERN_ERR "%s: too many IDE interfaces, no room in table\n",
593-
DRV_NAME);
591+
hwif = ide_find_port_slot(&d);
592+
if (hwif == NULL)
594593
return -ENOMEM;
595-
}
596594

597595
/* Get the CmdBlk and CtrlBlk Base Registers */
598596
bar0 = pci_resource_start(dev, 0);

‎drivers/ide/setup-pci.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,8 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
332332
}
333333

334334
hwif = ide_find_port_slot(d);
335-
if (hwif == NULL) {
336-
printk(KERN_ERR "%s: too many IDE interfaces, no room in "
337-
"table\n", d->name);
335+
if (hwif == NULL)
338336
return NULL;
339-
}
340337

341338
memset(&hw, 0, sizeof(hw));
342339
hw.irq = irq;

0 commit comments

Comments
 (0)