aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-22 16:13:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-22 16:13:47 -0400
commit53baaaa9682c230410a057263d1ce2922f43ddc4 (patch)
treef5cced5622130f780d76953b284a631c3d226488 /include
parentf10140fbe5f97ecfeda986a12d0f1bad75642779 (diff)
parent3f9787046ea37a26170dc4439efa21f8d23a9978 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (79 commits) arm: bus_id -> dev_name() and dev_set_name() conversions sparc64: fix up bus_id changes in sparc core code 3c59x: handle pci_name() being const MTD: handle pci_name() being const HP iLO driver sysdev: Convert the x86 mce tolerant sysdev attribute to generic attribute sysdev: Add utility functions for simple int/ulong variable sysdev attributes sysdev: Pass the attribute to the low level sysdev show/store function driver core: Suppress sysfs warnings for device_rename(). kobject: Transmit return value of call_usermodehelper() to caller sysfs-rules.txt: reword API stability statement debugfs: Implement debugfs_remove_recursive() HOWTO: change email addresses of James in HOWTO always enable FW_LOADER unless EMBEDDED=y uio-howto.tmpl: use unique output names uio-howto.tmpl: use standard copyright/legal markings sysfs: don't call notify_change sysdev: fix debugging statements in registration code. kobject: should use kobject_put() in kset-example kobject: reorder kobject to save space on 64 bit builds ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/debugfs.h4
-rw-r--r--include/linux/device.h58
-rw-r--r--include/linux/eisa.h2
-rw-r--r--include/linux/kobject.h3
-rw-r--r--include/linux/mtd/map.h2
-rw-r--r--include/linux/mtd/mtd.h2
-rw-r--r--include/linux/spi/spi.h2
-rw-r--r--include/linux/sysdev.h39
-rw-r--r--include/linux/sysfs.h10
-rw-r--r--include/linux/uio_driver.h8
-rw-r--r--include/scsi/scsi_host.h2
-rw-r--r--include/scsi/scsi_transport_fc.h4
-rw-r--r--include/scsi/scsi_transport_iscsi.h2
13 files changed, 101 insertions, 37 deletions
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 32755cdf68db..e1a6c046cea3 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -44,6 +44,7 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
44 const char *dest); 44 const char *dest);
45 45
46void debugfs_remove(struct dentry *dentry); 46void debugfs_remove(struct dentry *dentry);
47void debugfs_remove_recursive(struct dentry *dentry);
47 48
48struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, 49struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
49 struct dentry *new_dir, const char *new_name); 50 struct dentry *new_dir, const char *new_name);
@@ -101,6 +102,9 @@ static inline struct dentry *debugfs_create_symlink(const char *name,
101static inline void debugfs_remove(struct dentry *dentry) 102static inline void debugfs_remove(struct dentry *dentry)
102{ } 103{ }
103 104
105static inline void debugfs_remove_recursive(struct dentry *dentry)
106{ }
107
104static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, 108static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
105 struct dentry *new_dir, char *new_name) 109 struct dentry *new_dir, char *new_name)
106{ 110{
diff --git a/include/linux/device.h b/include/linux/device.h
index f71a78d123ae..d24a47f80f9c 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -16,6 +16,7 @@
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/klist.h> 17#include <linux/klist.h>
18#include <linux/list.h> 18#include <linux/list.h>
19#include <linux/lockdep.h>
19#include <linux/compiler.h> 20#include <linux/compiler.h>
20#include <linux/types.h> 21#include <linux/types.h>
21#include <linux/module.h> 22#include <linux/module.h>
@@ -24,17 +25,13 @@
24#include <asm/atomic.h> 25#include <asm/atomic.h>
25#include <asm/device.h> 26#include <asm/device.h>
26 27
27#define DEVICE_NAME_SIZE 50 28#define BUS_ID_SIZE 20
28/* DEVICE_NAME_HALF is really less than half to accommodate slop */
29#define DEVICE_NAME_HALF __stringify(20)
30#define DEVICE_ID_SIZE 32
31#define BUS_ID_SIZE KOBJ_NAME_LEN
32
33 29
34struct device; 30struct device;
35struct device_driver; 31struct device_driver;
36struct driver_private; 32struct driver_private;
37struct class; 33struct class;
34struct class_private;
38struct bus_type; 35struct bus_type;
39struct bus_type_private; 36struct bus_type_private;
40 37
@@ -186,13 +183,9 @@ struct class {
186 const char *name; 183 const char *name;
187 struct module *owner; 184 struct module *owner;
188 185
189 struct kset subsys;
190 struct list_head devices;
191 struct list_head interfaces;
192 struct kset class_dirs;
193 struct semaphore sem; /* locks children, devices, interfaces */
194 struct class_attribute *class_attrs; 186 struct class_attribute *class_attrs;
195 struct device_attribute *dev_attrs; 187 struct device_attribute *dev_attrs;
188 struct kobject *dev_kobj;
196 189
197 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 190 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
198 191
@@ -203,13 +196,28 @@ struct class {
203 int (*resume)(struct device *dev); 196 int (*resume)(struct device *dev);
204 197
205 struct pm_ops *pm; 198 struct pm_ops *pm;
199 struct class_private *p;
206}; 200};
207 201
208extern int __must_check class_register(struct class *class); 202extern struct kobject *sysfs_dev_block_kobj;
203extern struct kobject *sysfs_dev_char_kobj;
204extern int __must_check __class_register(struct class *class,
205 struct lock_class_key *key);
209extern void class_unregister(struct class *class); 206extern void class_unregister(struct class *class);
210extern int class_for_each_device(struct class *class, void *data, 207
208/* This is a #define to keep the compiler from merging different
209 * instances of the __key variable */
210#define class_register(class) \
211({ \
212 static struct lock_class_key __key; \
213 __class_register(class, &__key); \
214})
215
216extern int class_for_each_device(struct class *class, struct device *start,
217 void *data,
211 int (*fn)(struct device *dev, void *data)); 218 int (*fn)(struct device *dev, void *data));
212extern struct device *class_find_device(struct class *class, void *data, 219extern struct device *class_find_device(struct class *class,
220 struct device *start, void *data,
213 int (*match)(struct device *, void *)); 221 int (*match)(struct device *, void *));
214 222
215struct class_attribute { 223struct class_attribute {
@@ -237,9 +245,19 @@ struct class_interface {
237extern int __must_check class_interface_register(struct class_interface *); 245extern int __must_check class_interface_register(struct class_interface *);
238extern void class_interface_unregister(struct class_interface *); 246extern void class_interface_unregister(struct class_interface *);
239 247
240extern struct class *class_create(struct module *owner, const char *name); 248extern struct class * __must_check __class_create(struct module *owner,
249 const char *name,
250 struct lock_class_key *key);
241extern void class_destroy(struct class *cls); 251extern void class_destroy(struct class *cls);
242 252
253/* This is a #define to keep the compiler from merging different
254 * instances of the __key variable */
255#define class_create(owner, name) \
256({ \
257 static struct lock_class_key __key; \
258 __class_create(owner, name, &__key); \
259})
260
243/* 261/*
244 * The type of device, "struct device" is embedded in. A class 262 * The type of device, "struct device" is embedded in. A class
245 * or bus can contain devices of different types 263 * or bus can contain devices of different types
@@ -468,14 +486,10 @@ extern struct device *device_create_vargs(struct class *cls,
468 const char *fmt, 486 const char *fmt,
469 va_list vargs); 487 va_list vargs);
470extern struct device *device_create(struct class *cls, struct device *parent, 488extern struct device *device_create(struct class *cls, struct device *parent,
471 dev_t devt, const char *fmt, ...) 489 dev_t devt, void *drvdata,
472 __attribute__((format(printf, 4, 5))); 490 const char *fmt, ...)
473extern struct device *device_create_drvdata(struct class *cls,
474 struct device *parent,
475 dev_t devt,
476 void *drvdata,
477 const char *fmt, ...)
478 __attribute__((format(printf, 5, 6))); 491 __attribute__((format(printf, 5, 6)));
492#define device_create_drvdata device_create
479extern void device_destroy(struct class *cls, dev_t devt); 493extern void device_destroy(struct class *cls, dev_t devt);
480 494
481/* 495/*
diff --git a/include/linux/eisa.h b/include/linux/eisa.h
index fe806b6f030d..e61c0be2a459 100644
--- a/include/linux/eisa.h
+++ b/include/linux/eisa.h
@@ -40,7 +40,7 @@ struct eisa_device {
40 u64 dma_mask; 40 u64 dma_mask;
41 struct device dev; /* generic device */ 41 struct device dev; /* generic device */
42#ifdef CONFIG_EISA_NAMES 42#ifdef CONFIG_EISA_NAMES
43 char pretty_name[DEVICE_NAME_SIZE]; 43 char pretty_name[50];
44#endif 44#endif
45}; 45};
46 46
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 39e709f88aa0..60f0d418ae32 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -26,7 +26,6 @@
26#include <linux/wait.h> 26#include <linux/wait.h>
27#include <asm/atomic.h> 27#include <asm/atomic.h>
28 28
29#define KOBJ_NAME_LEN 20
30#define UEVENT_HELPER_PATH_LEN 256 29#define UEVENT_HELPER_PATH_LEN 256
31#define UEVENT_NUM_ENVP 32 /* number of env pointers */ 30#define UEVENT_NUM_ENVP 32 /* number of env pointers */
32#define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */ 31#define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */
@@ -59,12 +58,12 @@ enum kobject_action {
59 58
60struct kobject { 59struct kobject {
61 const char *name; 60 const char *name;
62 struct kref kref;
63 struct list_head entry; 61 struct list_head entry;
64 struct kobject *parent; 62 struct kobject *parent;
65 struct kset *kset; 63 struct kset *kset;
66 struct kobj_type *ktype; 64 struct kobj_type *ktype;
67 struct sysfs_dirent *sd; 65 struct sysfs_dirent *sd;
66 struct kref kref;
68 unsigned int state_initialized:1; 67 unsigned int state_initialized:1;
69 unsigned int state_in_sysfs:1; 68 unsigned int state_in_sysfs:1;
70 unsigned int state_add_uevent_sent:1; 69 unsigned int state_add_uevent_sent:1;
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index a9fae032ba81..9c1d95491f8b 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -189,7 +189,7 @@ typedef union {
189*/ 189*/
190 190
191struct map_info { 191struct map_info {
192 char *name; 192 const char *name;
193 unsigned long size; 193 unsigned long size;
194 resource_size_t phys; 194 resource_size_t phys;
195#define NO_XIP (-1UL) 195#define NO_XIP (-1UL)
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 245f9098e171..8b5d49133ec6 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -121,7 +121,7 @@ struct mtd_info {
121 u_int32_t oobavail; // Available OOB bytes per block 121 u_int32_t oobavail; // Available OOB bytes per block
122 122
123 // Kernel-only stuff starts here. 123 // Kernel-only stuff starts here.
124 char *name; 124 const char *name;
125 int index; 125 int index;
126 126
127 /* ecc layout structure pointer - read only ! */ 127 /* ecc layout structure pointer - read only ! */
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 387e428f1cdf..b9a76c972084 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -733,7 +733,7 @@ struct spi_board_info {
733 * controller_data goes to spi_device.controller_data, 733 * controller_data goes to spi_device.controller_data,
734 * irq is copied too 734 * irq is copied too
735 */ 735 */
736 char modalias[KOBJ_NAME_LEN]; 736 char modalias[32];
737 const void *platform_data; 737 const void *platform_data;
738 void *controller_data; 738 void *controller_data;
739 int irq; 739 int irq;
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index f2767bc6b735..f395bb3fa2f2 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -99,8 +99,9 @@ extern void sysdev_unregister(struct sys_device *);
99 99
100struct sysdev_attribute { 100struct sysdev_attribute {
101 struct attribute attr; 101 struct attribute attr;
102 ssize_t (*show)(struct sys_device *, char *); 102 ssize_t (*show)(struct sys_device *, struct sysdev_attribute *, char *);
103 ssize_t (*store)(struct sys_device *, const char *, size_t); 103 ssize_t (*store)(struct sys_device *, struct sysdev_attribute *,
104 const char *, size_t);
104}; 105};
105 106
106 107
@@ -118,4 +119,38 @@ struct sysdev_attribute {
118extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); 119extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *);
119extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); 120extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *);
120 121
122struct sysdev_ext_attribute {
123 struct sysdev_attribute attr;
124 void *var;
125};
126
127/*
128 * Support for simple variable sysdev attributes.
129 * The pointer to the variable is stored in a sysdev_ext_attribute
130 */
131
132/* Add more types as needed */
133
134extern ssize_t sysdev_show_ulong(struct sys_device *, struct sysdev_attribute *,
135 char *);
136extern ssize_t sysdev_store_ulong(struct sys_device *,
137 struct sysdev_attribute *, const char *, size_t);
138extern ssize_t sysdev_show_int(struct sys_device *, struct sysdev_attribute *,
139 char *);
140extern ssize_t sysdev_store_int(struct sys_device *,
141 struct sysdev_attribute *, const char *, size_t);
142
143#define _SYSDEV_ULONG_ATTR(_name, _mode, _var) \
144 { _SYSDEV_ATTR(_name, _mode, sysdev_show_ulong, sysdev_store_ulong), \
145 &(_var) }
146#define SYSDEV_ULONG_ATTR(_name, _mode, _var) \
147 struct sysdev_ext_attribute attr_##_name = \
148 _SYSDEV_ULONG_ATTR(_name, _mode, _var);
149#define _SYSDEV_INT_ATTR(_name, _mode, _var) \
150 { _SYSDEV_ATTR(_name, _mode, sysdev_show_int, sysdev_store_int), \
151 &(_var) }
152#define SYSDEV_INT_ATTR(_name, _mode, _var) \
153 struct sysdev_ext_attribute attr_##_name = \
154 _SYSDEV_INT_ATTR(_name, _mode, _var);
155
121#endif /* _SYSDEV_H_ */ 156#endif /* _SYSDEV_H_ */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 7858eac40aa7..37fa24152bd8 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -101,6 +101,9 @@ void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr);
101 101
102int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, 102int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target,
103 const char *name); 103 const char *name);
104int __must_check sysfs_create_link_nowarn(struct kobject *kobj,
105 struct kobject *target,
106 const char *name);
104void sysfs_remove_link(struct kobject *kobj, const char *name); 107void sysfs_remove_link(struct kobject *kobj, const char *name);
105 108
106int __must_check sysfs_create_group(struct kobject *kobj, 109int __must_check sysfs_create_group(struct kobject *kobj,
@@ -180,6 +183,13 @@ static inline int sysfs_create_link(struct kobject *kobj,
180 return 0; 183 return 0;
181} 184}
182 185
186static inline int sysfs_create_link_nowarn(struct kobject *kobj,
187 struct kobject *target,
188 const char *name)
189{
190 return 0;
191}
192
183static inline void sysfs_remove_link(struct kobject *kobj, const char *name) 193static inline void sysfs_remove_link(struct kobject *kobj, const char *name)
184{ 194{
185} 195}
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index 973386d439da..cdf338d94b7f 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -36,7 +36,7 @@ struct uio_mem {
36 struct uio_map *map; 36 struct uio_map *map;
37}; 37};
38 38
39#define MAX_UIO_MAPS 5 39#define MAX_UIO_MAPS 5
40 40
41struct uio_device; 41struct uio_device;
42 42
@@ -53,6 +53,7 @@ struct uio_device;
53 * @mmap: mmap operation for this uio device 53 * @mmap: mmap operation for this uio device
54 * @open: open operation for this uio device 54 * @open: open operation for this uio device
55 * @release: release operation for this uio device 55 * @release: release operation for this uio device
56 * @irqcontrol: disable/enable irqs when 0/1 is written to /dev/uioX
56 */ 57 */
57struct uio_info { 58struct uio_info {
58 struct uio_device *uio_dev; 59 struct uio_device *uio_dev;
@@ -66,6 +67,7 @@ struct uio_info {
66 int (*mmap)(struct uio_info *info, struct vm_area_struct *vma); 67 int (*mmap)(struct uio_info *info, struct vm_area_struct *vma);
67 int (*open)(struct uio_info *info, struct inode *inode); 68 int (*open)(struct uio_info *info, struct inode *inode);
68 int (*release)(struct uio_info *info, struct inode *inode); 69 int (*release)(struct uio_info *info, struct inode *inode);
70 int (*irqcontrol)(struct uio_info *info, s32 irq_on);
69}; 71};
70 72
71extern int __must_check 73extern int __must_check
@@ -80,11 +82,11 @@ static inline int __must_check
80extern void uio_unregister_device(struct uio_info *info); 82extern void uio_unregister_device(struct uio_info *info);
81extern void uio_event_notify(struct uio_info *info); 83extern void uio_event_notify(struct uio_info *info);
82 84
83/* defines for uio_device->irq */ 85/* defines for uio_info->irq */
84#define UIO_IRQ_CUSTOM -1 86#define UIO_IRQ_CUSTOM -1
85#define UIO_IRQ_NONE -2 87#define UIO_IRQ_NONE -2
86 88
87/* defines for uio_device->memtype */ 89/* defines for uio_mem->memtype */
88#define UIO_MEM_NONE 0 90#define UIO_MEM_NONE 0
89#define UIO_MEM_PHYS 1 91#define UIO_MEM_PHYS 1
90#define UIO_MEM_LOGICAL 2 92#define UIO_MEM_LOGICAL 2
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 1834fdfe82a7..a594bac4a77d 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -623,7 +623,7 @@ struct Scsi_Host {
623 /* 623 /*
624 * Optional work queue to be utilized by the transport 624 * Optional work queue to be utilized by the transport
625 */ 625 */
626 char work_q_name[KOBJ_NAME_LEN]; 626 char work_q_name[20];
627 struct workqueue_struct *work_q; 627 struct workqueue_struct *work_q;
628 628
629 /* 629 /*
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 06f72bab9df0..878373c32ef7 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -489,9 +489,9 @@ struct fc_host_attrs {
489 u16 npiv_vports_inuse; 489 u16 npiv_vports_inuse;
490 490
491 /* work queues for rport state manipulation */ 491 /* work queues for rport state manipulation */
492 char work_q_name[KOBJ_NAME_LEN]; 492 char work_q_name[20];
493 struct workqueue_struct *work_q; 493 struct workqueue_struct *work_q;
494 char devloss_work_q_name[KOBJ_NAME_LEN]; 494 char devloss_work_q_name[20];
495 struct workqueue_struct *devloss_work_q; 495 struct workqueue_struct *devloss_work_q;
496}; 496};
497 497
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index f5444e033cc9..8b6c91df4c7a 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -198,7 +198,7 @@ struct iscsi_cls_host {
198 atomic_t nr_scans; 198 atomic_t nr_scans;
199 struct mutex mutex; 199 struct mutex mutex;
200 struct workqueue_struct *scan_workq; 200 struct workqueue_struct *scan_workq;
201 char scan_workq_name[KOBJ_NAME_LEN]; 201 char scan_workq_name[20];
202}; 202};
203 203
204extern void iscsi_host_for_each_session(struct Scsi_Host *shost, 204extern void iscsi_host_for_each_session(struct Scsi_Host *shost,