mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/3] Introduce ARM AMBA bus
Date: Mon, 10 Sep 2012 09:25:58 +0200	[thread overview]
Message-ID: <20120910072558.GT18243@pengutronix.de> (raw)
In-Reply-To: <1346502990-21603-1-git-send-email-plagnioj@jcrosoft.com>

On Sat, Sep 01, 2012 at 02:36:28PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> This will allow to detect the amba device and use the right driver for it at
> runtime.
> 
> The code is base on linux 3.5.
> 
> +
> +int amba_driver_register(struct amba_driver *drv)
> +{
> +	drv->drv.bus = &amba_bustype;
> +#define SETFN(fn)	if (drv->fn) drv->drv.fn = amba_##fn
> +	SETFN(probe);
> +	SETFN(remove);

Can we please drop this SETFN and just open code it? Being able to grep
for amba_probe and finding its users is quite convenient. No, I don't
care that in Linux it's also done like this.

> +struct amba_device *amba_device_alloc(const char *name, int id, resource_size_t base,
> +	size_t size)
> +{
> +	struct amba_device *dev;
> +
> +	dev = xzalloc(sizeof(*dev));
> +	if (dev) {

xzalloc always returns a valid pointer.

> +		strcpy(dev->dev.name, name);
> +		dev->dev.id = id;
> +		dev->res.start = base;
> +		dev->res.end = base + size - 1;
> +		dev->res.flags = IORESOURCE_MEM;
> +	}
> +
> +	return dev;
> +}
> +
> +/**
> + * struct amba_id - identifies a device on an AMBA bus
> + * @id: The significant bits if the hardware device ID
> + * @mask: Bitmask specifying which bits of the id field are significant when
> + *	matching.  A driver binds to a device when ((hardware device ID) & mask)
> + *	== id.
> + * @data: Private data used by the driver.
> + */
> +struct amba_id {
> +	unsigned int		id;
> +	unsigned int		mask;
> +#ifndef __KERNEL__
> +	kernel_ulong_t		data;
> +#else
> +	void			*data;
> +#endif

Drop this ifdef.

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

  parent reply	other threads:[~2012-09-10  7:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-01 10:22 [PATCH 0/3] AMBA Bus support Jean-Christophe PLAGNIOL-VILLARD
2012-09-01 12:36 ` [PATCH 1/3] Introduce ARM AMBA bus Jean-Christophe PLAGNIOL-VILLARD
2012-09-01 12:36   ` [PATCH 2/3] amba-pl011: switch to amba bus Jean-Christophe PLAGNIOL-VILLARD
2012-09-01 12:36   ` [PATCH 3/3] amba-pl011: add st specific init Jean-Christophe PLAGNIOL-VILLARD
2012-09-10  7:25   ` Sascha Hauer [this message]
2012-09-11  4:47 [PATCH 0/3 v2] AMBA Bus support Jean-Christophe PLAGNIOL-VILLARD
2012-09-11  4:51 ` [PATCH 1/3] Introduce ARM AMBA bus 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=20120910072558.GT18243@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --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