From: Sascha Hauer <s.hauer@pengutronix.de>
To: Marc Reilly <marc@cpdesign.com.au>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] at24: add I2C eeprom for 24cl02
Date: Fri, 14 Jan 2011 10:39:37 +0100 [thread overview]
Message-ID: <20110114093937.GF24373@pengutronix.de> (raw)
In-Reply-To: <20110114091912.GD24373@pengutronix.de>
On Fri, Jan 14, 2011 at 10:19:12AM +0100, Sascha Hauer wrote:
> Hi Marc,
>
> > +
> > +static int at24_probe(struct device_d *dev)
> > +{
> > + struct at24 *at24;
> > + struct at24_platform_data *pdata;
> > + at24 = xzalloc(sizeof(*at24));
> > +
> > + dev->priv = at24;
> > + pdata = dev->platform_data;
> > +
> > + at24->cdev.name = DRIVERNAME;
>
> You should use at24->cdev.name = asprintf("%s%d", DRIVERNAME, dev->id);
> here to support multiple eeproms. Note that this afaics needs patching
> i2c_new_device to initialize client->dev.id to -1 to make sure the i2c
> device gets an autoassigned id.
This reminds me of something I should do in the next time.
A cdev is not in any way related to a struct device_d anymore.
Nevertheless we more than once use the device id to construct a
cdev name like above. Instead we should have a
get_cdev_name(char *template) function which creates a name suitable for
cdevs. This way both a spi and a i2c eeprom driver could use "eeprom" as
template and both would get a valid name.
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
next prev parent reply other threads:[~2011-01-14 9:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-14 0:06 Add basic driver for 24clxx eeproms Marc Reilly
2011-01-14 0:07 ` [PATCH 1/2] i2c: add platform_data for i2c_board_info Marc Reilly
2011-01-14 0:07 ` [PATCH 2/2] at24: add I2C eeprom for 24cl02 Marc Reilly
2011-01-14 9:19 ` Sascha Hauer
2011-01-14 9:39 ` Sascha Hauer [this message]
2011-01-16 1:04 ` [PATCH] devfs: new func make_cdev_name: allocate unique cdev name Marc Reilly
[not found] ` <1295139858-9193-1-git-send-email-marc@cpdesign.com.au>
2011-01-17 18:01 ` cdev name generation Sascha Hauer
2011-01-17 22:22 ` Marc Reilly
2011-01-19 8:41 ` Sascha Hauer
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=20110114093937.GF24373@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=marc@cpdesign.com.au \
/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