aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-07 22:22:26 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-07 22:22:26 -0500
commitf2aca47dc3c2d0c2d5dbd972558557e74232bbce (patch)
treeeae58f599a25a1f3ab41bf616a2b7c4b3c6e2277 /include/linux
parent7677ced48e2bbbb8d847d34f37e5d96d2b0e41e4 (diff)
parentb592fcfe7f06c15ec11774b5be7ce0de3aa86e73 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (28 commits) sysfs: Shadow directory support Driver Core: Increase the default timeout value of the firmware subsystem Driver core: allow to delay the uevent at device creation time Driver core: add device_type to struct device Driver core: add uevent vars for devices of a class SYSFS: Fix missing include of list.h in sysfs.h HOWTO: Add a reference to Harbison and Steele sysfs: error handling in sysfs, fill_read_buffer() kobject: kobject_put cleanup sysfs: kobject_put cleanup sysfs: suppress lockdep warnings Driver core: fix race in sysfs between sysfs_remove_file() and read()/write() driver core: Change function call order in device_bind_driver(). driver core: Don't stop probing on ->probe errors. driver core fixes: device_register() retval check in platform.c driver core fixes: make_class_name() retval checks /sys/modules/*/holders USB: add the sysfs driver name to all modules SERIO: add the sysfs driver name to all modules PCI: add the sysfs driver name to all modules ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/device.h12
-rw-r--r--include/linux/ide.h4
-rw-r--r--include/linux/kobject.h4
-rw-r--r--include/linux/module.h3
-rw-r--r--include/linux/netdevice.h5
-rw-r--r--include/linux/pci.h5
-rw-r--r--include/linux/serio.h5
-rw-r--r--include/linux/spi/spi.h10
-rw-r--r--include/linux/sysfs.h24
-rw-r--r--include/linux/usb.h5
10 files changed, 58 insertions, 19 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index f44247fe8135..5ca1cdba563a 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -126,6 +126,7 @@ struct device_driver {
126 struct klist_node knode_bus; 126 struct klist_node knode_bus;
127 127
128 struct module * owner; 128 struct module * owner;
129 const char * mod_name; /* used for built-in modules */
129 130
130 int (*probe) (struct device * dev); 131 int (*probe) (struct device * dev);
131 int (*remove) (struct device * dev); 132 int (*remove) (struct device * dev);
@@ -327,6 +328,13 @@ extern struct class_device *class_device_create(struct class *cls,
327 __attribute__((format(printf,5,6))); 328 __attribute__((format(printf,5,6)));
328extern void class_device_destroy(struct class *cls, dev_t devt); 329extern void class_device_destroy(struct class *cls, dev_t devt);
329 330
331struct device_type {
332 struct device_attribute *attrs;
333 int (*uevent)(struct device *dev, char **envp, int num_envp,
334 char *buffer, int buffer_size);
335 void (*release)(struct device *dev);
336};
337
330/* interface for exporting device attributes */ 338/* interface for exporting device attributes */
331struct device_attribute { 339struct device_attribute {
332 struct attribute attr; 340 struct attribute attr;
@@ -355,6 +363,7 @@ struct device {
355 363
356 struct kobject kobj; 364 struct kobject kobj;
357 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 365 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
366 struct device_type *type;
358 unsigned is_registered:1; 367 unsigned is_registered:1;
359 struct device_attribute uevent_attr; 368 struct device_attribute uevent_attr;
360 struct device_attribute *devt_attr; 369 struct device_attribute *devt_attr;
@@ -390,9 +399,10 @@ struct device {
390 399
391 /* class_device migration path */ 400 /* class_device migration path */
392 struct list_head node; 401 struct list_head node;
393 struct class *class; /* optional*/ 402 struct class *class;
394 dev_t devt; /* dev_t, creates the sysfs "dev" */ 403 dev_t devt; /* dev_t, creates the sysfs "dev" */
395 struct attribute_group **groups; /* optional groups */ 404 struct attribute_group **groups; /* optional groups */
405 int uevent_suppress;
396 406
397 void (*release)(struct device * dev); 407 void (*release)(struct device * dev);
398}; 408};
diff --git a/include/linux/ide.h b/include/linux/ide.h
index e26a03981a94..827688f41d6c 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1192,8 +1192,8 @@ void ide_init_disk(struct gendisk *, ide_drive_t *);
1192extern int ideprobe_init(void); 1192extern int ideprobe_init(void);
1193 1193
1194extern void ide_scan_pcibus(int scan_direction) __init; 1194extern void ide_scan_pcibus(int scan_direction) __init;
1195extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner); 1195extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
1196#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE) 1196#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
1197void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *); 1197void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *);
1198extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d); 1198extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d);
1199 1199
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 76538fcf2c4e..b850e0310538 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -74,9 +74,13 @@ extern void kobject_init(struct kobject *);
74extern void kobject_cleanup(struct kobject *); 74extern void kobject_cleanup(struct kobject *);
75 75
76extern int __must_check kobject_add(struct kobject *); 76extern int __must_check kobject_add(struct kobject *);
77extern int __must_check kobject_shadow_add(struct kobject *, struct dentry *);
77extern void kobject_del(struct kobject *); 78extern void kobject_del(struct kobject *);
78 79
79extern int __must_check kobject_rename(struct kobject *, const char *new_name); 80extern int __must_check kobject_rename(struct kobject *, const char *new_name);
81extern int __must_check kobject_shadow_rename(struct kobject *kobj,
82 struct dentry *new_parent,
83 const char *new_name);
80extern int __must_check kobject_move(struct kobject *, struct kobject *); 84extern int __must_check kobject_move(struct kobject *, struct kobject *);
81 85
82extern int __must_check kobject_register(struct kobject *); 86extern int __must_check kobject_register(struct kobject *);
diff --git a/include/linux/module.h b/include/linux/module.h
index 10f771a49997..419d3ef293dd 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -58,6 +58,7 @@ struct module_kobject
58{ 58{
59 struct kobject kobj; 59 struct kobject kobj;
60 struct module *mod; 60 struct module *mod;
61 struct kobject *drivers_dir;
61}; 62};
62 63
63/* These are either module local, or the kernel's dummy ones. */ 64/* These are either module local, or the kernel's dummy ones. */
@@ -263,7 +264,7 @@ struct module
263 struct module_attribute *modinfo_attrs; 264 struct module_attribute *modinfo_attrs;
264 const char *version; 265 const char *version;
265 const char *srcversion; 266 const char *srcversion;
266 struct kobject *drivers_dir; 267 struct kobject *holders_dir;
267 268
268 /* Exported symbols */ 269 /* Exported symbols */
269 const struct kernel_symbol *syms; 270 const struct kernel_symbol *syms;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index fea0d9db6846..2e37f5012788 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -529,10 +529,11 @@ struct net_device
529 struct net_bridge_port *br_port; 529 struct net_bridge_port *br_port;
530 530
531 /* class/net/name entry */ 531 /* class/net/name entry */
532 struct class_device class_dev; 532 struct device dev;
533 /* space for optional statistics and wireless sysfs groups */ 533 /* space for optional statistics and wireless sysfs groups */
534 struct attribute_group *sysfs_groups[3]; 534 struct attribute_group *sysfs_groups[3];
535}; 535};
536#define to_net_dev(d) container_of(d, struct net_device, dev)
536 537
537#define NETDEV_ALIGN 32 538#define NETDEV_ALIGN 32
538#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) 539#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)
@@ -548,7 +549,7 @@ static inline void *netdev_priv(struct net_device *dev)
548/* Set the sysfs physical device reference for the network logical device 549/* Set the sysfs physical device reference for the network logical device
549 * if set prior to registration will cause a symlink during initialization. 550 * if set prior to registration will cause a symlink during initialization.
550 */ 551 */
551#define SET_NETDEV_DEV(net, pdev) ((net)->class_dev.dev = (pdev)) 552#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev))
552 553
553struct packet_type { 554struct packet_type {
554 __be16 type; /* This is really htons(ether_type). */ 555 __be16 type; /* This is really htons(ether_type). */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index f3c617eabd8d..cb899eb95d31 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -573,10 +573,11 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
573void pci_enable_bridges(struct pci_bus *bus); 573void pci_enable_bridges(struct pci_bus *bus);
574 574
575/* Proper probing supporting hot-pluggable devices */ 575/* Proper probing supporting hot-pluggable devices */
576int __must_check __pci_register_driver(struct pci_driver *, struct module *); 576int __must_check __pci_register_driver(struct pci_driver *, struct module *,
577 const char *mod_name);
577static inline int __must_check pci_register_driver(struct pci_driver *driver) 578static inline int __must_check pci_register_driver(struct pci_driver *driver)
578{ 579{
579 return __pci_register_driver(driver, THIS_MODULE); 580 return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME);
580} 581}
581 582
582void pci_unregister_driver(struct pci_driver *); 583void pci_unregister_driver(struct pci_driver *);
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 0f478a8791a2..ac2c70e7f760 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -86,6 +86,11 @@ static inline void serio_register_port(struct serio *serio)
86void serio_unregister_port(struct serio *serio); 86void serio_unregister_port(struct serio *serio);
87void serio_unregister_child_port(struct serio *serio); 87void serio_unregister_child_port(struct serio *serio);
88 88
89int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name);
90static inline int serio_register_driver(struct serio_driver *drv)
91{
92 return __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME);
93}
89int serio_register_driver(struct serio_driver *drv); 94int serio_register_driver(struct serio_driver *drv);
90void serio_unregister_driver(struct serio_driver *drv); 95void serio_unregister_driver(struct serio_driver *drv);
91 96
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 176f6e36dbfa..8c2edd82a073 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -170,7 +170,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
170 * message's completion function when the transaction completes. 170 * message's completion function when the transaction completes.
171 */ 171 */
172struct spi_master { 172struct spi_master {
173 struct class_device cdev; 173 struct device dev;
174 174
175 /* other than negative (== assign one dynamically), bus_num is fully 175 /* other than negative (== assign one dynamically), bus_num is fully
176 * board-specific. usually that simplifies to being SOC-specific. 176 * board-specific. usually that simplifies to being SOC-specific.
@@ -216,17 +216,17 @@ struct spi_master {
216 216
217static inline void *spi_master_get_devdata(struct spi_master *master) 217static inline void *spi_master_get_devdata(struct spi_master *master)
218{ 218{
219 return class_get_devdata(&master->cdev); 219 return dev_get_drvdata(&master->dev);
220} 220}
221 221
222static inline void spi_master_set_devdata(struct spi_master *master, void *data) 222static inline void spi_master_set_devdata(struct spi_master *master, void *data)
223{ 223{
224 class_set_devdata(&master->cdev, data); 224 dev_set_drvdata(&master->dev, data);
225} 225}
226 226
227static inline struct spi_master *spi_master_get(struct spi_master *master) 227static inline struct spi_master *spi_master_get(struct spi_master *master)
228{ 228{
229 if (!master || !class_device_get(&master->cdev)) 229 if (!master || !get_device(&master->dev))
230 return NULL; 230 return NULL;
231 return master; 231 return master;
232} 232}
@@ -234,7 +234,7 @@ static inline struct spi_master *spi_master_get(struct spi_master *master)
234static inline void spi_master_put(struct spi_master *master) 234static inline void spi_master_put(struct spi_master *master)
235{ 235{
236 if (master) 236 if (master)
237 class_device_put(&master->cdev); 237 put_device(&master->dev);
238} 238}
239 239
240 240
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 2129d1b6c874..192de3afa96b 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -11,10 +11,12 @@
11#define _SYSFS_H_ 11#define _SYSFS_H_
12 12
13#include <linux/compiler.h> 13#include <linux/compiler.h>
14#include <linux/list.h>
14#include <asm/atomic.h> 15#include <asm/atomic.h>
15 16
16struct kobject; 17struct kobject;
17struct module; 18struct module;
19struct nameidata;
18 20
19struct attribute { 21struct attribute {
20 const char * name; 22 const char * name;
@@ -88,13 +90,13 @@ struct sysfs_dirent {
88#ifdef CONFIG_SYSFS 90#ifdef CONFIG_SYSFS
89 91
90extern int __must_check 92extern int __must_check
91sysfs_create_dir(struct kobject *); 93sysfs_create_dir(struct kobject *, struct dentry *);
92 94
93extern void 95extern void
94sysfs_remove_dir(struct kobject *); 96sysfs_remove_dir(struct kobject *);
95 97
96extern int __must_check 98extern int __must_check
97sysfs_rename_dir(struct kobject *, const char *new_name); 99sysfs_rename_dir(struct kobject *, struct dentry *, const char *new_name);
98 100
99extern int __must_check 101extern int __must_check
100sysfs_move_dir(struct kobject *, struct kobject *); 102sysfs_move_dir(struct kobject *, struct kobject *);
@@ -126,11 +128,17 @@ int __must_check sysfs_create_group(struct kobject *,
126void sysfs_remove_group(struct kobject *, const struct attribute_group *); 128void sysfs_remove_group(struct kobject *, const struct attribute_group *);
127void sysfs_notify(struct kobject * k, char *dir, char *attr); 129void sysfs_notify(struct kobject * k, char *dir, char *attr);
128 130
131
132extern int sysfs_make_shadowed_dir(struct kobject *kobj,
133 void * (*follow_link)(struct dentry *, struct nameidata *));
134extern struct dentry *sysfs_create_shadow_dir(struct kobject *kobj);
135extern void sysfs_remove_shadow_dir(struct dentry *dir);
136
129extern int __must_check sysfs_init(void); 137extern int __must_check sysfs_init(void);
130 138
131#else /* CONFIG_SYSFS */ 139#else /* CONFIG_SYSFS */
132 140
133static inline int sysfs_create_dir(struct kobject * k) 141static inline int sysfs_create_dir(struct kobject * k, struct dentry *shadow)
134{ 142{
135 return 0; 143 return 0;
136} 144}
@@ -140,7 +148,9 @@ static inline void sysfs_remove_dir(struct kobject * k)
140 ; 148 ;
141} 149}
142 150
143static inline int sysfs_rename_dir(struct kobject * k, const char *new_name) 151static inline int sysfs_rename_dir(struct kobject * k,
152 struct dentry *new_parent,
153 const char *new_name)
144{ 154{
145 return 0; 155 return 0;
146} 156}
@@ -204,6 +214,12 @@ static inline void sysfs_notify(struct kobject * k, char *dir, char *attr)
204{ 214{
205} 215}
206 216
217static inline int sysfs_make_shadowed_dir(struct kobject *kobj,
218 void * (*follow_link)(struct dentry *, struct nameidata *))
219{
220 return 0;
221}
222
207static inline int __must_check sysfs_init(void) 223static inline int __must_check sysfs_init(void)
208{ 224{
209 return 0; 225 return 0;
diff --git a/include/linux/usb.h b/include/linux/usb.h
index aab5b1b72021..733f38de4978 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -868,10 +868,11 @@ struct usb_class_driver {
868 * use these in module_init()/module_exit() 868 * use these in module_init()/module_exit()
869 * and don't forget MODULE_DEVICE_TABLE(usb, ...) 869 * and don't forget MODULE_DEVICE_TABLE(usb, ...)
870 */ 870 */
871extern int usb_register_driver(struct usb_driver *, struct module *); 871extern int usb_register_driver(struct usb_driver *, struct module *,
872 const char *);
872static inline int usb_register(struct usb_driver *driver) 873static inline int usb_register(struct usb_driver *driver)
873{ 874{
874 return usb_register_driver(driver, THIS_MODULE); 875 return usb_register_driver(driver, THIS_MODULE, KBUILD_MODNAME);
875} 876}
876extern void usb_deregister(struct usb_driver *); 877extern void usb_deregister(struct usb_driver *);
877 878