[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <45a44e480804010047m36a9b8e3p97910308ed5677fb@mail.gmail.com>
Date: Tue, 1 Apr 2008 00:47:54 -0700
From: "Jaya Kumar" <jayakumar.lkml@...il.com>
To: "Dmitry Torokhov" <dmitry.torokhov@...il.com>
Cc: "Linux Kernel Development" <linux-kernel@...r.kernel.org>
Subject: Re: Clarifying platform_device_unregister
On Mon, Mar 31, 2008 at 10:19 PM, Dmitry Torokhov
<dmitry.torokhov@...il.com> wrote:
> On Mon, Mar 31, 2008 at 09:14:35PM -0400, Jaya Kumar wrote:
> > mytest_device->dev.platform_data = &mydata;
>
> Platform device code does kfree(pdev->dev.platform_data) unpon
> unregistration, so it is not a good idea to assign address of
> statically-allocated variable here. You should be using:
>
> platform_device_add_data(mytest_device, &mydata, sizeof(mydata));
>
That's interesting. I noticed though that a lot of platform device
code assigns a statically allocated structure to platform_data. For
example:
arch/arm/mach-pxa/corgi_pm.c
static struct sharpsl_charger_machinfo corgi_pm_machinfo = {
...
}
corgipm_device->dev.platform_data = &corgi_pm_machinfo;
same with spitz_pm.c.
egrep "platform_data.*=.*\&" *.c shows quite a lot of users doing
that. I guess most of these below are probably okay since these
drivers can't be rmmoded.
corgi.c: .platform_data = &corgi_scoop_setup,
corgi.c: .platform_data = &corgi_bl_machinfo,
corgi.c: .platform_data = &corgi_ts_machinfo,
corgi_lcd.c: .platform_data = &corgi_fb_info,
corgi_pm.c: corgipm_device->dev.platform_data = &corgi_pm_machinfo;
generic.c: .platform_data = &pxa_udc_info,
lpd270.c: .platform_data = &lpd270_flash_data[0],
lpd270.c: .platform_data = &lpd270_flash_data[1],
lubbock.c: .platform_data = &pxa_ssp_master_info,
lubbock.c: .platform_data = &ads_info,
lubbock.c: .platform_data = &lubbock_flash_data[0],
lubbock.c: .platform_data = &lubbock_flash_data[1],
mainstone.c: .dev = { .platform_data = &mst_audio_ops },
mainstone.c: .platform_data = &mst_flash_data[0],
mainstone.c: .platform_data = &mst_flash_data[1],
poodle.c: .platform_data = &poodle_scoop_setup,
poodle.c: .platform_data = &poodle_ts_machinfo,
spitz.c: .platform_data = &spitz_scoop_setup,
spitz.c: .platform_data = &spitz_scoop2_setup,
spitz.c: .platform_data = &spitz_bl_machinfo,
spitz.c: .platform_data = &spitz_ts_machinfo,
spitz_pm.c: spitzpm_device->dev.platform_data = &spitz_pm_machinfo;
tosa.c: .platform_data = &tosa_scoop_setup,
tosa.c: .platform_data = &tosa_scoop_jc_setup,
trizeps4.c: .platform_data = &trizeps4_flash_data,
--
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