mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 03/19] add a add_mem_device function
Date: Tue, 19 Jul 2011 12:13:47 +0200	[thread overview]
Message-ID: <20110719101347.GE5727@game.jcrosoft.org> (raw)
In-Reply-To: <1311064803-6305-4-git-send-email-s.hauer@pengutronix.de>

On 10:39 Tue 19 Jul     , Sascha Hauer wrote:
> Add a helper function for boards to register their memory
> devices. This makes the board code smaller and also helps
> getting rid of map_base.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  commands/mem.c   |   25 +++++++++++++++++++++++++
>  include/driver.h |    6 ++++++
>  2 files changed, 31 insertions(+), 0 deletions(-)
> 
> diff --git a/commands/mem.c b/commands/mem.c
> index 8df5f0a..745eec4 100644
> --- a/commands/mem.c
> +++ b/commands/mem.c
> @@ -587,6 +587,31 @@ static struct file_operations memops = {
>  	.lseek = dev_lseek_default,
>  };
>  
> +struct device_d *add_mem_device(const char *name, unsigned long start, size_t size,
> +		unsigned int flags)
> +{
> +	struct device_d *dev;
> +	struct memory_platform_data *pdata;
> +
> +	dev = xzalloc(sizeof(*dev));
> +	strcpy(dev->name, "mem");
> +	dev->id = -1;
> +	dev->resource = xzalloc(sizeof(struct resource));
> +	dev->num_resources = 1;
> +	dev->resource[0].start = start;
> +	dev->resource[0].size = size;
> +	dev->resource[0].flags = IORESOURCE_MEM;
> +	pdata = xzalloc(sizeof(*pdata));
> +	dev->platform_data = pdata;
> +
> +	pdata->flags = flags;
> +	pdata->name = xstrdup(name);
can we drop the name here and use the resource name instead

I think we can drop the platfrom_data too

Best Regards,
J.

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

  reply	other threads:[~2011-07-19 10:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-19  8:39 [PATCH] resources work Sascha Hauer
2011-07-19  8:39 ` [PATCH 01/19] register_device: Add IORESOURCE_MEM flag Sascha Hauer
2011-07-19  8:39 ` [PATCH 02/19] device: Add a dev_request_mem_region function Sascha Hauer
2011-07-19 10:11   ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-19 10:58     ` Sascha Hauer
2011-07-19  8:39 ` [PATCH 03/19] add a add_mem_device function Sascha Hauer
2011-07-19 10:13   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2011-07-19 11:00     ` Sascha Hauer
2011-07-19 13:06       ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-19  8:39 ` [PATCH 04/19] generic memmap: use resources Sascha Hauer
2011-07-19  8:39 ` [PATCH 05/19] mem_read/write: " Sascha Hauer
2011-07-19 10:14   ` Jean-Christophe PLAGNIOL-VILLARD
2011-07-19  8:39 ` [PATCH 06/19] nand i.MX: convert to struct resource Sascha Hauer
2011-07-19  8:39 ` [PATCH 07/19] video " Sascha Hauer
2011-07-19  8:39 ` [PATCH 08/19] serial " Sascha Hauer
2011-07-19  8:39 ` [PATCH 09/19] i2c " Sascha Hauer
2011-07-19  8:39 ` [PATCH 10/19] mci " Sascha Hauer
2011-07-19  8:39 ` [PATCH 11/19] net i.MX fec: " Sascha Hauer
2011-07-19  8:39 ` [PATCH 12/19] mci i.MX esdhc: " Sascha Hauer
2011-07-19  8:39 ` [PATCH 13/19] spi i.MX: " Sascha Hauer
2011-07-19  8:39 ` [PATCH 14/19] video i.MX ipu: " Sascha Hauer
2011-07-19  8:39 ` [PATCH 15/19] i.MX devices: " Sascha Hauer
2011-07-19  8:40 ` [PATCH 16/19] cfi: " Sascha Hauer
2011-07-19  8:40 ` [PATCH 17/19] ARM pcm038: use add_mem_device helper Sascha Hauer
2011-07-19  8:40 ` [PATCH 18/19] ARM pcm037: " Sascha Hauer
2011-07-19  8:40 ` [PATCH 19/19] ARM i.MX51 babbage: " 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=20110719101347.GE5727@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox