mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* missing "platform_remove_devices" in kernel 2.6
@ 2005-07-05 21:04 Pawel Kolodziejski
  2005-07-05 21:37 ` Russell King
  0 siblings, 1 reply; 2+ messages in thread
From: Pawel Kolodziejski @ 2005-07-05 21:04 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 149 bytes --]

Hi,

I attached patch for kernel 2.6.12 which add missing
"platform_remove_devices" function in "drivers/base/platform.c" file.

Pawel Kolodziejski


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: remove_platform_devices.diff --]
[-- Type: text/x-patch; name="remove_platform_devices.diff", Size: 1051 bytes --]

diff -u -r -N -P old/kernel26/drivers/base/platform.c new/kernel26/drivers/base/platform.c
--- old/kernel26/drivers/base/platform.c	2005-07-01 06:48:46.000000000 +0200
+++ new/kernel26/drivers/base/platform.c	2005-07-01 07:33:44.000000000 +0200
@@ -114,6 +114,22 @@
 }
 
 /**
+ *	platform_remove_devices - remove a numbers of platform devices
+ *	@devs: array of platform devices to remove
+ *	@num: number of platform devices in array
+ */
+int platform_remove_devices(struct platform_device **devs, int num)
+{
+	int i;
+
+	for (i = 0; i < num; i++) {
+		platform_device_unregister(devs[i]);
+	}
+
+	return 0;
+}
+
+/**
  *	platform_device_register - add a platform-level device
  *	@pdev:	platform device we're adding
  *
@@ -347,6 +363,7 @@
 EXPORT_SYMBOL_GPL(platform_bus);
 EXPORT_SYMBOL_GPL(platform_bus_type);
 EXPORT_SYMBOL_GPL(platform_add_devices);
+EXPORT_SYMBOL_GPL(platform_remove_devices);
 EXPORT_SYMBOL_GPL(platform_device_register);
 EXPORT_SYMBOL_GPL(platform_device_register_simple);
 EXPORT_SYMBOL_GPL(platform_device_unregister);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: missing "platform_remove_devices" in kernel 2.6
  2005-07-05 21:04 missing "platform_remove_devices" in kernel 2.6 Pawel Kolodziejski
@ 2005-07-05 21:37 ` Russell King
  0 siblings, 0 replies; 2+ messages in thread
From: Russell King @ 2005-07-05 21:37 UTC (permalink / raw)
  To: Pawel Kolodziejski; +Cc: linux-kernel

On Tue, Jul 05, 2005 at 11:04:53PM +0200, Pawel Kolodziejski wrote:
> I attached patch for kernel 2.6.12 which add missing
> "platform_remove_devices" function in "drivers/base/platform.c" file.

It's missing because platform_register_devices() is only intended to
be called from code areas which only registers platform devices - eg,
platform specific initialisation code.

Using platform_register_devices() from a module to register a set of
statically allocated devices is very dangerous - you should be using
platform_device_register_simple() instead.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-07-05 21:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-05 21:04 missing "platform_remove_devices" in kernel 2.6 Pawel Kolodziejski
2005-07-05 21:37 ` Russell King

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®