From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Eric Miao <eric.y.miao@gmail.com>, Sascha Hauer <s.hauer@pengutronix.de>
Cc: Greg KH <greg@kroah.com>, 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>,
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: Mon, 28 Jun 2010 07:16:06 +0200 [thread overview]
Message-ID: <20100628051606.GA16445@pengutronix.de> (raw)
In-Reply-To: <AANLkTinMLrXyqKZ76AiWiw6N_glrWWrP-2_aUTzQm5Xr@mail.gmail.com>
Hi Eric,
On Mon, Jun 28, 2010 at 12:55:45PM +0800, Eric Miao wrote:
> I suggest you to have a look into arch/arm/mach-mmp/devices.c and
> arch/arm/mach-mmp/pxa{168,910}.c as well as
> arch/arm/mach-mmp/include/mach/pxa{168,910}.h, maybe we can find
> some common practice.
I think I like this approach in general, I already thought about not
passing all parameters as function/macro arguments, too. But maybe this
becomes too excessive for imx as I would need too many of these device
desc for the different imx variants?!
Anyhow a few things I thought when looking in the files you suggested:
- Why not use an array for all uart devdescs, maybe the code for
pxa168_add_uart could become a bit smaller then?:
extern struct pxa_device_desc pxa168_device_uart[2];
...
static inline int pxa168_add_uart(int id)
{
struct pxa_device_desc *d = pxa168_device_uart + id;
if (id < 0 || id > 2)
return -EINVAL;
return pxa_register_device(d, NULL, 0);
}
(Ditto for the other types obviously.)
- shouldn't all these pxa_device_descs and pxa168_add_$device functions
be __initdata and __init?
- pxa_register_device is better than my add_resndata function in (at
least) one aspect as it sets coherent_dma_mask, too. This is
something I missed when trying to add mxc-mmc (IIRC) devices.
Thanks
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2010-06-28 5:16 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
2010-06-28 4:55 ` Eric Miao
2010-06-28 5:16 ` Uwe Kleine-König [this message]
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=20100628051606.GA16445@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 \
--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.