1 #include <linux/kernel.h>
4 static void ide_legacy_init_one(hw_regs_t **hws, hw_regs_t *hw,
5 u8 port_no, const struct ide_port_info *d,
8 unsigned long base, ctl;
21 if (!request_region(base, 8, d->name)) {
22 printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
23 d->name, base, base + 7);
27 if (!request_region(ctl, 1, d->name)) {
28 printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n",
30 release_region(base, 8);
34 ide_std_init_ports(hw, base, ctl);
36 hw->chipset = d->chipset;
42 int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config)
44 hw_regs_t hw[2], *hws[] = { NULL, NULL, NULL, NULL };
46 memset(&hw, 0, sizeof(hw));
48 if ((d->host_flags & IDE_HFLAG_QD_2ND_PORT) == 0)
49 ide_legacy_init_one(hws, &hw[0], 0, d, config);
50 ide_legacy_init_one(hws, &hw[1], 1, d, config);
52 if (hws[0] == NULL && hws[1] == NULL &&
53 (d->host_flags & IDE_HFLAG_SINGLE))
56 return ide_host_add(d, hws, NULL);
58 EXPORT_SYMBOL_GPL(ide_legacy_device_add);