mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Li Shaohua <shaohua.li@intel.com>
To: ACPI-DEV <acpi-devel@lists.sourceforge.net>,
	lkml <linux-kernel@vger.kernel.org>
Cc: Len Brown <len.brown@intel.com>, Greg <greg@kroah.com>,
	Patrick Mochel <mochel@digitalimplant.org>
Subject: [PATCH/RFC 1/4]device core changes
Date: Mon, 08 Nov 2004 12:11:11 +0800	[thread overview]
Message-ID: <1099887071.1750.243.camel@sli10-desk.sh.intel.com> (raw)

[-- 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 *
_

             reply	other threads:[~2004-11-08  4:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-08  4:11 Li Shaohua [this message]
2004-11-08 22:58 ` Greg KH
2004-11-09  0:50   ` Li Shaohua
2004-11-09  3:35     ` Li Shaohua
2004-11-09  4:58       ` Greg KH
2004-11-09  9:03         ` Li Shaohua
2004-11-10  1:24           ` Greg KH
2004-11-10  1:45             ` Li Shaohua
2004-11-10  4:28               ` Russell King
2004-11-11  7:03                 ` Li Shaohua
2004-11-11  8:44                   ` Russell King
2004-11-11  8:46                     ` Li Shaohua
2004-11-12  0:30                   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1099887071.1750.243.camel@sli10-desk.sh.intel.com \
    --to=shaohua.li@intel.com \
    --cc=acpi-devel@lists.sourceforge.net \
    --cc=greg@kroah.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@digitalimplant.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®