From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org,
Patrice Vilchez <patrice.vilchez@atmel.com>,
Nicolas Ferre <nicolas.ferre@atmel.com>
Subject: Re: [PATCH 1/7] device: introduce resource structure to simplify resource declaration
Date: Mon, 18 Jul 2011 08:26:01 +0200 [thread overview]
Message-ID: <20110718062601.GA20587@pengutronix.de> (raw)
In-Reply-To: <20110718044347.GI20678@game.jcrosoft.org>
On Mon, Jul 18, 2011 at 06:43:47AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > +#endif /* __ASSEMBLY__ */
> > > +#endif /* _LINUX_IOPORT_H */
> > > diff --git a/lib/driver.c b/lib/driver.c
> > > index 4c10a49..ee5e850 100644
> > > --- a/lib/driver.c
> > > +++ b/lib/driver.c
> > > @@ -103,6 +103,15 @@ int register_device(struct device_d *new_device)
> > > {
> > > struct driver_d *drv;
> > >
> > > + /* if no map_base available use the first resource if available
> > > + * so we do not need to duplicate it
> > > + * Temporary fixup until we get rid of map_base and size
> > > + */
> > > + if (new_device->map_base == 0 && new_device->resource) {
> > > + new_device->map_base = new_device->resource[0].start;
> > > + new_device->size = new_device->resource[0].size;
> > > + }
> >
> > I think we don't need this. What we need though is the other way round:
> >
> > if (new_device->map_base) {
> > dev_warn(new_device, "uses map_base. Please convert to use resources\n")
> > new_device->resource = xzalloc(sizeof(struct resource));
> > new_device->resource[0].start = new_device->map_base;
> > new_device->resource[0].size = new_device->size;
> > }
> >
> > This way all devices have resources, we can convert the drivers and
> > devices to use resources one by one.
> ok for the warning
>
> but if we do not keep the map_base uptodate the core device drivers will be
> broken so if no map_base is specified we must update it with the first
> resource
You're right.
>
> how about this
>
> if (new_device->map_base) {
> if (new_device->resource) {
> dev_err(new_device, "map_base and resource specifed\n");
> return -EIO;
> }
> dev_warn(new_device, "uses map_base. Please convert to use resources\n")
> new_device->resource = xzalloc(sizeof(struct resource));
> new_device->resource[0].start = new_device->map_base;
> new_device->resource[0].size = new_device->size;
> new_device->numresources = 1;
> } else if (new_device->resource) {
> new_device->map_base = new_device->resource[0].start;
> new_device->size = new_device->resource[0].size;
> }
Ok, this looks good.
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-07-18 6:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-16 10:45 Jean-Christophe PLAGNIOL-VILLARD
2011-07-16 10:45 ` [PATCH 2/7] at91: switch to all resource declaration to "struct resource" Jean-Christophe PLAGNIOL-VILLARD
2011-07-16 10:45 ` [PATCH 3/7] at91/serial: switch " Jean-Christophe PLAGNIOL-VILLARD
2011-07-16 10:45 ` [PATCH 4/7] macb: " Jean-Christophe PLAGNIOL-VILLARD
2011-07-16 10:45 ` [PATCH 5/7] atmel_mci: " Jean-Christophe PLAGNIOL-VILLARD
2011-07-16 10:45 ` [PATCH 6/7] atmel_nand: " Jean-Christophe PLAGNIOL-VILLARD
2011-07-16 10:45 ` [PATCH 7/7] dm9200: use "struct resource" instead of platform_data Jean-Christophe PLAGNIOL-VILLARD
2011-07-17 15:28 ` Sascha Hauer
2011-07-18 4:36 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-17 15:37 ` [PATCH 1/7] device: introduce resource structure to simplify resource declaration Sascha Hauer
2011-07-18 4:43 ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-18 6:26 ` Sascha Hauer [this message]
2011-07-19 13:40 ` Antony Pavlov
2011-07-19 15:45 ` Jean-Christophe PLAGNIOL-VILLARD
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=20110718062601.GA20587@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=nicolas.ferre@atmel.com \
--cc=patrice.vilchez@atmel.com \
--cc=plagnioj@jcrosoft.com \
/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