From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Greg KH <gregkh@suse.de>
Cc: linux-kernel@vger.kernel.org,
Russell King <rmk+kernel@arm.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>,
Samuel Ortiz <sameo@linux.intel.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: Re: platform_device_add_data(pdev, NULL, 0)
Date: Mon, 26 Oct 2009 22:19:03 +0100 [thread overview]
Message-ID: <20091026211903.GA27094@pengutronix.de> (raw)
In-Reply-To: <20091026164807.GC28072@suse.de>
Hi Greg,
On Mon, Oct 26, 2009 at 09:48:07AM -0700, Greg KH wrote:
> On Fri, Oct 23, 2009 at 10:26:22PM +0200, Uwe Kleine-König wrote:
> > Hello,
> >
> > mfd_add_device() (defined in drivers/mfd/mfd-core.c) is a wrapper do
> > allocate platform_devices.
> >
> > It contains:
> >
> > ret = platform_device_add_data(pdev,
> > cell->platform_data, cell->data_size);
> >
> > If cell->data_size is 0 (and so likely cell->platform_data == NULL),
> > still pdev->dev.platform_data get assigned ZERO_SIZE_PTR.
> >
> > IMHO the result should better be that pdev->dev.platform_data ends being
> > NULL, too. Agreed?
>
> Why? Is this causing problems somewhere?
The "problem" I as follows: I have a driver that doesn't use
platform_data and I want to change that. As both the driver and the
device probably go via different trees and I want to do the following in
the driver:
if (platform_data != NULL)
/* use it */
else
/* use the old data */
OK, I could simply use:
if (platform_data != NULL && platform_data != ZERO_SIZE_PTR)
...
but it feels ugly.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2009-10-26 21:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-23 20:26 Uwe Kleine-König
2009-10-26 16:48 ` Greg KH
2009-10-26 21:19 ` Uwe Kleine-König [this message]
2009-10-26 21:21 ` Greg KH
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=20091026211903.GA27094@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=akpm@linux-foundation.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+kernel@arm.linux.org.uk \
--cc=sameo@linux.intel.com \
/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
all inboxes | Powered by JetHome®