Re: scx200_acb: Use PCI I/O resource when appropriate

From: Jean Delvare
Date: Tue Apr 11 2006 - 16:43:00 EST


Hi Rudolf, Jordan,

> Well we had the problem with i2c-viapro and vi686a. Best solution was
> to fail from the probe function - like this:
>
> /* Always return failure here. This is to allow other drivers to bind
> * to this pci device. We don't really want to have control over the
> * pci device, we only wanted to read as few register values from it.
> */
> return -ENODEV;
>
> release_region:
> release_region(vt596_smba, 8);
> return error;
> }

True, but we were lucky. You can only do that if you don't need to
access the PCI configuration space during run-time (after the
initialization step) in either driver "sharing" the PCI device. The
i2c-viapro driver qualified, but for example we couldn't do that for
the i2c-i801 driver (block transactions in I2C mode require PCI
configuration register access.)

So depending on the exact hardware context, Jordan may or may not be
able to use the same trick. The other (cleaner) solution is to have an
additional module which registers the PCI device and exports some kind
of interface for the other modules to access the parts they need - but
this requires extra code and makes things much more complex too.

--
Jean Delvare
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/