[PATCH v2 1/2] mfd: add stmpe-i2c driver
Sascha Hauer
s.hauer at pengutronix.de
Tue Sep 4 04:11:17 EDT 2012
On Mon, Sep 03, 2012 at 01:03:46PM +0200, Steffen Trumtrar wrote:
> The stmpe mfds can be connected via i2c and spi. This driver provides the basic
> infrastructure for the i2c kind. It can be added as a normal i2c-device in the
> board code. To enable functions a platform_data struct has to be provided, that
> describes what parts of the chip are to be used.
>
> Signed-off-by: Steffen Trumtrar <s.trumtrar at pengutronix.de>
> +
> +struct stmpe *stmpe_get(void)
> +{
> + if (!stmpe_dev)
> + return NULL;
> +
> + return stmpe_dev;
> +}
> +EXPORT_SYMBOL(stmpe_get);
For the pmic devices the assumption that there is only one in the system
is not nice, but reasonable. For this driver it is an unnecessary
limitation.
How about this:
add a 'static struct stmpe stmpe_dev' just like you did, but instead
of returning -EBUSY for the second one, do
if (!stmpe_dev)
stmpe_dev = newdev;
This way the at least the gpio support works for multiple instances.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list