mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2 1/2] mfd: add stmpe-i2c driver
Date: Tue, 4 Sep 2012 10:11:17 +0200	[thread overview]
Message-ID: <20120904081117.GN26594@pengutronix.de> (raw)
In-Reply-To: <1346670227-1840-2-git-send-email-s.trumtrar@pengutronix.de>

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@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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-09-04  8:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-03 11:03 [PATCH v2 0/2] Add stmpe mfd Steffen Trumtrar
2012-09-03 11:03 ` [PATCH v2 1/2] mfd: add stmpe-i2c driver Steffen Trumtrar
2012-09-04  8:11   ` Sascha Hauer [this message]
2012-09-04  8:18   ` Marc Kleine-Budde
2012-09-03 11:03 ` [PATCH v2 2/2] gpio: add driver for stmpe io-expander Steffen Trumtrar
2012-09-04  8:13   ` Sascha Hauer
2012-09-04  8:29   ` Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120904081117.GN26594@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.trumtrar@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox