From: Marc Reilly <marc@cpdesign.com.au>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: cdev name generation
Date: Tue, 18 Jan 2011 09:22:20 +1100 [thread overview]
Message-ID: <201101180922.20345.marc@cpdesign.com.au> (raw)
In-Reply-To: <20110117180137.GN9041@pengutronix.de>
Hi Sascha,
> >
> > Do you mean something like this attached patch?
>
> Yes
>
> > I preferred having the possibilty for assigning the id, so that boards
> > can have some expectations of what the device name will be.
>
> Generally a good idea, but how do you want to pass previd to the drivers
> using it? via platform_data? I haven't looked into it to see if this
> works well.
>
That's what I did for the at24, (although preferred_id would be a better name
than just id)
static struct at24_platform_data at24_data = {
.size = 2048 / 8,
.id = 1,
};
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 = make_cdev_name("eeprom", pdata->id);
at24->client = to_i2c_client(dev);
at24->cdev.size = pdata->size;
at24->cdev.dev = dev;
Maybe the platform data should have the preferred cdev name also? In the
example above, the driver just blindly calls it "eeprom", ie a more generic
term than "at24", the driver name.
If the desired end result is to have for example eeprom0, eeprom1 and eeprom2
cdevs all from potentially different drivers then I makes sense to also be
able to specify the "eeprom" part. (and then we'd probably want to pass in the
device_d* to make_cdev_name in case the user doesn't specify a cdev name - the
device name, and id, could be used).
Seems like too much thinking for so little code :)
Cheers,
Marc
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2011-01-17 22:23 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
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 [this message]
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=201101180922.20345.marc@cpdesign.com.au \
--to=marc@cpdesign.com.au \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.