Commit graph

7 commits

Author SHA1 Message Date
Scott Wood
6eefd34fdc Driver core: Make platform_device_add_data accept a const pointer
platform_device_add_data() makes a copy of the data that is given to it,
and thus the parameter can be const.  This removes a warning when data
from get_property() on powerpc is handed to platform_device_add_data(),
as get_property() returns a const pointer.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-12-13 15:38:46 -08:00
David Brownell
c67334fbdf Driver core: platform_driver_probe(), can save codespace
This defines a new platform_driver_probe() method allowing the driver's
probe() method, and its support code+data, to safely live in __init
sections for typical system configurations.

Many system-on-chip processors could benefit from this API, to the tune
of recovering hundreds to thousands of bytes per driver.  That's memory
which is currently wasted holding code which can never be called after
system startup, yet can not be removed.   It can't be removed because of
the linkage requirement that pointers to init section code (like, ideally,
probe support) must not live in other sections (like driver method tables)
after those pointers would be invalid.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-12-01 14:52:02 -08:00
David Brownell
386415d88b PM: platform_bus and late_suspend/early_resume
Teach platform_bus about the new suspend_late/resume_early PM calls,
issued with IRQs off.  Do we really need sysdev and friends any more,
or can janitors start switching its users over to platform_device so
we can do a minor code-ectomy?

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-25 21:08:38 -07:00
Dmitry Torokhov
93ce3061be [PATCH] Driver Core: Add platform_device_del()
Driver core: add platform_device_del function

Having platform_device_del90 allows more straightforward error
handling code in drivers registering platform devices.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 16:18:09 -08:00
Russell King
00d3dcdd96 [DRIVER MODEL] Add platform_driver
Introduce struct platform_driver.  This allows the platform device
driver methods to be passed a platform_device structure instead of
instead of a plain device structure, and therefore requiring casting
in every platform driver.

We introduce this in such a way that any existing platform drivers
registered directly via driver_register continue to work as before,
thereby allowing a gradual conversion to the new platform_driver
methods.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-11-09 17:23:39 +00:00
Russell King
37c12e7497 [DRIVER MODEL] Improved dynamically allocated platform_device interface
Re-jig the simple platform device support to allow private data
to be attached to a platform device, as well as allowing the
parent device to be set.

Example usage:

	pdev = platform_device_alloc("mydev", id);
	if (pdev) {
		err = platform_device_add_resources(pdev, &resources,
						    ARRAY_SIZE(resources));
		if (err == 0)
			err = platform_device_add_data(pdev, &platform_data,
						       sizeof(platform_data));
		if (err == 0)
			err = platform_device_add(pdev);
	} else {
		err = -ENOMEM;
	}
	if (err)
		platform_device_put(pdev);

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-11-05 21:19:33 +00:00
Russell King
bbbf508d64 [DRIVER MODEL] Add missing platform_device.h header.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-10-29 22:17:58 +01:00