* [PATCH 8/9] ARM: shmobile: APE6EVM: switch to using platform_add_devices()
@ 2013-05-17 14:55 Guennadi Liakhovetski
2013-05-17 17:48 ` Sergei Shtylyov
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Guennadi Liakhovetski @ 2013-05-17 14:55 UTC (permalink / raw)
To: linux-sh
Switch from platform_device_register_resndata() to platform_add_devices()
to make adding new devices easier.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
---
arch/arm/mach-shmobile/board-ape6evm.c | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c
index 5eb0caa..9c69643 100644
--- a/arch/arm/mach-shmobile/board-ape6evm.c
+++ b/arch/arm/mach-shmobile/board-ape6evm.c
@@ -41,7 +41,7 @@ static struct regulator_consumer_supply dummy_supplies[] = {
};
/* SMSC LAN9220 */
-static const struct resource lan9220_res[] = {
+static struct resource lan9220_res[] = {
DEFINE_RES_MEM(0x08000000, 0x1000),
{
.start = irq_pin(40), /* IRQ40 */
@@ -49,12 +49,22 @@ static const struct resource lan9220_res[] = {
},
};
-static const struct smsc911x_platform_config lan9220_data = {
+static struct smsc911x_platform_config lan9220_data = {
.flags = SMSC911X_USE_32BIT,
.irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
};
+static struct platform_device lan9220_device = {
+ .name = "smsc911x",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(lan9220_res),
+ .resource = lan9220_res,
+ .dev = {
+ .platform_data = &lan9220_data,
+ },
+};
+
static const struct pinctrl_map ape6evm_pinctrl_map[] = {
/* SCIFA0 console */
PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a73a4",
@@ -64,6 +74,13 @@ static const struct pinctrl_map ape6evm_pinctrl_map[] = {
"irqc_irq40", "irqc"),
};
+/*
+ * board devices
+ */
+static struct platform_device *ape6evm_devices[] __initdata = {
+ &lan9220_device,
+};
+
static void __init ape6evm_add_standard_devices(void)
{
@@ -91,9 +108,8 @@ static void __init ape6evm_add_standard_devices(void)
regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
- platform_device_register_resndata(&platform_bus, "smsc911x", -1,
- lan9220_res, ARRAY_SIZE(lan9220_res),
- &lan9220_data, sizeof(lan9220_data));
+ platform_add_devices(ape6evm_devices,
+ ARRAY_SIZE(ape6evm_devices));
}
static const char *ape6evm_boards_compat_dt[] __initdata = {
--
1.7.2.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 8/9] ARM: shmobile: APE6EVM: switch to using platform_add_devices()
2013-05-17 14:55 [PATCH 8/9] ARM: shmobile: APE6EVM: switch to using platform_add_devices() Guennadi Liakhovetski
@ 2013-05-17 17:48 ` Sergei Shtylyov
2013-05-17 19:05 ` Guennadi Liakhovetski
2013-05-17 19:17 ` Sergei Shtylyov
2 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2013-05-17 17:48 UTC (permalink / raw)
To: linux-sh
Hello.
On 05/17/2013 06:55 PM, Guennadi Liakhovetski wrote:
> Switch from platform_device_register_resndata() to platform_add_devices()
> to make adding new devices easier.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
> ---
> arch/arm/mach-shmobile/board-ape6evm.c | 26 +++++++++++++++++++++-----
> 1 files changed, 21 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c
> index 5eb0caa..9c69643 100644
> --- a/arch/arm/mach-shmobile/board-ape6evm.c
> +++ b/arch/arm/mach-shmobile/board-ape6evm.c
[...]
> @@ -64,6 +74,13 @@ static const struct pinctrl_map ape6evm_pinctrl_map[] = {
> "irqc_irq40", "irqc"),
> };
>
> +/*
> + * board devices
> + */
> +static struct platform_device *ape6evm_devices[] __initdata = {
> + &lan9220_device,
> +};
> +
> static void __init ape6evm_add_standard_devices(void)
> {
>
> @@ -91,9 +108,8 @@ static void __init ape6evm_add_standard_devices(void)
>
> regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
>
> - platform_device_register_resndata(&platform_bus, "smsc911x", -1,
> - lan9220_res, ARRAY_SIZE(lan9220_res),
> - &lan9220_data, sizeof(lan9220_data));
> + platform_add_devices(ape6evm_devices,
> + ARRAY_SIZE(ape6evm_devices));
We have been discouraged from using platform_device_register() and
its ilk by Greg KH and Arnd, so
platform_device_register_resndata() might have been there on purpose.
WBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 8/9] ARM: shmobile: APE6EVM: switch to using platform_add_devices()
2013-05-17 14:55 [PATCH 8/9] ARM: shmobile: APE6EVM: switch to using platform_add_devices() Guennadi Liakhovetski
2013-05-17 17:48 ` Sergei Shtylyov
@ 2013-05-17 19:05 ` Guennadi Liakhovetski
2013-05-17 19:17 ` Sergei Shtylyov
2 siblings, 0 replies; 4+ messages in thread
From: Guennadi Liakhovetski @ 2013-05-17 19:05 UTC (permalink / raw)
To: linux-sh
Hi Sergei
On Fri, 17 May 2013, Sergei Shtylyov wrote:
> Hello.
>
> On 05/17/2013 06:55 PM, Guennadi Liakhovetski wrote:
>
> > Switch from platform_device_register_resndata() to platform_add_devices()
> > to make adding new devices easier.
> >
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
> > ---
> > arch/arm/mach-shmobile/board-ape6evm.c | 26 +++++++++++++++++++++-----
> > 1 files changed, 21 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/arm/mach-shmobile/board-ape6evm.c
> > b/arch/arm/mach-shmobile/board-ape6evm.c
> > index 5eb0caa..9c69643 100644
> > --- a/arch/arm/mach-shmobile/board-ape6evm.c
> > +++ b/arch/arm/mach-shmobile/board-ape6evm.c
> [...]
> > @@ -64,6 +74,13 @@ static const struct pinctrl_map ape6evm_pinctrl_map[] = {
> > "irqc_irq40", "irqc"),
> > };
> > +/*
> > + * board devices
> > + */
> > +static struct platform_device *ape6evm_devices[] __initdata = {
> > + &lan9220_device,
> > +};
> > +
> > static void __init ape6evm_add_standard_devices(void)
> > {
> > @@ -91,9 +108,8 @@ static void __init ape6evm_add_standard_devices(void)
> > regulator_register_fixed(0, dummy_supplies,
> > ARRAY_SIZE(dummy_supplies));
> > - platform_device_register_resndata(&platform_bus, "smsc911x", -1,
> > - lan9220_res,
> > ARRAY_SIZE(lan9220_res),
> > - &lan9220_data,
> > sizeof(lan9220_data));
> > + platform_add_devices(ape6evm_devices,
> > + ARRAY_SIZE(ape6evm_devices));
>
> We have been discouraged from using platform_device_register() and its ilk
> by Greg KH and Arnd, so
>
> platform_device_register_resndata() might have been there on purpose.
Sure, I was surprised as well. Could you point me to a thread? I just
thought - it's ok for one device, but repeating
platform_device_register_*() multiple times for each device wouldn't look
very nice. But I'll switch back to this, if that's really the current
preference.
Thanks
Guennadi
>
>
> WBR, Sergei
>
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 8/9] ARM: shmobile: APE6EVM: switch to using platform_add_devices()
2013-05-17 14:55 [PATCH 8/9] ARM: shmobile: APE6EVM: switch to using platform_add_devices() Guennadi Liakhovetski
2013-05-17 17:48 ` Sergei Shtylyov
2013-05-17 19:05 ` Guennadi Liakhovetski
@ 2013-05-17 19:17 ` Sergei Shtylyov
2 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2013-05-17 19:17 UTC (permalink / raw)
To: linux-sh
Hello.
On 05/17/2013 11:05 PM, Guennadi Liakhovetski wrote:
>>> Switch from platform_device_register_resndata() to platform_add_devices()
>>> to make adding new devices easier.
>>>
>>> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
>>> ---
>>> arch/arm/mach-shmobile/board-ape6evm.c | 26 +++++++++++++++++++++-----
>>> 1 files changed, 21 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-shmobile/board-ape6evm.c
>>> b/arch/arm/mach-shmobile/board-ape6evm.c
>>> index 5eb0caa..9c69643 100644
>>> --- a/arch/arm/mach-shmobile/board-ape6evm.c
>>> +++ b/arch/arm/mach-shmobile/board-ape6evm.c
>> [...]
>>> @@ -64,6 +74,13 @@ static const struct pinctrl_map ape6evm_pinctrl_map[] = {
>>> "irqc_irq40", "irqc"),
>>> };
>>> +/*
>>> + * board devices
>>> + */
>>> +static struct platform_device *ape6evm_devices[] __initdata = {
>>> + &lan9220_device,
>>> +};
>>> +
>>> static void __init ape6evm_add_standard_devices(void)
>>> {
>>> @@ -91,9 +108,8 @@ static void __init ape6evm_add_standard_devices(void)
>>> regulator_register_fixed(0, dummy_supplies,
>>> ARRAY_SIZE(dummy_supplies));
>>> - platform_device_register_resndata(&platform_bus, "smsc911x", -1,
>>> - lan9220_res,
>>> ARRAY_SIZE(lan9220_res),
>>> - &lan9220_data,
>>> sizeof(lan9220_data));
>>> + platform_add_devices(ape6evm_devices,
>>> + ARRAY_SIZE(ape6evm_devices));
>> We have been discouraged from using platform_device_register() and its ilk
>> by Greg KH and Arnd, so
>>
>> platform_device_register_resndata() might have been there on purpose.
> Sure, I was surprised as well. Could you point me to a thread?
http://www.spinics.net/lists/linux-sh/msg16871.html is all I have.
The original Greg's reasoning is missing there.
> I just
> thought - it's ok for one device, but repeating
> platform_device_register_*() multiple times for each device wouldn't look
> very nice. But I'll switch back to this, if that's really the current
> preference.
Well, Simon tried to use platform_add_devices() despite that mail
once --
I stopped him on the reason that platform_add_devices() is close
relative of the
heathen platform_device_register(), i.e. former calls the latter.
> Thanks
> Guennadi
WBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-17 19:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-17 14:55 [PATCH 8/9] ARM: shmobile: APE6EVM: switch to using platform_add_devices() Guennadi Liakhovetski
2013-05-17 17:48 ` Sergei Shtylyov
2013-05-17 19:05 ` Guennadi Liakhovetski
2013-05-17 19:17 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).