projects/linux·commit ab86e576

Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6

ab86e576 · Linus Torvalds <[email protected]> · 2009-09-16 08:27:10 -07:00

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6:
  Driver Core: devtmpfs - kernel-maintained tmpfs-based /dev
  debugfs: Modify default debugfs directory for debugging pktcdvd.
  debugfs: Modified default dir of debugfs for debugging UHCI.
  debugfs: Change debugfs directory of IWMC3200
  debugfs: Change debuhgfs directory of trace-events-sample.h
  debugfs: Fix mount directory of debugfs by default in events.txt
  hpilo: add poll f_op
  hpilo: add interrupt handler
  hpilo: staging for interrupt handling
  driver core: platform_device_add_data(): use kmemdup()
  Driver core: Add support for compatibility classes
  uio: add generic driver for PCI 2.3 devices
  driver-core: move dma-coherent.c from kernel to driver/base
  mem_class: fix bug
  mem_class: use minor as index instead of searching the array
  driver model: constify attribute groups
  UIO: remove 'default n' from Kconfig
  Driver core: Add accessor for device platform data
  Driver core: move dev_get/set_drvdata to drivers/base/dd.c
  Driver core: add new device to bus's list before probing
Commit
ab86e5765d41a5eb4239a1c04d613db87bea5ed8
Parents
7ea61767 · 2b2af54a

Merge commit. Changes below are compared with the first parent: 7ea61767.

Changes

59 files changed · +1287 −239

FileStatusAddDelContent
Documentation/DocBook/uio-howto.tmplmodified+163−0View file
Documentation/trace/events.txtmodified+12−12View file
MAINTAINERSmodified+7−0View file
block/genhd.cmodified+1−1View file
drivers/base/Kconfigmodified+25−0View file
drivers/base/Makefilemodified+2−0View file
drivers/base/base.hmodified+12−1View file
drivers/base/bus.cmodified+10−13View file
drivers/base/class.cmodified+87−0View file
drivers/base/core.cmodified+20−9View file
drivers/base/dd.cmodified+29−2View file
drivers/base/devtmpfs.cadded+367−0View file
kernel/dma-coherent.c → drivers/base/dma-coherent.crenamed+0−0View file
drivers/base/driver.cmodified+2−2View file
drivers/base/init.cmodified+1−0View file
drivers/base/platform.cmodified+4−4View file
drivers/block/cciss.cmodified+1−1View file
drivers/block/pktcdvd.cmodified+1−1View file
drivers/char/mem.cmodified+40−42View file
drivers/firewire/core-device.cmodified+1−1View file
drivers/firmware/dmi-id.cmodified+1−1View file
drivers/infiniband/hw/ehca/ehca_main.cmodified+1−1View file
drivers/infiniband/hw/ipath/ipath_kernel.hmodified+1−1View file
drivers/infiniband/hw/ipath/ipath_sysfs.cmodified+1−1View file
drivers/input/input.cmodified+1−1View file
drivers/misc/enclosure.cmodified+2−2View file
drivers/misc/hpilo.cmodified+203−87View file
drivers/misc/hpilo.hmodified+7−1View file
drivers/mmc/core/mmc.cmodified+1−1View file
drivers/mmc/core/sd.cmodified+1−1View file
drivers/mtd/mtdcore.cmodified+1−1View file
drivers/net/wireless/iwmc3200wifi/Kconfigmodified+3−3View file
drivers/s390/cio/css.cmodified+1−1View file
drivers/s390/cio/device.cmodified+1−1View file
drivers/s390/net/netiucv.cmodified+1−1View file
drivers/scsi/scsi_priv.hmodified+1−1View file
drivers/scsi/scsi_sysfs.cmodified+2−2View file
drivers/uio/Kconfigmodified+10−5View file
drivers/uio/Makefilemodified+1−0View file
drivers/uio/uio_pci_generic.cadded+207−0View file
drivers/usb/core/endpoint.cmodified+1−1View file
drivers/usb/core/sysfs.cmodified+2−2View file
drivers/usb/core/usb.hmodified+2−2View file
drivers/usb/host/uhci-hcd.cmodified+1−1View file
drivers/uwb/lc-dev.cmodified+1−1View file
fs/partitions/check.cmodified+1−1View file
include/linux/attribute_container.hmodified+1−1View file
include/linux/device.hmodified+30−15View file
include/linux/netdevice.hmodified+1−1View file
include/linux/pci_regs.hmodified+1−0View file
include/linux/shmem_fs.hmodified+3−0View file
include/linux/transport_class.hmodified+1−1View file
init/do_mounts.cmodified+1−1View file
init/main.cmodified+2−0View file
kernel/Makefilemodified+0−1View file
mm/shmem.cmodified+3−6View file
net/bluetooth/hci_sysfs.cmodified+2−2View file
net/core/net-sysfs.cmodified+1−1View file
samples/trace_events/trace-events-sample.hmodified+1−1View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/DocBook/uio-howto.tmpl

View file
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl
index 8f6e3b2..4d4ce0e 100644
--- a/Documentation/DocBook/uio-howto.tmpl
+++ b/Documentation/DocBook/uio-howto.tmpl
@@ -25,6 +25,10 @@
<year>2006-2008</year>
<holder>Hans-Jürgen Koch.</holder>
</copyright>
+<copyright>
+ <year>2009</year>
+ <holder>Red Hat Inc, Michael S. Tsirkin ([email protected])</holder>
+</copyright>
<legalnotice>
<para>
@@ -42,6 +46,13 @@ GPL version 2.
<revhistory>
<revision>
+ <revnumber>0.9</revnumber>
+ <date>2009-07-16</date>
+ <authorinitials>mst</authorinitials>
+ <revremark>Added generic pci driver
+ </revremark>
+ </revision>
+ <revision>
<revnumber>0.8</revnumber>
<date>2008-12-24</date>
<authorinitials>hjk</authorinitials>
@@ -809,6 +820,158 @@ framework to set up sysfs files for this region. Simply leave it alone.
</chapter>
+<chapter id="uio_pci_generic" xreflabel="Using Generic driver for PCI cards">
+<?dbhtml filename="uio_pci_generic.html"?>
+<title>Generic PCI UIO driver</title>
+ <para>
+ The generic driver is a kernel module named uio_pci_generic.
+ It can work with any device compliant to PCI 2.3 (circa 2002) and
+ any compliant PCI Express device. Using this, you only need to
+ write the userspace driver, removing the need to write
+ a hardware-specific kernel module.
+ </para>
+
+<sect1 id="uio_pci_generic_binding">
+<title>Making the driver recognize the device</title>
+ <para>
+Since the driver does not declare any device ids, it will not get loaded
+automatically and will not automatically bind to any devices, you must load it
+and allocate id to the driver yourself. For example:
+ <programlisting>
+ modprobe uio_pci_generic
+ echo &quot;8086 10f5&quot; &gt; /sys/bus/pci/drivers/uio_pci_generic/new_id
+ </programlisting>
+ </para>
+ <para>
+If there already is a hardware specific kernel driver for your device, the
+generic driver still won't bind to it, in this case if you want to use the
+generic driver (why would you?) you'll have to manually unbind the hardware
+specific driver and bind the generic driver, like this:
+ <programlisting>
+ echo -n 0000:00:19.0 &gt; /sys/bus/pci/drivers/e1000e/unbind
+ echo -n 0000:00:19.0 &gt; /sys/bus/pci/drivers/uio_pci_generic/bind
+ </programlisting>
+ </para>
+ <para>
+You can verify that the device has been bound to the driver
+by looking for it in sysfs, for example like the following:
+ <programlisting>
+ ls -l /sys/bus/pci/devices/0000:00:19.0/driver
+ </programlisting>
+Which if successful should print
+ <programlisting>
+ .../0000:00:19.0/driver -&gt; ../../../bus/pci/drivers/uio_pci_generic
+ </programlisting>
+Note that the generic driver will not bind to old PCI 2.2 devices.
+If binding the device failed, run the following command:
+ <programlisting>
+ dmesg
+ </programlisting>
+and look in the output for failure reasons
+ </para>
+</sect1>
+
+<sect1 id="uio_pci_generic_internals">
+<title>Things to know about uio_pci_generic</title>
+ <para>
+Interrupts are handled using the Interrupt Disable bit in the PCI command
+register and Interrupt Status bit in the PCI status register. All devices
+compliant to PCI 2.3 (circa 2002) and all compliant PCI Express devices should
+support these bits. uio_pci_generic detects this support, and won't bind to
+devices which do not support the Interrupt Disable Bit in the command register.
+ </para>
+ <para>
+On each interrupt, uio_pci_generic sets the Interrupt Disable bit.
+This prevents the device from generating further interrupts
+until the bit is cleared. The userspace driver should clear this
+bit before blocking and waiting for more interrupts.
+ </para>
+</sect1>
+<sect1 id="uio_pci_generic_userspace">
+<title>Writing userspace driver using uio_pci_generic</title>
+ <para>
+Userspace driver can use pci sysfs interface, or the
+libpci libray that wraps it, to talk to the device and to
+re-enable interrupts by writing to the command register.
+ </para>
+</sect1>
+<sect1 id="uio_pci_generic_example">
+<title>Example code using uio_pci_generic</title>
+ <para>
+Here is some sample userspace driver code using uio_pci_generic:
+<programlisting>
+#include &lt;stdlib.h&gt;
+#include &lt;stdio.h&gt;
+#include &lt;unistd.h&gt;
+#include &lt;sys/types.h&gt;
+#include &lt;sys/stat.h&gt;
+#include &lt;fcntl.h&gt;
+#include &lt;errno.h&gt;
+
+int main()
+{
+ int uiofd;
+ int configfd;
+ int err;
+ int i;
+ unsigned icount;
+ unsigned char command_high;
+
+ uiofd = open(&quot;/dev/uio0&quot;, O_RDONLY);
+ if (uiofd &lt; 0) {
+ perror(&quot;uio open:&quot;);
+ return errno;
+ }
+ configfd = open(&quot;/sys/class/uio/uio0/device/config&quot;, O_RDWR);
+ if (uiofd &lt; 0) {
+ perror(&quot;config open:&quot;);
+ return errno;
+ }
+
+ /* Read and cache command value */
+ err = pread(configfd, &amp;command_high, 1, 5);
+ if (err != 1) {
+ perror(&quot;command config read:&quot;);
+ return errno;
+ }
+ command_high &amp;= ~0x4;
+
+ for(i = 0;; ++i) {
+ /* Print out a message, for debugging. */
+ if (i == 0)
+ fprintf(stderr, &quot;Started uio test driver.\n&quot;);
+ else
+ fprintf(stderr, &quot;Interrupts: %d\n&quot;, icount);
+
+ /****************************************/
+ /* Here we got an interrupt from the
+ device. Do something to it. */
+ /****************************************/
+
+ /* Re-enable interrupts. */
+ err = pwrite(configfd, &amp;command_high, 1, 5);
+ if (err != 1) {
+ perror(&quot;config write:&quot;);
+ break;
+ }
+
+ /* Wait for next interrupt. */
+ err = read(uiofd, &amp;icount, 4);
+ if (err != 4) {
+ perror(&quot;uio read:&quot;);
+ break;
+ }
+
+ }
+ return errno;
+}
+
+</programlisting>
+ </para>
+</sect1>
+
+</chapter>
+
<appendix id="app1">
<title>Further information</title>
<itemizedlist>

Documentation/trace/events.txt

View file
diff --git a/Documentation/trace/events.txt b/Documentation/trace/events.txt
index 2bcc8d4..90e8b33 100644
--- a/Documentation/trace/events.txt
+++ b/Documentation/trace/events.txt
@@ -22,12 +22,12 @@ tracing information should be printed.
---------------------------------
The events which are available for tracing can be found in the file
-/debug/tracing/available_events.
+/sys/kernel/debug/tracing/available_events.
To enable a particular event, such as 'sched_wakeup', simply echo it
-to /debug/tracing/set_event. For example:
+to /sys/kernel/debug/tracing/set_event. For example:
- # echo sched_wakeup >> /debug/tracing/set_event
+ # echo sched_wakeup >> /sys/kernel/debug/tracing/set_event
[ Note: '>>' is necessary, otherwise it will firstly disable
all the events. ]
@@ -35,15 +35,15 @@ to /debug/tracing/set_event. For example:
To disable an event, echo the event name to the set_event file prefixed
with an exclamation point:
- # echo '!sched_wakeup' >> /debug/tracing/set_event
+ # echo '!sched_wakeup' >> /sys/kernel/debug/tracing/set_event
To disable all events, echo an empty line to the set_event file:
- # echo > /debug/tracing/set_event
+ # echo > /sys/kernel/debug/tracing/set_event
To enable all events, echo '*:*' or '*:' to the set_event file:
- # echo *:* > /debug/tracing/set_event
+ # echo *:* > /sys/kernel/debug/tracing/set_event
The events are organized into subsystems, such as ext4, irq, sched,
etc., and a full event name looks like this: <subsystem>:<event>. The
@@ -52,29 +52,29 @@ file. All of the events in a subsystem can be specified via the syntax
"<subsystem>:*"; for example, to enable all irq events, you can use the
command:
- # echo 'irq:*' > /debug/tracing/set_event
+ # echo 'irq:*' > /sys/kernel/debug/tracing/set_event
2.2 Via the 'enable' toggle
---------------------------
-The events available are also listed in /debug/tracing/events/ hierarchy
+The events available are also listed in /sys/kernel/debug/tracing/events/ hierarchy
of directories.
To enable event 'sched_wakeup':
- # echo 1 > /debug/tracing/events/sched/sched_wakeup/enable
+ # echo 1 > /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable
To disable it:
- # echo 0 > /debug/tracing/events/sched/sched_wakeup/enable
+ # echo 0 > /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable
To enable all events in sched subsystem:
- # echo 1 > /debug/tracing/events/sched/enable
+ # echo 1 > /sys/kernel/debug/tracing/events/sched/enable
To eanble all events:
- # echo 1 > /debug/tracing/events/enable
+ # echo 1 > /sys/kernel/debug/tracing/events/enable
When reading one of these enable files, there are four results:

MAINTAINERS

View file
diff --git a/MAINTAINERS b/MAINTAINERS
index 64b9e44..9117b65 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2218,6 +2218,13 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git
S: Maintained
F: include/asm-generic
+GENERIC UIO DRIVER FOR PCI DEVICES
+M: Michael S. Tsirkin <[email protected]>
+S: Supported
+F: drivers/uio/uio_pci_generic.c
+
GFS2 FILE SYSTEM
M: Steven Whitehouse <[email protected]>

block/genhd.c

View file
diff --git a/block/genhd.c b/block/genhd.c
index 5b76bf5..2ad91dd 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -903,7 +903,7 @@ static struct attribute_group disk_attr_group = {
.attrs = disk_attrs,
};
-static struct attribute_group *disk_attr_groups[] = {
+static const struct attribute_group *disk_attr_groups[] = {
&disk_attr_group,
NULL
};

drivers/base/Kconfig

View file
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 8f006f9..ee37727 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -8,6 +8,31 @@ config UEVENT_HELPER_PATH
Path to uevent helper program forked by the kernel for
every uevent.
+config DEVTMPFS
+ bool "Create a kernel maintained /dev tmpfs (EXPERIMENTAL)"
+ depends on HOTPLUG && SHMEM && TMPFS
+ help
+ This creates a tmpfs filesystem, and mounts it at bootup
+ and mounts it at /dev. The kernel driver core creates device
+ nodes for all registered devices in that filesystem. All device
+ nodes are owned by root and have the default mode of 0600.
+ Userspace can add and delete the nodes as needed. This is
+ intended to simplify bootup, and make it possible to delay
+ the initial coldplug at bootup done by udev in userspace.
+ It should also provide a simpler way for rescue systems
+ to bring up a kernel with dynamic major/minor numbers.
+ Meaningful symlinks, permissions and device ownership must
+ still be handled by userspace.
+ If unsure, say N here.
+
+config DEVTMPFS_MOUNT
+ bool "Automount devtmpfs at /dev"
+ depends on DEVTMPFS
+ help
+ This will mount devtmpfs at /dev if the kernel mounts the root
+ filesystem. It will not affect initramfs based mounting.
+ If unsure, say N here.
+
config STANDALONE
bool "Select only drivers that don't need compile-time external firmware" if EXPERIMENTAL
default y

drivers/base/Makefile

View file
diff --git a/drivers/base/Makefile b/drivers/base/Makefile
index b5b8ba5..c12c7f2 100644
--- a/drivers/base/Makefile
+++ b/drivers/base/Makefile
@@ -4,8 +4,10 @@ obj-y := core.o sys.o bus.o dd.o \
driver.o class.o platform.o \
cpu.o firmware.o init.o map.o devres.o \
attribute_container.o transport_class.o
+obj-$(CONFIG_DEVTMPFS) += devtmpfs.o
obj-y += power/
obj-$(CONFIG_HAS_DMA) += dma-mapping.o
+obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o
obj-$(CONFIG_ISA) += isa.o
obj-$(CONFIG_FW_LOADER) += firmware_class.o
obj-$(CONFIG_NUMA) += node.o

drivers/base/base.h

View file
diff --git a/drivers/base/base.h b/drivers/base/base.h
index b528145..2ca7f5b 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -70,6 +70,8 @@ struct class_private {
* @knode_parent - node in sibling list
* @knode_driver - node in driver list
* @knode_bus - node in bus list
+ * @driver_data - private pointer for driver specific info. Will turn into a
+ * list soon.
* @device - pointer back to the struct class that this structure is
* associated with.
*
@@ -80,6 +82,7 @@ struct device_private {
struct klist_node knode_parent;
struct klist_node knode_driver;
struct klist_node knode_bus;
+ void *driver_data;
struct device *device;
};
#define to_device_private_parent(obj) \
@@ -89,6 +92,8 @@ struct device_private {
#define to_device_private_bus(obj) \
container_of(obj, struct device_private, knode_bus)
+extern int device_private_init(struct device *dev);
+
/* initialisation functions */
extern int devices_init(void);
extern int buses_init(void);
@@ -104,7 +109,7 @@ extern int system_bus_init(void);
extern int cpu_dev_init(void);
extern int bus_add_device(struct device *dev);
-extern void bus_attach_device(struct device *dev);
+extern void bus_probe_device(struct device *dev);
extern void bus_remove_device(struct device *dev);
extern int bus_add_driver(struct device_driver *drv);
@@ -134,3 +139,9 @@ static inline void module_add_driver(struct module *mod,
struct device_driver *drv) { }
static inline void module_remove_driver(struct device_driver *drv) { }
#endif
+
+#ifdef CONFIG_DEVTMPFS
+extern int devtmpfs_init(void);
+#else
+static inline int devtmpfs_init(void) { return 0; }
+#endif

drivers/base/bus.c

View file
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 4b04a15..973bf2a 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -459,8 +459,9 @@ static inline void remove_deprecated_bus_links(struct device *dev) { }
* bus_add_device - add device to bus
* @dev: device being added
*
+ * - Add device's bus attributes.
+ * - Create links to device's bus.
* - Add the device to its bus's list of devices.
- * - Create link to device's bus.
*/
int bus_add_device(struct device *dev)
{
@@ -483,6 +484,7 @@ int bus_add_device(struct device *dev)
error = make_deprecated_bus_links(dev);
if (error)
goto out_deprecated;
+ klist_add_tail(&dev->p->knode_bus, &bus->p->klist_devices);
}
return 0;
@@ -498,24 +500,19 @@ out_put:
}
/**
- * bus_attach_device - add device to bus
- * @dev: device tried to attach to a driver
+ * bus_probe_device - probe drivers for a new device
+ * @dev: device to probe
*
- * - Add device to bus's list of devices.
- * - Try to attach to driver.
+ * - Automatically probe for a driver if the bus allows it.
*/
-void bus_attach_device(struct device *dev)
+void bus_probe_device(struct device *dev)
{
struct bus_type *bus = dev->bus;
- int ret = 0;
+ int ret;
- if (bus) {
- if (bus->p->drivers_autoprobe)
- ret = device_attach(dev);
+ if (bus && bus->p->drivers_autoprobe) {
+ ret = device_attach(dev);
WARN_ON(ret < 0);
- if (ret >= 0)
- klist_add_tail(&dev->p->knode_bus,
- &bus->p->klist_devices);
}
}

drivers/base/class.c

View file
diff --git a/drivers/base/class.c b/drivers/base/class.c
index eb85e43..161746d 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -488,6 +488,93 @@ void class_interface_unregister(struct class_interface *class_intf)
class_put(parent);
}
+struct class_compat {
+ struct kobject *kobj;
+};
+
+/**
+ * class_compat_register - register a compatibility class
+ * @name: the name of the class
+ *
+ * Compatibility class are meant as a temporary user-space compatibility
+ * workaround when converting a family of class devices to a bus devices.
+ */
+struct class_compat *class_compat_register(const char *name)
+{
+ struct class_compat *cls;
+
+ cls = kmalloc(sizeof(struct class_compat), GFP_KERNEL);
+ if (!cls)
+ return NULL;
+ cls->kobj = kobject_create_and_add(name, &class_kset->kobj);
+ if (!cls->kobj) {
+ kfree(cls);
+ return NULL;
+ }
+ return cls;
+}
+EXPORT_SYMBOL_GPL(class_compat_register);
+
+/**
+ * class_compat_unregister - unregister a compatibility class
+ * @cls: the class to unregister
+ */
+void class_compat_unregister(struct class_compat *cls)
+{
+ kobject_put(cls->kobj);
+ kfree(cls);
+}
+EXPORT_SYMBOL_GPL(class_compat_unregister);
+
+/**
+ * class_compat_create_link - create a compatibility class device link to
+ * a bus device
+ * @cls: the compatibility class
+ * @dev: the target bus device
+ * @device_link: an optional device to which a "device" link should be created
+ */
+int class_compat_create_link(struct class_compat *cls, struct device *dev,
+ struct device *device_link)
+{
+ int error;
+
+ error = sysfs_create_link(cls->kobj, &dev->kobj, dev_name(dev));
+ if (error)
+ return error;
+
+ /*
+ * Optionally add a "device" link (typically to the parent), as a
+ * class device would have one and we want to provide as much
+ * backwards compatibility as possible.
+ */
+ if (device_link) {
+ error = sysfs_create_link(&dev->kobj, &device_link->kobj,
+ "device");
+ if (error)
+ sysfs_remove_link(cls->kobj, dev_name(dev));
+ }
+
+ return error;
+}
+EXPORT_SYMBOL_GPL(class_compat_create_link);
+
+/**
+ * class_compat_remove_link - remove a compatibility class device link to
+ * a bus device
+ * @cls: the compatibility class
+ * @dev: the target bus device
+ * @device_link: an optional device to which a "device" link was previously
+ * created
+ */
+void class_compat_remove_link(struct class_compat *cls, struct device *dev,
+ struct device *device_link)
+{
+ if (device_link)
+ sysfs_remove_link(&dev->kobj, "device");
+ sysfs_remove_link(cls->kobj, dev_name(dev));
+}
+EXPORT_SYMBOL_GPL(class_compat_remove_link);
+
int __init classes_init(void)
{
class_kset = kset_create_and_add("class", NULL, NULL);

drivers/base/core.c

View file
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 7ecb193..390e664 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -341,7 +341,7 @@ static void device_remove_attributes(struct device *dev,
}
static int device_add_groups(struct device *dev,
- struct attribute_group **groups)
+ const struct attribute_group **groups)
{
int error = 0;
int i;
@@ -361,7 +361,7 @@ static int device_add_groups(struct device *dev,
}
static void device_remove_groups(struct device *dev,
- struct attribute_group **groups)
+ const struct attribute_group **groups)
{
int i;
@@ -843,6 +843,17 @@ static void device_remove_sys_dev_entry(struct device *dev)
}
}
+int device_private_init(struct device *dev)
+{
+ dev->p = kzalloc(sizeof(*dev->p), GFP_KERNEL);
+ if (!dev->p)
+ return -ENOMEM;
+ dev->p->device = dev;
+ klist_init(&dev->p->klist_children, klist_children_get,
+ klist_children_put);
+ return 0;
+}
+
/**
* device_add - add device to device hierarchy.
* @dev: device.
@@ -868,14 +879,11 @@ int device_add(struct device *dev)
if (!dev)
goto done;
- dev->p = kzalloc(sizeof(*dev->p), GFP_KERNEL);
if (!dev->p) {
- error = -ENOMEM;
- goto done;
+ error = device_private_init(dev);
+ if (error)
+ goto done;
}
- dev->p->device = dev;

This diff is incomplete. Download the complete patch.

drivers/base/dd.c

View file

This diff is incomplete. Download the complete patch.

drivers/base/devtmpfs.c

View file

This diff is incomplete. Download the complete patch.

drivers/base/dma-coherent.c

View file

This diff is incomplete. Download the complete patch.

drivers/base/driver.c

View file

This diff is incomplete. Download the complete patch.

drivers/base/init.c

View file

This diff is incomplete. Download the complete patch.

drivers/base/platform.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/cciss.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/pktcdvd.c

View file

This diff is incomplete. Download the complete patch.

drivers/char/mem.c

View file

This diff is incomplete. Download the complete patch.

drivers/firewire/core-device.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/dmi-id.c

View file

This diff is incomplete. Download the complete patch.

drivers/infiniband/hw/ehca/ehca_main.c

View file

This diff is incomplete. Download the complete patch.

drivers/infiniband/hw/ipath/ipath_kernel.h

View file

This diff is incomplete. Download the complete patch.

drivers/infiniband/hw/ipath/ipath_sysfs.c

View file

This diff is incomplete. Download the complete patch.

drivers/input/input.c

View file

This diff is incomplete. Download the complete patch.

drivers/misc/enclosure.c

View file

This diff is incomplete. Download the complete patch.

drivers/misc/hpilo.c

View file

This diff is incomplete. Download the complete patch.

drivers/misc/hpilo.h

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/mmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mmc/core/sd.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/mtdcore.c

View file

This diff is incomplete. Download the complete patch.

drivers/net/wireless/iwmc3200wifi/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/s390/cio/css.c

View file

This diff is incomplete. Download the complete patch.

drivers/s390/cio/device.c

View file

This diff is incomplete. Download the complete patch.

drivers/s390/net/netiucv.c

View file

This diff is incomplete. Download the complete patch.

drivers/scsi/scsi_priv.h

View file

This diff is incomplete. Download the complete patch.

drivers/scsi/scsi_sysfs.c

View file

This diff is incomplete. Download the complete patch.

drivers/uio/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/uio/Makefile

View file

This diff is incomplete. Download the complete patch.

drivers/uio/uio_pci_generic.c

View file

This diff is incomplete. Download the complete patch.

drivers/usb/core/endpoint.c

View file

This diff is incomplete. Download the complete patch.

drivers/usb/core/sysfs.c

View file

This diff is incomplete. Download the complete patch.

drivers/usb/core/usb.h

View file

This diff is incomplete. Download the complete patch.

drivers/usb/host/uhci-hcd.c

View file

This diff is incomplete. Download the complete patch.

drivers/uwb/lc-dev.c

View file

This diff is incomplete. Download the complete patch.

fs/partitions/check.c

View file

This diff is incomplete. Download the complete patch.

include/linux/attribute_container.h

View file

This diff is incomplete. Download the complete patch.

include/linux/device.h

View file

This diff is incomplete. Download the complete patch.

include/linux/netdevice.h

View file

This diff is incomplete. Download the complete patch.

include/linux/pci_regs.h

View file

This diff is incomplete. Download the complete patch.

include/linux/shmem_fs.h

View file

This diff is incomplete. Download the complete patch.

include/linux/transport_class.h

View file

This diff is incomplete. Download the complete patch.

init/do_mounts.c

View file

This diff is incomplete. Download the complete patch.

init/main.c

View file

This diff is incomplete. Download the complete patch.

kernel/Makefile

View file

This diff is incomplete. Download the complete patch.

mm/shmem.c

View file

This diff is incomplete. Download the complete patch.

net/bluetooth/hci_sysfs.c

View file

This diff is incomplete. Download the complete patch.

net/core/net-sysfs.c

View file

This diff is incomplete. Download the complete patch.

samples/trace_events/trace-events-sample.h

View file

This diff is incomplete. Download the complete patch.