2009-04-16 13:50:34

by Atsushi Nemoto

[permalink] [raw]
Subject: [PATCH] platform: Do not complain for platform_data added by platform_device_add_data()

The commit ce21c7bc ("driver core: fix passing platform_data") added
an error message "foo: use which platform_data?", but this is normal
if platform_device_add_data() was used.

Do not print the error message if pdev->platform_data and
pdev->dev.platform_data have same value.

Signed-off-by: Atsushi Nemoto <[email protected]>
---
drivers/base/platform.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index d2198f6..f984376 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -253,7 +253,8 @@ int platform_device_add(struct platform_device *pdev)
* long time, so we allow the two cases coexist to make
* this kind of fix more easily*/
if (pdev->platform_data && pdev->dev.platform_data) {
- printk(KERN_ERR
+ if (pdev->platform_data != pdev->dev.platform_data)
+ printk(KERN_ERR
"%s: use which platform_data?\n",
dev_name(&pdev->dev));
} else if (pdev->platform_data) {
--
1.5.6.3


2009-04-17 00:06:36

by Ming Lei

[permalink] [raw]
Subject: Re: [PATCH] platform: Do not complain for platform_data added by platform_device_add_data()

2009/4/16 Atsushi Nemoto <[email protected]>:
> The commit ce21c7bc ("driver core: fix passing platform_data") added
> an error message "foo: use which platform_data?", but this is normal
> if platform_device_add_data() was used.
>
> Do not print the error message if pdev->platform_data and
> pdev->dev.platform_data have same value.
>
> Signed-off-by: Atsushi Nemoto <[email protected]>

Acked-by: Ming Lei <[email protected]>

> ---
> ?drivers/base/platform.c | ? ?3 ++-
> ?1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index d2198f6..f984376 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -253,7 +253,8 @@ int platform_device_add(struct platform_device *pdev)
> ? ? ? ?* long time, so we allow the two cases coexist to make
> ? ? ? ?* this kind of fix more easily*/
> ? ? ? ?if (pdev->platform_data && pdev->dev.platform_data) {
> - ? ? ? ? ? ? ? printk(KERN_ERR
> + ? ? ? ? ? ? ? if (pdev->platform_data != pdev->dev.platform_data)
> + ? ? ? ? ? ? ? ? ? ? ? printk(KERN_ERR
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "%s: use which platform_data?\n",
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? dev_name(&pdev->dev));
> ? ? ? ?} else if (pdev->platform_data) {
> --
> 1.5.6.3
>
>



--
Lei Ming