コード例 #1
0
ファイル: ide-cs.c プロジェクト: 12rafael/jellytimekernel
static struct ide_host *idecs_register(unsigned long io, unsigned long ctl,
				unsigned long irq, struct pcmcia_device *handle)
{
    struct ide_host *host;
    ide_hwif_t *hwif;
    int i, rc;
    struct ide_hw hw, *hws[] = { &hw };

    if (!request_region(io, 8, DRV_NAME)) {
	printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
			DRV_NAME, io, io + 7);
	return NULL;
    }

    if (!request_region(ctl, 1, DRV_NAME)) {
	printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n",
			DRV_NAME, ctl);
	release_region(io, 8);
	return NULL;
    }

    memset(&hw, 0, sizeof(hw));
    ide_std_init_ports(&hw, io, ctl);
    hw.irq = irq;
    hw.dev = &handle->dev;

    rc = ide_host_add(&idecs_port_info, hws, 1, &host);
    if (rc)
	goto out_release;

    hwif = host->ports[0];

    if (hwif->present)
	return host;

    /* retry registration in case device is still spinning up */
    for (i = 0; i < 10; i++) {
	msleep(100);
	ide_port_scan(hwif);
	if (hwif->present)
	    return host;
    }

    return host;

out_release:
    release_region(ctl, 1);
    release_region(io, 8);
    return NULL;
}
コード例 #2
0
ファイル: ide-sysfs.c プロジェクト: 020gzh/linux
static ssize_t store_scan(struct device *portdev,
			  struct device_attribute *attr,
			  const char *buf, size_t n)
{
	ide_hwif_t *hwif = dev_get_drvdata(portdev);

	if (strncmp(buf, "1", n))
		return -EINVAL;

	ide_port_unregister_devices(hwif);
	ide_port_scan(hwif);

	return n;
};
コード例 #3
0
ファイル: pmac.c プロジェクト: 168519/linux
static void pmac_ide_macio_mb_event(struct macio_dev* mdev, int mb_state)
{
	pmac_ide_hwif_t *pmif = dev_get_drvdata(&mdev->ofdev.dev);

	switch(mb_state) {
	case MB_CD:
		if (!pmif->hwif->present)
			ide_port_scan(pmif->hwif);
		break;
	default:
		if (pmif->hwif->present)
			ide_port_unregister_devices(pmif->hwif);
	}
}