2011-02-11 14:39:20

by Subhasish Ghosh

[permalink] [raw]
Subject: [PATCH v2 12/13] da850: pruss SUART platform specific additions.

This patch adds the McASP clock alias.
The alias is used by the pruss suart driver
for enabling the McASP PSC.

Signed-off-by: Subhasish Ghosh <[email protected]>
---
arch/arm/mach-davinci/devices-da8xx.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index e15de72..f1cf605 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -560,7 +560,18 @@ struct platform_device da8xx_pruss_dev = {

int __init da8xx_register_pruss(struct da8xx_pruss_devices *pruss_device)
{
+#ifdef CONFIG_SERIAL_PRUSS_SUART_MODULE
+ int ret;
+#endif
+
da8xx_pruss_dev.dev.platform_data = pruss_device;
+
+#ifdef CONFIG_SERIAL_PRUSS_SUART_MODULE
+ ret = clk_add_alias(NULL, "da8xx_pruss_uart.1",
+ NULL, &da850_mcasp_device.dev);
+ if (ret < 0)
+ return ret;
+#endif
return platform_device_register(&da8xx_pruss_dev);
}

--
1.7.2.3


2011-02-11 18:56:40

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH v2 12/13] da850: pruss SUART platform specific additions.

Subhasish Ghosh wrote:

> This patch adds the McASP clock alias.
> The alias is used by the pruss suart driver
> for enabling the McASP PSC.

> Signed-off-by: Subhasish Ghosh <[email protected]>
[...]

> diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
> index e15de72..f1cf605 100644
> --- a/arch/arm/mach-davinci/devices-da8xx.c
> +++ b/arch/arm/mach-davinci/devices-da8xx.c
> @@ -560,7 +560,18 @@ struct platform_device da8xx_pruss_dev = {
>
> int __init da8xx_register_pruss(struct da8xx_pruss_devices *pruss_device)
> {
> +#ifdef CONFIG_SERIAL_PRUSS_SUART_MODULE

#ifdef's in the function body are generally fromned upon.

> + int ret;
> +#endif
> +

This line should have been inside #ifdef...

> da8xx_pruss_dev.dev.platform_data = pruss_device;
> +
> +#ifdef CONFIG_SERIAL_PRUSS_SUART_MODULE

Why not do it before assigning the platform data and avoid extra #ifdef?

> + ret = clk_add_alias(NULL, "da8xx_pruss_uart.1",
> + NULL, &da850_mcasp_device.dev);

This line should be indented more to the right.

> + if (ret < 0)
> + return ret;
> +#endif

WBR, Sergei

2011-02-22 09:22:45

by Subhasish Ghosh

[permalink] [raw]
Subject: Re: [PATCH v2 12/13] da850: pruss SUART platform specific additions.

Hello,

I could not follow your recommendations clearly, are you suggesting this:

int __init da8xx_register_pruss(struct da8xx_pruss_devices *pruss_device)
{
#ifdef CONFIG_SERIAL_PRUSS_SUART_MODULE
int ret;

ret = clk_add_alias(NULL, "da8xx_pruss_uart.1",
NULL, &da850_mcasp_device.dev);
if (ret < 0)
return ret;
#endif
da8xx_pruss_dev.dev.platform_data = pruss_device;
return platform_device_register(&da8xx_pruss_dev);
}

--------------------------------------------------
From: "Sergei Shtylyov" <[email protected]>
Sent: Saturday, February 12, 2011 12:25 AM
To: "Subhasish Ghosh" <[email protected]>
Cc: <[email protected]>;
<[email protected]>; "Russell King" <[email protected]>;
"Kevin Hilman" <[email protected]>; <[email protected]>; "open list"
<[email protected]>; <[email protected]>;
<[email protected]>
Subject: Re: [PATCH v2 12/13] da850: pruss SUART platform specific
additions.

> Subhasish Ghosh wrote:
>
>> This patch adds the McASP clock alias.
>> The alias is used by the pruss suart driver
>> for enabling the McASP PSC.
>
>> Signed-off-by: Subhasish Ghosh <[email protected]>
> [...]
>
>> diff --git a/arch/arm/mach-davinci/devices-da8xx.c
>> b/arch/arm/mach-davinci/devices-da8xx.c
>> index e15de72..f1cf605 100644
>> --- a/arch/arm/mach-davinci/devices-da8xx.c
>> +++ b/arch/arm/mach-davinci/devices-da8xx.c
>> @@ -560,7 +560,18 @@ struct platform_device da8xx_pruss_dev = {
>> int __init da8xx_register_pruss(struct da8xx_pruss_devices
>> *pruss_device)
>> {
>> +#ifdef CONFIG_SERIAL_PRUSS_SUART_MODULE
>
> #ifdef's in the function body are generally fromned upon.
>
>> + int ret;
>> +#endif
>> +
>
> This line should have been inside #ifdef...
>
>> da8xx_pruss_dev.dev.platform_data = pruss_device;
>> +
>> +#ifdef CONFIG_SERIAL_PRUSS_SUART_MODULE
>
> Why not do it before assigning the platform data and avoid extra
> #ifdef?
>
>> + ret = clk_add_alias(NULL, "da8xx_pruss_uart.1",
>> + NULL, &da850_mcasp_device.dev);
>
> This line should be indented more to the right.
>
>> + if (ret < 0)
>> + return ret;
>> +#endif
>
> WBR, Sergei

2011-02-22 11:22:17

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH v2 12/13] da850: pruss SUART platform specific additions.

Hello.

On 22-02-2011 12:18, Subhasish Ghosh wrote:

> I could not follow your recommendations clearly, are you suggesting this:

> int __init da8xx_register_pruss(struct da8xx_pruss_devices *pruss_device)
> {
> #ifdef CONFIG_SERIAL_PRUSS_SUART_MODULE
> int ret;
>
> ret = clk_add_alias(NULL, "da8xx_pruss_uart.1",
> NULL, &da850_mcasp_device.dev);
> if (ret < 0)
> return ret;
> #endif
> da8xx_pruss_dev.dev.platform_data = pruss_device;
> return platform_device_register(&da8xx_pruss_dev);
> }

Yes. But still better would be to wrap clk_add_alias() into a function of
its own (defining it empty if CONFIG_SERIAL_PRUSS_SUART_MODULE is not defined).

WBR, Sergei

2011-02-22 13:23:07

by Subhasish Ghosh

[permalink] [raw]
Subject: Re: [PATCH v2 12/13] da850: pruss SUART platform specific additions.

Ok, will do.

--------------------------------------------------
From: "Sergei Shtylyov" <[email protected]>
Sent: Tuesday, February 22, 2011 4:50 PM
To: "Subhasish Ghosh" <[email protected]>
Cc: <[email protected]>;
<[email protected]>; "Russell King" <[email protected]>;
"Kevin Hilman" <[email protected]>; <[email protected]>; "open list"
<[email protected]>; <[email protected]>;
<[email protected]>
Subject: Re: [PATCH v2 12/13] da850: pruss SUART platform specific
additions.

> Hello.
>
> On 22-02-2011 12:18, Subhasish Ghosh wrote:
>
>> I could not follow your recommendations clearly, are you suggesting this:
>
>> int __init da8xx_register_pruss(struct da8xx_pruss_devices *pruss_device)
>> {
>> #ifdef CONFIG_SERIAL_PRUSS_SUART_MODULE
>> int ret;
>>
>> ret = clk_add_alias(NULL, "da8xx_pruss_uart.1",
>> NULL, &da850_mcasp_device.dev);
>> if (ret < 0)
>> return ret;
>> #endif
>> da8xx_pruss_dev.dev.platform_data = pruss_device;
>> return platform_device_register(&da8xx_pruss_dev);
>> }
>
> Yes. But still better would be to wrap clk_add_alias() into a function
> of its own (defining it empty if CONFIG_SERIAL_PRUSS_SUART_MODULE is not
> defined).
>
> WBR, Sergei