public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC 1/4]device core changes
@ 2004-11-08  4:11 Li Shaohua
  2004-11-08 22:58 ` Greg KH
  0 siblings, 1 reply; 13+ messages in thread
From: Li Shaohua @ 2004-11-08  4:11 UTC (permalink / raw)
  To: ACPI-DEV, lkml; +Cc: Len Brown, Greg, Patrick Mochel

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

Hi,
This is the device core change required. Add .platform_bind method for
bus_type, so platform can do addition things when add a new device. A
case is ACPI, we want to utilize some ACPI methods for physical devices.
1. Why doesn't use 'platform_notify'?
Current device core has a 'platform_notify' mechanism, but it's not
sufficient for this. Only sepcific bus type know how to parse dev.bus_id
and know how to encode specific device's address into ACPI _ADR syntax.
2. Why adds new 'handle' in 'struct device'?
'Platform_data' is the best candidate, but a search shows some drivers
have used it. We can remove 'handle' after the drivers changes their
behavior.


Thanks,
Shaohua
---

 2.6-root/drivers/base/bus.c     |    2 ++
 2.6-root/include/linux/device.h |    2 ++
 2 files changed, 4 insertions(+)

diff -puN drivers/base/bus.c~devcore-platformbind drivers/base/bus.c
--- 2.6/drivers/base/bus.c~devcore-platformbind	2004-11-08
10:57:57.996568552 +0800
+++ 2.6-root/drivers/base/bus.c	2004-11-08 11:02:42.045386568 +0800
@@ -463,6 +463,8 @@ int bus_add_device(struct device * dev)
 		list_add_tail(&dev->bus_list, &dev->bus->devices.list);
 		device_attach(dev);
 		up_write(&dev->bus->subsys.rwsem);
+		if (bus->platform_bind)
+			bus->platform_bind(dev);
 		device_add_attrs(bus, dev);
 		sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id);
 	}
diff -puN include/linux/device.h~devcore-platformbind
include/linux/device.h
--- 2.6/include/linux/device.h~devcore-platformbind	2004-11-08
10:57:57.998568248 +0800
+++ 2.6-root/include/linux/device.h	2004-11-08 10:57:58.001567792 +0800
@@ -63,6 +63,7 @@ struct bus_type {
 				    int num_envp, char *buffer, int buffer_size);
 	int		(*suspend)(struct device * dev, u32 state);
 	int		(*resume)(struct device * dev);
+	int		(*platform_bind)(struct device *dev);
 };
 
 extern int bus_register(struct bus_type * bus);
@@ -290,6 +291,7 @@ struct device {
 					     override */
 
 	void	(*release)(struct device * dev);
+	void			*handle;
 };
 
 static inline struct device *
_


[-- Attachment #2: p00001_devcore-platformbind.patch --]
[-- Type: text/x-patch, Size: 1982 bytes --]


Add .platform_bind method for bus_type, so platform can do addition things
when add a new device. A case is ACPI, we want to utilize some ACPI methods
for physical devices.
1. Why doesn't use 'platform_notify'?
Current device core has a 'platform_notify' mechanism, but it's not
sufficient for this. Only sepcific bus type know how to parse dev.bus_id and
know how to encode specific device's address into ACPI _ADR syntax.
2. Why adds new 'handle' in 'struct device'?
'Platform_data' is the best candidate, but a search shows some drivers have
used it. We can remove 'handle' after the drivers changes their behavior.

---

 2.6-root/drivers/base/bus.c     |    2 ++
 2.6-root/include/linux/device.h |    2 ++
 2 files changed, 4 insertions(+)

diff -puN drivers/base/bus.c~devcore-platformbind drivers/base/bus.c
--- 2.6/drivers/base/bus.c~devcore-platformbind	2004-11-08 10:57:57.996568552 +0800
+++ 2.6-root/drivers/base/bus.c	2004-11-08 11:02:42.045386568 +0800
@@ -463,6 +463,8 @@ int bus_add_device(struct device * dev)
 		list_add_tail(&dev->bus_list, &dev->bus->devices.list);
 		device_attach(dev);
 		up_write(&dev->bus->subsys.rwsem);
+		if (bus->platform_bind)
+			bus->platform_bind(dev);
 		device_add_attrs(bus, dev);
 		sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id);
 	}
diff -puN include/linux/device.h~devcore-platformbind include/linux/device.h
--- 2.6/include/linux/device.h~devcore-platformbind	2004-11-08 10:57:57.998568248 +0800
+++ 2.6-root/include/linux/device.h	2004-11-08 10:57:58.001567792 +0800
@@ -63,6 +63,7 @@ struct bus_type {
 				    int num_envp, char *buffer, int buffer_size);
 	int		(*suspend)(struct device * dev, u32 state);
 	int		(*resume)(struct device * dev);
+	int		(*platform_bind)(struct device *dev);
 };
 
 extern int bus_register(struct bus_type * bus);
@@ -290,6 +291,7 @@ struct device {
 					     override */
 
 	void	(*release)(struct device * dev);
+	void			*handle;
 };
 
 static inline struct device *
_

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

end of thread, other threads:[~2004-11-12  0:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-08  4:11 [PATCH/RFC 1/4]device core changes Li Shaohua
2004-11-08 22:58 ` Greg KH
2004-11-09  0:50   ` Li Shaohua
2004-11-09  3:35     ` Li Shaohua
     [not found]       ` <1099971341.15294.48.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org>
2004-11-09  4:58         ` Greg KH
     [not found]           ` <20041109045843.GA4849-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2004-11-09  9:03             ` Li Shaohua
     [not found]               ` <1099990981.15294.57.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org>
2004-11-10  1:24                 ` Greg KH
     [not found]                   ` <20041110012443.GA9496-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2004-11-10  1:45                     ` Li Shaohua
2004-11-10  4:28                       ` Russell King
     [not found]                         ` <20041110042822.A13318-f404yB8NqCZvn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2004-11-11  7:03                           ` Li Shaohua
     [not found]                             ` <1100156613.8769.26.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org>
2004-11-11  8:44                               ` Russell King
     [not found]                                 ` <20041111084411.A2400-f404yB8NqCZvn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2004-11-11  8:46                                   ` Li Shaohua
2004-11-12  0:30                               ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox