From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Greg KH <greg@kroah.com>
Cc: Randy Dunlap <rdunlap@xenotime.net>,
Dmitry Torokhov <dtor@mail.ru>, Anisse Astier <anisse@astier.eu>,
Greg Kroah-Hartman <gregkh@suse.de>,
Magnus Damm <damm@opensource.se>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
Paul Mundt <lethal@linux-sh.org>,
Eric Miao <eric.y.miao@gmail.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH 2/2 v2] Driver core: reduce duplicated code
Date: Tue, 22 Jun 2010 07:23:14 +0200 [thread overview]
Message-ID: <20100622052314.GA17128@pengutronix.de> (raw)
In-Reply-To: <20100621213846.GB25511@kroah.com>
Hi Greg,
> > I changed the semantic slightly to only call
> > platform_device_add_resources if data != NULL instead of size != 0. The
> > idea is to support wrappers like:
> >
> > #define add_blablub(id, pdata) \
> > platform_device_register_resndata(NULL, "blablub", id, \
> > NULL, 0, pdata, sizeof(struct blablub_platform_data))
> >
> > that don't fail if pdata=NULL. Ditto for res.
>
> That's fine, but why would you want to have a #define for something like
> this? Is it really needed?
Well, what is really needed? I intend to use it on arm/imx. I have
several different machines using similar SoCs and so I want to have a
function à la:
struct platform_device *__init imx_add_imx_i2c(int id,
resource_size_t iobase, resource_size_t iosize, int irq,
const struct imxi2c_platform_data *pdata)
that builds a struct resource[] and then calls
platform_device_register_resndata(). And then I have a set of macros
like:
#define imx21_add_i2c_imx(pdata) \
imx_add_imx_i2c(0, MX2x_I2C_BASE_ADDR, SZ_4K, MX2x_INT_I2C, pdata)
#define imx25_add_imx_i2c0(pdata) \
imx_add_imx_i2c(0, MX25_I2C1_BASE_ADDR, SZ_16K, MX25_INT_I2C1, pdata)
##define imx25_add_imx_i2c1(pdata) \
imx_add_imx_i2c(1, MX25_I2C2_BASE_ADDR, SZ_16K, MX25_INT_I2C2, pdata)
etc. The final goal is to get rid of files like
arch/arm/mach-mx3/devices.c.
> Anyway, this version looks fine to me, I'll go apply it.
\o/
Best regards and thanks
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2010-06-22 5:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-15 8:47 [PATCH 1/2] Driver core: use kmemdup in platform_device_add_resources Uwe Kleine-König
2010-06-15 8:47 ` [PATCH 2/2] Driver core: reduce duplicated code Uwe Kleine-König
2010-06-15 9:05 ` Uwe Kleine-König
2010-06-16 20:53 ` Greg KH
2010-06-18 7:39 ` Uwe Kleine-König
2010-06-21 13:31 ` [PATCH] ACPI dock: move some functions to .init.text Uwe Kleine-König
2010-06-21 13:31 ` Uwe Kleine-König
2010-10-19 7:13 ` [PATCH RESEND] " Uwe Kleine-König
2010-10-19 7:13 ` Uwe Kleine-König
2010-10-19 15:48 ` Greg KH
2010-10-19 18:03 ` Len Brown
2010-06-21 14:11 ` [PATCH 2/2 v2] Driver core: reduce duplicated code Uwe Kleine-König
2010-06-21 21:38 ` Greg KH
2010-06-22 5:23 ` Uwe Kleine-König [this message]
2010-06-28 4:55 ` Eric Miao
2010-06-28 5:16 ` Uwe Kleine-König
2010-06-28 5:27 ` Eric Miao
2010-06-21 14:11 ` [PATCH 3/2] Driver core: move platform device creation helpers to .init.text (if MODULE=n) Uwe Kleine-König
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=20100622052314.GA17128@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=anisse@astier.eu \
--cc=damm@opensource.se \
--cc=dtor@mail.ru \
--cc=eric.y.miao@gmail.com \
--cc=greg@kroah.com \
--cc=gregkh@suse.de \
--cc=lethal@linux-sh.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rdunlap@xenotime.net \
--cc=rjw@sisk.pl \
/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.