diff options
| author | Greg Kroah-Hartman <gregkh@suse.de> | 2012-01-06 14:42:52 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2012-01-06 14:42:52 -0500 |
| commit | ff4b8a57f0aaa2882d444ca44b2b9b333d22a4df (patch) | |
| tree | d851c923f85566572112d4c0f884cff388a3cc05 /include | |
| parent | 805a6af8dba5dfdd35ec35dc52ec0122400b2610 (diff) | |
| parent | ea04018e6bc5ddb2f0466c0e5b986bd4901b7e8e (diff) | |
Merge branch 'driver-core-next' into Linux 3.2
This resolves the conflict in the arch/arm/mach-s3c64xx/s3c6400.c file,
and it fixes the build error in the arch/x86/kernel/microcode_core.c
file, that the merge did not catch.
The microcode_core.c patch was provided by Stephen Rothwell
<sfr@canb.auug.org.au> who was invaluable in the merge issues involved
with the large sysdev removal process in the driver-core tree.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/cpu.h | 18 | ||||
| -rw-r--r-- | include/linux/debugfs.h | 26 | ||||
| -rw-r--r-- | include/linux/device.h | 108 | ||||
| -rw-r--r-- | include/linux/edac.h | 8 | ||||
| -rw-r--r-- | include/linux/i2c.h | 13 | ||||
| -rw-r--r-- | include/linux/kobject.h | 2 | ||||
| -rw-r--r-- | include/linux/kref.h | 77 | ||||
| -rw-r--r-- | include/linux/memory.h | 3 | ||||
| -rw-r--r-- | include/linux/node.h | 6 | ||||
| -rw-r--r-- | include/linux/platform_device.h | 14 | ||||
| -rw-r--r-- | include/linux/spi/spi.h | 11 | ||||
| -rw-r--r-- | include/linux/usb.h | 12 | ||||
| -rw-r--r-- | include/xen/balloon.h | 6 |
13 files changed, 257 insertions, 47 deletions
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 6cb60fd2ea84..fc3da0d70d68 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #ifndef _LINUX_CPU_H_ | 14 | #ifndef _LINUX_CPU_H_ |
| 15 | #define _LINUX_CPU_H_ | 15 | #define _LINUX_CPU_H_ |
| 16 | 16 | ||
| 17 | #include <linux/sysdev.h> | 17 | #include <linux/device.h> |
| 18 | #include <linux/node.h> | 18 | #include <linux/node.h> |
| 19 | #include <linux/compiler.h> | 19 | #include <linux/compiler.h> |
| 20 | #include <linux/cpumask.h> | 20 | #include <linux/cpumask.h> |
| @@ -22,19 +22,19 @@ | |||
| 22 | struct cpu { | 22 | struct cpu { |
| 23 | int node_id; /* The node which contains the CPU */ | 23 | int node_id; /* The node which contains the CPU */ |
| 24 | int hotpluggable; /* creates sysfs control file if hotpluggable */ | 24 | int hotpluggable; /* creates sysfs control file if hotpluggable */ |
| 25 | struct sys_device sysdev; | 25 | struct device dev; |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | extern int register_cpu(struct cpu *cpu, int num); | 28 | extern int register_cpu(struct cpu *cpu, int num); |
| 29 | extern struct sys_device *get_cpu_sysdev(unsigned cpu); | 29 | extern struct device *get_cpu_device(unsigned cpu); |
| 30 | 30 | ||
| 31 | extern int cpu_add_sysdev_attr(struct sysdev_attribute *attr); | 31 | extern int cpu_add_dev_attr(struct device_attribute *attr); |
| 32 | extern void cpu_remove_sysdev_attr(struct sysdev_attribute *attr); | 32 | extern void cpu_remove_dev_attr(struct device_attribute *attr); |
| 33 | 33 | ||
| 34 | extern int cpu_add_sysdev_attr_group(struct attribute_group *attrs); | 34 | extern int cpu_add_dev_attr_group(struct attribute_group *attrs); |
| 35 | extern void cpu_remove_sysdev_attr_group(struct attribute_group *attrs); | 35 | extern void cpu_remove_dev_attr_group(struct attribute_group *attrs); |
| 36 | 36 | ||
| 37 | extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls); | 37 | extern int sched_create_sysfs_power_savings_entries(struct device *dev); |
| 38 | 38 | ||
| 39 | #ifdef CONFIG_HOTPLUG_CPU | 39 | #ifdef CONFIG_HOTPLUG_CPU |
| 40 | extern void unregister_cpu(struct cpu *cpu); | 40 | extern void unregister_cpu(struct cpu *cpu); |
| @@ -160,7 +160,7 @@ static inline void cpu_maps_update_done(void) | |||
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | #endif /* CONFIG_SMP */ | 162 | #endif /* CONFIG_SMP */ |
| 163 | extern struct sysdev_class cpu_sysdev_class; | 163 | extern struct bus_type cpu_subsys; |
| 164 | 164 | ||
| 165 | #ifdef CONFIG_HOTPLUG_CPU | 165 | #ifdef CONFIG_HOTPLUG_CPU |
| 166 | /* Stop CPUs going up and down. */ | 166 | /* Stop CPUs going up and down. */ |
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index e7d9b20ddc5b..e8c3abc60811 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #define _DEBUGFS_H_ | 16 | #define _DEBUGFS_H_ |
| 17 | 17 | ||
| 18 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
| 19 | #include <linux/seq_file.h> | ||
| 19 | 20 | ||
| 20 | #include <linux/types.h> | 21 | #include <linux/types.h> |
| 21 | 22 | ||
| @@ -26,6 +27,17 @@ struct debugfs_blob_wrapper { | |||
| 26 | unsigned long size; | 27 | unsigned long size; |
| 27 | }; | 28 | }; |
| 28 | 29 | ||
| 30 | struct debugfs_reg32 { | ||
| 31 | char *name; | ||
| 32 | unsigned long offset; | ||
| 33 | }; | ||
| 34 | |||
| 35 | struct debugfs_regset32 { | ||
| 36 | struct debugfs_reg32 *regs; | ||
| 37 | int nregs; | ||
| 38 | void __iomem *base; | ||
| 39 | }; | ||
| 40 | |||
| 29 | extern struct dentry *arch_debugfs_dir; | 41 | extern struct dentry *arch_debugfs_dir; |
| 30 | 42 | ||
| 31 | #if defined(CONFIG_DEBUG_FS) | 43 | #if defined(CONFIG_DEBUG_FS) |
| @@ -74,6 +86,13 @@ struct dentry *debugfs_create_blob(const char *name, mode_t mode, | |||
| 74 | struct dentry *parent, | 86 | struct dentry *parent, |
| 75 | struct debugfs_blob_wrapper *blob); | 87 | struct debugfs_blob_wrapper *blob); |
| 76 | 88 | ||
| 89 | struct dentry *debugfs_create_regset32(const char *name, mode_t mode, | ||
| 90 | struct dentry *parent, | ||
| 91 | struct debugfs_regset32 *regset); | ||
| 92 | |||
| 93 | int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, | ||
| 94 | int nregs, void __iomem *base, char *prefix); | ||
| 95 | |||
| 77 | bool debugfs_initialized(void); | 96 | bool debugfs_initialized(void); |
| 78 | 97 | ||
| 79 | #else | 98 | #else |
| @@ -188,6 +207,13 @@ static inline struct dentry *debugfs_create_blob(const char *name, mode_t mode, | |||
| 188 | return ERR_PTR(-ENODEV); | 207 | return ERR_PTR(-ENODEV); |
| 189 | } | 208 | } |
| 190 | 209 | ||
| 210 | static inline struct dentry *debugfs_create_regset32(const char *name, | ||
| 211 | mode_t mode, struct dentry *parent, | ||
| 212 | struct debugfs_regset32 *regset) | ||
| 213 | { | ||
| 214 | return ERR_PTR(-ENODEV); | ||
| 215 | } | ||
| 216 | |||
| 191 | static inline bool debugfs_initialized(void) | 217 | static inline bool debugfs_initialized(void) |
| 192 | { | 218 | { |
| 193 | return false; | 219 | return false; |
diff --git a/include/linux/device.h b/include/linux/device.h index 3136ede5a1e1..96acef8dd916 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -53,6 +53,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *); | |||
| 53 | * struct bus_type - The bus type of the device | 53 | * struct bus_type - The bus type of the device |
| 54 | * | 54 | * |
| 55 | * @name: The name of the bus. | 55 | * @name: The name of the bus. |
| 56 | * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id). | ||
| 57 | * @dev_root: Default device to use as the parent. | ||
| 56 | * @bus_attrs: Default attributes of the bus. | 58 | * @bus_attrs: Default attributes of the bus. |
| 57 | * @dev_attrs: Default attributes of the devices on the bus. | 59 | * @dev_attrs: Default attributes of the devices on the bus. |
| 58 | * @drv_attrs: Default attributes of the device drivers on the bus. | 60 | * @drv_attrs: Default attributes of the device drivers on the bus. |
| @@ -86,6 +88,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *); | |||
| 86 | */ | 88 | */ |
| 87 | struct bus_type { | 89 | struct bus_type { |
| 88 | const char *name; | 90 | const char *name; |
| 91 | const char *dev_name; | ||
| 92 | struct device *dev_root; | ||
| 89 | struct bus_attribute *bus_attrs; | 93 | struct bus_attribute *bus_attrs; |
| 90 | struct device_attribute *dev_attrs; | 94 | struct device_attribute *dev_attrs; |
| 91 | struct driver_attribute *drv_attrs; | 95 | struct driver_attribute *drv_attrs; |
| @@ -106,12 +110,30 @@ struct bus_type { | |||
| 106 | struct subsys_private *p; | 110 | struct subsys_private *p; |
| 107 | }; | 111 | }; |
| 108 | 112 | ||
| 109 | extern int __must_check bus_register(struct bus_type *bus); | 113 | /* This is a #define to keep the compiler from merging different |
| 114 | * instances of the __key variable */ | ||
| 115 | #define bus_register(subsys) \ | ||
| 116 | ({ \ | ||
| 117 | static struct lock_class_key __key; \ | ||
| 118 | __bus_register(subsys, &__key); \ | ||
| 119 | }) | ||
| 120 | extern int __must_check __bus_register(struct bus_type *bus, | ||
| 121 | struct lock_class_key *key); | ||
| 110 | extern void bus_unregister(struct bus_type *bus); | 122 | extern void bus_unregister(struct bus_type *bus); |
| 111 | 123 | ||
| 112 | extern int __must_check bus_rescan_devices(struct bus_type *bus); | 124 | extern int __must_check bus_rescan_devices(struct bus_type *bus); |
| 113 | 125 | ||
| 114 | /* iterator helpers for buses */ | 126 | /* iterator helpers for buses */ |
| 127 | struct subsys_dev_iter { | ||
| 128 | struct klist_iter ki; | ||
| 129 | const struct device_type *type; | ||
| 130 | }; | ||
| 131 | void subsys_dev_iter_init(struct subsys_dev_iter *iter, | ||
| 132 | struct bus_type *subsys, | ||
| 133 | struct device *start, | ||
| 134 | const struct device_type *type); | ||
| 135 | struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); | ||
| 136 | void subsys_dev_iter_exit(struct subsys_dev_iter *iter); | ||
| 115 | 137 | ||
| 116 | int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, | 138 | int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, |
| 117 | int (*fn)(struct device *dev, void *data)); | 139 | int (*fn)(struct device *dev, void *data)); |
| @@ -121,10 +143,10 @@ struct device *bus_find_device(struct bus_type *bus, struct device *start, | |||
| 121 | struct device *bus_find_device_by_name(struct bus_type *bus, | 143 | struct device *bus_find_device_by_name(struct bus_type *bus, |
| 122 | struct device *start, | 144 | struct device *start, |
| 123 | const char *name); | 145 | const char *name); |
| 124 | 146 | struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id, | |
| 147 | struct device *hint); | ||
| 125 | int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, | 148 | int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, |
| 126 | void *data, int (*fn)(struct device_driver *, void *)); | 149 | void *data, int (*fn)(struct device_driver *, void *)); |
| 127 | |||
| 128 | void bus_sort_breadthfirst(struct bus_type *bus, | 150 | void bus_sort_breadthfirst(struct bus_type *bus, |
| 129 | int (*compare)(const struct device *a, | 151 | int (*compare)(const struct device *a, |
| 130 | const struct device *b)); | 152 | const struct device *b)); |
| @@ -256,6 +278,33 @@ struct device *driver_find_device(struct device_driver *drv, | |||
| 256 | int (*match)(struct device *dev, void *data)); | 278 | int (*match)(struct device *dev, void *data)); |
| 257 | 279 | ||
| 258 | /** | 280 | /** |
| 281 | * struct subsys_interface - interfaces to device functions | ||
| 282 | * @name name of the device function | ||
| 283 | * @subsystem subsytem of the devices to attach to | ||
| 284 | * @node the list of functions registered at the subsystem | ||
| 285 | * @add device hookup to device function handler | ||
| 286 | * @remove device hookup to device function handler | ||
| 287 | * | ||
| 288 | * Simple interfaces attached to a subsystem. Multiple interfaces can | ||
| 289 | * attach to a subsystem and its devices. Unlike drivers, they do not | ||
| 290 | * exclusively claim or control devices. Interfaces usually represent | ||
| 291 | * a specific functionality of a subsystem/class of devices. | ||
| 292 | */ | ||
| 293 | struct subsys_interface { | ||
| 294 | const char *name; | ||
| 295 | struct bus_type *subsys; | ||
| 296 | struct list_head node; | ||
| 297 | int (*add_dev)(struct device *dev, struct subsys_interface *sif); | ||
| 298 | int (*remove_dev)(struct device *dev, struct subsys_interface *sif); | ||
| 299 | }; | ||
| 300 | |||
| 301 | int subsys_interface_register(struct subsys_interface *sif); | ||
| 302 | void subsys_interface_unregister(struct subsys_interface *sif); | ||
| 303 | |||
| 304 | int subsys_system_register(struct bus_type *subsys, | ||
| 305 | const struct attribute_group **groups); | ||
| 306 | |||
| 307 | /** | ||
| 259 | * struct class - device classes | 308 | * struct class - device classes |
| 260 | * @name: Name of the class. | 309 | * @name: Name of the class. |
| 261 | * @owner: The module owner. | 310 | * @owner: The module owner. |
| @@ -438,11 +487,31 @@ struct device_attribute { | |||
| 438 | const char *buf, size_t count); | 487 | const char *buf, size_t count); |
| 439 | }; | 488 | }; |
| 440 | 489 | ||
| 441 | #define DEVICE_ATTR(_name, _mode, _show, _store) \ | 490 | struct dev_ext_attribute { |
| 442 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) | 491 | struct device_attribute attr; |
| 492 | void *var; | ||
| 493 | }; | ||
| 494 | |||
| 495 | ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr, | ||
| 496 | char *buf); | ||
| 497 | ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr, | ||
| 498 | const char *buf, size_t count); | ||
| 499 | ssize_t device_show_int(struct device *dev, struct device_attribute *attr, | ||
| 500 | char *buf); | ||
| 501 | ssize_t device_store_int(struct device *dev, struct device_attribute *attr, | ||
| 502 | const char *buf, size_t count); | ||
| 443 | 503 | ||
| 444 | extern int __must_check device_create_file(struct device *device, | 504 | #define DEVICE_ATTR(_name, _mode, _show, _store) \ |
| 445 | const struct device_attribute *entry); | 505 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) |
| 506 | #define DEVICE_ULONG_ATTR(_name, _mode, _var) \ | ||
| 507 | struct dev_ext_attribute dev_attr_##_name = \ | ||
| 508 | { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } | ||
| 509 | #define DEVICE_INT_ATTR(_name, _mode, _var) \ | ||
| 510 | struct dev_ext_attribute dev_attr_##_name = \ | ||
| 511 | { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } | ||
| 512 | |||
| 513 | extern int device_create_file(struct device *device, | ||
| 514 | const struct device_attribute *entry); | ||
| 446 | extern void device_remove_file(struct device *dev, | 515 | extern void device_remove_file(struct device *dev, |
| 447 | const struct device_attribute *attr); | 516 | const struct device_attribute *attr); |
| 448 | extern int __must_check device_create_bin_file(struct device *dev, | 517 | extern int __must_check device_create_bin_file(struct device *dev, |
| @@ -490,6 +559,9 @@ extern int devres_release_group(struct device *dev, void *id); | |||
| 490 | extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); | 559 | extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); |
| 491 | extern void devm_kfree(struct device *dev, void *p); | 560 | extern void devm_kfree(struct device *dev, void *p); |
| 492 | 561 | ||
| 562 | void __iomem *devm_request_and_ioremap(struct device *dev, | ||
| 563 | struct resource *res); | ||
| 564 | |||
| 493 | struct device_dma_parameters { | 565 | struct device_dma_parameters { |
| 494 | /* | 566 | /* |
| 495 | * a low level driver may set these to teach IOMMU code about | 567 | * a low level driver may set these to teach IOMMU code about |
| @@ -600,6 +672,7 @@ struct device { | |||
| 600 | struct device_node *of_node; /* associated device tree node */ | 672 | struct device_node *of_node; /* associated device tree node */ |
| 601 | 673 | ||
| 602 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 674 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
| 675 | u32 id; /* device instance */ | ||
| 603 | 676 | ||
| 604 | spinlock_t devres_lock; | 677 | spinlock_t devres_lock; |
| 605 | struct list_head devres_head; | 678 | struct list_head devres_head; |
| @@ -924,4 +997,25 @@ extern long sysfs_deprecated; | |||
| 924 | #define sysfs_deprecated 0 | 997 | #define sysfs_deprecated 0 |
| 925 | #endif | 998 | #endif |
| 926 | 999 | ||
| 1000 | /** | ||
| 1001 | * module_driver() - Helper macro for drivers that don't do anything | ||
| 1002 | * special in module init/exit. This eliminates a lot of boilerplate. | ||
| 1003 | * Each module may only use this macro once, and calling it replaces | ||
| 1004 | * module_init() and module_exit(). | ||
| 1005 | * | ||
| 1006 | * Use this macro to construct bus specific macros for registering | ||
| 1007 | * drivers, and do not use it on its own. | ||
| 1008 | */ | ||
| 1009 | #define module_driver(__driver, __register, __unregister) \ | ||
| 1010 | static int __init __driver##_init(void) \ | ||
| 1011 | { \ | ||
| 1012 | return __register(&(__driver)); \ | ||
| 1013 | } \ | ||
| 1014 | module_init(__driver##_init); \ | ||
| 1015 | static void __exit __driver##_exit(void) \ | ||
| 1016 | { \ | ||
| 1017 | __unregister(&(__driver)); \ | ||
| 1018 | } \ | ||
| 1019 | module_exit(__driver##_exit); | ||
| 1020 | |||
| 927 | #endif /* _DEVICE_H_ */ | 1021 | #endif /* _DEVICE_H_ */ |
diff --git a/include/linux/edac.h b/include/linux/edac.h index 055b248bdd53..1cd3947987e5 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #define _LINUX_EDAC_H_ | 13 | #define _LINUX_EDAC_H_ |
| 14 | 14 | ||
| 15 | #include <linux/atomic.h> | 15 | #include <linux/atomic.h> |
| 16 | #include <linux/sysdev.h> | 16 | #include <linux/device.h> |
| 17 | 17 | ||
| 18 | #define EDAC_OPSTATE_INVAL -1 | 18 | #define EDAC_OPSTATE_INVAL -1 |
| 19 | #define EDAC_OPSTATE_POLL 0 | 19 | #define EDAC_OPSTATE_POLL 0 |
| @@ -23,12 +23,12 @@ | |||
| 23 | extern int edac_op_state; | 23 | extern int edac_op_state; |
| 24 | extern int edac_err_assert; | 24 | extern int edac_err_assert; |
| 25 | extern atomic_t edac_handlers; | 25 | extern atomic_t edac_handlers; |
| 26 | extern struct sysdev_class edac_class; | 26 | extern struct bus_type edac_subsys; |
| 27 | 27 | ||
| 28 | extern int edac_handler_set(void); | 28 | extern int edac_handler_set(void); |
| 29 | extern void edac_atomic_assert_error(void); | 29 | extern void edac_atomic_assert_error(void); |
| 30 | extern struct sysdev_class *edac_get_sysfs_class(void); | 30 | extern struct bus_type *edac_get_sysfs_subsys(void); |
| 31 | extern void edac_put_sysfs_class(void); | 31 | extern void edac_put_sysfs_subsys(void); |
| 32 | 32 | ||
| 33 | static inline void opstate_init(void) | 33 | static inline void opstate_init(void) |
| 34 | { | 34 | { |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 07d103a06d64..8e25a9167f13 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
| @@ -482,6 +482,19 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap) | |||
| 482 | { | 482 | { |
| 483 | return adap->nr; | 483 | return adap->nr; |
| 484 | } | 484 | } |
| 485 | |||
| 486 | /** | ||
| 487 | * module_i2c_driver() - Helper macro for registering a I2C driver | ||
| 488 | * @__i2c_driver: i2c_driver struct | ||
| 489 | * | ||
| 490 | * Helper macro for I2C drivers which do not do anything special in module | ||
| 491 | * init/exit. This eliminates a lot of boilerplate. Each module may only | ||
| 492 | * use this macro once, and calling it replaces module_init() and module_exit() | ||
| 493 | */ | ||
| 494 | #define module_i2c_driver(__i2c_driver) \ | ||
| 495 | module_driver(__i2c_driver, i2c_add_driver, \ | ||
| 496 | i2c_del_driver) | ||
| 497 | |||
| 485 | #endif /* I2C */ | 498 | #endif /* I2C */ |
| 486 | #endif /* __KERNEL__ */ | 499 | #endif /* __KERNEL__ */ |
| 487 | 500 | ||
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index ad81e1c51487..fc615a97e2d3 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
| @@ -191,8 +191,6 @@ static inline struct kobj_type *get_ktype(struct kobject *kobj) | |||
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | extern struct kobject *kset_find_obj(struct kset *, const char *); | 193 | extern struct kobject *kset_find_obj(struct kset *, const char *); |
| 194 | extern struct kobject *kset_find_obj_hinted(struct kset *, const char *, | ||
| 195 | struct kobject *); | ||
| 196 | 194 | ||
| 197 | /* The global /sys/kernel/ kobject for people to chain off of */ | 195 | /* The global /sys/kernel/ kobject for people to chain off of */ |
| 198 | extern struct kobject *kernel_kobj; | 196 | extern struct kobject *kernel_kobj; |
diff --git a/include/linux/kref.h b/include/linux/kref.h index d4a62ab2ee5e..abc0120b09b7 100644 --- a/include/linux/kref.h +++ b/include/linux/kref.h | |||
| @@ -15,16 +15,81 @@ | |||
| 15 | #ifndef _KREF_H_ | 15 | #ifndef _KREF_H_ |
| 16 | #define _KREF_H_ | 16 | #define _KREF_H_ |
| 17 | 17 | ||
| 18 | #include <linux/types.h> | 18 | #include <linux/bug.h> |
| 19 | #include <linux/atomic.h> | ||
| 19 | 20 | ||
| 20 | struct kref { | 21 | struct kref { |
| 21 | atomic_t refcount; | 22 | atomic_t refcount; |
| 22 | }; | 23 | }; |
| 23 | 24 | ||
| 24 | void kref_init(struct kref *kref); | 25 | /** |
| 25 | void kref_get(struct kref *kref); | 26 | * kref_init - initialize object. |
| 26 | int kref_put(struct kref *kref, void (*release) (struct kref *kref)); | 27 | * @kref: object in question. |
| 27 | int kref_sub(struct kref *kref, unsigned int count, | 28 | */ |
| 28 | void (*release) (struct kref *kref)); | 29 | static inline void kref_init(struct kref *kref) |
| 30 | { | ||
| 31 | atomic_set(&kref->refcount, 1); | ||
| 32 | } | ||
| 33 | |||
| 34 | /** | ||
| 35 | * kref_get - increment refcount for object. | ||
| 36 | * @kref: object. | ||
| 37 | */ | ||
| 38 | static inline void kref_get(struct kref *kref) | ||
| 39 | { | ||
| 40 | WARN_ON(!atomic_read(&kref->refcount)); | ||
| 41 | atomic_inc(&kref->refcount); | ||
| 42 | } | ||
| 29 | 43 | ||
| 44 | /** | ||
| 45 | * kref_sub - subtract a number of refcounts for object. | ||
| 46 | * @kref: object. | ||
| 47 | * @count: Number of recounts to subtract. | ||
| 48 | * @release: pointer to the function that will clean up the object when the | ||
| 49 | * last reference to the object is released. | ||
| 50 | * This pointer is required, and it is not acceptable to pass kfree | ||
| 51 | * in as this function. If the caller does pass kfree to this | ||
| 52 | * function, you will be publicly mocked mercilessly by the kref | ||
| 53 | * maintainer, and anyone else who happens to notice it. You have | ||
| 54 | * been warned. | ||
| 55 | * | ||
| 56 | * Subtract @count from the refcount, and if 0, call release(). | ||
| 57 | * Return 1 if the object was removed, otherwise return 0. Beware, if this | ||
| 58 | * function returns 0, you still can not count on the kref from remaining in | ||
| 59 | * memory. Only use the return value if you want to see if the kref is now | ||
| 60 | * gone, not present. | ||
| 61 | */ | ||
| 62 | static inline int kref_sub(struct kref *kref, unsigned int count, | ||
| 63 | void (*release)(struct kref *kref)) | ||
| 64 | { | ||
| 65 | WARN_ON(release == NULL); | ||
| 66 | |||
| 67 | if (atomic_sub_and_test((int) count, &kref->refcount)) { | ||
| 68 | release(kref); | ||
| 69 | return 1; | ||
| 70 | } | ||
| 71 | return 0; | ||
| 72 | } | ||
| 73 | |||
| 74 | /** | ||
| 75 | * kref_put - decrement refcount for object. | ||
| 76 | * @kref: object. | ||
| 77 | * @release: pointer to the function that will clean up the object when the | ||
| 78 | * last reference to the object is released. | ||
| 79 | * This pointer is required, and it is not acceptable to pass kfree | ||
| 80 | * in as this function. If the caller does pass kfree to this | ||
| 81 | * function, you will be publicly mocked mercilessly by the kref | ||
| 82 | * maintainer, and anyone else who happens to notice it. You have | ||
| 83 | * been warned. | ||
| 84 | * | ||
| 85 | * Decrement the refcount, and if 0, call release(). | ||
| 86 | * Return 1 if the object was removed, otherwise return 0. Beware, if this | ||
| 87 | * function returns 0, you still can not count on the kref from remaining in | ||
| 88 | * memory. Only use the return value if you want to see if the kref is now | ||
| 89 | * gone, not present. | ||
| 90 | */ | ||
| 91 | static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref)) | ||
| 92 | { | ||
| 93 | return kref_sub(kref, 1, release); | ||
| 94 | } | ||
| 30 | #endif /* _KREF_H_ */ | 95 | #endif /* _KREF_H_ */ |
diff --git a/include/linux/memory.h b/include/linux/memory.h index 935699b30b7c..1ac7f6e405f9 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h | |||
| @@ -15,7 +15,6 @@ | |||
| 15 | #ifndef _LINUX_MEMORY_H_ | 15 | #ifndef _LINUX_MEMORY_H_ |
| 16 | #define _LINUX_MEMORY_H_ | 16 | #define _LINUX_MEMORY_H_ |
| 17 | 17 | ||
| 18 | #include <linux/sysdev.h> | ||
| 19 | #include <linux/node.h> | 18 | #include <linux/node.h> |
| 20 | #include <linux/compiler.h> | 19 | #include <linux/compiler.h> |
| 21 | #include <linux/mutex.h> | 20 | #include <linux/mutex.h> |
| @@ -38,7 +37,7 @@ struct memory_block { | |||
| 38 | int phys_device; /* to which fru does this belong? */ | 37 | int phys_device; /* to which fru does this belong? */ |
| 39 | void *hw; /* optional pointer to fw/hw data */ | 38 | void *hw; /* optional pointer to fw/hw data */ |
| 40 | int (*phys_callback)(struct memory_block *); | 39 | int (*phys_callback)(struct memory_block *); |
| 41 | struct sys_device sysdev; | 40 | struct device dev; |
| 42 | }; | 41 | }; |
| 43 | 42 | ||
| 44 | int arch_get_memory_phys_device(unsigned long start_pfn); | 43 | int arch_get_memory_phys_device(unsigned long start_pfn); |
diff --git a/include/linux/node.h b/include/linux/node.h index 92370e22343c..624e53cecc02 100644 --- a/include/linux/node.h +++ b/include/linux/node.h | |||
| @@ -14,12 +14,12 @@ | |||
| 14 | #ifndef _LINUX_NODE_H_ | 14 | #ifndef _LINUX_NODE_H_ |
| 15 | #define _LINUX_NODE_H_ | 15 | #define _LINUX_NODE_H_ |
| 16 | 16 | ||
| 17 | #include <linux/sysdev.h> | 17 | #include <linux/device.h> |
| 18 | #include <linux/cpumask.h> | 18 | #include <linux/cpumask.h> |
| 19 | #include <linux/workqueue.h> | 19 | #include <linux/workqueue.h> |
| 20 | 20 | ||
| 21 | struct node { | 21 | struct node { |
| 22 | struct sys_device sysdev; | 22 | struct device dev; |
| 23 | 23 | ||
| 24 | #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS) | 24 | #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS) |
| 25 | struct work_struct node_work; | 25 | struct work_struct node_work; |
| @@ -80,6 +80,6 @@ static inline void register_hugetlbfs_with_node(node_registration_func_t reg, | |||
| 80 | } | 80 | } |
| 81 | #endif | 81 | #endif |
| 82 | 82 | ||
| 83 | #define to_node(sys_device) container_of(sys_device, struct node, sysdev) | 83 | #define to_node(device) container_of(device, struct node, dev) |
| 84 | 84 | ||
| 85 | #endif /* _LINUX_NODE_H_ */ | 85 | #endif /* _LINUX_NODE_H_ */ |
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 2a23f7d1a825..5622fa24e97b 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
| @@ -63,7 +63,7 @@ struct platform_device_info { | |||
| 63 | u64 dma_mask; | 63 | u64 dma_mask; |
| 64 | }; | 64 | }; |
| 65 | extern struct platform_device *platform_device_register_full( | 65 | extern struct platform_device *platform_device_register_full( |
| 66 | struct platform_device_info *pdevinfo); | 66 | const struct platform_device_info *pdevinfo); |
| 67 | 67 | ||
| 68 | /** | 68 | /** |
| 69 | * platform_device_register_resndata - add a platform-level device with | 69 | * platform_device_register_resndata - add a platform-level device with |
| @@ -196,16 +196,8 @@ static inline void platform_set_drvdata(struct platform_device *pdev, void *data | |||
| 196 | * calling it replaces module_init() and module_exit() | 196 | * calling it replaces module_init() and module_exit() |
| 197 | */ | 197 | */ |
| 198 | #define module_platform_driver(__platform_driver) \ | 198 | #define module_platform_driver(__platform_driver) \ |
| 199 | static int __init __platform_driver##_init(void) \ | 199 | module_driver(__platform_driver, platform_driver_register, \ |
| 200 | { \ | 200 | platform_driver_unregister) |
| 201 | return platform_driver_register(&(__platform_driver)); \ | ||
| 202 | } \ | ||
| 203 | module_init(__platform_driver##_init); \ | ||
| 204 | static void __exit __platform_driver##_exit(void) \ | ||
| 205 | { \ | ||
| 206 | platform_driver_unregister(&(__platform_driver)); \ | ||
| 207 | } \ | ||
| 208 | module_exit(__platform_driver##_exit); | ||
| 209 | 201 | ||
| 210 | extern struct platform_device *platform_create_bundle(struct platform_driver *driver, | 202 | extern struct platform_device *platform_create_bundle(struct platform_driver *driver, |
| 211 | int (*probe)(struct platform_device *), | 203 | int (*probe)(struct platform_device *), |
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index bb4f5fbbbd8e..176fce9cc6b1 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
| @@ -200,6 +200,17 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
| 200 | driver_unregister(&sdrv->driver); | 200 | driver_unregister(&sdrv->driver); |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | /** | ||
| 204 | * module_spi_driver() - Helper macro for registering a SPI driver | ||
| 205 | * @__spi_driver: spi_driver struct | ||
| 206 | * | ||
| 207 | * Helper macro for SPI drivers which do not do anything special in module | ||
| 208 | * init/exit. This eliminates a lot of boilerplate. Each module may only | ||
| 209 | * use this macro once, and calling it replaces module_init() and module_exit() | ||
| 210 | */ | ||
| 211 | #define module_spi_driver(__spi_driver) \ | ||
| 212 | module_driver(__spi_driver, spi_register_driver, \ | ||
| 213 | spi_unregister_driver) | ||
| 203 | 214 | ||
| 204 | /** | 215 | /** |
| 205 | * struct spi_master - interface to SPI master controller | 216 | * struct spi_master - interface to SPI master controller |
diff --git a/include/linux/usb.h b/include/linux/usb.h index d3d0c1374334..5d258c3180ae 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
| @@ -953,6 +953,18 @@ extern int usb_register_driver(struct usb_driver *, struct module *, | |||
| 953 | 953 | ||
| 954 | extern void usb_deregister(struct usb_driver *); | 954 | extern void usb_deregister(struct usb_driver *); |
| 955 | 955 | ||
| 956 | /** | ||
| 957 | * module_usb_driver() - Helper macro for registering a USB driver | ||
| 958 | * @__usb_driver: usb_driver struct | ||
| 959 | * | ||
| 960 | * Helper macro for USB drivers which do not do anything special in module | ||
| 961 | * init/exit. This eliminates a lot of boilerplate. Each module may only | ||
| 962 | * use this macro once, and calling it replaces module_init() and module_exit() | ||
| 963 | */ | ||
| 964 | #define module_usb_driver(__usb_driver) \ | ||
| 965 | module_driver(__usb_driver, usb_register, \ | ||
| 966 | usb_deregister) | ||
| 967 | |||
| 956 | extern int usb_register_device_driver(struct usb_device_driver *, | 968 | extern int usb_register_device_driver(struct usb_device_driver *, |
| 957 | struct module *); | 969 | struct module *); |
| 958 | extern void usb_deregister_device_driver(struct usb_device_driver *); | 970 | extern void usb_deregister_device_driver(struct usb_device_driver *); |
diff --git a/include/xen/balloon.h b/include/xen/balloon.h index d29c153705bc..cc2e1a7e44ec 100644 --- a/include/xen/balloon.h +++ b/include/xen/balloon.h | |||
| @@ -29,11 +29,11 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages, | |||
| 29 | bool highmem); | 29 | bool highmem); |
| 30 | void free_xenballooned_pages(int nr_pages, struct page **pages); | 30 | void free_xenballooned_pages(int nr_pages, struct page **pages); |
| 31 | 31 | ||
| 32 | struct sys_device; | 32 | struct device; |
| 33 | #ifdef CONFIG_XEN_SELFBALLOONING | 33 | #ifdef CONFIG_XEN_SELFBALLOONING |
| 34 | extern int register_xen_selfballooning(struct sys_device *sysdev); | 34 | extern int register_xen_selfballooning(struct device *dev); |
| 35 | #else | 35 | #else |
| 36 | static inline int register_xen_selfballooning(struct sys_device *sysdev) | 36 | static inline int register_xen_selfballooning(struct device *dev) |
| 37 | { | 37 | { |
| 38 | return -ENOSYS; | 38 | return -ENOSYS; |
| 39 | } | 39 | } |
