Exemple #1
0
/* Detect chip and initialize it. */
static int savage4_setup(void)
{
	struct pci_dev *dev;
	int s4_num;

	s4_num = 0;

	dev = NULL;
	do {
		if ((dev = pci_find_device(PCI_VENDOR_ID_S3,
					   PCI_CHIP_SAVAGE4,
					   dev))) {
			if (!s4_num)
				config_s4(dev);
			s4_num++;
		}
	} while (dev);

	dev = NULL;
	do {
		if ((dev = pci_find_device(PCI_VENDOR_ID_S3,
					   PCI_CHIP_SAVAGE2000,
					   dev))) {
			if (!s4_num)
				config_s4(dev);
			s4_num++;
		}
	} while (dev);

	if (s4_num > 0) {
		if(!mem)
			return -ENOMEM;
		printk("i2c-savage4: %d Savage4 found.\n", s4_num);
		if (s4_num > 1)
			printk("i2c-savage4: warning: only 1 supported.\n");
		return 0;
	} else {
		printk("i2c-savage4: No Savage4 found.\n");
		return -ENODEV;
	}
}
Exemple #2
0
static int __devinit savage4_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
    int retval;

    retval = config_s4(dev);
    if (retval)
        return retval;

    /* set up the sysfs linkage to our parent device */
    savage4_i2c_adapter.dev.parent = &dev->dev;

    return i2c_bit_add_bus(&savage4_i2c_adapter);
}