public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Greg KH <greg@kroah.com>, lkml <linux-kernel@vger.kernel.org>
Subject: [patch 2.6.30-rc3] platform_bus:  remove "which platform_data?" confusion
Date: Mon, 27 Apr 2009 19:43:40 -0700	[thread overview]
Message-ID: <200904271943.40588.david-b@pacbell.net> (raw)

From: David Brownell <dbrownell@users.sourceforge.net>

Recent patches have caused platform_device_add_pdata() users
to trigger confused "use which platform_data?" error messages
from the kernel.  ("The _only_ one you were given, dummy!" is
the correct answer.)

This patch fixes those messages so they only appear if there's
reason to be confused.  (The call should probably fail too...)

Those patches seem to support what I think is a misguided
notion:  that somehow device.platform_data might move into
the platform_device.  The problem with that idea is that it's
a general purpose hook, and is used by other busses to provide
board-specific configuration data ... not just for platform_bus.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
For 2.6.30, which recently acquired this confusion.

 drivers/base/platform.c |   22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -251,16 +251,20 @@ int platform_device_add(struct platform_
 	* if all platform devices pass its platform specific data
 	* from platform_device. The conversion is going to be a
 	* 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
-			       "%s: use which platform_data?\n",
-			       dev_name(&pdev->dev));
-	} else if (pdev->platform_data) {
-		pdev->dev.platform_data = pdev->platform_data;
-	} else if (pdev->dev.platform_data) {
+	* this kind of fix more easily
+	*
+	* REVISIT platform_data is used by more than "platform_bus".
+	* It's a generic hook for data that's specific to a given
+	* board.  Removing it seems rather impractical...
+	*/
+	if (!pdev->platform_data)
 		pdev->platform_data = pdev->dev.platform_data;
-	}
+	else if (!pdev->dev.platform_data)
+		pdev->dev.platform_data = pdev->platform_data;
+
+	if (pdev->platform_data != pdev->dev.platform_data)
+		pr_err("%s: use which platform_data?\n",
+			       dev_name(&pdev->dev));
 
 	for (i = 0; i < pdev->num_resources; i++) {
 		struct resource *p, *r = &pdev->resource[i];


             reply	other threads:[~2009-04-28  2:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-28  2:43 David Brownell [this message]
2009-04-28  5:07 ` [patch 2.6.30-rc3] platform_bus: remove "which platform_data?" confusion Greg KH
2009-04-28  9:28   ` David Brownell
2009-04-29  3:24     ` Greg KH
2009-04-29  5:01       ` David Brownell
2009-04-29  4:08 ` Greg KH
2009-04-29 12:08   ` Ming Lei
2009-04-29 18:16     ` Greg KH
2009-04-29 23:53       ` Ming Lei

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=200904271943.40588.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox