s3cmci_def_pdata vs. pdev->dev.platform_data

Werner Almesberger werner at openmoko.org
Tue Nov 18 22:03:17 CET 2008

Hi Ben,

when compiling s3cmci as a module and doing an insmod-rmmod-insmod
sequence, s3cmci_probe often oopses because the platform data contains

The reason for this is that I'm not providing any platform data, and
thus s3cmci tries to put its own defaults:

	if (!host->pdata) {
		pdev->dev.platform_data = &s3cmci_def_pdata;
		host->pdata = &s3cmci_def_pdata;

s3cmci_def_pdata is inside the module, so the pointer in
pdev->dev.platform_data becomes invalid after the module is unloaded.

This is easy enough to work around by providing empty platform data
in mach-gta02.c (patch attached), but I wonder if we can't do better
than this.

Do we actually need to "patch" pdev->dev.platform_data ? Inside s3cmci,
all accesses to the platform data go through host->pdata, so this
seems fine.

I've built a kernel without platform data in mach-gta02.c that doesn't
modify pdev->dev.platform_data and it seems to work.

Can you please suggest the best course of action ?

- Werner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: workaround-s3cmci-reload.patch
Type: text/x-diff
Size: 1580 bytes
Desc: not available
Url : http://lists.openmoko.org/pipermail/openmoko-kernel/attachments/20081118/43c3ac06/attachment.patch 

More information about the openmoko-kernel mailing list