[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091026211903.GA27094@pengutronix.de>
Date: Mon, 26 Oct 2009 22:19:03 +0100
From: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
To: Greg KH <gregkh@...e.de>
Cc: linux-kernel@...r.kernel.org,
Russell King <rmk+kernel@....linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
Samuel Ortiz <sameo@...ux.intel.com>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>
Subject: Re: platform_device_add_data(pdev, NULL, 0)
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/ |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists