diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-01-12 11:53:55 -0500 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-01-12 11:53:55 -0500 |
commit | d3b7737f2b70ed2fb7cef985e70d04fb5dee7b7c (patch) | |
tree | 190e42f90d152ebad1c077809422c366cdf0577b | |
parent | dc6821e0cfe74802aefd2067b40fcdc03fc4599e (diff) | |
parent | 070680218379e15c1901f4bf21b98e3cbf12b527 (diff) | |
download | linux-3.10-d3b7737f2b70ed2fb7cef985e70d04fb5dee7b7c.tar.gz linux-3.10-d3b7737f2b70ed2fb7cef985e70d04fb5dee7b7c.tar.bz2 linux-3.10-d3b7737f2b70ed2fb7cef985e70d04fb5dee7b7c.zip |
Merge commit '070680218379e15c1901f4bf21b98e3cbf12b527' into stable/for-linus-fixes-3.3
* commit '070680218379e15c1901f4bf21b98e3cbf12b527': (50 commits)
xen-balloon: convert sysdev_class to a regular subsystem
clocksource: convert sysdev_class to a regular subsystem
ibm_rtl: convert sysdev_class to a regular subsystem
edac: convert sysdev_class to a regular subsystem
rtmutex-tester: convert sysdev_class to a regular subsystem
driver-core: implement 'sysdev' functionality for regular devices and buses
kref: fix up the kfree build problems
kref: Remove the memory barriers
kref: Implement kref_put in terms of kref_sub
kref: Inline all functions
Drivers: hv: Get rid of an unnecessary check in hv.c
Drivers: hv: Make the vmbus driver unloadable
Drivers: hv: Fix a memory leak
Documentation: Update stable address
MAINTAINERS: stable: Update address
w1: add fast search for single slave bus
driver-core: skip uevent generation when nobody is listening
drivers: hv: Don't OOPS when you cannot init vmbus
firmware: google: fix gsmi.c build warning
drivers_base: make argument to platform_device_register_full const
...
351 files changed, 1373 insertions, 5091 deletions
diff --git a/Documentation/HOWTO b/Documentation/HOWTO index 81bc1a9ab9d..f7ade3b3b40 100644 --- a/Documentation/HOWTO +++ b/Documentation/HOWTO @@ -275,8 +275,8 @@ versions. If no 2.6.x.y kernel is available, then the highest numbered 2.6.x kernel is the current stable kernel. -2.6.x.y are maintained by the "stable" team <stable@kernel.org>, and are -released as needs dictate. The normal release period is approximately +2.6.x.y are maintained by the "stable" team <stable@vger.kernel.org>, and +are released as needs dictate. The normal release period is approximately two weeks, but it can be longer if there are no pressing problems. A security-related problem, instead, can cause a release to happen almost instantly. diff --git a/Documentation/development-process/5.Posting b/Documentation/development-process/5.Posting index 903a2546f13..8a48c9b6286 100644 --- a/Documentation/development-process/5.Posting +++ b/Documentation/development-process/5.Posting @@ -271,10 +271,10 @@ copies should go to: the linux-kernel list. - If you are fixing a bug, think about whether the fix should go into the - next stable update. If so, stable@kernel.org should get a copy of the - patch. Also add a "Cc: stable@kernel.org" to the tags within the patch - itself; that will cause the stable team to get a notification when your - fix goes into the mainline. + next stable update. If so, stable@vger.kernel.org should get a copy of + the patch. Also add a "Cc: stable@vger.kernel.org" to the tags within + the patch itself; that will cause the stable team to get a notification + when your fix goes into the mainline. When selecting recipients for a patch, it is good to have an idea of who you think will eventually accept the patch and get it merged. While it diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt index d79aead9418..10c64c8a13d 100644 --- a/Documentation/driver-model/devres.txt +++ b/Documentation/driver-model/devres.txt @@ -262,6 +262,7 @@ IOMAP devm_ioremap() devm_ioremap_nocache() devm_iounmap() + devm_request_and_ioremap() : checks resource, requests region, ioremaps pcim_iomap() pcim_iounmap() pcim_iomap_table() : array of mapped addresses indexed by BAR diff --git a/Documentation/filesystems/debugfs.txt b/Documentation/filesystems/debugfs.txt index 742cc06e138..f04066a37f4 100644 --- a/Documentation/filesystems/debugfs.txt +++ b/Documentation/filesystems/debugfs.txt @@ -97,7 +97,8 @@ A read on the resulting file will yield either Y (for non-zero values) or N, followed by a newline. If written to, it will accept either upper- or lower-case values, or 1 or 0. Any other input will be silently ignored. -Finally, a block of arbitrary binary data can be exported with: +Another option is exporting a block of arbitrary binary data, with +this structure and function: struct debugfs_blob_wrapper { void *data; @@ -115,6 +116,35 @@ can be used to export binary information, but there does not appear to be any code which does so in the mainline. Note that all files created with debugfs_create_blob() are read-only. +If you want to dump a block of registers (something that happens quite +often during development, even if little such code reaches mainline. +Debugfs offers two functions: one to make a registers-only file, and +another to insert a register block in the middle of another sequential +file. + + struct debugfs_reg32 { + char *name; + unsigned long offset; + }; + + struct debugfs_regset32 { + struct debugfs_reg32 *regs; + int nregs; + void __iomem *base; + }; + + struct dentry *debugfs_create_regset32(const char *name, mode_t mode, + struct dentry *parent, + struct debugfs_regset32 *regset); + + int debugfs_print_regs32(struct seq_file *s, struct debugfs_reg32 *regs, + int nregs, void __iomem *base, char *prefix); + +The "base" argument may be 0, but you may want to build the reg32 array +using __stringify, and a number of register names (macros) are actually +byte offsets over a base for the register block. + + There are a couple of other directory-oriented helper functions: struct dentry *debugfs_rename(struct dentry *old_dir, diff --git a/MAINTAINERS b/MAINTAINERS index 3523ab000f1..194d323484a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6261,7 +6261,7 @@ F: arch/alpha/kernel/srm_env.c STABLE BRANCH M: Greg Kroah-Hartman <greg@kroah.com> -L: stable@kernel.org +L: stable@vger.kernel.org S: Maintained STAGING SUBSYSTEM diff --git a/drivers/Kconfig b/drivers/Kconfig index b5e6f243f74..5afe5d1f199 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -116,6 +116,8 @@ source "drivers/vlynq/Kconfig" source "drivers/virtio/Kconfig" +source "drivers/hv/Kconfig" + source "drivers/xen/Kconfig" source "drivers/staging/Kconfig" @@ -132,8 +134,6 @@ source "drivers/iommu/Kconfig" source "drivers/virt/Kconfig" -source "drivers/hv/Kconfig" - source "drivers/devfreq/Kconfig" endmenu diff --git a/drivers/base/Makefile b/drivers/base/Makefile index 99a375ad2cc..1334d893b56 100644 --- a/drivers/base/Makefile +++ b/drivers/base/Makefile @@ -3,7 +3,8 @@ obj-y := core.o sys.o bus.o dd.o syscore.o \ driver.o class.o platform.o \ cpu.o firmware.o init.o map.o devres.o \ - attribute_container.o transport_class.o + attribute_container.o transport_class.o \ + topology.o obj-$(CONFIG_DEVTMPFS) += devtmpfs.o obj-y += power/ obj-$(CONFIG_HAS_DMA) += dma-mapping.o @@ -12,7 +13,6 @@ obj-$(CONFIG_ISA) += isa.o obj-$(CONFIG_FW_LOADER) += firmware_class.o obj-$(CONFIG_NUMA) += node.o obj-$(CONFIG_MEMORY_HOTPLUG_SPARSE) += memory.o -obj-$(CONFIG_SMP) += topology.o ifeq ($(CONFIG_SYSFS),y) obj-$(CONFIG_MODULES) += module.o endif diff --git a/drivers/base/base.h b/drivers/base/base.h index 21c1b96c34c..7a6ae422876 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h @@ -4,7 +4,9 @@ * struct subsys_private - structure to hold the private to the driver core portions of the bus_type/class structure. * * @subsys - the struct kset that defines this subsystem - * @devices_kset - the list of devices associated + * @devices_kset - the subsystem's 'devices' directory + * @interfaces - list of subsystem interfaces associated + * @mutex - protect the devices, and interfaces lists. * * @drivers_kset - the list of drivers associated * @klist_devices - the klist to iterate over the @devices_kset @@ -14,10 +16,8 @@ * @bus - pointer back to the struct bus_type that this structure is associated * with. * - * @class_interfaces - list of class_interfaces associated * @glue_dirs - "glue" directory to put in-between the parent device to * avoid namespace conflicts - * @class_mutex - mutex to protect the children, devices, and interfaces lists. * @class - pointer back to the struct class that this structure is associated * with. * @@ -28,6 +28,8 @@ struct subsys_private { struct kset subsys; struct kset *devices_kset; + struct list_head interfaces; + struct mutex mutex; struct kset *drivers_kset; struct klist klist_devices; @@ -36,9 +38,7 @@ struct subsys_private { unsigned int drivers_autoprobe:1; struct bus_type *bus; - struct list_head class_interfaces; struct kset glue_dirs; - struct mutex class_mutex; struct class *class; }; #define to_subsys_private(obj) container_of(obj, struct subsys_private, subsys.kobj) @@ -94,7 +94,6 @@ extern int hypervisor_init(void); static inline int hypervisor_init(void) { return 0; } #endif extern int platform_bus_init(void); -extern int system_bus_init(void); extern int cpu_dev_init(void); extern int bus_add_device(struct device *dev); @@ -116,6 +115,7 @@ extern char *make_class_name(const char *name, struct kobject *kobj); extern int devres_release_all(struct device *dev); +/* /sys/devices directory */ extern struct kset *devices_kset; #if defined(CONFIG_MODULES) && defined(CONFIG_SYSFS) diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 000e7b2006f..99dc5921e1d 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -16,9 +16,14 @@ #include <linux/slab.h> #include <linux/init.h> #include <linux/string.h> +#include <linux/mutex.h> #include "base.h" #include "power/power.h" +/* /sys/devices/system */ +/* FIXME: make static after drivers/base/sys.c is deleted */ +struct kset *system_kset; + #define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr) /* @@ -360,6 +365,47 @@ struct device *bus_find_device_by_name(struct bus_type *bus, } EXPORT_SYMBOL_GPL(bus_find_device_by_name); +/** + * subsys_find_device_by_id - find a device with a specific enumeration number + * @subsys: subsystem + * @id: index 'id' in struct device + * @hint: device to check first + * + * Check the hint's next object and if it is a match return it directly, + * otherwise, fall back to a full list search. Either way a reference for + * the returned object is taken. + */ +struct device *subsys_find_device_by_id(struct bus_type *subsys, unsigned int id, + struct device *hint) +{ + struct klist_iter i; + struct device *dev; + + if (!subsys) + return NULL; + + if (hint) { + klist_iter_init_node(&subsys->p->klist_devices, &i, &hint->p->knode_bus); + dev = next_device(&i); + if (dev && dev->id == id && get_device(dev)) { + klist_iter_exit(&i); + return dev; + } + klist_iter_exit(&i); + } + + klist_iter_init_node(&subsys->p->klist_devices, &i, NULL); + while ((dev = next_device(&i))) { + if (dev->id == id && get_device(dev)) { + klist_iter_exit(&i); + return dev; + } + } + klist_iter_exit(&i); + return NULL; +} +EXPORT_SYMBOL_GPL(subsys_find_device_by_id); + static struct device_driver *next_driver(struct klist_iter *i) { struct klist_node *n = klist_next(i); @@ -487,38 +533,59 @@ out_put: void bus_probe_device(struct device *dev) { struct bus_type *bus = dev->bus; + struct subsys_interface *sif; int ret; - if (bus && bus->p->drivers_autoprobe) { + if (!bus) + return; + + if (bus->p->drivers_autoprobe) { ret = device_attach(dev); WARN_ON(ret < 0); } + + mutex_lock(&bus->p->mutex); + list_for_each_entry(sif, &bus->p->interfaces, node) + if (sif->add_dev) + sif->add_dev(dev, sif); + mutex_unlock(&bus->p->mutex); } /** * bus_remove_device - remove device from bus * @dev: device to be removed * - * - Remove symlink from bus's directory. + * - Remove device from all interfaces. + * - Remove symlink from bus' directory. * - Delete device from bus's list. * - Detach from its driver. * - Drop reference taken in bus_add_device(). */ void bus_remove_device(struct device *dev) { - if (dev->bus) { - sysfs_remove_link(&dev->kobj, "subsystem"); - sysfs_remove_link(&dev->bus->p->devices_kset->kobj, - dev_name(dev)); - device_remove_attrs(dev->bus, dev); - if (klist_node_attached(&dev->p->knode_bus)) - klist_del(&dev->p->knode_bus); - - pr_debug("bus: '%s': remove device %s\n", - dev->bus->name, dev_name(dev)); - device_release_driver(dev); - bus_put(dev->bus); - } + struct bus_type *bus = dev->bus; + struct subsys_interface *sif; + + if (!bus) + return; + + mutex_lock(&bus->p->mutex); + list_for_each_entry(sif, &bus->p->interfaces, node) + if (sif->remove_dev) + sif->remove_dev(dev, sif); + mutex_unlock(&bus->p->mutex); + + sysfs_remove_link(&dev->kobj, "subsystem"); + sysfs_remove_link(&dev->bus->p->devices_kset->kobj, + dev_name(dev)); + device_remove_attrs(dev->bus, dev); + if (klist_node_attached(&dev->p->knode_bus)) + klist_del(&dev->p->knode_bus); + + pr_debug("bus: '%s': remove device %s\n", + dev->bus->name, dev_name(dev)); + device_release_driver(dev); + bus_put(dev->bus); } static int driver_add_attrs(struct bus_type *bus, struct device_driver *drv) @@ -847,14 +914,14 @@ static ssize_t bus_uevent_store(struct bus_type *bus, static BUS_ATTR(uevent, S_IWUSR, NULL, bus_uevent_store); /** - * bus_register - register a bus with the system. + * __bus_register - register a driver-core subsystem * @bus: bus. * * Once we have that, we registered the bus with the kobject * infrastructure, then register the children subsystems it has: - * the devices and drivers that belong to the bus. + * the devices and drivers that belong to the subsystem. */ -int bus_register(struct bus_type *bus) +int __bus_register(struct bus_type *bus, struct lock_class_key *key) { int retval; struct subsys_private *priv; @@ -898,6 +965,8 @@ int bus_register(struct bus_type *bus) goto bus_drivers_fail; } + INIT_LIST_HEAD(&priv->interfaces); + __mutex_init(&priv->mutex, "subsys mutex", key); klist_init(&priv->klist_devices, klist_devices_get, klist_devices_put); klist_init(&priv->klist_drivers, NULL, NULL); @@ -927,7 +996,7 @@ out: bus->p = NULL; return retval; } -EXPORT_SYMBOL_GPL(bus_register); +EXPORT_SYMBOL_GPL(__bus_register); /** * bus_unregister - remove a bus from the system @@ -939,6 +1008,8 @@ EXPORT_SYMBOL_GPL(bus_register); void bus_unregister(struct bus_type *bus) { pr_debug("bus: '%s': unregistering\n", bus->name); + if (bus->dev_root) + device_unregister(bus->dev_root); bus_remove_attrs(bus); remove_probe_files(bus); kset_unregister(bus->p->drivers_kset); @@ -1028,10 +1099,194 @@ void bus_sort_breadthfirst(struct bus_type *bus, } EXPORT_SYMBOL_GPL(bus_sort_breadthfirst); +/** + * subsys_dev_iter_init - initialize subsys device iterator + * @iter: subsys iterator to initialize + * @subsys: the subsys we wanna iterate over + * @start: the device to start iterating from, if any + * @type: device_type of the devices to iterate over, NULL for all + * + * Initialize subsys iterator @iter such that it iterates over devices + * of @subsys. If @start is set, the list iteration will start there, + * otherwise if it is NULL, the iteration starts at the beginning of + * the list. + */ +void subsys_dev_iter_init(struct subsys_dev_iter *iter, struct bus_type *subsys, + struct device *start, const struct device_type *type) +{ + struct klist_node *start_knode = NULL; + + if (start) + start_knode = &start->p->knode_bus; + klist_iter_init_node(&subsys->p->klist_devices, &iter->ki, start_knode); + iter->type = type; +} +EXPORT_SYMBOL_GPL(subsys_dev_iter_init); + +/** + * subsys_dev_iter_next - iterate to the next device + * @iter: subsys iterator to proceed + * + * Proceed @iter to the next device and return it. Returns NULL if + * iteration is complete. + * + * The returned device is referenced and won't be released till + * iterator is proceed to the next device or exited. The caller is + * free to do whatever it wants to do with the device including + * calling back into subsys code. + */ +struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter) +{ + struct klist_node *knode; + struct device *dev; + + for (;;) { + knode = klist_next(&iter->ki); + if (!knode) + return NULL; + dev = container_of(knode, struct device_private, knode_bus)->device; + if (!iter->type || iter->type == dev->type) + return dev; + } +} +EXPORT_SYMBOL_GPL(subsys_dev_iter_next); + +/** + * subsys_dev_iter_exit - finish iteration + * @iter: subsys iterator to finish + * + * Finish an iteration. Always call this function after iteration is + * complete whether the iteration ran till the end or not. + */ +void subsys_dev_iter_exit(struct subsys_dev_iter *iter) +{ + klist_iter_exit(&iter->ki); +} +EXPORT_SYMBOL_GPL(subsys_dev_iter_exit); + +int subsys_interface_register(struct subsys_interface *sif) +{ + struct bus_type *subsys; + struct subsys_dev_iter iter; + struct device *dev; + + if (!sif || !sif->subsys) + return -ENODEV; + + subsys = bus_get(sif->subsys); + if (!subsys) + return -EINVAL; + + mutex_lock(&subsys->p->mutex); + list_add_tail(&sif->node, &subsys->p->interfaces); + if (sif->add_dev) { + subsys_dev_iter_init(&iter, subsys, NULL, NULL); + while ((dev = subsys_dev_iter_next(&iter))) + sif->add_dev(dev, sif); + subsys_dev_iter_exit(&iter); + } + mutex_unlock(&subsys->p->mutex); + + return 0; +} +EXPORT_SYMBOL_GPL(subsys_interface_register); + +void subsys_interface_unregister(struct subsys_interface *sif) +{ + struct bus_type *subsys = sif->subsys; + struct subsys_dev_iter iter; + struct device *dev; + + if (!sif) + return; + + mutex_lock(&subsys->p->mutex); + list_del_init(&sif->node); + if (sif->remove_dev) { + subsys_dev_iter_init(&iter, subsys, NULL, NULL); + while ((dev = subsys_dev_iter_next(&iter))) + sif->remove_dev(dev, sif); + subsys_dev_iter_exit(&iter); + } + mutex_unlock(&subsys->p->mutex); + + bus_put(subsys); +} +EXPORT_SYMBOL_GPL(subsys_interface_unregister); + +static void system_root_device_release(struct device *dev) +{ + kfree(dev); +} +/** + * subsys_system_register - register a subsystem at /sys/devices/system/ + * @subsys - system subsystem + * @groups - default attributes for the root device + * + * All 'system' subsystems have a /sys/devices/system/<name> root device + * with the name of the subsystem. The root device can carry subsystem- + * wide attributes. All registered devices are below this single root + * device and are named after the subsystem with a simple enumeration + * number appended. The registered devices are not explicitely named; + * only 'id' in the device needs to be set. + * + * Do not use this interface for anything new, it exists for compatibility + * with bad ideas only. New subsystems should use plain subsystems; and + * add the subsystem-wide attributes should be added to the subsystem + * directory itself and not some create fake root-device placed in + * /sys/devices/system/<name>. + */ +int subsys_system_register(struct bus_type *subsys, + const struct attribute_group **groups) +{ + struct device *dev; + int err; + + err = bus_register(subsys); + if (err < 0) + return err; + + dev = kzalloc(sizeof(struct device), GFP_KERNEL); + if (!dev) { + err = -ENOMEM; + goto err_dev; + } + + err = dev_set_name(dev, "%s", subsys->name); + if (err < 0) + goto err_name; + + dev->kobj.parent = &system_kset->kobj; + dev->groups = groups; + dev->release = system_root_device_release; + + err = device_register(dev); + if (err < 0) + goto err_dev_reg; + + subsys->dev_root = dev; + return 0; + +err_dev_reg: + put_device(dev); + dev = NULL; +err_name: + kfree(dev); +err_dev: + bus_unregister(subsys); + return err; +} +EXPORT_SYMBOL_GPL(subsys_system_register); + int __init buses_init(void) { bus_kset = kset_create_and_add("bus", &bus_uevent_ops, NULL); if (!bus_kset) return -ENOMEM; + + system_kset = kset_create_and_add("system", NULL, &devices_kset->kobj); + if (!system_kset) + return -ENOMEM; + return 0; } diff --git a/drivers/base/class.c b/drivers/base/class.c index b80d91cc8c3..03243d4002f 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -184,9 +184,9 @@ int __class_register(struct class *cls, struct lock_class_key *key) if (!cp) return -ENOMEM; klist_init(&cp->klist_devices, klist_class_dev_get, klist_class_dev_put); - INIT_LIST_HEAD(&cp->class_interfaces); + INIT_LIST_HEAD(&cp->interfaces); kset_init(&cp->glue_dirs); - __mutex_init(&cp->class_mutex, "struct class mutex", key); + __mutex_init(&cp->mutex, "subsys mutex", key); error = kobject_set_name(&cp->subsys.kobj, "%s", cls->name); if (error) { kfree(cp); @@ -460,15 +460,15 @@ int class_interface_register(struct class_interface *class_intf) if (!parent) return -EINVAL; - mutex_lock(&parent->p->class_mutex); - list_add_tail(&class_intf->node, &parent->p->class_interfaces); + mutex_lock(&parent->p->mutex); + list_add_tail(&class_intf->node, &parent->p->interfaces); if (class_intf->add_dev) { class_dev_iter_init(&iter, parent, NULL, NULL); while ((dev = class_dev_iter_next(&iter))) class_intf->add_dev(dev, class_intf); class_dev_iter_exit(&iter); } - mutex_unlock(&parent->p->class_mutex); + mutex_unlock(&parent->p->mutex); return 0; } @@ -482,7 +482,7 @@ void class_interface_unregister(struct class_interface *class_intf) if (!parent) return; - mutex_lock(&parent->p->class_mutex); + mutex_lock(&parent->p->mutex); list_del_init(&class_intf->node); if (class_intf->remove_dev) { class_dev_iter_init(&iter, parent, NULL, NULL); @@ -490,7 +490,7 @@ void class_interface_unregister(struct class_interface *class_intf) class_intf->remove_dev(dev, class_intf); class_dev_iter_exit(&iter); } - mutex_unlock(&parent->p->class_mutex); + mutex_unlock(&parent->p->mutex); class_put(parent); } diff --git a/drivers/base/core.c b/drivers/base/core.c index d8b3d89db04..2dbe801c6ae 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -118,6 +118,56 @@ static const struct sysfs_ops dev_sysfs_ops = { .store = dev_attr_store, }; +#define to_ext_attr(x) container_of(x, struct dev_ext_attribute, attr) + +ssize_t device_store_ulong(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t size) +{ + struct dev_ext_attribute *ea = to_ext_attr(attr); + char *end; + unsigned long new = simple_strtoul(buf, &end, 0); + if (end == buf) + return -EINVAL; + *(unsigned long *)(ea->var) = new; + /* Always return full write size even if we didn't consume all */ + return size; +} +EXPORT_SYMBOL_GPL(device_store_ulong); + +ssize_t device_show_ulong(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct dev_ext_attribute *ea = to_ext_attr(attr); + return snprintf(buf, PAGE_SIZE, "%lx\n", *(unsigned long *)(ea->var)); +} +EXPORT_SYMBOL_GPL(device_show_ulong); + +ssize_t device_store_int(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t size) +{ + struct dev_ext_attribute *ea = to_ext_attr(attr); + char *end; + long new = simple_strtol(buf, &end, 0); + if (end == buf || new > INT_MAX || new < INT_MIN) + return -EINVAL; + *(int *)(ea->var) = new; + /* Always return full write size even if we didn't consume all */ + return size; +} +EXPORT_SYMBOL_GPL(device_store_int); + +ssize_t device_show_int(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct dev_ext_attribute *ea = to_ext_attr(attr); + + return snprintf(buf, PAGE_SIZE, "%d\n", *(int *)(ea->var)); +} +EXPORT_SYMBOL_GPL(device_show_int); /** * device_release - free device structure. @@ -464,7 +514,7 @@ static ssize_t show_dev(struct device *dev, struct device_attribute *attr, static struct device_attribute devt_attr = __ATTR(dev, S_IRUGO, show_dev, NULL); -/* kset to create /sys/devices/ */ +/* /sys/devices/ */ struct kset *devices_kset; /** @@ -711,6 +761,10 @@ static struct kobject *get_device_parent(struct device *dev, return k; } + /* subsystems can specify a default root directory for their devices */ + if (!parent && dev->bus && dev->bus->dev_root) + return &dev->bus->dev_root->kobj; + if (parent) return &parent->kobj; return NULL; @@ -731,14 +785,6 @@ static void cleanup_device_parent(struct device *dev) cleanup_glue_dir(dev, dev->kobj.parent); } -static void setup_parent(struct device *dev, struct device *parent) -{ - struct kobject *kobj; - kobj = get_device_parent(dev, parent); - if (kobj) - dev->kobj.parent = kobj; -} - static int device_add_class_symlinks(struct device *dev) { int error; @@ -891,6 +937,7 @@ int device_private_init(struct device *dev) int device_add(struct device *dev) { struct device *parent = NULL; + struct kobject *kobj; struct class_interface *class_intf; int error = -EINVAL; @@ -914,6 +961,10 @@ int device_add(struct device *dev) dev->init_name = NULL; } + /* subsystems can specify simple device enumeration */ + if (!dev_name(dev) && dev->bus && dev->bus->dev_name) + dev_set_name(dev, "%s%u", dev->bus->dev_name, dev->id); + if (!dev_name(dev)) { error = -EINVAL; goto name_error; @@ -922,7 +973,9 @@ int device_add(struct device *dev) pr_debug("device: '%s': %s\n", dev_name(dev), __func__); parent = get_device(dev->parent); - setup_parent(dev, parent); + kobj = get_device_parent(dev, parent); + if (kobj) + dev->kobj.parent = kobj; /* use parent numa_node */ if (parent) @@ -982,17 +1035,17 @@ int device_add(struct device *dev) &parent->p->klist_children); if (dev->class) { - mutex_lock(&dev->class->p->class_mutex); + mutex_lock(&dev->class->p->mutex); /* tie the class to the device */ klist_add_tail(&dev->knode_class, &dev->class->p->klist_devices); /* notify any interfaces that the device is here */ list_for_each_entry(class_intf, - &dev->class->p->class_interfaces, node) + &dev->class->p->interfaces, node) if (class_intf->add_dev) class_intf->add_dev(dev, class_intf); - mutex_unlock(&dev->class->p->class_mutex); + mutex_unlock(&dev->class->p->mutex); } done: put_device(dev); @@ -1107,15 +1160,15 @@ void device_del(struct device *dev) if (dev->class) { device_remove_class_symlinks(dev); - mutex_lock(&dev->class->p->class_mutex); + mutex_lock(&dev->class->p->mutex); /* notify any interfaces that the device is now gone */ list_for_each_entry(class_intf, - &dev->class->p->class_interfaces, node) + &dev->class->p->interfaces, node) if (class_intf->remove_dev) class_intf->remove_dev(dev, class_intf); /* remove the device from the class list */ klist_del(&dev->knode_class); - mutex_unlock(&dev->class->p->class_mutex); + mutex_unlock(&dev->class->p->mutex); } device_remove_file(dev, &uevent_attr); device_remove_attrs(dev); diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index a4760e095ff..2bb4bff3af7 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c @@ -413,10 +413,9 @@ static int devtmpfsd(void *p) } spin_lock(&req_lock); } - set_current_state(TASK_INTERRUPTIBLE); + __set_current_state(TASK_INTERRUPTIBLE); spin_unlock(&req_lock); schedule(); - __set_current_state(TASK_RUNNING); } return 0; out: diff --git a/drivers/base/init.c b/drivers/base/init.c index c8a934e7942..c16f0b808a1 100644 --- a/drivers/base/init.c +++ b/drivers/base/init.c @@ -31,7 +31,6 @@ void __init driver_init(void) * core core pieces. */ platform_bus_init(); - system_bus_init(); cpu_dev_init(); memory_dev_init(); } diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 7a24895543e..a7c06374062 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -383,7 +383,7 @@ EXPORT_SYMBOL_GPL(platform_device_unregister); * Returns &struct platform_device pointer on success, or ERR_PTR() on error. */ struct platform_device *platform_device_register_full( - struct platform_device_info *pdevinfo) + const struct platform_device_info *pdevinfo) { int ret = -ENOMEM; struct platform_device *pdev; diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 9dff77bfe1e..409f5ce7882 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c @@ -126,7 +126,7 @@ void sysdev_class_remove_file(struct sysdev_class *c, } EXPORT_SYMBOL_GPL(sysdev_class_remove_file); -static struct kset *system_kset; +extern struct kset *system_kset; int sysdev_class_register(struct sysdev_class *cls) { @@ -331,14 +331,6 @@ void sysdev_unregister(struct sys_device *sysdev) EXPORT_SYMBOL_GPL(sysdev_register); EXPORT_SYMBOL_GPL(sysdev_unregister); -int __init system_bus_init(void) -{ - system_kset = kset_create_and_add("system", NULL, &devices_kset->kobj); - if (!system_kset) - return -ENOMEM; - return 0; -} - #define to_ext_attr(x) container_of(x, struct sysdev_ext_attribute, attr) ssize_t sysdev_store_ulong(struct sys_device *sysdev, diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 106beb194f3..cf77a9a2bfa 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c @@ -423,19 +423,7 @@ static struct usb_driver ath3k_driver = { .id_table = ath3k_table, }; -static int __init ath3k_init(void) -{ - BT_INFO("Atheros AR30xx firmware driver ver %s", VERSION); - return usb_register(&ath3k_driver); -} - -static void __exit ath3k_exit(void) -{ - usb_deregister(&ath3k_driver); -} - -module_init(ath3k_init); -module_exit(ath3k_exit); +module_usb_driver(ath3k_driver); MODULE_AUTHOR("Atheros Communications"); MODULE_DESCRIPTION("Atheros AR30xx firmware driver"); diff --git a/drivers/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c index 54952ab800b..1e742a50e2c 100644 --- a/drivers/bluetooth/bcm203x.c +++ b/drivers/bluetooth/bcm203x.c @@ -281,26 +281,7 @@ static struct usb_driver bcm203x_driver = { .id_table = bcm203x_table, }; -static int __init bcm203x_init(void) -{ - int err; - - BT_INFO("Broadcom Blutonium firmware driver ver %s", VERSION); - - err = usb_register(&bcm203x_driver); - if (err < 0) - BT_ERR("Failed to register USB driver"); - - return err; -} - -static void __exit bcm203x_exit(void) -{ - usb_deregister(&bcm203x_driver); -} - -module_init(bcm203x_init); -module_exit(bcm203x_exit); +module_usb_driver(bcm203x_driver); MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); MODULE_DESCRIPTION("Broadcom Blutonium firmware driver ver " VERSION); diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index 61b591470a9..e64a290a1b9 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c @@ -764,26 +764,7 @@ static struct usb_driver bfusb_driver = { .id_table = bfusb_table, }; -static int __init bfusb_init(void) -{ - int err; - - BT_INFO("BlueFRITZ! USB driver ver %s", VERSION); - - err = usb_register(&bfusb_driver); - if (err < 0) - BT_ERR("Failed to register BlueFRITZ! USB driver"); - - return err; -} - -static void __exit bfusb_exit(void) -{ - usb_deregister(&bfusb_driver); -} - -module_init(bfusb_init); -module_exit(bfusb_exit); +module_usb_driver(bfusb_driver); MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); MODULE_DESCRIPTION("BlueFRITZ! USB driver ver " VERSION); diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c index 751b338d904..62831603de5 100644 --- a/drivers/bluetooth/bpa10x.c +++ b/drivers/bluetooth/bpa10x.c @@ -521,20 +521,7 @@ static struct usb_driver bpa10x_driver = { .id_table = bpa10x_table, }; -static int __init bpa10x_init(void) -{ - BT_INFO("Digianswer Bluetooth USB driver ver %s", VERSION); - - return usb_register(&bpa10x_driver); -} - -static void __exit bpa10x_exit(void) -{ - usb_deregister(&bpa10x_driver); -} - -module_init(bpa10x_init); -module_exit(bpa10x_exit); +module_usb_driver(bpa10x_driver); MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); MODULE_DESCRIPTION("Digianswer Bluetooth USB driver ver " VERSION); diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index fe4ebc375b3..da832353abe 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -1223,20 +1223,7 @@ static struct usb_driver btusb_driver = { .supports_autosuspend = 1, }; -static int __init btusb_init(void) -{ - BT_INFO("Generic Bluetooth USB driver ver %s", VERSION); - - return usb_register(&btusb_driver); -} - -static void __exit btusb_exit(void) -{ - usb_deregister(&btusb_driver); -} - -module_init(btusb_init); -module_exit(btusb_exit); +module_usb_driver(btusb_driver); module_param(ignore_dga, bool, 0644); MODULE_PARM_DESC(ignore_dga, "Ignore devices with id 08fd:0001"); diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h index fe90cd4a7eb..e48ab3108ad 100644 --- a/drivers/edac/edac_core.h +++ b/drivers/edac/edac_core.h @@ -32,7 +32,6 @@ #include <linux/completion.h> #include <linux/kobject.h> #include <linux/platform_device.h> -#include <linux/sysdev.h> #include <linux/workqueue.h> #include <linux/edac.h> @@ -243,8 +242,8 @@ struct edac_device_ctl_info { */ struct edac_dev_sysfs_attribute *sysfs_attributes; - /* pointer to main 'edac' class in sysfs */ - struct sysdev_class *edac_class; + /* pointer to main 'edac' subsys in sysfs */ + struct bus_type *edac_subsys; /* the internal state of this controller instance */ int op_state; @@ -342,7 +341,7 @@ struct edac_pci_ctl_info { int pci_idx; - struct sysdev_class *edac_class; /* pointer to class */ + struct bus_type *edac_subsys; /* pointer to subsystem */ /* the internal state of this controller instance */ int op_state; diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c index c3f67437afb..4b154593343 100644 --- a/drivers/edac/edac_device.c +++ b/drivers/edac/edac_device.c @@ -23,7 +23,6 @@ #include <linux/jiffies.h> #include <linux/spinlock.h> #include <linux/list.h> -#include <linux/sysdev.h> #include <linux/ctype.h> #include <linux/workqueue.h> #include <asm/uaccess.h> diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c index 86649df0028..b4ea185cceb 100644 --- a/drivers/edac/edac_device_sysfs.c +++ b/drivers/edac/edac_device_sysfs.c @@ -1,5 +1,5 @@ /* - * file for managing the edac_device class of devices for EDAC + * file for managing the edac_device subsystem of devices for EDAC * * (C) 2007 SoftwareBitMaker * @@ -230,21 +230,21 @@ static struct kobj_type ktype_device_ctrl = { */ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) { - struct sysdev_class *edac_class; + struct bus_type *edac_subsys; int err; debugf1("%s()\n", __func__); /* get the /sys/devices/system/edac reference */ - edac_class = edac_get_sysfs_class(); - if (edac_class == NULL) { - debugf1("%s() no edac_class error\n", __func__); + edac_subsys = edac_get_sysfs_subsys(); + if (edac_subsys == NULL) { + debugf1("%s() no edac_subsys error\n", __func__); err = -ENODEV; goto err_out; } - /* Point to the 'edac_class' this instance 'reports' to */ - edac_dev->edac_class = edac_class; + /* Point to the 'edac_subsys' this instance 'reports' to */ + edac_dev->edac_subsys = edac_subsys; /* Init the devices's kobject */ memset(&edac_dev->kobj, 0, sizeof(struct kobject)); @@ -261,7 +261,7 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) /* register */ err = kobject_init_and_add(&edac_dev->kobj, &ktype_device_ctrl, - &edac_class->kset.kobj, + &edac_subsys->dev_root->kobj, "%s", edac_dev->name); if (err) { debugf1("%s()Failed to register '.../edac/%s'\n", @@ -284,7 +284,7 @@ err_kobj_reg: module_put(edac_dev->owner); err_mod_get: - edac_put_sysfs_class(); + edac_put_sysfs_subsys(); err_out: return err; @@ -308,7 +308,7 @@ void edac_device_unregister_sysfs_main_kobj(struct edac_device_ctl_info *dev) * b) 'kfree' the memory */ kobject_put(&dev->kobj); - edac_put_sysfs_class(); + edac_put_sysfs_subsys(); } /* edac_dev -> instance information */ diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index d69144a0904..ca6c04d350e 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -25,7 +25,6 @@ #include <linux/jiffies.h> #include <linux/spinlock.h> #include <linux/list.h> -#include <linux/sysdev.h> #include <linux/ctype.h> #include <linux/edac.h> #include <asm/uaccess.h> diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c index 29ffa350bfb..d56e63477d5 100644 --- a/drivers/edac/edac_mc_sysfs.c +++ b/drivers/edac/edac_mc_sysfs.c @@ -1021,19 +1021,19 @@ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci) int edac_sysfs_setup_mc_kset(void) { int err = -EINVAL; - struct sysdev_class *edac_class; + struct bus_type *edac_subsys; debugf1("%s()\n", __func__); - /* get the /sys/devices/system/edac class reference */ - edac_class = edac_get_sysfs_class(); - if (edac_class == NULL) { - debugf1("%s() no edac_class error=%d\n", __func__, err); + /* get the /sys/devices/system/edac subsys reference */ + edac_subsys = edac_get_sysfs_subsys(); + if (edac_subsys == NULL) { + debugf1("%s() no edac_subsys error=%d\n", __func__, err); goto fail_out; } /* Init the MC's kobject */ - mc_kset = kset_create_and_add("mc", NULL, &edac_class->kset.kobj); + mc_kset = kset_create_and_add("mc", NULL, &edac_subsys->dev_root->kobj); if (!mc_kset) { err = -ENOMEM; debugf1("%s() Failed to register '.../edac/mc'\n", __func__); @@ -1045,7 +1045,7 @@ int edac_sysfs_setup_mc_kset(void) return 0; fail_kset: - edac_put_sysfs_class(); + edac_put_sysfs_subsys(); fail_out: return err; @@ -1059,6 +1059,6 @@ fail_out: void edac_sysfs_teardown_mc_kset(void) { kset_unregister(mc_kset); - edac_put_sysfs_class(); + edac_put_sysfs_subsys(); } diff --git a/drivers/edac/edac_module.h b/drivers/edac/edac_module.h index 17aabb7b90e..00f81b47a51 100644 --- a/drivers/edac/edac_module.h +++ b/drivers/edac/edac_module.h @@ -10,8 +10,6 @@ #ifndef __EDAC_MODULE_H__ #define __EDAC_MODULE_H__ -#include <linux/sysdev.h> - #include "edac_core.h" /* diff --git a/drivers/edac/edac_pci.c b/drivers/edac/edac_pci.c index 2b378207d57..63af1c5673d 100644 --- a/drivers/edac/edac_pci.c +++ b/drivers/edac/edac_pci.c @@ -19,7 +19,6 @@ #include <linux/slab.h> #include <linux/spinlock.h> #include <linux/list.h> -#include <linux/sysdev.h> #include <linux/ctype.h> #include <linux/workqueue.h> #include <asm/uaccess.h> diff --git a/drivers/edac/edac_pci_sysfs.c b/drivers/edac/edac_pci_sysfs.c index 495198ad059..97f5064e399 100644 --- a/drivers/edac/edac_pci_sysfs.c +++ b/drivers/edac/edac_pci_sysfs.c @@ -338,12 +338,12 @@ static struct kobj_type ktype_edac_pci_main_kobj = { * edac_pci_main_kobj_setup() * * setup the sysfs for EDAC PCI attributes - * assumes edac_class has already been initialized + * assumes edac_subsys has already been initialized */ static int edac_pci_main_kobj_setup(void) { int err; - struct sysdev_class *edac_class; + struct bus_type *edac_subsys; debugf0("%s()\n", __func__); @@ -354,9 +354,9 @@ static int edac_pci_main_kobj_setup(void) /* First time, so create the main kobject and its * controls and attributes */ - edac_class = edac_get_sysfs_class(); - if (edac_class == NULL) { - debugf1("%s() no edac_class\n", __func__); + edac_subsys = edac_get_sysfs_subsys(); + if (edac_subsys == NULL) { + debugf1("%s() no edac_subsys\n", __func__); err = -ENODEV; goto decrement_count_fail; } @@ -381,7 +381,7 @@ static int edac_pci_main_kobj_setup(void) /* Instanstiate the pci object */ err = kobject_init_and_add(edac_pci_top_main_kobj, &ktype_edac_pci_main_kobj, - &edac_class->kset.kobj, "pci"); + &edac_subsys->dev_root->kobj, "pci"); if (err) { debugf1("Failed to register '.../edac/pci'\n"); goto kobject_init_and_add_fail; @@ -404,7 +404,7 @@ kzalloc_fail: module_put(THIS_MODULE); mod_get_fail: - edac_put_sysfs_class(); + edac_put_sysfs_subsys(); decrement_count_fail: /* if are on this error exit, nothing to tear down */ @@ -432,7 +432,7 @@ static void edac_pci_main_kobj_teardown(void) __func__); kobject_put(edac_pci_top_main_kobj); } - edac_put_sysfs_class(); + edac_put_sysfs_subsys(); } /* diff --git a/drivers/edac/edac_stub.c b/drivers/edac/edac_stub.c index 86ad2eee120..670c4481453 100644 --- a/drivers/edac/edac_stub.c +++ b/drivers/edac/edac_stub.c @@ -26,7 +26,7 @@ EXPORT_SYMBOL_GPL(edac_handlers); int edac_err_assert = 0; EXPORT_SYMBOL_GPL(edac_err_assert); -static atomic_t edac_class_valid = ATOMIC_INIT(0); +static atomic_t edac_subsys_valid = ATOMIC_INIT(0); /* * called to determine if there is an EDAC driver interested in @@ -54,36 +54,37 @@ EXPORT_SYMBOL_GPL(edac_atomic_assert_error); * sysfs object: /sys/devices/system/edac * need to export to other files */ -struct sysdev_class edac_class = { +struct bus_type edac_subsys = { .name = "edac", + .dev_name = "edac", }; -EXPORT_SYMBOL_GPL(edac_class); +EXPORT_SYMBOL_GPL(edac_subsys); /* return pointer to the 'edac' node in sysfs */ -struct sysdev_class *edac_get_sysfs_class(void) +struct bus_type *edac_get_sysfs_subsys(void) { int err = 0; - if (atomic_read(&edac_class_valid)) + if (atomic_read(&edac_subsys_valid)) goto out; /* create the /sys/devices/system/edac directory */ - err = sysdev_class_register(&edac_class); + err = subsys_system_register(&edac_subsys, NULL); if (err) { printk(KERN_ERR "Error registering toplevel EDAC sysfs dir\n"); return NULL; } out: - atomic_inc(&edac_class_valid); - return &edac_class; + atomic_inc(&edac_subsys_valid); + return &edac_subsys; } -EXPORT_SYMBOL_GPL(edac_get_sysfs_class); +EXPORT_SYMBOL_GPL(edac_get_sysfs_subsys); -void edac_put_sysfs_class(void) +void edac_put_sysfs_subsys(void) { /* last user unregisters it */ - if (atomic_dec_and_test(&edac_class_valid)) - sysdev_class_unregister(&edac_class); + if (atomic_dec_and_test(&edac_subsys_valid)) + bus_unregister(&edac_subsys); } -EXPORT_SYMBOL_GPL(edac_put_sysfs_class); +EXPORT_SYMBOL_GPL(edac_put_sysfs_subsys); diff --git a/drivers/edac/mce_amd_inj.c b/drivers/edac/mce_amd_inj.c index 73c3e26a0bc..885e8ad8fdc 100644 --- a/drivers/edac/mce_amd_inj.c +++ b/drivers/edac/mce_amd_inj.c @@ -11,7 +11,6 @@ */ #include <linux/kobject.h> -#include <linux/sysdev.h> #include <linux/edac.h> #include <linux/module.h> #include <asm/mce.h> @@ -116,14 +115,14 @@ static struct edac_mce_attr *sysfs_attrs[] = { &mce_attr_status, &mce_attr_misc, static int __init edac_init_mce_inject(void) { - struct sysdev_class *edac_class = NULL; + struct bus_type *edac_subsys = NULL; int i, err = 0; - edac_class = edac_get_sysfs_class(); - if (!edac_class) + edac_subsys = edac_get_sysfs_subsys(); + if (!edac_subsys) return -EINVAL; - mce_kobj = kobject_create_and_add("mce", &edac_class->kset.kobj); + mce_kobj = kobject_create_and_add("mce", &edac_subsys->dev_root->kobj); if (!mce_kobj) { printk(KERN_ERR "Error creating a mce kset.\n"); err = -ENOMEM; @@ -147,7 +146,7 @@ err_sysfs_create: kobject_del(mce_kobj); err_mce_kobj: - edac_put_sysfs_class(); + edac_put_sysfs_subsys(); return err; } @@ -161,7 +160,7 @@ static void __exit edac_exit_mce_inject(void) kobject_del(mce_kobj); - edac_put_sysfs_class(); + edac_put_sysfs_subsys(); } module_init(edac_init_mce_inject); diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c index c4e7c59d1c6..91ddf0f7a1b 100644 --- a/drivers/firmware/google/gsmi.c +++ b/drivers/firmware/google/gsmi.c @@ -345,7 +345,8 @@ static efi_status_t gsmi_get_variable(efi_char16_t *name, memcpy(¶m, gsmi_dev.param_buf->start, sizeof(param)); /* The size reported is the min of all of our buffers */ - *data_size = min(*data_size, gsmi_dev.data_buf->length); + *data_size = min_t(unsigned long, *data_size, + gsmi_dev.data_buf->length); *data_size = min_t(unsigned long, *data_size, param.data_len); /* Copy data back to return buffer. */ diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c index 065817329f0..bc445d7e3bf 100644 --- a/drivers/hid/usbhid/usbkbd.c +++ b/drivers/hid/usbhid/usbkbd.c @@ -354,19 +354,4 @@ static struct usb_driver usb_kbd_driver = { .id_table = usb_kbd_id_table, }; -static int __init usb_kbd_init(void) -{ - int result = usb_register(&usb_kbd_driver); - if (result == 0) - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - return result; -} - -static void __exit usb_kbd_exit(void) -{ - usb_deregister(&usb_kbd_driver); -} - -module_init(usb_kbd_init); -module_exit(usb_kbd_exit); +module_usb_driver(usb_kbd_driver); diff --git a/drivers/hid/usbhid/usbmouse.c b/drivers/hid/usbhid/usbmouse.c index 79b2bf81a05..0f6be45d43d 100644 --- a/drivers/hid/usbhid/usbmouse.c +++ b/drivers/hid/usbhid/usbmouse.c @@ -241,19 +241,4 @@ static struct usb_driver usb_mouse_driver = { .id_table = usb_mouse_id_table, }; -static int __init usb_mouse_init(void) -{ - int retval = usb_register(&usb_mouse_driver); - if (retval == 0) - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - return retval; -} - -static void __exit usb_mouse_exit(void) -{ - usb_deregister(&usb_mouse_driver); -} - -module_init(usb_mouse_init); -module_exit(usb_mouse_exit); +module_usb_driver(usb_mouse_driver); diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig index 9fa09ac000a..70f5dde1cc5 100644 --- a/drivers/hv/Kconfig +++ b/drivers/hv/Kconfig @@ -1,3 +1,5 @@ +menu "Microsoft Hyper-V guest support" + config HYPERV tristate "Microsoft Hyper-V client drivers" depends on X86 && ACPI && PCI @@ -11,4 +13,4 @@ config HYPERV_UTILS help Select this option to enable the Hyper-V Utilities. - +endmenu diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 12b85ff957f..36484db36ba 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -223,6 +223,17 @@ static void vmbus_process_rescind_offer(struct work_struct *work) vmbus_device_unregister(channel->device_obj); } +void vmbus_free_channels(void) +{ + struct vmbus_channel *channel; + + list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) { + vmbus_device_unregister(channel->device_obj); + kfree(channel->device_obj); + free_channel(channel); + } +} + /* * vmbus_process_offer - Process the offer by creating a channel/device * associated with this offer @@ -287,6 +298,7 @@ static void vmbus_process_offer(struct work_struct *work) spin_lock_irqsave(&vmbus_connection.channel_lock, flags); list_del(&newchannel->listentry); spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags); + kfree(newchannel->device_obj); free_channel(newchannel); } else { diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index 0fb100ed91a..12aa97f31f9 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -164,11 +164,6 @@ int hv_init(void) max_leaf = query_hypervisor_info(); - rdmsrl(HV_X64_MSR_GUEST_OS_ID, hv_context.guestid); - - if (hv_context.guestid != 0) - goto cleanup; - /* Write our OS info */ wrmsrl(HV_X64_MSR_GUEST_OS_ID, HV_LINUX_GUEST_ID); hv_context.guestid = HV_LINUX_GUEST_ID; @@ -237,6 +232,9 @@ void hv_cleanup(void) { union hv_x64_msr_hypercall_contents hypercall_msr; + /* Reset our OS id */ + wrmsrl(HV_X64_MSR_GUEST_OS_ID, 0); + kfree(hv_context.signal_event_buffer); hv_context.signal_event_buffer = NULL; hv_context.signal_event_param = NULL; diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index 0aee1122734..6d7d286d544 100644 --- a/drivers/hv/hyperv_vmbus.h +++ b/drivers/hv/hyperv_vmbus.h @@ -611,6 +611,7 @@ void vmbus_device_unregister(struct hv_device *device_obj); struct vmbus_channel *relid2channel(u32 relid); +void vmbus_free_channels(void); /* Connection interface */ diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 0c048dd8013..c3875f72b5b 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -62,6 +62,14 @@ struct hv_device_info { struct hv_dev_port_info outbound; }; +static int vmbus_exists(void) +{ + if (hv_acpi_dev == NULL) + return -ENODEV; + + return 0; +} + static void get_channel_info(struct hv_device *device, struct hv_device_info *info) @@ -590,6 +598,10 @@ int __vmbus_driver_register(struct hv_driver *hv_driver, struct module *owner, c pr_info("registering driver %s\n", hv_driver->name); + ret = vmbus_exists(); + if (ret < 0) + return ret; + hv_driver->driver.name = hv_driver->name; hv_driver->driver.owner = owner; hv_driver->driver.mod_name = mod_name; @@ -614,6 +626,9 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver) { pr_info("unregistering driver %s\n", hv_driver->name); + if (!vmbus_exists()) + return; + driver_unregister(&hv_driver->driver); } @@ -776,11 +791,23 @@ static int __init hv_acpi_init(void) cleanup: acpi_bus_unregister_driver(&vmbus_acpi_driver); + hv_acpi_dev = NULL; return ret; } +static void __exit vmbus_exit(void) +{ + + free_irq(irq, hv_acpi_dev); + vmbus_free_channels(); + bus_unregister(&hv_bus); + hv_cleanup(); + acpi_bus_unregister_driver(&vmbus_acpi_driver); +} + MODULE_LICENSE("GPL"); MODULE_VERSION(HV_DRV_VERSION); -module_init(hv_acpi_init); +subsys_initcall(hv_acpi_init); +module_exit(vmbus_exit); diff --git a/drivers/i2c/busses/i2c-diolan-u2c.c b/drivers/i2c/busses/i2c-diolan-u2c.c index 76366716a85..7eb19a5222f 100644 --- a/drivers/i2c/busses/i2c-diolan-u2c.c +++ b/drivers/i2c/busses/i2c-diolan-u2c.c @@ -515,20 +515,7 @@ static struct usb_driver diolan_u2c_driver = { .id_table = diolan_u2c_table, }; -static int __init diolan_u2c_init(void) -{ - /* register this driver with the USB subsystem */ - return usb_register(&diolan_u2c_driver); -} - -static void __exit diolan_u2c_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&diolan_u2c_driver); -} - -module_init(diolan_u2c_init); -module_exit(diolan_u2c_exit); +module_usb_driver(diolan_u2c_driver); MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>"); MODULE_DESCRIPTION(DRIVER_NAME " driver"); diff --git a/drivers/i2c/busses/i2c-tiny-usb.c b/drivers/i2c/busses/i2c-tiny-usb.c index d03b04002f0..f07307ff360 100644 --- a/drivers/i2c/busses/i2c-tiny-usb.c +++ b/drivers/i2c/busses/i2c-tiny-usb.c @@ -262,20 +262,7 @@ static struct usb_driver i2c_tiny_usb_driver = { .id_table = i2c_tiny_usb_table, }; -static int __init usb_i2c_tiny_usb_init(void) -{ - /* register this driver with the USB subsystem */ - return usb_register(&i2c_tiny_usb_driver); -} - -static void __exit usb_i2c_tiny_usb_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&i2c_tiny_usb_driver); -} - -module_init(usb_i2c_tiny_usb_init); -module_exit(usb_i2c_tiny_usb_exit); +module_usb_driver(i2c_tiny_usb_driver); /* ----- end of usb layer ------------------------------------------------ */ diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index d72887585a1..32bbd4c77b7 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -1041,18 +1041,7 @@ static struct usb_driver xpad_driver = { .id_table = xpad_table, }; -static int __init usb_xpad_init(void) -{ - return usb_register(&xpad_driver); -} - -static void __exit usb_xpad_exit(void) -{ - usb_deregister(&xpad_driver); -} - -module_init(usb_xpad_init); -module_exit(usb_xpad_exit); +module_usb_driver(xpad_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c index 8d345e87075..874a51c2fbb 100644 --- a/drivers/input/misc/ati_remote2.c +++ b/drivers/input/misc/ati_remote2.c @@ -1010,23 +1010,4 @@ static int ati_remote2_post_reset(struct usb_interface *interface) return r; } -static int __init ati_remote2_init(void) -{ - int r; - - r = usb_register(&ati_remote2_driver); - if (r) - printk(KERN_ERR "ati_remote2: usb_register() = %d\n", r); - else - printk(KERN_INFO "ati_remote2: " DRIVER_DESC " " DRIVER_VERSION "\n"); - - return r; -} - -static void __exit ati_remote2_exit(void) -{ - usb_deregister(&ati_remote2_driver); -} - -module_init(ati_remote2_init); -module_exit(ati_remote2_exit); +module_usb_driver(ati_remote2_driver); diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c index fc62256c963..d99151a8bf1 100644 --- a/drivers/input/misc/keyspan_remote.c +++ b/drivers/input/misc/keyspan_remote.c @@ -580,26 +580,7 @@ static struct usb_driver keyspan_driver = .id_table = keyspan_table }; -static int __init usb_keyspan_init(void) -{ - int result; - - /* register this driver with the USB subsystem */ - result = usb_register(&keyspan_driver); - if (result) - err("usb_register failed. Error number %d\n", result); - - return result; -} - -static void __exit usb_keyspan_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&keyspan_driver); -} - -module_init(usb_keyspan_init); -module_exit(usb_keyspan_exit); +module_usb_driver(keyspan_driver); MODULE_DEVICE_TABLE(usb, keyspan_table); MODULE_AUTHOR(DRIVER_AUTHOR); diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c index f45947190e4..538f7049ec6 100644 --- a/drivers/input/misc/powermate.c +++ b/drivers/input/misc/powermate.c @@ -441,18 +441,7 @@ static struct usb_driver powermate_driver = { .id_table = powermate_devices, }; -static int __init powermate_init(void) -{ - return usb_register(&powermate_driver); -} - -static void __exit powermate_cleanup(void) -{ - usb_deregister(&powermate_driver); -} - -module_init(powermate_init); -module_exit(powermate_cleanup); +module_usb_driver(powermate_driver); MODULE_AUTHOR( "William R Sowerbutts" ); MODULE_DESCRIPTION( "Griffin Technology, Inc PowerMate driver" ); diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c index 41201c6b5e6..f4776e7f8c1 100644 --- a/drivers/input/misc/yealink.c +++ b/drivers/input/misc/yealink.c @@ -988,22 +988,7 @@ static struct usb_driver yealink_driver = { .id_table = usb_table, }; -static int __init yealink_dev_init(void) -{ - int ret = usb_register(&yealink_driver); - if (ret == 0) - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - return ret; -} - -static void __exit yealink_dev_exit(void) -{ - usb_deregister(&yealink_driver); -} - -module_init(yealink_dev_init); -module_exit(yealink_dev_exit); +module_usb_driver(yealink_driver); MODULE_DEVICE_TABLE (usb, usb_table); diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c index b77f9991278..0acbc7d50d0 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c @@ -938,15 +938,4 @@ static struct usb_driver atp_driver = { .id_table = atp_table, }; -static int __init atp_init(void) -{ - return usb_register(&atp_driver); -} - -static void __exit atp_exit(void) -{ - usb_deregister(&atp_driver); -} - -module_init(atp_init); -module_exit(atp_exit); +module_usb_driver(atp_driver); diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index 5ec617e28f7..cf87f8b18e3 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c @@ -940,16 +940,4 @@ static struct usb_driver bcm5974_driver = { .supports_autosuspend = 1, }; -static int __init bcm5974_init(void) -{ - return usb_register(&bcm5974_driver); -} - -static void __exit bcm5974_exit(void) -{ - usb_deregister(&bcm5974_driver); -} - -module_init(bcm5974_init); -module_exit(bcm5974_exit); - +module_usb_driver(bcm5974_driver); diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c index d94f7e9aa99..f8b0b1df913 100644 --- a/drivers/input/tablet/acecad.c +++ b/drivers/input/tablet/acecad.c @@ -269,19 +269,4 @@ static struct usb_driver usb_acecad_driver = { .id_table = usb_acecad_id_table, }; -static int __init usb_acecad_init(void) -{ - int result = usb_register(&usb_acecad_driver); - if (result == 0) - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - return result; -} - -static void __exit usb_acecad_exit(void) -{ - usb_deregister(&usb_acecad_driver); -} - -module_init(usb_acecad_init); -module_exit(usb_acecad_exit); +module_usb_driver(usb_acecad_driver); diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c index 6d89fd1842c..d5ef3debd04 100644 --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c @@ -1919,21 +1919,7 @@ static struct usb_driver aiptek_driver = { .id_table = aiptek_ids, }; -static int __init aiptek_init(void) -{ - int result = usb_register(&aiptek_driver); - if (result == 0) { - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_AUTHOR "\n"); - } - return result; -} - -static void __exit aiptek_exit(void) -{ - usb_deregister(&aiptek_driver); -} +module_usb_driver(aiptek_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); @@ -1943,6 +1929,3 @@ module_param(programmableDelay, int, 0); MODULE_PARM_DESC(programmableDelay, "delay used during tablet programming"); module_param(jitterDelay, int, 0); MODULE_PARM_DESC(jitterDelay, "stylus/mouse settlement delay"); - -module_init(aiptek_init); -module_exit(aiptek_exit); diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index 8ea6afe2e99..89a297801dc 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c @@ -1022,33 +1022,7 @@ static struct usb_driver gtco_driverinfo_table = { .disconnect = gtco_disconnect, }; -/* - * Register this module with the USB subsystem - */ -static int __init gtco_init(void) -{ - int error; - - error = usb_register(>co_driverinfo_table); - if (error) { - err("usb_register() failed rc=0x%x", error); - return error; - } - - printk("GTCO usb driver version: %s", GTCO_VERSION); - return 0; -} - -/* - * Deregister this module with the USB subsystem - */ -static void __exit gtco_exit(void) -{ - usb_deregister(>co_driverinfo_table); -} - -module_init(gtco_init); -module_exit(gtco_exit); +module_usb_driver(gtco_driverinfo_table); MODULE_DESCRIPTION("GTCO digitizer USB driver"); MODULE_LICENSE("GPL"); diff --git a/drivers/input/tablet/hanwang.c b/drivers/input/tablet/hanwang.c index 6504b627b23..b2db3cfe308 100644 --- a/drivers/input/tablet/hanwang.c +++ b/drivers/input/tablet/hanwang.c @@ -432,15 +432,4 @@ static struct usb_driver hanwang_driver = { .id_table = hanwang_ids, }; -static int __init hanwang_init(void) -{ - return usb_register(&hanwang_driver); -} - -static void __exit hanwang_exit(void) -{ - usb_deregister(&hanwang_driver); -} - -module_init(hanwang_init); -module_exit(hanwang_exit); +module_usb_driver(hanwang_driver); diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c index 290f4e57b58..85a5b40333a 100644 --- a/drivers/input/tablet/kbtab.c +++ b/drivers/input/tablet/kbtab.c @@ -198,22 +198,4 @@ static struct usb_driver kbtab_driver = { .id_table = kbtab_ids, }; -static int __init kbtab_init(void) -{ - int retval; - retval = usb_register(&kbtab_driver); - if (retval) - goto out; - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); -out: - return retval; -} - -static void __exit kbtab_exit(void) -{ - usb_deregister(&kbtab_driver); -} - -module_init(kbtab_init); -module_exit(kbtab_exit); +module_usb_driver(kbtab_driver); diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 1c1b7b43cf9..8f9cde3e0ec 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -919,21 +919,4 @@ static struct usb_driver wacom_driver = { .supports_autosuspend = 1, }; -static int __init wacom_init(void) -{ - int result; - - result = usb_register(&wacom_driver); - if (result == 0) - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - return result; -} - -static void __exit wacom_exit(void) -{ - usb_deregister(&wacom_driver); -} - -module_init(wacom_init); -module_exit(wacom_exit); +module_usb_driver(wacom_driver); diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 73fd6642b68..e539d92cc62 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c @@ -1580,18 +1580,7 @@ static struct usb_driver usbtouch_driver = { .supports_autosuspend = 1, }; -static int __init usbtouch_init(void) -{ - return usb_register(&usbtouch_driver); -} - -static void __exit usbtouch_cleanup(void) -{ - usb_deregister(&usbtouch_driver); -} - -module_init(usbtouch_init); -module_exit(usbtouch_cleanup); +module_usb_driver(usbtouch_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c index 71a8eb6ef71..0e1f4d5b977 100644 --- a/drivers/isdn/hardware/mISDN/hfcsusb.c +++ b/drivers/isdn/hardware/mISDN/hfcsusb.c @@ -2154,30 +2154,4 @@ static struct usb_driver hfcsusb_drv = { .disconnect = hfcsusb_disconnect, }; -static int __init -hfcsusb_init(void) -{ - printk(KERN_INFO DRIVER_NAME " driver Rev. %s debug(0x%x) poll(%i)\n", - hfcsusb_rev, debug, poll); - - if (usb_register(&hfcsusb_drv)) { - printk(KERN_INFO DRIVER_NAME - ": Unable to register hfcsusb module at usb stack\n"); - return -ENODEV; - } - - return 0; -} - -static void __exit -hfcsusb_cleanup(void) -{ - if (debug & DBG_HFC_CALL_TRACE) - printk(KERN_INFO DRIVER_NAME ": %s\n", __func__); - - /* unregister Hardware */ - usb_deregister(&hfcsusb_drv); /* release our driver */ -} - -module_init(hfcsusb_init); -module_exit(hfcsusb_cleanup); +module_usb_driver(hfcsusb_drv); diff --git a/drivers/media/dvb/b2c2/flexcop-usb.c b/drivers/media/dvb/b2c2/flexcop-usb.c index bedcfb67162..26c666dd351 100644 --- a/drivers/media/dvb/b2c2/flexcop-usb.c +++ b/drivers/media/dvb/b2c2/flexcop-usb.c @@ -583,25 +583,7 @@ static struct usb_driver flexcop_usb_driver = { .id_table = flexcop_usb_table, }; -/* module stuff */ -static int __init flexcop_usb_module_init(void) -{ - int result; - if ((result = usb_register(&flexcop_usb_driver))) { - err("usb_register failed. (%d)", result); - return result; - } - return 0; -} - -static void __exit flexcop_usb_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&flexcop_usb_driver); -} - -module_init(flexcop_usb_module_init); -module_exit(flexcop_usb_module_exit); +module_usb_driver(flexcop_usb_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_NAME); diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c index 2aef3c89e9f..8d7fef84afd 100644 --- a/drivers/media/dvb/dvb-usb/a800.c +++ b/drivers/media/dvb/dvb-usb/a800.c @@ -183,26 +183,7 @@ static struct usb_driver a800_driver = { .id_table = a800_table, }; -/* module stuff */ -static int __init a800_module_init(void) -{ - int result; - if ((result = usb_register(&a800_driver))) { - err("usb_register failed. Error number %d",result); - return result; - } - - return 0; -} - -static void __exit a800_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&a800_driver); -} - -module_init (a800_module_init); -module_exit (a800_module_exit); +module_usb_driver(a800_driver); MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); MODULE_DESCRIPTION("AVerMedia AverTV DVB-T USB 2.0 (A800)"); diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index c6c275bac08..56cbd3636c3 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c @@ -1713,25 +1713,7 @@ static struct usb_driver af9015_usb_driver = { .id_table = af9015_usb_table, }; -/* module stuff */ -static int __init af9015_usb_module_init(void) -{ - int ret; - ret = usb_register(&af9015_usb_driver); - if (ret) - err("module init failed:%d", ret); - - return ret; -} - -static void __exit af9015_usb_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&af9015_usb_driver); -} - -module_init(af9015_usb_module_init); -module_exit(af9015_usb_module_exit); +module_usb_driver(af9015_usb_driver); MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); MODULE_DESCRIPTION("Driver for Afatech AF9015 DVB-T"); diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c index 5f2278b73ee..b39f14f85e7 100644 --- a/drivers/media/dvb/dvb-usb/anysee.c +++ b/drivers/media/dvb/dvb-usb/anysee.c @@ -1091,26 +1091,7 @@ static struct usb_driver anysee_driver = { .id_table = anysee_table, }; -/* module stuff */ -static int __init anysee_module_init(void) -{ - int ret; - - ret = usb_register(&anysee_driver); - if (ret) - err("%s: usb_register failed. Error number %d", __func__, ret); - - return ret; -} - -static void __exit anysee_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&anysee_driver); -} - -module_init(anysee_module_init); -module_exit(anysee_module_exit); +module_usb_driver(anysee_driver); MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); MODULE_DESCRIPTION("Driver Anysee E30 DVB-C & DVB-T USB2.0"); diff --git a/drivers/media/dvb/dvb-usb/au6610.c b/drivers/media/dvb/dvb-usb/au6610.c index b77994967b9..16210c06030 100644 --- a/drivers/media/dvb/dvb-usb/au6610.c +++ b/drivers/media/dvb/dvb-usb/au6610.c @@ -244,26 +244,7 @@ static struct usb_driver au6610_driver = { .id_table = au6610_table, }; -/* module stuff */ -static int __init au6610_module_init(void) -{ - int ret; - - ret = usb_register(&au6610_driver); - if (ret) - err("usb_register failed. Error number %d", ret); - - return ret; -} - -static void __exit au6610_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&au6610_driver); -} - -module_init(au6610_module_init); -module_exit(au6610_module_exit); +module_usb_driver(au6610_driver); MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); MODULE_DESCRIPTION("Driver for Alcor Micro AU6610 DVB-T USB2.0"); diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c index bf67b4dfd82..5e45ae60542 100644 --- a/drivers/media/dvb/dvb-usb/az6027.c +++ b/drivers/media/dvb/dvb-usb/az6027.c @@ -1174,28 +1174,7 @@ static struct usb_driver az6027_usb_driver = { .id_table = az6027_usb_table, }; -/* module stuff */ -static int __init az6027_usb_module_init(void) -{ - int result; - - result = usb_register(&az6027_usb_driver); - if (result) { - err("usb_register failed. (%d)", result); - return result; - } - - return 0; -} - -static void __exit az6027_usb_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&az6027_usb_driver); -} - -module_init(az6027_usb_module_init); -module_exit(az6027_usb_module_exit); +module_usb_driver(az6027_usb_driver); MODULE_AUTHOR("Adams Xu <Adams.xu@azwave.com.cn>"); MODULE_DESCRIPTION("Driver for AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)"); diff --git a/drivers/media/dvb/dvb-usb/ce6230.c b/drivers/media/dvb/dvb-usb/ce6230.c index 57afb5a9157..fa637255729 100644 --- a/drivers/media/dvb/dvb-usb/ce6230.c +++ b/drivers/media/dvb/dvb-usb/ce6230.c @@ -317,27 +317,7 @@ static struct usb_driver ce6230_driver = { .id_table = ce6230_table, }; -/* module stuff */ -static int __init ce6230_module_init(void) -{ - int ret; - deb_info("%s:\n", __func__); - ret = usb_register(&ce6230_driver); - if (ret) - err("usb_register failed with error:%d", ret); - - return ret; -} - -static void __exit ce6230_module_exit(void) -{ - deb_info("%s:\n", __func__); - /* deregister this driver from the USB subsystem */ - usb_deregister(&ce6230_driver); -} - -module_init(ce6230_module_init); -module_exit(ce6230_module_exit); +module_usb_driver(ce6230_driver); MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); MODULE_DESCRIPTION("Driver for Intel CE6230 DVB-T USB2.0"); diff --git a/drivers/media/dvb/dvb-usb/cinergyT2-core.c b/drivers/media/dvb/dvb-usb/cinergyT2-core.c index f9d905002ec..0a98548ecd1 100644 --- a/drivers/media/dvb/dvb-usb/cinergyT2-core.c +++ b/drivers/media/dvb/dvb-usb/cinergyT2-core.c @@ -247,25 +247,7 @@ static struct usb_driver cinergyt2_driver = { .id_table = cinergyt2_usb_table }; -static int __init cinergyt2_usb_init(void) -{ - int err; - - err = usb_register(&cinergyt2_driver); - if (err) { - err("usb_register() failed! (err %i)\n", err); - return err; - } - return 0; -} - -static void __exit cinergyt2_usb_exit(void) -{ - usb_deregister(&cinergyt2_driver); -} - -module_init(cinergyt2_usb_init); -module_exit(cinergyt2_usb_exit); +module_usb_driver(cinergyt2_driver); MODULE_DESCRIPTION("Terratec Cinergy T2 DVB-T driver"); MODULE_LICENSE("GPL"); diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 9f2a02c4837..949ea1bc0aa 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c @@ -2034,26 +2034,7 @@ static struct usb_driver cxusb_driver = { .id_table = cxusb_table, }; -/* module stuff */ -static int __init cxusb_module_init(void) -{ - int result; - if ((result = usb_register(&cxusb_driver))) { - err("usb_register failed. Error number %d",result); - return result; - } - - return 0; -} - -static void __exit cxusb_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&cxusb_driver); -} - -module_init (cxusb_module_init); -module_exit (cxusb_module_exit); +module_usb_driver(cxusb_driver); MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>"); diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c index 156cbfc9c79..206999476f0 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_core.c +++ b/drivers/media/dvb/dvb-usb/dib0700_core.c @@ -832,27 +832,7 @@ static struct usb_driver dib0700_driver = { .id_table = dib0700_usb_id_table, }; -/* module stuff */ -static int __init dib0700_module_init(void) -{ - int result; - info("loaded with support for %d different device-types", dib0700_device_count); - if ((result = usb_register(&dib0700_driver))) { - err("usb_register failed. Error number %d",result); - return result; - } - - return 0; -} - -static void __exit dib0700_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&dib0700_driver); -} - -module_init (dib0700_module_init); -module_exit (dib0700_module_exit); +module_usb_driver(dib0700_driver); MODULE_AUTHOR("Patrick Boettcher <pboettcher@dibcom.fr>"); MODULE_DESCRIPTION("Driver for devices based on DiBcom DiB0700 - USB bridge"); diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c index 7270791f834..a4ac37e0e98 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mb.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c @@ -463,26 +463,7 @@ static struct usb_driver dibusb_driver = { .id_table = dibusb_dib3000mb_table, }; -/* module stuff */ -static int __init dibusb_module_init(void) -{ - int result; - if ((result = usb_register(&dibusb_driver))) { - err("usb_register failed. Error number %d",result); - return result; - } - - return 0; -} - -static void __exit dibusb_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&dibusb_driver); -} - -module_init (dibusb_module_init); -module_exit (dibusb_module_exit); +module_usb_driver(dibusb_driver); MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); MODULE_DESCRIPTION("Driver for DiBcom USB DVB-T devices (DiB3000M-B based)"); diff --git a/drivers/media/dvb/dvb-usb/dibusb-mc.c b/drivers/media/dvb/dvb-usb/dibusb-mc.c index 9c165e2569d..9d1a59d09c5 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mc.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mc.c @@ -141,26 +141,7 @@ static struct usb_driver dibusb_mc_driver = { .id_table = dibusb_dib3000mc_table, }; -/* module stuff */ -static int __init dibusb_mc_module_init(void) -{ - int result; - if ((result = usb_register(&dibusb_mc_driver))) { - err("usb_register failed. Error number %d",result); - return result; - } - - return 0; -} - -static void __exit dibusb_mc_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&dibusb_mc_driver); -} - -module_init (dibusb_mc_module_init); -module_exit (dibusb_mc_module_exit); +module_usb_driver(dibusb_mc_driver); MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); MODULE_DESCRIPTION("Driver for DiBcom USB2.0 DVB-T (DiB3000M-C/P based) devices"); diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c index f7184111aa6..0a9a79820f2 100644 --- a/drivers/media/dvb/dvb-usb/digitv.c +++ b/drivers/media/dvb/dvb-usb/digitv.c @@ -346,26 +346,7 @@ static struct usb_driver digitv_driver = { .id_table = digitv_table, }; -/* module stuff */ -static int __init digitv_module_init(void) -{ - int result; - if ((result = usb_register(&digitv_driver))) { - err("usb_register failed. Error number %d",result); - return result; - } - - return 0; -} - -static void __exit digitv_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&digitv_driver); -} - -module_init (digitv_module_init); -module_exit (digitv_module_exit); +module_usb_driver(digitv_driver); MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); MODULE_DESCRIPTION("Driver for Nebula Electronics uDigiTV DVB-T USB2.0"); diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c index 106dfd55ff9..66f205c112b 100644 --- a/drivers/media/dvb/dvb-usb/dtt200u.c +++ b/drivers/media/dvb/dvb-usb/dtt200u.c @@ -360,26 +360,7 @@ static struct usb_driver dtt200u_usb_driver = { .id_table = dtt200u_usb_table, }; -/* module stuff */ -static int __init dtt200u_usb_module_init(void) -{ - int result; - if ((result = usb_register(&dtt200u_usb_driver))) { - err("usb_register failed. (%d)",result); - return result; - } - - return 0; -} - -static void __exit dtt200u_usb_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&dtt200u_usb_driver); -} - -module_init(dtt200u_usb_module_init); -module_exit(dtt200u_usb_module_exit); +module_usb_driver(dtt200u_usb_driver); MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); MODULE_DESCRIPTION("Driver for the WideView/Yakumo/Hama/Typhoon/Club3D/Miglia DVB-T USB2.0 devices"); diff --git a/drivers/media/dvb/dvb-usb/dtv5100.c b/drivers/media/dvb/dvb-usb/dtv5100.c index 7373132163d..3d11df41cac 100644 --- a/drivers/media/dvb/dvb-usb/dtv5100.c +++ b/drivers/media/dvb/dvb-usb/dtv5100.c @@ -217,26 +217,7 @@ static struct usb_driver dtv5100_driver = { .id_table = dtv5100_table, }; -/* module stuff */ -static int __init dtv5100_module_init(void) -{ - int ret; - - ret = usb_register(&dtv5100_driver); - if (ret) - err("usb_register failed. Error number %d", ret); - - return ret; -} - -static void __exit dtv5100_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&dtv5100_driver); -} - -module_init(dtv5100_module_init); -module_exit(dtv5100_module_exit); +module_usb_driver(dtv5100_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/media/dvb/dvb-usb/dw2102.c b/drivers/media/dvb/dvb-usb/dw2102.c index f103ec1fe82..ff941d20e6b 100644 --- a/drivers/media/dvb/dvb-usb/dw2102.c +++ b/drivers/media/dvb/dvb-usb/dw2102.c @@ -1928,22 +1928,7 @@ static struct usb_driver dw2102_driver = { .id_table = dw2102_table, }; -static int __init dw2102_module_init(void) -{ - int ret = usb_register(&dw2102_driver); - if (ret) - err("usb_register failed. Error number %d", ret); - - return ret; -} - -static void __exit dw2102_module_exit(void) -{ - usb_deregister(&dw2102_driver); -} - -module_init(dw2102_module_init); -module_exit(dw2102_module_exit); +module_usb_driver(dw2102_driver); MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by"); MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104," diff --git a/drivers/media/dvb/dvb-usb/ec168.c b/drivers/media/dvb/dvb-usb/ec168.c index 78442fe4aa5..b4989ba8897 100644 --- a/drivers/media/dvb/dvb-usb/ec168.c +++ b/drivers/media/dvb/dvb-usb/ec168.c @@ -428,27 +428,7 @@ static struct usb_driver ec168_driver = { .id_table = ec168_id, }; -/* module stuff */ -static int __init ec168_module_init(void) -{ - int ret; - deb_info("%s:\n", __func__); - ret = usb_register(&ec168_driver); - if (ret) - err("module init failed:%d", ret); - - return ret; -} - -static void __exit ec168_module_exit(void) -{ - deb_info("%s:\n", __func__); - /* deregister this driver from the USB subsystem */ - usb_deregister(&ec168_driver); -} - -module_init(ec168_module_init); -module_exit(ec168_module_exit); +module_usb_driver(ec168_driver); MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); MODULE_DESCRIPTION("E3C EC168 DVB-T USB2.0 driver"); diff --git a/drivers/media/dvb/dvb-usb/friio.c b/drivers/media/dvb/dvb-usb/friio.c index b092dc2137c..474a17e4db0 100644 --- a/drivers/media/dvb/dvb-usb/friio.c +++ b/drivers/media/dvb/dvb-usb/friio.c @@ -514,28 +514,7 @@ static struct usb_driver friio_driver = { .id_table = friio_table, }; - -/* module stuff */ -static int __init friio_module_init(void) -{ - int ret; - - ret = usb_register(&friio_driver); - if (ret) - err("usb_register failed. Error number %d", ret); - - return ret; -} - - -static void __exit friio_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&friio_driver); -} - -module_init(friio_module_init); -module_exit(friio_module_exit); +module_usb_driver(friio_driver); MODULE_AUTHOR("Akihiro Tsukada <tskd2@yahoo.co.jp>"); MODULE_DESCRIPTION("Driver for Friio ISDB-T USB2.0 Receiver"); diff --git a/drivers/media/dvb/dvb-usb/gl861.c b/drivers/media/dvb/dvb-usb/gl861.c index 63681df244c..c1f5582e1cd 100644 --- a/drivers/media/dvb/dvb-usb/gl861.c +++ b/drivers/media/dvb/dvb-usb/gl861.c @@ -209,26 +209,7 @@ static struct usb_driver gl861_driver = { .id_table = gl861_table, }; -/* module stuff */ -static int __init gl861_module_init(void) -{ - int ret; - - ret = usb_register(&gl861_driver); - if (ret) - err("usb_register failed. Error number %d", ret); - - return ret; -} - -static void __exit gl861_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&gl861_driver); -} - -module_init(gl861_module_init); -module_exit(gl861_module_exit); +module_usb_driver(gl861_driver); MODULE_AUTHOR("Carl Lundqvist <comabug@gmail.com>"); MODULE_DESCRIPTION("Driver MSI Mega Sky 580 DVB-T USB2.0 / GL861"); diff --git a/drivers/media/dvb/dvb-usb/gp8psk.c b/drivers/media/dvb/dvb-usb/gp8psk.c index 5f71284703d..5d0384dd45b 100644 --- a/drivers/media/dvb/dvb-usb/gp8psk.c +++ b/drivers/media/dvb/dvb-usb/gp8psk.c @@ -320,26 +320,7 @@ static struct usb_driver gp8psk_usb_driver = { .id_table = gp8psk_usb_table, }; -/* module stuff */ -static int __init gp8psk_usb_module_init(void) -{ - int result; - if ((result = usb_register(&gp8psk_usb_driver))) { - err("usb_register failed. (%d)",result); - return result; - } - - return 0; -} - -static void __exit gp8psk_usb_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&gp8psk_usb_driver); -} - -module_init(gp8psk_usb_module_init); -module_exit(gp8psk_usb_module_exit); +module_usb_driver(gp8psk_usb_driver); MODULE_AUTHOR("Alan Nisota <alannisota@gamil.com>"); MODULE_DESCRIPTION("Driver for Genpix DVB-S"); diff --git a/drivers/media/dvb/dvb-usb/it913x.c b/drivers/media/dvb/dvb-usb/it913x.c index c4622618714..67094b879bb 100644 --- a/drivers/media/dvb/dvb-usb/it913x.c +++ b/drivers/media/dvb/dvb-usb/it913x.c @@ -675,26 +675,7 @@ static struct usb_driver it913x_driver = { .id_table = it913x_table, }; -/* module stuff */ -static int __init it913x_module_init(void) -{ - int result = usb_register(&it913x_driver); - if (result) { - err("usb_register failed. Error number %d", result); - return result; - } - - return 0; -} - -static void __exit it913x_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&it913x_driver); -} - -module_init(it913x_module_init); -module_exit(it913x_module_exit); +module_usb_driver(it913x_driver); MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); MODULE_DESCRIPTION("it913x USB 2 Driver"); diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c index b9228240f5c..1a876a65ed5 100644 --- a/drivers/media/dvb/dvb-usb/lmedm04.c +++ b/drivers/media/dvb/dvb-usb/lmedm04.c @@ -1289,26 +1289,7 @@ static struct usb_driver lme2510_driver = { .id_table = lme2510_table, }; -/* module stuff */ -static int __init lme2510_module_init(void) -{ - int result = usb_register(&lme2510_driver); - if (result) { - err("usb_register failed. Error number %d", result); - return result; - } - - return 0; -} - -static void __exit lme2510_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&lme2510_driver); -} - -module_init(lme2510_module_init); -module_exit(lme2510_module_exit); +module_usb_driver(lme2510_driver); MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0"); diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c index a1e1287c949..288af29a8bb 100644 --- a/drivers/media/dvb/dvb-usb/m920x.c +++ b/drivers/media/dvb/dvb-usb/m920x.c @@ -1086,27 +1086,7 @@ static struct usb_driver m920x_driver = { .id_table = m920x_table, }; -/* module stuff */ -static int __init m920x_module_init(void) -{ - int ret; - - if ((ret = usb_register(&m920x_driver))) { - err("usb_register failed. Error number %d", ret); - return ret; - } - - return 0; -} - -static void __exit m920x_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&m920x_driver); -} - -module_init (m920x_module_init); -module_exit (m920x_module_exit); +module_usb_driver(m920x_driver); MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>"); MODULE_DESCRIPTION("DVB Driver for ULI M920x"); diff --git a/drivers/media/dvb/dvb-usb/mxl111sf.c b/drivers/media/dvb/dvb-usb/mxl111sf.c index b5c98da5d9e..825a8b242e0 100644 --- a/drivers/media/dvb/dvb-usb/mxl111sf.c +++ b/drivers/media/dvb/dvb-usb/mxl111sf.c @@ -1055,24 +1055,7 @@ static struct usb_driver mxl111sf_driver = { .id_table = mxl111sf_table, }; -static int __init mxl111sf_module_init(void) -{ - int result = usb_register(&mxl111sf_driver); - if (result) { - err("usb_register failed. Error number %d", result); - return result; - } - - return 0; -} - -static void __exit mxl111sf_module_exit(void) -{ - usb_deregister(&mxl111sf_driver); -} - -module_init(mxl111sf_module_init); -module_exit(mxl111sf_module_exit); +module_usb_driver(mxl111sf_driver); MODULE_AUTHOR("Michael Krufky <mkrufky@kernellabs.com>"); MODULE_DESCRIPTION("Driver for MaxLinear MxL111SF"); diff --git a/drivers/media/dvb/dvb-usb/nova-t-usb2.c b/drivers/media/dvb/dvb-usb/nova-t-usb2.c index 21384da6570..6c55384e2fc 100644 --- a/drivers/media/dvb/dvb-usb/nova-t-usb2.c +++ b/drivers/media/dvb/dvb-usb/nova-t-usb2.c @@ -225,26 +225,7 @@ static struct usb_driver nova_t_driver = { .id_table = nova_t_table, }; -/* module stuff */ -static int __init nova_t_module_init(void) -{ - int result; - if ((result = usb_register(&nova_t_driver))) { - err("usb_register failed. Error number %d",result); - return result; - } - - return 0; -} - -static void __exit nova_t_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&nova_t_driver); -} - -module_init (nova_t_module_init); -module_exit (nova_t_module_exit); +module_usb_driver(nova_t_driver); MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); MODULE_DESCRIPTION("Hauppauge WinTV-NOVA-T usb2"); diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c index 98fd9a6092b..c8a95042dfb 100644 --- a/drivers/media/dvb/dvb-usb/opera1.c +++ b/drivers/media/dvb/dvb-usb/opera1.c @@ -574,22 +574,7 @@ static struct usb_driver opera1_driver = { .id_table = opera1_table, }; -static int __init opera1_module_init(void) -{ - int result = 0; - if ((result = usb_register(&opera1_driver))) { - err("usb_register failed. Error number %d", result); - } - return result; -} - -static void __exit opera1_module_exit(void) -{ - usb_deregister(&opera1_driver); -} - -module_init(opera1_module_init); -module_exit(opera1_module_exit); +module_usb_driver(opera1_driver); MODULE_AUTHOR("Mario Hlawitschka (c) dh1pa@amsat.org"); MODULE_AUTHOR("Marco Gittler (c) g.marco@freenet.de"); diff --git a/drivers/media/dvb/dvb-usb/pctv452e.c b/drivers/media/dvb/dvb-usb/pctv452e.c index f9aec5cb6e7..f526eb05cc7 100644 --- a/drivers/media/dvb/dvb-usb/pctv452e.c +++ b/drivers/media/dvb/dvb-usb/pctv452e.c @@ -1055,22 +1055,7 @@ static struct usb_driver pctv452e_usb_driver = { .id_table = pctv452e_usb_table, }; -static int __init pctv452e_usb_init(void) -{ - int ret = usb_register(&pctv452e_usb_driver); - if (ret) - err("%s: usb_register failed! Error %d", __FILE__, ret); - - return ret; -} - -static void __exit pctv452e_usb_exit(void) -{ - usb_deregister(&pctv452e_usb_driver); -} - -module_init(pctv452e_usb_init); -module_exit(pctv452e_usb_exit); +module_usb_driver(pctv452e_usb_driver); MODULE_AUTHOR("Dominik Kuhlen <dkuhlen@gmx.net>"); MODULE_AUTHOR("Andre Weidemann <Andre.Weidemann@web.de>"); diff --git a/drivers/media/dvb/dvb-usb/technisat-usb2.c b/drivers/media/dvb/dvb-usb/technisat-usb2.c index 0998fe96195..acefaa89cc5 100644 --- a/drivers/media/dvb/dvb-usb/technisat-usb2.c +++ b/drivers/media/dvb/dvb-usb/technisat-usb2.c @@ -781,25 +781,7 @@ static struct usb_driver technisat_usb2_driver = { .id_table = technisat_usb2_id_table, }; -/* module stuff */ -static int __init technisat_usb2_module_init(void) -{ - int result = usb_register(&technisat_usb2_driver); - if (result) { - err("usb_register failed. Code %d", result); - return result; - } - - return 0; -} - -static void __exit technisat_usb2_module_exit(void) -{ - usb_deregister(&technisat_usb2_driver); -} - -module_init(technisat_usb2_module_init); -module_exit(technisat_usb2_module_exit); +module_usb_driver(technisat_usb2_driver); MODULE_AUTHOR("Patrick Boettcher <pboettcher@kernellabs.com>"); MODULE_DESCRIPTION("Driver for Technisat DVB-S/S2 USB 2.0 device"); diff --git a/drivers/media/dvb/dvb-usb/ttusb2.c b/drivers/media/dvb/dvb-usb/ttusb2.c index ea4eab8b396..56acf8e55d5 100644 --- a/drivers/media/dvb/dvb-usb/ttusb2.c +++ b/drivers/media/dvb/dvb-usb/ttusb2.c @@ -799,26 +799,7 @@ static struct usb_driver ttusb2_driver = { .id_table = ttusb2_table, }; -/* module stuff */ -static int __init ttusb2_module_init(void) -{ - int result; - if ((result = usb_register(&ttusb2_driver))) { - err("usb_register failed. Error number %d",result); - return result; - } - - return 0; -} - -static void __exit ttusb2_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&ttusb2_driver); -} - -module_init (ttusb2_module_init); -module_exit (ttusb2_module_exit); +module_usb_driver(ttusb2_driver); MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); MODULE_DESCRIPTION("Driver for Pinnacle PCTV 400e DVB-S USB2.0"); diff --git a/drivers/media/dvb/dvb-usb/umt-010.c b/drivers/media/dvb/dvb-usb/umt-010.c index 463673a5c2b..9b042292e78 100644 --- a/drivers/media/dvb/dvb-usb/umt-010.c +++ b/drivers/media/dvb/dvb-usb/umt-010.c @@ -143,26 +143,7 @@ static struct usb_driver umt_driver = { .id_table = umt_table, }; -/* module stuff */ -static int __init umt_module_init(void) -{ - int result; - if ((result = usb_register(&umt_driver))) { - err("usb_register failed. Error number %d",result); - return result; - } - - return 0; -} - -static void __exit umt_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&umt_driver); -} - -module_init (umt_module_init); -module_exit (umt_module_exit); +module_usb_driver(umt_driver); MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); MODULE_DESCRIPTION("Driver for HanfTek UMT 010 USB2.0 DVB-T device"); diff --git a/drivers/media/dvb/dvb-usb/vp702x.c b/drivers/media/dvb/dvb-usb/vp702x.c index 45e31f22481..07c673a6e76 100644 --- a/drivers/media/dvb/dvb-usb/vp702x.c +++ b/drivers/media/dvb/dvb-usb/vp702x.c @@ -436,26 +436,7 @@ static struct usb_driver vp702x_usb_driver = { .id_table = vp702x_usb_table, }; -/* module stuff */ -static int __init vp702x_usb_module_init(void) -{ - int result; - if ((result = usb_register(&vp702x_usb_driver))) { - err("usb_register failed. (%d)",result); - return result; - } - - return 0; -} - -static void __exit vp702x_usb_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&vp702x_usb_driver); -} - -module_init(vp702x_usb_module_init); -module_exit(vp702x_usb_module_exit); +module_usb_driver(vp702x_usb_driver); MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); MODULE_DESCRIPTION("Driver for Twinhan StarBox DVB-S USB2.0 and clones"); diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c index 90873af5682..d750724132e 100644 --- a/drivers/media/dvb/dvb-usb/vp7045.c +++ b/drivers/media/dvb/dvb-usb/vp7045.c @@ -294,26 +294,7 @@ static struct usb_driver vp7045_usb_driver = { .id_table = vp7045_usb_table, }; -/* module stuff */ -static int __init vp7045_usb_module_init(void) -{ - int result; - if ((result = usb_register(&vp7045_usb_driver))) { - err("usb_register failed. (%d)",result); - return result; - } - - return 0; -} - -static void __exit vp7045_usb_module_exit(void) -{ - /* deregister this driver from the USB subsystem */ - usb_deregister(&vp7045_usb_driver); -} - -module_init(vp7045_usb_module_init); -module_exit(vp7045_usb_module_exit); +module_usb_driver(vp7045_usb_driver); MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); MODULE_DESCRIPTION("Driver for Twinhan MagicBox/Alpha and DNTV tinyUSB2 DVB-T USB2.0"); diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 51c7121b321..b1fe5137df0 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c @@ -557,26 +557,7 @@ static struct usb_driver smsusb_driver = { .resume = smsusb_resume, }; -static int __init smsusb_module_init(void) -{ - int rc = usb_register(&smsusb_driver); - if (rc) - sms_err("usb_register failed. Error number %d", rc); - - sms_debug(""); - - return rc; -} - -static void __exit smsusb_module_exit(void) -{ - /* Regular USB Cleanup */ - usb_deregister(&smsusb_driver); - sms_info("end"); -} - -module_init(smsusb_module_init); -module_exit(smsusb_module_exit); +module_usb_driver(smsusb_driver); MODULE_DESCRIPTION("Driver for the Siano SMS1xxx USB dongle"); MODULE_AUTHOR("Siano Mobile Silicon, INC. (uris@siano-ms.com)"); diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 420bb42d523..e90192fdde1 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c @@ -1794,26 +1794,7 @@ static struct usb_driver ttusb_driver = { .id_table = ttusb_table, }; -static int __init ttusb_init(void) -{ - int err; - - if ((err = usb_register(&ttusb_driver)) < 0) { - printk("%s: usb_register failed! Error number %d", - __FILE__, err); - return err; - } - - return 0; -} - -static void __exit ttusb_exit(void) -{ - usb_deregister(&ttusb_driver); -} - -module_init(ttusb_init); -module_exit(ttusb_exit); +module_usb_driver(ttusb_driver); MODULE_AUTHOR("Holger Waechtler <holger@convergence.de>"); MODULE_DESCRIPTION("TTUSB DVB Driver"); diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c index f893bffa08a..504c8123033 100644 --- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c @@ -1756,26 +1756,7 @@ static struct usb_driver ttusb_dec_driver = { .id_table = ttusb_dec_table, }; -static int __init ttusb_dec_init(void) -{ - int result; - - if ((result = usb_register(&ttusb_dec_driver)) < 0) { - printk("%s: initialisation failed: error %d.\n", __func__, - result); - return result; - } - - return 0; -} - -static void __exit ttusb_dec_exit(void) -{ - usb_deregister(&ttusb_dec_driver); -} - -module_init(ttusb_dec_init); -module_exit(ttusb_dec_exit); +module_usb_driver(ttusb_dec_driver); MODULE_AUTHOR("Alex Woods <linux-dvb@giblets.org>"); MODULE_DESCRIPTION(DRIVER_NAME); diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c index 25e58cbf35f..f36905b6364 100644 --- a/drivers/media/radio/dsbr100.c +++ b/drivers/media/radio/dsbr100.c @@ -624,21 +624,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf, return 0; } -static int __init dsbr100_init(void) -{ - int retval = usb_register(&usb_dsbr100_driver); - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - return retval; -} - -static void __exit dsbr100_exit(void) -{ - usb_deregister(&usb_dsbr100_driver); -} - -module_init (dsbr100_init); -module_exit (dsbr100_exit); +module_usb_driver(usb_dsbr100_driver); MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_DESCRIPTION( DRIVER_DESC ); diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c index 1742bd8110b..a860a72a58e 100644 --- a/drivers/media/radio/radio-mr800.c +++ b/drivers/media/radio/radio-mr800.c @@ -659,25 +659,4 @@ err: return retval; } -static int __init amradio_init(void) -{ - int retval = usb_register(&usb_amradio_driver); - - pr_info(KBUILD_MODNAME - ": version " DRIVER_VERSION " " DRIVER_DESC "\n"); - - if (retval) - pr_err(KBUILD_MODNAME - ": usb_register failed. Error number %d\n", retval); - - return retval; -} - -static void __exit amradio_exit(void) -{ - usb_deregister(&usb_amradio_driver); -} - -module_init(amradio_init); -module_exit(amradio_exit); - +module_usb_driver(usb_amradio_driver); diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c index a6ad707fae9..b7debb67932 100644 --- a/drivers/media/radio/si470x/radio-si470x-usb.c +++ b/drivers/media/radio/si470x/radio-si470x-usb.c @@ -861,33 +861,7 @@ static struct usb_driver si470x_usb_driver = { .supports_autosuspend = 1, }; - - -/************************************************************************** - * Module Interface - **************************************************************************/ - -/* - * si470x_module_init - module init - */ -static int __init si470x_module_init(void) -{ - printk(KERN_INFO DRIVER_DESC ", Version " DRIVER_VERSION "\n"); - return usb_register(&si470x_usb_driver); -} - - -/* - * si470x_module_exit - module exit - */ -static void __exit si470x_module_exit(void) -{ - usb_deregister(&si470x_usb_driver); -} - - -module_init(si470x_module_init); -module_exit(si470x_module_exit); +module_usb_driver(si470x_usb_driver); MODULE_LICENSE("GPL"); MODULE_AUTHOR(DRIVER_AUTHOR); diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c index 303f22ea04c..4363bc38aab 100644 --- a/drivers/media/rc/ati_remote.c +++ b/drivers/media/rc/ati_remote.c @@ -908,38 +908,7 @@ static void ati_remote_disconnect(struct usb_interface *interface) kfree(ati_remote); } -/* - * ati_remote_init - */ -static int __init ati_remote_init(void) -{ - int result; - - result = usb_register(&ati_remote_driver); - if (result) - printk(KERN_ERR KBUILD_MODNAME - ": usb_register error #%d\n", result); - else - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - - return result; -} - -/* - * ati_remote_exit - */ -static void __exit ati_remote_exit(void) -{ - usb_deregister(&ati_remote_driver); -} - -/* - * module specification - */ - -module_init(ati_remote_init); -module_exit(ati_remote_exit); +module_usb_driver(ati_remote_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 6ed96465137..3aeb29a7ce1 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -2458,23 +2458,4 @@ static int imon_resume(struct usb_interface *intf) return rc; } -static int __init imon_init(void) -{ - int rc; - - rc = usb_register(&imon_driver); - if (rc) { - pr_err("usb register failed(%d)\n", rc); - rc = -ENODEV; - } - - return rc; -} - -static void __exit imon_exit(void) -{ - usb_deregister(&imon_driver); -} - -module_init(imon_init); -module_exit(imon_exit); +module_usb_driver(imon_driver); diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index 60d3c1e0971..20bb12d6fbb 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -1448,25 +1448,7 @@ static struct usb_driver mceusb_dev_driver = { .id_table = mceusb_dev_table }; -static int __init mceusb_dev_init(void) -{ - int ret; - - ret = usb_register(&mceusb_dev_driver); - if (ret < 0) - printk(KERN_ERR DRIVER_NAME - ": usb register failed, result = %d\n", ret); - - return ret; -} - -static void __exit mceusb_dev_exit(void) -{ - usb_deregister(&mceusb_dev_driver); -} - -module_init(mceusb_dev_init); -module_exit(mceusb_dev_exit); +module_usb_driver(mceusb_dev_driver); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_AUTHOR(DRIVER_AUTHOR); diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index 61287fcca61..07322fb75ef 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c @@ -1300,25 +1300,7 @@ static struct usb_driver redrat3_dev_driver = { .id_table = redrat3_dev_table }; -static int __init redrat3_dev_init(void) -{ - int ret; - - ret = usb_register(&redrat3_dev_driver); - if (ret < 0) - pr_err(DRIVER_NAME - ": usb register failed, result = %d\n", ret); - - return ret; -} - -static void __exit redrat3_dev_exit(void) -{ - usb_deregister(&redrat3_dev_driver); -} - -module_init(redrat3_dev_init); -module_exit(redrat3_dev_exit); +module_usb_driver(redrat3_dev_driver); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_AUTHOR(DRIVER_AUTHOR); diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c index e435d94c077..b1d29d09eea 100644 --- a/drivers/media/rc/streamzap.c +++ b/drivers/media/rc/streamzap.c @@ -523,33 +523,7 @@ static int streamzap_resume(struct usb_interface *intf) return 0; } -/** - * streamzap_init - */ -static int __init streamzap_init(void) -{ - int ret; - - /* register this driver with the USB subsystem */ - ret = usb_register(&streamzap_driver); - if (ret < 0) - printk(KERN_ERR DRIVER_NAME ": usb register failed, " - "result = %d\n", ret); - - return ret; -} - -/** - * streamzap_exit - */ -static void __exit streamzap_exit(void) -{ - usb_deregister(&streamzap_driver); -} - - -module_init(streamzap_init); -module_exit(streamzap_exit); +module_usb_driver(streamzap_driver); MODULE_AUTHOR("Jarod Wilson <jarod@wilsonet.com>"); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index 53dae2a8272..60b021e7986 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c @@ -1385,26 +1385,4 @@ static struct usb_driver cx231xx_usb_driver = { .id_table = cx231xx_id_table, }; -static int __init cx231xx_module_init(void) -{ - int result; - - printk(KERN_INFO DRIVER_NAME " v4l2 driver loaded.\n"); - - /* register this driver with the USB subsystem */ - result = usb_register(&cx231xx_usb_driver); - if (result) - cx231xx_err(DRIVER_NAME - " usb_register failed. Error number %d.\n", result); - - return result; -} - -static void __exit cx231xx_module_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&cx231xx_usb_driver); -} - -module_init(cx231xx_module_init); -module_exit(cx231xx_module_exit); +module_usb_driver(cx231xx_usb_driver); diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 9b747c266af..93807dcf944 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -3325,26 +3325,4 @@ static struct usb_driver em28xx_usb_driver = { .id_table = em28xx_id_table, }; -static int __init em28xx_module_init(void) -{ - int result; - - /* register this driver with the USB subsystem */ - result = usb_register(&em28xx_usb_driver); - if (result) - em28xx_err(DRIVER_NAME - " usb_register failed. Error number %d.\n", result); - - printk(KERN_INFO DRIVER_NAME " driver loaded\n"); - - return result; -} - -static void __exit em28xx_module_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&em28xx_usb_driver); -} - -module_init(em28xx_module_init); -module_exit(em28xx_module_exit); +module_usb_driver(em28xx_usb_driver); diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c index d3777c86e1d..40f214ab924 100644 --- a/drivers/media/video/et61x251/et61x251_core.c +++ b/drivers/media/video/et61x251/et61x251_core.c @@ -2680,27 +2680,4 @@ static struct usb_driver et61x251_usb_driver = { .disconnect = et61x251_usb_disconnect, }; -/*****************************************************************************/ - -static int __init et61x251_module_init(void) -{ - int err = 0; - - KDBG(2, ET61X251_MODULE_NAME " v" ET61X251_MODULE_VERSION); - KDBG(3, ET61X251_MODULE_AUTHOR); - - if ((err = usb_register(&et61x251_usb_driver))) - KDBG(1, "usb_register() failed"); - - return err; -} - - -static void __exit et61x251_module_exit(void) -{ - usb_deregister(&et61x251_usb_driver); -} - - -module_init(et61x251_module_init); -module_exit(et61x251_module_exit); +module_usb_driver(et61x251_usb_driver); diff --git a/drivers/media/video/gspca/benq.c b/drivers/media/video/gspca/benq.c index 6ae26160b81..636627b57dc 100644 --- a/drivers/media/video/gspca/benq.c +++ b/drivers/media/video/gspca/benq.c @@ -288,15 +288,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c index 4c56dbef6d9..ea17b5d94ea 100644 --- a/drivers/media/video/gspca/conex.c +++ b/drivers/media/video/gspca/conex.c @@ -1067,15 +1067,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/cpia1.c b/drivers/media/video/gspca/cpia1.c index f9b86b2484b..8f33bbd091a 100644 --- a/drivers/media/video/gspca/cpia1.c +++ b/drivers/media/video/gspca/cpia1.c @@ -2132,15 +2132,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/etoms.c b/drivers/media/video/gspca/etoms.c index 0357d6d461d..81a4adbd9f7 100644 --- a/drivers/media/video/gspca/etoms.c +++ b/drivers/media/video/gspca/etoms.c @@ -895,16 +895,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} - -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/finepix.c b/drivers/media/video/gspca/finepix.c index ea48200fd3a..0107513cd72 100644 --- a/drivers/media/video/gspca/finepix.c +++ b/drivers/media/video/gspca/finepix.c @@ -290,16 +290,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} - -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/gl860/gl860.c b/drivers/media/video/gspca/gl860/gl860.c index 2ced3b73994..a8f54c20e58 100644 --- a/drivers/media/video/gspca/gl860/gl860.c +++ b/drivers/media/video/gspca/gl860/gl860.c @@ -524,22 +524,7 @@ static struct usb_driver sd_driver = { /*====================== Init and Exit module functions ====================*/ -static int __init sd_mod_init(void) -{ - PDEBUG(D_PROBE, "driver startup - version %s", DRIVER_VERSION); - - if (usb_register(&sd_driver) < 0) - return -1; - return 0; -} - -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); /*==========================================================================*/ diff --git a/drivers/media/video/gspca/jeilinj.c b/drivers/media/video/gspca/jeilinj.c index 8e3dabe3007..5ab3f7e1276 100644 --- a/drivers/media/video/gspca/jeilinj.c +++ b/drivers/media/video/gspca/jeilinj.c @@ -582,16 +582,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} - -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/kinect.c b/drivers/media/video/gspca/kinect.c index 4fe51fda80f..e8e8f2fe916 100644 --- a/drivers/media/video/gspca/kinect.c +++ b/drivers/media/video/gspca/kinect.c @@ -413,16 +413,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} - -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/konica.c b/drivers/media/video/gspca/konica.c index f3f7fe0ec4b..b1da7f4096c 100644 --- a/drivers/media/video/gspca/konica.c +++ b/drivers/media/video/gspca/konica.c @@ -634,15 +634,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/m5602/m5602_core.c b/drivers/media/video/gspca/m5602/m5602_core.c index 67533e5582a..9fe3816b2aa 100644 --- a/drivers/media/video/gspca/m5602/m5602_core.c +++ b/drivers/media/video/gspca/m5602/m5602_core.c @@ -404,19 +404,7 @@ static struct usb_driver sd_driver = { .disconnect = m5602_disconnect }; -/* -- module insert / remove -- */ -static int __init mod_m5602_init(void) -{ - return usb_register(&sd_driver); -} - -static void __exit mod_m5602_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(mod_m5602_init); -module_exit(mod_m5602_exit); +module_usb_driver(sd_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c index ef45fa57575..5c2ea05c46b 100644 --- a/drivers/media/video/gspca/mars.c +++ b/drivers/media/video/gspca/mars.c @@ -517,15 +517,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/mr97310a.c b/drivers/media/video/gspca/mr97310a.c index 473e813b680..d73e5bd3dbf 100644 --- a/drivers/media/video/gspca/mr97310a.c +++ b/drivers/media/video/gspca/mr97310a.c @@ -1259,15 +1259,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/nw80x.c b/drivers/media/video/gspca/nw80x.c index 7681814e594..d4bec932177 100644 --- a/drivers/media/video/gspca/nw80x.c +++ b/drivers/media/video/gspca/nw80x.c @@ -2118,18 +2118,7 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); module_param(webcam, int, 0644); MODULE_PARM_DESC(webcam, diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c index 6a01b35a947..08b8ce1dee1 100644 --- a/drivers/media/video/gspca/ov519.c +++ b/drivers/media/video/gspca/ov519.c @@ -5056,18 +5056,7 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); module_param(frame_rate, int, 0644); MODULE_PARM_DESC(frame_rate, "Frame rate (5, 10, 15, 20 or 30 fps)"); diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 76907eced4a..04753391de3 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c @@ -1533,16 +1533,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} - -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/ov534_9.c b/drivers/media/video/gspca/ov534_9.c index b3b1ea60a84..f30060d5063 100644 --- a/drivers/media/video/gspca/ov534_9.c +++ b/drivers/media/video/gspca/ov534_9.c @@ -1432,16 +1432,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} - -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/pac207.c b/drivers/media/video/gspca/pac207.c index 1600df152fd..ece8b1e82a1 100644 --- a/drivers/media/video/gspca/pac207.c +++ b/drivers/media/video/gspca/pac207.c @@ -569,15 +569,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/pac7302.c b/drivers/media/video/gspca/pac7302.c index 1c44f78ff9e..2811195258c 100644 --- a/drivers/media/video/gspca/pac7302.c +++ b/drivers/media/video/gspca/pac7302.c @@ -1220,15 +1220,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c index 7509d05dc06..1ac111176ff 100644 --- a/drivers/media/video/gspca/pac7311.c +++ b/drivers/media/video/gspca/pac7311.c @@ -868,15 +868,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/se401.c b/drivers/media/video/gspca/se401.c index 3b71bbcd977..1494e1829d3 100644 --- a/drivers/media/video/gspca/se401.c +++ b/drivers/media/video/gspca/se401.c @@ -766,15 +766,4 @@ static struct usb_driver sd_driver = { .post_reset = sd_post_reset, }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/sn9c2028.c b/drivers/media/video/gspca/sn9c2028.c index 48aae3926a3..478533cb115 100644 --- a/drivers/media/video/gspca/sn9c2028.c +++ b/drivers/media/video/gspca/sn9c2028.c @@ -737,16 +737,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} - -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index 86e07a139a1..33cabc342dc 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c @@ -2554,15 +2554,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c index 146b459b08d..ddb392dc4f2 100644 --- a/drivers/media/video/gspca/sonixb.c +++ b/drivers/media/video/gspca/sonixb.c @@ -1527,15 +1527,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index c746bf19ca1..afa3186b803 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c @@ -3104,15 +3104,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/spca1528.c b/drivers/media/video/gspca/spca1528.c index 695673106e7..070b9c33b51 100644 --- a/drivers/media/video/gspca/spca1528.c +++ b/drivers/media/video/gspca/spca1528.c @@ -590,15 +590,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c index bb82c94ece1..103984708c7 100644 --- a/drivers/media/video/gspca/spca500.c +++ b/drivers/media/video/gspca/spca500.c @@ -1092,15 +1092,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/spca501.c b/drivers/media/video/gspca/spca501.c index 7aaac72aee9..9c16821addd 100644 --- a/drivers/media/video/gspca/spca501.c +++ b/drivers/media/video/gspca/spca501.c @@ -2188,15 +2188,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/spca505.c b/drivers/media/video/gspca/spca505.c index 16722dc6039..1320f35e39f 100644 --- a/drivers/media/video/gspca/spca505.c +++ b/drivers/media/video/gspca/spca505.c @@ -815,15 +815,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/spca506.c b/drivers/media/video/gspca/spca506.c index 89fec4c500a..54eed87672d 100644 --- a/drivers/media/video/gspca/spca506.c +++ b/drivers/media/video/gspca/spca506.c @@ -714,21 +714,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - int ret; - ret = usb_register(&sd_driver); - if (ret < 0) - return ret; - PDEBUG(D_PROBE, "registered"); - return 0; -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); - PDEBUG(D_PROBE, "deregistered"); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/spca508.c b/drivers/media/video/gspca/spca508.c index a44fe3d2596..df4e1699646 100644 --- a/drivers/media/video/gspca/spca508.c +++ b/drivers/media/video/gspca/spca508.c @@ -1544,15 +1544,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c index c82fd53cef9..259a0c73c66 100644 --- a/drivers/media/video/gspca/spca561.c +++ b/drivers/media/video/gspca/spca561.c @@ -1106,15 +1106,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/sq905.c b/drivers/media/video/gspca/sq905.c index df805f79828..2fe3c29bd6b 100644 --- a/drivers/media/video/gspca/sq905.c +++ b/drivers/media/video/gspca/sq905.c @@ -432,16 +432,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} - -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/sq905c.c b/drivers/media/video/gspca/sq905c.c index c2c056056e0..ae783634712 100644 --- a/drivers/media/video/gspca/sq905c.c +++ b/drivers/media/video/gspca/sq905c.c @@ -339,16 +339,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} - -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/sq930x.c b/drivers/media/video/gspca/sq930x.c index e4255b4905e..1a8ba9b3550 100644 --- a/drivers/media/video/gspca/sq930x.c +++ b/drivers/media/video/gspca/sq930x.c @@ -1197,15 +1197,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c index 42a7a28a6c8..4ae7cc8f463 100644 --- a/drivers/media/video/gspca/stk014.c +++ b/drivers/media/video/gspca/stk014.c @@ -519,15 +519,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/stv0680.c b/drivers/media/video/gspca/stv0680.c index 4dcc7e37f9f..461ed645f30 100644 --- a/drivers/media/video/gspca/stv0680.c +++ b/drivers/media/video/gspca/stv0680.c @@ -355,15 +355,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/stv06xx/stv06xx.c b/drivers/media/video/gspca/stv06xx/stv06xx.c index b1fca7db101..0ab425fbea9 100644 --- a/drivers/media/video/gspca/stv06xx/stv06xx.c +++ b/drivers/media/video/gspca/stv06xx/stv06xx.c @@ -612,18 +612,7 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); module_param(dump_bridge, bool, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(dump_bridge, "Dumps all usb bridge registers at startup"); diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c index c8909772435..c80f0c0c75b 100644 --- a/drivers/media/video/gspca/sunplus.c +++ b/drivers/media/video/gspca/sunplus.c @@ -1211,15 +1211,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c index 90f0877eb59..ea44deb66af 100644 --- a/drivers/media/video/gspca/t613.c +++ b/drivers/media/video/gspca/t613.c @@ -1438,15 +1438,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/topro.c b/drivers/media/video/gspca/topro.c index 29596c59837..b2695b1dc60 100644 --- a/drivers/media/video/gspca/topro.c +++ b/drivers/media/video/gspca/topro.c @@ -4971,18 +4971,7 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); module_param(force_sensor, int, 0644); MODULE_PARM_DESC(force_sensor, diff --git a/drivers/media/video/gspca/tv8532.c b/drivers/media/video/gspca/tv8532.c index 933ef2ca658..c8922c5ffbf 100644 --- a/drivers/media/video/gspca/tv8532.c +++ b/drivers/media/video/gspca/tv8532.c @@ -418,16 +418,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} - -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c index 7ee2c8271dc..208f6b2d512 100644 --- a/drivers/media/video/gspca/vc032x.c +++ b/drivers/media/video/gspca/vc032x.c @@ -4230,15 +4230,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/vicam.c b/drivers/media/video/gspca/vicam.c index 81dd4c99d02..d12ea1518ac 100644 --- a/drivers/media/video/gspca/vicam.c +++ b/drivers/media/video/gspca/vicam.c @@ -368,16 +368,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} - -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/xirlink_cit.c b/drivers/media/video/gspca/xirlink_cit.c index 3aed42acdb5..fbb6ed25ec3 100644 --- a/drivers/media/video/gspca/xirlink_cit.c +++ b/drivers/media/video/gspca/xirlink_cit.c @@ -3325,15 +3325,4 @@ static struct usb_driver sd_driver = { #endif }; -/* -- module insert / remove -- */ -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c index 30ea1e47949..0202fead6b9 100644 --- a/drivers/media/video/gspca/zc3xx.c +++ b/drivers/media/video/gspca/zc3xx.c @@ -7050,18 +7050,7 @@ static struct usb_driver sd_driver = { #endif }; -static int __init sd_mod_init(void) -{ - return usb_register(&sd_driver); -} - -static void __exit sd_mod_exit(void) -{ - usb_deregister(&sd_driver); -} - -module_init(sd_mod_init); -module_exit(sd_mod_exit); +module_usb_driver(sd_driver); module_param(force_sensor, int, 0644); MODULE_PARM_DESC(force_sensor, diff --git a/drivers/media/video/hdpvr/hdpvr-core.c b/drivers/media/video/hdpvr/hdpvr-core.c index 441dacf642b..3f1a5b1beeb 100644 --- a/drivers/media/video/hdpvr/hdpvr-core.c +++ b/drivers/media/video/hdpvr/hdpvr-core.c @@ -452,26 +452,7 @@ static struct usb_driver hdpvr_usb_driver = { .id_table = hdpvr_table, }; -static int __init hdpvr_init(void) -{ - int result; - - /* register this driver with the USB subsystem */ - result = usb_register(&hdpvr_usb_driver); - if (result) - err("usb_register failed. Error number %d", result); - - return result; -} - -static void __exit hdpvr_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&hdpvr_usb_driver); -} - -module_init(hdpvr_init); -module_exit(hdpvr_exit); +module_usb_driver(hdpvr_usb_driver); MODULE_LICENSE("GPL"); MODULE_VERSION("0.2.1"); diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index 803c9c82e49..c1bef618766 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c @@ -2682,25 +2682,7 @@ static struct usb_driver s2255_driver = { .id_table = s2255_table, }; -static int __init usb_s2255_init(void) -{ - int result; - /* register this driver with the USB subsystem */ - result = usb_register(&s2255_driver); - if (result) - pr_err(KBUILD_MODNAME - ": usb_register failed. Error number %d\n", result); - dprintk(2, "%s\n", __func__); - return result; -} - -static void __exit usb_s2255_exit(void) -{ - usb_deregister(&s2255_driver); -} - -module_init(usb_s2255_init); -module_exit(usb_s2255_exit); +module_usb_driver(s2255_driver); MODULE_DESCRIPTION("Sensoray 2255 Video for Linux driver"); MODULE_AUTHOR("Dean Anderson (Sensoray Company Inc.)"); diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c index 16cb07c5c27..7025be12928 100644 --- a/drivers/media/video/sn9c102/sn9c102_core.c +++ b/drivers/media/video/sn9c102/sn9c102_core.c @@ -3420,27 +3420,4 @@ static struct usb_driver sn9c102_usb_driver = { .disconnect = sn9c102_usb_disconnect, }; -/*****************************************************************************/ - -static int __init sn9c102_module_init(void) -{ - int err = 0; - - KDBG(2, SN9C102_MODULE_NAME " v" SN9C102_MODULE_VERSION); - KDBG(3, SN9C102_MODULE_AUTHOR); - - if ((err = usb_register(&sn9c102_usb_driver))) - KDBG(1, "usb_register() failed"); - - return err; -} - - -static void __exit sn9c102_module_exit(void) -{ - usb_deregister(&sn9c102_usb_driver); -} - - -module_init(sn9c102_module_init); -module_exit(sn9c102_module_exit); +module_usb_driver(sn9c102_usb_driver); diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c index cbc105f975d..b7fb5a5cad7 100644 --- a/drivers/media/video/stk-webcam.c +++ b/drivers/media/video/stk-webcam.c @@ -1377,25 +1377,4 @@ static struct usb_driver stk_camera_driver = { #endif }; - -static int __init stk_camera_init(void) -{ - int result; - - result = usb_register(&stk_camera_driver); - if (result) - STK_ERROR("usb_register failed ! Error number %d\n", result); - - - return result; -} - -static void __exit stk_camera_exit(void) -{ - usb_deregister(&stk_camera_driver); -} - -module_init(stk_camera_init); -module_exit(stk_camera_exit); - - +module_usb_driver(stk_camera_driver); diff --git a/drivers/media/video/tm6000/tm6000-cards.c b/drivers/media/video/tm6000/tm6000-cards.c index ec2578a0fdf..ff939bc0e0b 100644 --- a/drivers/media/video/tm6000/tm6000-cards.c +++ b/drivers/media/video/tm6000/tm6000-cards.c @@ -1371,31 +1371,7 @@ static struct usb_driver tm6000_usb_driver = { .id_table = tm6000_id_table, }; -static int __init tm6000_module_init(void) -{ - int result; - - printk(KERN_INFO "tm6000" " v4l2 driver version %d.%d.%d loaded\n", - (TM6000_VERSION >> 16) & 0xff, - (TM6000_VERSION >> 8) & 0xff, TM6000_VERSION & 0xff); - - /* register this driver with the USB subsystem */ - result = usb_register(&tm6000_usb_driver); - if (result) - printk(KERN_ERR "tm6000" - " usb_register failed. Error number %d.\n", result); - - return result; -} - -static void __exit tm6000_module_exit(void) -{ - /* deregister at USB subsystem */ - usb_deregister(&tm6000_usb_driver); -} - -module_init(tm6000_module_init); -module_exit(tm6000_module_exit); +module_usb_driver(tm6000_usb_driver); MODULE_DESCRIPTION("Trident TVMaster TM5600/TM6000/TM6010 USB2 adapter"); MODULE_AUTHOR("Mauro Carvalho Chehab"); diff --git a/drivers/media/video/zr364xx.c b/drivers/media/video/zr364xx.c index e78cf94f491..cd2e39fc4bf 100644 --- a/drivers/media/video/zr364xx.c +++ b/drivers/media/video/zr364xx.c @@ -1695,28 +1695,7 @@ static struct usb_driver zr364xx_driver = { .id_table = device_table }; - -static int __init zr364xx_init(void) -{ - int retval; - retval = usb_register(&zr364xx_driver); - if (retval) - printk(KERN_ERR KBUILD_MODNAME ": usb_register failed!\n"); - else - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n"); - return retval; -} - - -static void __exit zr364xx_exit(void) -{ - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC " module unloaded\n"); - usb_deregister(&zr364xx_driver); -} - - -module_init(zr364xx_init); -module_exit(zr364xx_exit); +module_usb_driver(zr364xx_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/mmc/host/ushc.c b/drivers/mmc/host/ushc.c index f08f944ac53..c0105a2e269 100644 --- a/drivers/mmc/host/ushc.c +++ b/drivers/mmc/host/ushc.c @@ -562,17 +562,7 @@ static struct usb_driver ushc_driver = { .disconnect = ushc_disconnect, }; -static int __init ushc_init(void) -{ - return usb_register(&ushc_driver); -} -module_init(ushc_init); - -static void __exit ushc_exit(void) -{ - usb_deregister(&ushc_driver); -} -module_exit(ushc_exit); +module_usb_driver(ushc_driver); MODULE_DESCRIPTION("USB SD Host Controller driver"); MODULE_AUTHOR("David Vrabel <david.vrabel@csr.com>"); diff --git a/drivers/mtd/nand/alauda.c b/drivers/mtd/nand/alauda.c index eb40ea829ab..6a5ff64a139 100644 --- a/drivers/mtd/nand/alauda.c +++ b/drivers/mtd/nand/alauda.c @@ -717,17 +717,6 @@ static struct usb_driver alauda_driver = { .id_table = alauda_table, }; -static int __init alauda_init(void) -{ - return usb_register(&alauda_driver); -} - -static void __exit alauda_exit(void) -{ - usb_deregister(&alauda_driver); -} - -module_init(alauda_init); -module_exit(alauda_exit); +module_usb_driver(alauda_driver); MODULE_LICENSE("GPL"); diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index a72c7bfb409..9697c14b8dc 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c @@ -1115,28 +1115,4 @@ static struct usb_driver ems_usb_driver = { .id_table = ems_usb_table, }; -static int __init ems_usb_init(void) -{ - int err; - - printk(KERN_INFO "CPC-USB kernel driver loaded\n"); - - /* register this driver with the USB subsystem */ - err = usb_register(&ems_usb_driver); - - if (err) { - err("usb_register failed. Error number %d\n", err); - return err; - } - - return 0; -} - -static void __exit ems_usb_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&ems_usb_driver); -} - -module_init(ems_usb_init); -module_exit(ems_usb_exit); +module_usb_driver(ems_usb_driver); diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c index eb8b0e60028..92774637aad 100644 --- a/drivers/net/can/usb/esd_usb2.c +++ b/drivers/net/can/usb/esd_usb2.c @@ -1108,25 +1108,4 @@ static struct usb_driver esd_usb2_driver = { .id_table = esd_usb2_table, }; -static int __init esd_usb2_init(void) -{ - int err; - - /* register this driver with the USB subsystem */ - err = usb_register(&esd_usb2_driver); - - if (err) { - err("usb_register failed. Error number %d\n", err); - return err; - } - - return 0; -} -module_init(esd_usb2_init); - -static void __exit esd_usb2_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&esd_usb2_driver); -} -module_exit(esd_usb2_exit); +module_usb_driver(esd_usb2_driver); diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index d9267cb98a2..72f687b40d6 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c @@ -1914,41 +1914,8 @@ static struct usb_driver irda_driver = { #endif }; -/************************* MODULE CALLBACKS *************************/ -/* - * Deal with module insertion/removal - * Mostly tell USB about our existence - */ - -/*------------------------------------------------------------------*/ -/* - * Module insertion - */ -static int __init usb_irda_init(void) -{ - int ret; - - ret = usb_register(&irda_driver); - if (ret < 0) - return ret; - - IRDA_MESSAGE("USB IrDA support registered\n"); - return 0; -} -module_init(usb_irda_init); +module_usb_driver(irda_driver); -/*------------------------------------------------------------------*/ -/* - * Module removal - */ -static void __exit usb_irda_cleanup(void) -{ - /* Deregister the driver and remove all pending instances */ - usb_deregister(&irda_driver); -} -module_exit(usb_irda_cleanup); - -/*------------------------------------------------------------------*/ /* * Module parameters */ diff --git a/drivers/net/irda/kingsun-sir.c b/drivers/net/irda/kingsun-sir.c index cb90d640007..79aebeee928 100644 --- a/drivers/net/irda/kingsun-sir.c +++ b/drivers/net/irda/kingsun-sir.c @@ -621,24 +621,7 @@ static struct usb_driver irda_driver = { #endif }; -/* - * Module insertion - */ -static int __init kingsun_init(void) -{ - return usb_register(&irda_driver); -} -module_init(kingsun_init); - -/* - * Module removal - */ -static void __exit kingsun_cleanup(void) -{ - /* Deregister the driver and remove all pending instances */ - usb_deregister(&irda_driver); -} -module_exit(kingsun_cleanup); +module_usb_driver(irda_driver); MODULE_AUTHOR("Alex VillacÃs Lasso <a_villacis@palosanto.com>"); MODULE_DESCRIPTION("IrDA-USB Dongle Driver for KingSun/DonShine"); diff --git a/drivers/net/irda/ks959-sir.c b/drivers/net/irda/ks959-sir.c index 1046014dd6c..abe689dffc7 100644 --- a/drivers/net/irda/ks959-sir.c +++ b/drivers/net/irda/ks959-sir.c @@ -901,26 +901,7 @@ static struct usb_driver irda_driver = { #endif }; -/* - * Module insertion - */ -static int __init ks959_init(void) -{ - return usb_register(&irda_driver); -} - -module_init(ks959_init); - -/* - * Module removal - */ -static void __exit ks959_cleanup(void) -{ - /* Deregister the driver and remove all pending instances */ - usb_deregister(&irda_driver); -} - -module_exit(ks959_cleanup); +module_usb_driver(irda_driver); MODULE_AUTHOR("Alex VillacÃs Lasso <a_villacis@palosanto.com>"); MODULE_DESCRIPTION("IrDA-USB Dongle Driver for KingSun KS-959"); diff --git a/drivers/net/irda/ksdazzle-sir.c b/drivers/net/irda/ksdazzle-sir.c index 9cc142fcc71..f8c01088eeb 100644 --- a/drivers/net/irda/ksdazzle-sir.c +++ b/drivers/net/irda/ksdazzle-sir.c @@ -796,26 +796,7 @@ static struct usb_driver irda_driver = { #endif }; -/* - * Module insertion - */ -static int __init ksdazzle_init(void) -{ - return usb_register(&irda_driver); -} - -module_init(ksdazzle_init); - -/* - * Module removal - */ -static void __exit ksdazzle_cleanup(void) -{ - /* Deregister the driver and remove all pending instances */ - usb_deregister(&irda_driver); -} - -module_exit(ksdazzle_cleanup); +module_usb_driver(irda_driver); MODULE_AUTHOR("Alex VillacÃs Lasso <a_villacis@palosanto.com>"); MODULE_DESCRIPTION("IrDA-USB Dongle Driver for KingSun Dazzle"); diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c index be52bfed66a..1a00b5990cb 100644 --- a/drivers/net/irda/mcs7780.c +++ b/drivers/net/irda/mcs7780.c @@ -968,25 +968,4 @@ static void mcs_disconnect(struct usb_interface *intf) IRDA_DEBUG(0, "MCS7780 now disconnected.\n"); } -/* Module insertion */ -static int __init mcs_init(void) -{ - int result; - - /* register this driver with the USB subsystem */ - result = usb_register(&mcs_driver); - if (result) - IRDA_ERROR("usb_register failed. Error number %d\n", result); - - return result; -} -module_init(mcs_init); - -/* Module removal */ -static void __exit mcs_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&mcs_driver); -} -module_exit(mcs_exit); - +module_usb_driver(mcs_driver); diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index 41c96b3d815..212868eb6f5 100644 --- a/drivers/net/irda/stir4200.c +++ b/drivers/net/irda/stir4200.c @@ -1133,21 +1133,4 @@ static struct usb_driver irda_driver = { #endif }; -/* - * Module insertion - */ -static int __init stir_init(void) -{ - return usb_register(&irda_driver); -} -module_init(stir_init); - -/* - * Module removal - */ -static void __exit stir_cleanup(void) -{ - /* Deregister the driver and remove all pending instances */ - usb_deregister(&irda_driver); -} -module_exit(stir_cleanup); +module_usb_driver(irda_driver); diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index e6fed4d4cb7..6832ca467c8 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c @@ -1670,17 +1670,7 @@ static struct usb_driver asix_driver = { .supports_autosuspend = 1, }; -static int __init asix_init(void) -{ - return usb_register(&asix_driver); -} -module_init(asix_init); - -static void __exit asix_exit(void) -{ - usb_deregister(&asix_driver); -} -module_exit(asix_exit); +module_usb_driver(asix_driver); MODULE_AUTHOR("David Hollis"); MODULE_VERSION(DRIVER_VERSION); diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c index a68272c9338..182cfb4aeb1 100644 --- a/drivers/net/usb/catc.c +++ b/drivers/net/usb/catc.c @@ -949,19 +949,4 @@ static struct usb_driver catc_driver = { .id_table = catc_id_table, }; -static int __init catc_init(void) -{ - int result = usb_register(&catc_driver); - if (result == 0) - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - return result; -} - -static void __exit catc_exit(void) -{ - usb_deregister(&catc_driver); -} - -module_init(catc_init); -module_exit(catc_exit); +module_usb_driver(catc_driver); diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c index a60d0069cc4..30aedcd5597 100644 --- a/drivers/net/usb/cdc-phonet.c +++ b/drivers/net/usb/cdc-phonet.c @@ -457,18 +457,7 @@ static struct usb_driver usbpn_driver = { .id_table = usbpn_ids, }; -static int __init usbpn_init(void) -{ - return usb_register(&usbpn_driver); -} - -static void __exit usbpn_exit(void) -{ - usb_deregister(&usbpn_driver); -} - -module_init(usbpn_init); -module_exit(usbpn_exit); +module_usb_driver(usbpn_driver); MODULE_AUTHOR("Remi Denis-Courmont"); MODULE_DESCRIPTION("USB CDC Phonet host interface"); diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c index 882f53f708d..439690be519 100644 --- a/drivers/net/usb/cdc_eem.c +++ b/drivers/net/usb/cdc_eem.c @@ -369,18 +369,7 @@ static struct usb_driver eem_driver = { .resume = usbnet_resume, }; - -static int __init eem_init(void) -{ - return usb_register(&eem_driver); -} -module_init(eem_init); - -static void __exit eem_exit(void) -{ - usb_deregister(&eem_driver); -} -module_exit(eem_exit); +module_usb_driver(eem_driver); MODULE_AUTHOR("Omar Laazimani <omar.oberthur@gmail.com>"); MODULE_DESCRIPTION("USB CDC EEM"); diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 99ed6eb4dfa..41a61efc331 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c @@ -425,6 +425,9 @@ int usbnet_cdc_bind(struct usbnet *dev, struct usb_interface *intf) int status; struct cdc_state *info = (void *) &dev->data; + BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) + < sizeof(struct cdc_state))); + status = usbnet_generic_cdc_bind(dev, intf); if (status < 0) return status; @@ -615,21 +618,7 @@ static struct usb_driver cdc_driver = { .supports_autosuspend = 1, }; - -static int __init cdc_init(void) -{ - BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) - < sizeof(struct cdc_state))); - - return usb_register(&cdc_driver); -} -module_init(cdc_init); - -static void __exit cdc_exit(void) -{ - usb_deregister(&cdc_driver); -} -module_exit(cdc_exit); +module_usb_driver(cdc_driver); MODULE_AUTHOR("David Brownell"); MODULE_DESCRIPTION("USB CDC Ethernet devices"); diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index f06fb78383a..9904b7ebca2 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -1232,20 +1232,7 @@ static struct ethtool_ops cdc_ncm_ethtool_ops = { .nway_reset = usbnet_nway_reset, }; -static int __init cdc_ncm_init(void) -{ - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION "\n"); - return usb_register(&cdc_ncm_driver); -} - -module_init(cdc_ncm_init); - -static void __exit cdc_ncm_exit(void) -{ - usb_deregister(&cdc_ncm_driver); -} - -module_exit(cdc_ncm_exit); +module_usb_driver(cdc_ncm_driver); MODULE_AUTHOR("Hans Petter Selasky"); MODULE_DESCRIPTION("USB CDC NCM host driver"); diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c index fc5f13d47ad..b403d934e4e 100644 --- a/drivers/net/usb/cdc_subset.c +++ b/drivers/net/usb/cdc_subset.c @@ -338,17 +338,7 @@ static struct usb_driver cdc_subset_driver = { .id_table = products, }; -static int __init cdc_subset_init(void) -{ - return usb_register(&cdc_subset_driver); -} -module_init(cdc_subset_init); - -static void __exit cdc_subset_exit(void) -{ - usb_deregister(&cdc_subset_driver); -} -module_exit(cdc_subset_exit); +module_usb_driver(cdc_subset_driver); MODULE_AUTHOR("David Brownell"); MODULE_DESCRIPTION("Simple 'CDC Subset' USB networking links"); diff --git a/drivers/net/usb/cx82310_eth.c b/drivers/net/usb/cx82310_eth.c index 8969f124c18..0e0531356e6 100644 --- a/drivers/net/usb/cx82310_eth.c +++ b/drivers/net/usb/cx82310_eth.c @@ -329,17 +329,7 @@ static struct usb_driver cx82310_driver = { .resume = usbnet_resume, }; -static int __init cx82310_init(void) -{ - return usb_register(&cx82310_driver); -} -module_init(cx82310_init); - -static void __exit cx82310_exit(void) -{ - usb_deregister(&cx82310_driver); -} -module_exit(cx82310_exit); +module_usb_driver(cx82310_driver); MODULE_AUTHOR("Ondrej Zary"); MODULE_DESCRIPTION("Conexant CX82310-based ADSL router USB ethernet driver"); diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index fbc0e4def76..b97226318ea 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c @@ -672,18 +672,7 @@ static struct usb_driver dm9601_driver = { .resume = usbnet_resume, }; -static int __init dm9601_init(void) -{ - return usb_register(&dm9601_driver); -} - -static void __exit dm9601_exit(void) -{ - usb_deregister(&dm9601_driver); -} - -module_init(dm9601_init); -module_exit(dm9601_exit); +module_usb_driver(dm9601_driver); MODULE_AUTHOR("Peter Korsgaard <jacmet@sunsite.dk>"); MODULE_DESCRIPTION("Davicom DM9601 USB 1.1 ethernet devices"); diff --git a/drivers/net/usb/gl620a.c b/drivers/net/usb/gl620a.c index c4cfd1dea88..38266bdae26 100644 --- a/drivers/net/usb/gl620a.c +++ b/drivers/net/usb/gl620a.c @@ -227,17 +227,7 @@ static struct usb_driver gl620a_driver = { .resume = usbnet_resume, }; -static int __init usbnet_init(void) -{ - return usb_register(&gl620a_driver); -} -module_init(usbnet_init); - -static void __exit usbnet_exit(void) -{ - usb_deregister(&gl620a_driver); -} -module_exit(usbnet_exit); +module_usb_driver(gl620a_driver); MODULE_AUTHOR("Jiun-Jie Huang"); MODULE_DESCRIPTION("GL620-USB-A Host-to-Host Link cables"); diff --git a/drivers/net/usb/int51x1.c b/drivers/net/usb/int51x1.c index 131ac6c172f..12a22a453ff 100644 --- a/drivers/net/usb/int51x1.c +++ b/drivers/net/usb/int51x1.c @@ -238,17 +238,7 @@ static struct usb_driver int51x1_driver = { .resume = usbnet_resume, }; -static int __init int51x1_init(void) -{ - return usb_register(&int51x1_driver); -} -module_init(int51x1_init); - -static void __exit int51x1_exit(void) -{ - usb_deregister(&int51x1_driver); -} -module_exit(int51x1_exit); +module_usb_driver(int51x1_driver); MODULE_AUTHOR("Peter Holik"); MODULE_DESCRIPTION("Intellon usb powerline adapter"); diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c index 13c1f044b40..08a4df23879 100644 --- a/drivers/net/usb/ipheth.c +++ b/drivers/net/usb/ipheth.c @@ -543,25 +543,7 @@ static struct usb_driver ipheth_driver = { .id_table = ipheth_table, }; -static int __init ipheth_init(void) -{ - int retval; - - retval = usb_register(&ipheth_driver); - if (retval) { - err("usb_register failed: %d", retval); - return retval; - } - return 0; -} - -static void __exit ipheth_exit(void) -{ - usb_deregister(&ipheth_driver); -} - -module_init(ipheth_init); -module_exit(ipheth_exit); +module_usb_driver(ipheth_driver); MODULE_AUTHOR("Diego Giagio <diego@giagio.com>"); MODULE_DESCRIPTION("Apple iPhone USB Ethernet driver"); diff --git a/drivers/net/usb/kalmia.c b/drivers/net/usb/kalmia.c index 5a6d0f88f43..7562649b3d6 100644 --- a/drivers/net/usb/kalmia.c +++ b/drivers/net/usb/kalmia.c @@ -375,17 +375,7 @@ static struct usb_driver kalmia_driver = { .resume = usbnet_resume }; -static int __init kalmia_init(void) -{ - return usb_register(&kalmia_driver); -} -module_init( kalmia_init); - -static void __exit kalmia_exit(void) -{ - usb_deregister(&kalmia_driver); -} -module_exit( kalmia_exit); +module_usb_driver(kalmia_driver); MODULE_AUTHOR("Marius Bjoernstad Kotsbak <marius@kotsbak.com>"); MODULE_DESCRIPTION("Samsung Kalmia USB network driver"); diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c index 582ca2dfa5f..d034d9c4254 100644 --- a/drivers/net/usb/kaweth.c +++ b/drivers/net/usb/kaweth.c @@ -1324,32 +1324,4 @@ static int kaweth_internal_control_msg(struct usb_device *usb_dev, } } - -/**************************************************************** - * kaweth_init - ****************************************************************/ -static int __init kaweth_init(void) -{ - dbg("Driver loading"); - return usb_register(&kaweth_driver); -} - -/**************************************************************** - * kaweth_exit - ****************************************************************/ -static void __exit kaweth_exit(void) -{ - usb_deregister(&kaweth_driver); -} - -module_init(kaweth_init); -module_exit(kaweth_exit); - - - - - - - - - +module_usb_driver(kaweth_driver); diff --git a/drivers/net/usb/lg-vl600.c b/drivers/net/usb/lg-vl600.c index 9c26c6390d6..45a981fde43 100644 --- a/drivers/net/usb/lg-vl600.c +++ b/drivers/net/usb/lg-vl600.c @@ -346,17 +346,7 @@ static struct usb_driver lg_vl600_driver = { .resume = usbnet_resume, }; -static int __init vl600_init(void) -{ - return usb_register(&lg_vl600_driver); -} -module_init(vl600_init); - -static void __exit vl600_exit(void) -{ - usb_deregister(&lg_vl600_driver); -} -module_exit(vl600_exit); +module_usb_driver(lg_vl600_driver); MODULE_AUTHOR("Anrzej Zaborowski"); MODULE_DESCRIPTION("LG-VL600 modem's ethernet link"); diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c index db2cb74bf85..a29aa9cf9f6 100644 --- a/drivers/net/usb/mcs7830.c +++ b/drivers/net/usb/mcs7830.c @@ -692,17 +692,7 @@ static struct usb_driver mcs7830_driver = { .reset_resume = mcs7830_reset_resume, }; -static int __init mcs7830_init(void) -{ - return usb_register(&mcs7830_driver); -} -module_init(mcs7830_init); - -static void __exit mcs7830_exit(void) -{ - usb_deregister(&mcs7830_driver); -} -module_exit(mcs7830_exit); +module_usb_driver(mcs7830_driver); MODULE_DESCRIPTION("USB to network adapter MCS7830)"); MODULE_LICENSE("GPL"); diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c index 01db4602a39..83f965cb69e 100644 --- a/drivers/net/usb/net1080.c +++ b/drivers/net/usb/net1080.c @@ -589,17 +589,7 @@ static struct usb_driver net1080_driver = { .resume = usbnet_resume, }; -static int __init net1080_init(void) -{ - return usb_register(&net1080_driver); -} -module_init(net1080_init); - -static void __exit net1080_exit(void) -{ - usb_deregister(&net1080_driver); -} -module_exit(net1080_exit); +module_usb_driver(net1080_driver); MODULE_AUTHOR("David Brownell"); MODULE_DESCRIPTION("NetChip 1080 based USB Host-to-Host Links"); diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c index 217aec8a768..b2b035e2997 100644 --- a/drivers/net/usb/plusb.c +++ b/drivers/net/usb/plusb.c @@ -154,17 +154,7 @@ static struct usb_driver plusb_driver = { .resume = usbnet_resume, }; -static int __init plusb_init(void) -{ - return usb_register(&plusb_driver); -} -module_init(plusb_init); - -static void __exit plusb_exit(void) -{ - usb_deregister(&plusb_driver); -} -module_exit(plusb_exit); +module_usb_driver(plusb_driver); MODULE_AUTHOR("David Brownell"); MODULE_DESCRIPTION("Prolific PL-2301/2302/25A1 USB Host to Host Link Driver"); diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c index 255d6a424a6..c8f1b5b3aff 100644 --- a/drivers/net/usb/rndis_host.c +++ b/drivers/net/usb/rndis_host.c @@ -635,17 +635,7 @@ static struct usb_driver rndis_driver = { .resume = usbnet_resume, }; -static int __init rndis_init(void) -{ - return usb_register(&rndis_driver); -} -module_init(rndis_init); - -static void __exit rndis_exit(void) -{ - usb_deregister(&rndis_driver); -} -module_exit(rndis_exit); +module_usb_driver(rndis_driver); MODULE_AUTHOR("David Brownell"); MODULE_DESCRIPTION("USB Host side RNDIS driver"); diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index bf8c84d0adf..0710b4ca925 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c @@ -978,20 +978,7 @@ static struct usb_driver rtl8150_driver = { .resume = rtl8150_resume }; -static int __init usb_rtl8150_init(void) -{ - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - return usb_register(&rtl8150_driver); -} - -static void __exit usb_rtl8150_exit(void) -{ - usb_deregister(&rtl8150_driver); -} - -module_init(usb_rtl8150_init); -module_exit(usb_rtl8150_exit); +module_usb_driver(rtl8150_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c index ed1b4321058..e45dfdcb871 100644 --- a/drivers/net/usb/sierra_net.c +++ b/drivers/net/usb/sierra_net.c @@ -900,6 +900,9 @@ struct sk_buff *sierra_net_tx_fixup(struct usbnet *dev, struct sk_buff *skb, u16 len; bool need_tail; + BUILD_BUG_ON(FIELD_SIZEOF(struct usbnet, data) + < sizeof(struct cdc_state)); + dev_dbg(&dev->udev->dev, "%s", __func__); if (priv->link_up && check_ethip_packet(skb, dev) && is_ip(skb)) { /* enough head room as is? */ @@ -981,21 +984,7 @@ static struct usb_driver sierra_net_driver = { .no_dynamic_id = 1, }; -static int __init sierra_net_init(void) -{ - BUILD_BUG_ON(FIELD_SIZEOF(struct usbnet, data) - < sizeof(struct cdc_state)); - - return usb_register(&sierra_net_driver); -} - -static void __exit sierra_net_exit(void) -{ - usb_deregister(&sierra_net_driver); -} - -module_exit(sierra_net_exit); -module_init(sierra_net_init); +module_usb_driver(sierra_net_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index a5b9b12ef26..e85840ee36e 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c @@ -1237,17 +1237,7 @@ static struct usb_driver smsc75xx_driver = { .disconnect = usbnet_disconnect, }; -static int __init smsc75xx_init(void) -{ - return usb_register(&smsc75xx_driver); -} -module_init(smsc75xx_init); - -static void __exit smsc75xx_exit(void) -{ - usb_deregister(&smsc75xx_driver); -} -module_exit(smsc75xx_exit); +module_usb_driver(smsc75xx_driver); MODULE_AUTHOR("Nancy Lin"); MODULE_AUTHOR("Steve Glendinning <steve.glendinning@smsc.com>"); diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index eff67678c5a..4a107610ac4 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -1297,17 +1297,7 @@ static struct usb_driver smsc95xx_driver = { .disconnect = usbnet_disconnect, }; -static int __init smsc95xx_init(void) -{ - return usb_register(&smsc95xx_driver); -} -module_init(smsc95xx_init); - -static void __exit smsc95xx_exit(void) -{ - usb_deregister(&smsc95xx_driver); -} -module_exit(smsc95xx_exit); +module_usb_driver(smsc95xx_driver); MODULE_AUTHOR("Nancy Lin"); MODULE_AUTHOR("Steve Glendinning <steve.glendinning@smsc.com>"); diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c index 1a2234c2051..f701d412708 100644 --- a/drivers/net/usb/zaurus.c +++ b/drivers/net/usb/zaurus.c @@ -362,17 +362,7 @@ static struct usb_driver zaurus_driver = { .resume = usbnet_resume, }; -static int __init zaurus_init(void) -{ - return usb_register(&zaurus_driver); -} -module_init(zaurus_init); - -static void __exit zaurus_exit(void) -{ - usb_deregister(&zaurus_driver); -} -module_exit(zaurus_exit); +module_usb_driver(zaurus_driver); MODULE_AUTHOR("Pavel Machek, David Brownell"); MODULE_DESCRIPTION("Sharp Zaurus PDA, and compatible products"); diff --git a/drivers/net/wireless/ath/carl9170/usb.c b/drivers/net/wireless/ath/carl9170/usb.c index 333b69ef2ae..89821e4835c 100644 --- a/drivers/net/wireless/ath/carl9170/usb.c +++ b/drivers/net/wireless/ath/carl9170/usb.c @@ -1161,15 +1161,4 @@ static struct usb_driver carl9170_driver = { #endif /* CONFIG_PM */ }; -static int __init carl9170_usb_init(void) -{ - return usb_register(&carl9170_driver); -} - -static void __exit carl9170_usb_exit(void) -{ - usb_deregister(&carl9170_driver); -} - -module_init(carl9170_usb_init); -module_exit(carl9170_usb_exit); +module_usb_driver(carl9170_driver); diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index db879c364eb..b5fbbc7947d 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -1184,29 +1184,7 @@ static struct usb_driver if_usb_driver = { .reset_resume = if_usb_resume, }; -static int __init if_usb_init_module(void) -{ - int ret = 0; - - lbs_deb_enter(LBS_DEB_MAIN); - - ret = usb_register(&if_usb_driver); - - lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); - return ret; -} - -static void __exit if_usb_exit_module(void) -{ - lbs_deb_enter(LBS_DEB_MAIN); - - usb_deregister(&if_usb_driver); - - lbs_deb_leave(LBS_DEB_MAIN); -} - -module_init(if_usb_init_module); -module_exit(if_usb_exit_module); +module_usb_driver(if_usb_driver); MODULE_DESCRIPTION("8388 USB WLAN Driver"); MODULE_AUTHOR("Marvell International Ltd. and Red Hat, Inc."); diff --git a/drivers/net/wireless/libertas_tf/if_usb.c b/drivers/net/wireless/libertas_tf/if_usb.c index 68202e63873..aff8b5743af 100644 --- a/drivers/net/wireless/libertas_tf/if_usb.c +++ b/drivers/net/wireless/libertas_tf/if_usb.c @@ -924,27 +924,7 @@ static struct usb_driver if_usb_driver = { .resume = if_usb_resume, }; -static int __init if_usb_init_module(void) -{ - int ret = 0; - - lbtf_deb_enter(LBTF_DEB_MAIN); - - ret = usb_register(&if_usb_driver); - - lbtf_deb_leave_args(LBTF_DEB_MAIN, "ret %d", ret); - return ret; -} - -static void __exit if_usb_exit_module(void) -{ - lbtf_deb_enter(LBTF_DEB_MAIN); - usb_deregister(&if_usb_driver); - lbtf_deb_leave(LBTF_DEB_MAIN); -} - -module_init(if_usb_init_module); -module_exit(if_usb_exit_module); +module_usb_driver(if_usb_driver); MODULE_DESCRIPTION("8388 USB WLAN Thinfirm Driver"); MODULE_AUTHOR("Cozybit Inc."); diff --git a/drivers/net/wireless/orinoco/orinoco_usb.c b/drivers/net/wireless/orinoco/orinoco_usb.c index 0793e4265b4..ae8ce56670b 100644 --- a/drivers/net/wireless/orinoco/orinoco_usb.c +++ b/drivers/net/wireless/orinoco/orinoco_usb.c @@ -1759,32 +1759,7 @@ static struct usb_driver orinoco_driver = { static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION " (Manuel Estrada Sainz)"; -static int __init ezusb_module_init(void) -{ - int err; - - printk(KERN_DEBUG "%s\n", version); - - /* register this driver with the USB subsystem */ - err = usb_register(&orinoco_driver); - if (err < 0) { - printk(KERN_ERR PFX "usb_register failed, error %d\n", - err); - return err; - } - - return 0; -} - -static void __exit ezusb_module_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&orinoco_driver); -} - - -module_init(ezusb_module_init); -module_exit(ezusb_module_exit); +module_usb_driver(orinoco_driver); MODULE_AUTHOR("Manuel Estrada Sainz"); MODULE_DESCRIPTION("Driver for Orinoco wireless LAN cards using EZUSB bridge"); diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index 9b609686642..f4d28c39aac 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c @@ -1083,15 +1083,4 @@ static struct usb_driver p54u_driver = { .soft_unbind = 1, }; -static int __init p54u_init(void) -{ - return usb_register(&p54u_driver); -} - -static void __exit p54u_exit(void) -{ - usb_deregister(&p54u_driver); -} - -module_init(p54u_init); -module_exit(p54u_exit); +module_usb_driver(p54u_driver); diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 0c13840a7de..85370a7dfa8 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c @@ -3754,17 +3754,7 @@ static struct usb_driver rndis_wlan_driver = { .resume = usbnet_resume, }; -static int __init rndis_wlan_init(void) -{ - return usb_register(&rndis_wlan_driver); -} -module_init(rndis_wlan_init); - -static void __exit rndis_wlan_exit(void) -{ - usb_deregister(&rndis_wlan_driver); -} -module_exit(rndis_wlan_exit); +module_usb_driver(rndis_wlan_driver); MODULE_AUTHOR("Bjorge Dijkstra"); MODULE_AUTHOR("Jussi Kivilinna"); diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 53c5f878f61..b31f38d41a4 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c @@ -1982,15 +1982,4 @@ static struct usb_driver rt2500usb_driver = { .resume = rt2x00usb_resume, }; -static int __init rt2500usb_init(void) -{ - return usb_register(&rt2500usb_driver); -} - -static void __exit rt2500usb_exit(void) -{ - usb_deregister(&rt2500usb_driver); -} - -module_init(rt2500usb_init); -module_exit(rt2500usb_exit); +module_usb_driver(rt2500usb_driver); diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 377876315b8..9ea4ecb3d9c 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c @@ -1234,15 +1234,4 @@ static struct usb_driver rt2800usb_driver = { .resume = rt2x00usb_resume, }; -static int __init rt2800usb_init(void) -{ - return usb_register(&rt2800usb_driver); -} - -static void __exit rt2800usb_exit(void) -{ - usb_deregister(&rt2800usb_driver); -} - -module_init(rt2800usb_init); -module_exit(rt2800usb_exit); +module_usb_driver(rt2800usb_driver); diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index cfb19dbb0a6..0e5a1017918 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c @@ -2528,15 +2528,4 @@ static struct usb_driver rt73usb_driver = { .resume = rt2x00usb_resume, }; -static int __init rt73usb_init(void) -{ - return usb_register(&rt73usb_driver); -} - -static void __exit rt73usb_exit(void) -{ - usb_deregister(&rt73usb_driver); -} - -module_init(rt73usb_init); -module_exit(rt73usb_exit); +module_usb_driver(rt73usb_driver); diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c index 4a78f9e39df..638fbef693e 100644 --- a/drivers/net/wireless/rtl818x/rtl8187/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c @@ -1592,15 +1592,4 @@ static struct usb_driver rtl8187_driver = { .disconnect = __devexit_p(rtl8187_disconnect), }; -static int __init rtl8187_init(void) -{ - return usb_register(&rtl8187_driver); -} - -static void __exit rtl8187_exit(void) -{ - usb_deregister(&rtl8187_driver); -} - -module_init(rtl8187_init); -module_exit(rtl8187_exit); +module_usb_driver(rtl8187_driver); diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c index c244f2f1b83..674cd1a486c 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c @@ -356,15 +356,4 @@ static struct usb_driver rtl8192cu_driver = { #endif }; -static int __init rtl8192cu_init(void) -{ - return usb_register(&rtl8192cu_driver); -} - -static void __exit rtl8192cu_exit(void) -{ - usb_deregister(&rtl8192cu_driver); -} - -module_init(rtl8192cu_init); -module_exit(rtl8192cu_exit); +module_usb_driver(rtl8192cu_driver); diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c index 8efa2f2d957..a66b93b7ff9 100644 --- a/drivers/net/wireless/zd1201.c +++ b/drivers/net/wireless/zd1201.c @@ -1907,15 +1907,4 @@ static struct usb_driver zd1201_usb = { .resume = zd1201_resume, }; -static int __init zd1201_init(void) -{ - return usb_register(&zd1201_usb); -} - -static void __exit zd1201_cleanup(void) -{ - usb_deregister(&zd1201_usb); -} - -module_init(zd1201_init); -module_exit(zd1201_cleanup); +module_usb_driver(zd1201_usb); diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c index 7bcb1febef0..bd023847efb 100644 --- a/drivers/nfc/pn533.c +++ b/drivers/nfc/pn533.c @@ -1597,24 +1597,7 @@ static struct usb_driver pn533_driver = { .id_table = pn533_table, }; -static int __init pn533_init(void) -{ - int rc; - - rc = usb_register(&pn533_driver); - if (rc) - err("usb_register failed. Error number %d", rc); - - return rc; -} - -static void __exit pn533_exit(void) -{ - usb_deregister(&pn533_driver); -} - -module_init(pn533_init); -module_exit(pn533_exit); +module_usb_driver(pn533_driver); MODULE_AUTHOR("Lauro Ramos Venancio <lauro.venancio@openbossa.org>," " Aloisio Almeida Jr <aloisio.almeida@openbossa.org>"); diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c index 811d436cd67..42a7d603c87 100644 --- a/drivers/platform/x86/ibm_rtl.c +++ b/drivers/platform/x86/ibm_rtl.c @@ -28,7 +28,6 @@ #include <linux/delay.h> #include <linux/module.h> #include <linux/io.h> -#include <linux/sysdev.h> #include <linux/dmi.h> #include <linux/efi.h> #include <linux/mutex.h> @@ -165,22 +164,22 @@ static int ibm_rtl_write(u8 value) return ret; } -static ssize_t rtl_show_version(struct sysdev_class * dev, - struct sysdev_class_attribute *attr, +static ssize_t rtl_show_version(struct device *dev, + struct device_attribute *attr, char *buf) { return sprintf(buf, "%d\n", (int)ioread8(&rtl_table->version)); } -static ssize_t rtl_show_state(struct sysdev_class *dev, - struct sysdev_class_attribute *attr, +static ssize_t rtl_show_state(struct device *dev, + struct device_attribute *attr, char *buf) { return sprintf(buf, "%d\n", ioread8(&rtl_table->rt_status)); } -static ssize_t rtl_set_state(struct sysdev_class *dev, - struct sysdev_class_attribute *attr, +static ssize_t rtl_set_state(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { @@ -205,27 +204,28 @@ static ssize_t rtl_set_state(struct sysdev_class *dev, return ret; } -static struct sysdev_class class_rtl = { +static struct bus_type rtl_subsys = { .name = "ibm_rtl", + .dev_name = "ibm_rtl", }; -static SYSDEV_CLASS_ATTR(version, S_IRUGO, rtl_show_version, NULL); -static SYSDEV_CLASS_ATTR(state, 0600, rtl_show_state, rtl_set_state); +static DEVICE_ATTR(version, S_IRUGO, rtl_show_version, NULL); +static DEVICE_ATTR(state, 0600, rtl_show_state, rtl_set_state); -static struct sysdev_class_attribute *rtl_attributes[] = { - &attr_version, - &attr_state, +static struct device_attribute *rtl_attributes[] = { + &dev_attr_version, + &dev_attr_state, NULL }; static int rtl_setup_sysfs(void) { int ret, i; - ret = sysdev_class_register(&class_rtl); + ret = subsys_system_register(&rtl_subsys, NULL); if (!ret) { for (i = 0; rtl_attributes[i]; i ++) - sysdev_class_create_file(&class_rtl, rtl_attributes[i]); + device_create_file(rtl_subsys.dev_root, rtl_attributes[i]); } return ret; } @@ -233,8 +233,8 @@ static int rtl_setup_sysfs(void) { static void rtl_teardown_sysfs(void) { int i; for (i = 0; rtl_attributes[i]; i ++) - sysdev_class_remove_file(&class_rtl, rtl_attributes[i]); - sysdev_class_unregister(&class_rtl); + device_remove_file(rtl_subsys.dev_root, rtl_attributes[i]); + bus_unregister(&rtl_subsys); } diff --git a/drivers/staging/frontier/alphatrack.c b/drivers/staging/frontier/alphatrack.c index 2babb034a25..d8efed65744 100644 --- a/drivers/staging/frontier/alphatrack.c +++ b/drivers/staging/frontier/alphatrack.c @@ -867,30 +867,4 @@ static struct usb_driver usb_alphatrack_driver = { .id_table = usb_alphatrack_table, }; -/** - * usb_alphatrack_init - */ -static int __init usb_alphatrack_init(void) -{ - int retval; - - /* register this driver with the USB subsystem */ - retval = usb_register(&usb_alphatrack_driver); - if (retval) - err("usb_register failed for the " __FILE__ - " driver. Error number %d\n", retval); - - return retval; -} - -/** - * usb_alphatrack_exit - */ -static void __exit usb_alphatrack_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&usb_alphatrack_driver); -} - -module_init(usb_alphatrack_init); -module_exit(usb_alphatrack_exit); +module_usb_driver(usb_alphatrack_driver); diff --git a/drivers/staging/frontier/tranzport.c b/drivers/staging/frontier/tranzport.c index 8894ab14f16..c263284ddc0 100644 --- a/drivers/staging/frontier/tranzport.c +++ b/drivers/staging/frontier/tranzport.c @@ -971,29 +971,4 @@ static struct usb_driver usb_tranzport_driver = { .id_table = usb_tranzport_table, }; -/** - * usb_tranzport_init - */ -static int __init usb_tranzport_init(void) -{ - int retval; - - /* register this driver with the USB subsystem */ - retval = usb_register(&usb_tranzport_driver); - if (retval) - err("usb_register failed for the " __FILE__ - " driver. Error number %d\n", retval); - return retval; -} -/** - * usb_tranzport_exit - */ - -static void __exit usb_tranzport_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&usb_tranzport_driver); -} - -module_init(usb_tranzport_init); -module_exit(usb_tranzport_exit); +module_usb_driver(usb_tranzport_driver); diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c index 79482ac1c48..84c38d5c939 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c @@ -263,24 +263,4 @@ static struct usb_driver ft1000_usb_driver = { .id_table = id_table, }; -static int __init usb_ft1000_init(void) -{ - int ret = 0; - - DEBUG("Initialize and register the driver\n"); - - ret = usb_register(&ft1000_usb_driver); - if (ret) - err("usb_register failed. Error number %d", ret); - - return ret; -} - -static void __exit usb_ft1000_exit(void) -{ - DEBUG("Deregister the driver\n"); - usb_deregister(&ft1000_usb_driver); -} - -module_init(usb_ft1000_init); -module_exit(usb_ft1000_exit); +module_usb_driver(ft1000_usb_driver); diff --git a/drivers/staging/iio/accel/adis16201_core.c b/drivers/staging/iio/accel/adis16201_core.c index 1c5dad53784..97f747eac64 100644 --- a/drivers/staging/iio/accel/adis16201_core.c +++ b/drivers/staging/iio/accel/adis16201_core.c @@ -549,18 +549,7 @@ static struct spi_driver adis16201_driver = { .probe = adis16201_probe, .remove = __devexit_p(adis16201_remove), }; - -static __init int adis16201_init(void) -{ - return spi_register_driver(&adis16201_driver); -} -module_init(adis16201_init); - -static __exit void adis16201_exit(void) -{ - spi_unregister_driver(&adis16201_driver); -} -module_exit(adis16201_exit); +module_spi_driver(adis16201_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices ADIS16201 Programmable Digital Vibration Sensor driver"); diff --git a/drivers/staging/iio/accel/adis16203_core.c b/drivers/staging/iio/accel/adis16203_core.c index 8a3337442af..a6d6d27f3c9 100644 --- a/drivers/staging/iio/accel/adis16203_core.c +++ b/drivers/staging/iio/accel/adis16203_core.c @@ -504,18 +504,7 @@ static struct spi_driver adis16203_driver = { .probe = adis16203_probe, .remove = __devexit_p(adis16203_remove), }; - -static __init int adis16203_init(void) -{ - return spi_register_driver(&adis16203_driver); -} -module_init(adis16203_init); - -static __exit void adis16203_exit(void) -{ - spi_unregister_driver(&adis16203_driver); -} -module_exit(adis16203_exit); +module_spi_driver(adis16203_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices ADIS16203 Programmable Digital Vibration Sensor driver"); diff --git a/drivers/staging/iio/accel/adis16204_core.c b/drivers/staging/iio/accel/adis16204_core.c index 644ac8e4d2a..7ac5b4c533d 100644 --- a/drivers/staging/iio/accel/adis16204_core.c +++ b/drivers/staging/iio/accel/adis16204_core.c @@ -577,18 +577,7 @@ static struct spi_driver adis16204_driver = { .probe = adis16204_probe, .remove = __devexit_p(adis16204_remove), }; - -static __init int adis16204_init(void) -{ - return spi_register_driver(&adis16204_driver); -} -module_init(adis16204_init); - -static __exit void adis16204_exit(void) -{ - spi_unregister_driver(&adis16204_driver); -} -module_exit(adis16204_exit); +module_spi_driver(adis16204_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("ADIS16204 High-g Digital Impact Sensor and Recorder"); diff --git a/drivers/staging/iio/accel/adis16209_core.c b/drivers/staging/iio/accel/adis16209_core.c index 0a8571b18b3..c03afbf5bbd 100644 --- a/drivers/staging/iio/accel/adis16209_core.c +++ b/drivers/staging/iio/accel/adis16209_core.c @@ -553,18 +553,7 @@ static struct spi_driver adis16209_driver = { .probe = adis16209_probe, .remove = __devexit_p(adis16209_remove), }; - -static __init int adis16209_init(void) -{ - return spi_register_driver(&adis16209_driver); -} -module_init(adis16209_init); - -static __exit void adis16209_exit(void) -{ - spi_unregister_driver(&adis16209_driver); -} -module_exit(adis16209_exit); +module_spi_driver(adis16209_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices ADIS16209 Digital Vibration Sensor driver"); diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c index 6d4503de192..73298e7849e 100644 --- a/drivers/staging/iio/accel/adis16220_core.c +++ b/drivers/staging/iio/accel/adis16220_core.c @@ -708,18 +708,7 @@ static struct spi_driver adis16220_driver = { .probe = adis16220_probe, .remove = __devexit_p(adis16220_remove), }; - -static __init int adis16220_init(void) -{ - return spi_register_driver(&adis16220_driver); -} -module_init(adis16220_init); - -static __exit void adis16220_exit(void) -{ - spi_unregister_driver(&adis16220_driver); -} -module_exit(adis16220_exit); +module_spi_driver(adis16220_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices ADIS16220 Digital Vibration Sensor"); diff --git a/drivers/staging/iio/accel/adis16240_core.c b/drivers/staging/iio/accel/adis16240_core.c index b8be2925d61..88881b9919e 100644 --- a/drivers/staging/iio/accel/adis16240_core.c +++ b/drivers/staging/iio/accel/adis16240_core.c @@ -606,18 +606,7 @@ static struct spi_driver adis16240_driver = { .probe = adis16240_probe, .remove = __devexit_p(adis16240_remove), }; - -static __init int adis16240_init(void) -{ - return spi_register_driver(&adis16240_driver); -} -module_init(adis16240_init); - -static __exit void adis16240_exit(void) -{ - spi_unregister_driver(&adis16240_driver); -} -module_exit(adis16240_exit); +module_spi_driver(adis16240_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices Programmable Impact Sensor and Recorder"); diff --git a/drivers/staging/iio/accel/kxsd9.c b/drivers/staging/iio/accel/kxsd9.c index 5238503f680..cfce21c2edd 100644 --- a/drivers/staging/iio/accel/kxsd9.c +++ b/drivers/staging/iio/accel/kxsd9.c @@ -280,18 +280,7 @@ static struct spi_driver kxsd9_driver = { .remove = __devexit_p(kxsd9_remove), .id_table = kxsd9_id, }; - -static __init int kxsd9_spi_init(void) -{ - return spi_register_driver(&kxsd9_driver); -} -module_init(kxsd9_spi_init); - -static __exit void kxsd9_spi_exit(void) -{ - spi_unregister_driver(&kxsd9_driver); -} -module_exit(kxsd9_spi_exit); +module_spi_driver(kxsd9_driver); MODULE_AUTHOR("Jonathan Cameron <jic23@cam.ac.uk>"); MODULE_DESCRIPTION("Kionix KXSD9 SPI driver"); diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c b/drivers/staging/iio/accel/lis3l02dq_core.c index 559545a4233..6877521ec17 100644 --- a/drivers/staging/iio/accel/lis3l02dq_core.c +++ b/drivers/staging/iio/accel/lis3l02dq_core.c @@ -804,18 +804,7 @@ static struct spi_driver lis3l02dq_driver = { .probe = lis3l02dq_probe, .remove = __devexit_p(lis3l02dq_remove), }; - -static __init int lis3l02dq_init(void) -{ - return spi_register_driver(&lis3l02dq_driver); -} -module_init(lis3l02dq_init); - -static __exit void lis3l02dq_exit(void) -{ - spi_unregister_driver(&lis3l02dq_driver); -} -module_exit(lis3l02dq_exit); +module_spi_driver(lis3l02dq_driver); MODULE_AUTHOR("Jonathan Cameron <jic23@cam.ac.uk>"); MODULE_DESCRIPTION("ST LIS3L02DQ Accelerometer SPI driver"); diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c index a44a70589db..6c359074a06 100644 --- a/drivers/staging/iio/accel/sca3000_core.c +++ b/drivers/staging/iio/accel/sca3000_core.c @@ -1250,18 +1250,7 @@ static struct spi_driver sca3000_driver = { .remove = __devexit_p(sca3000_remove), .id_table = sca3000_id, }; - -static __init int sca3000_init(void) -{ - return spi_register_driver(&sca3000_driver); -} -module_init(sca3000_init); - -static __exit void sca3000_exit(void) -{ - spi_unregister_driver(&sca3000_driver); -} -module_exit(sca3000_exit); +module_spi_driver(sca3000_driver); MODULE_AUTHOR("Jonathan Cameron <jic23@cam.ac.uk>"); MODULE_DESCRIPTION("VTI SCA3000 Series Accelerometers SPI driver"); diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c index 31c376b9d5e..a6a4a4e1f18 100644 --- a/drivers/staging/iio/adc/ad7192.c +++ b/drivers/staging/iio/adc/ad7192.c @@ -1161,18 +1161,7 @@ static struct spi_driver ad7192_driver = { .remove = __devexit_p(ad7192_remove), .id_table = ad7192_id, }; - -static int __init ad7192_init(void) -{ - return spi_register_driver(&ad7192_driver); -} -module_init(ad7192_init); - -static void __exit ad7192_exit(void) -{ - spi_unregister_driver(&ad7192_driver); -} -module_exit(ad7192_exit); +module_spi_driver(ad7192_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD7190, AD7192, AD7195 ADC"); diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c index 372d059042f..dbaeae81e87 100644 --- a/drivers/staging/iio/adc/ad7280a.c +++ b/drivers/staging/iio/adc/ad7280a.c @@ -979,18 +979,7 @@ static struct spi_driver ad7280_driver = { .remove = __devexit_p(ad7280_remove), .id_table = ad7280_id, }; - -static int __init ad7280_init(void) -{ - return spi_register_driver(&ad7280_driver); -} -module_init(ad7280_init); - -static void __exit ad7280_exit(void) -{ - spi_unregister_driver(&ad7280_driver); -} -module_exit(ad7280_exit); +module_spi_driver(ad7280_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD7280A"); diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c index 10e79e8ee64..aa44a52a7ad 100644 --- a/drivers/staging/iio/adc/ad7291.c +++ b/drivers/staging/iio/adc/ad7291.c @@ -700,20 +700,8 @@ static struct i2c_driver ad7291_driver = { .remove = __devexit_p(ad7291_remove), .id_table = ad7291_id, }; - -static __init int ad7291_init(void) -{ - return i2c_add_driver(&ad7291_driver); -} - -static __exit void ad7291_exit(void) -{ - i2c_del_driver(&ad7291_driver); -} +module_i2c_driver(ad7291_driver); MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); MODULE_DESCRIPTION("Analog Devices AD7291 ADC driver"); MODULE_LICENSE("GPL v2"); - -module_init(ad7291_init); -module_exit(ad7291_exit); diff --git a/drivers/staging/iio/adc/ad7298_core.c b/drivers/staging/iio/adc/ad7298_core.c index c1de73a1ca9..a799bd1922d 100644 --- a/drivers/staging/iio/adc/ad7298_core.c +++ b/drivers/staging/iio/adc/ad7298_core.c @@ -276,18 +276,7 @@ static struct spi_driver ad7298_driver = { .remove = __devexit_p(ad7298_remove), .id_table = ad7298_id, }; - -static int __init ad7298_init(void) -{ - return spi_register_driver(&ad7298_driver); -} -module_init(ad7298_init); - -static void __exit ad7298_exit(void) -{ - spi_unregister_driver(&ad7298_driver); -} -module_exit(ad7298_exit); +module_spi_driver(ad7298_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD7298 ADC"); diff --git a/drivers/staging/iio/adc/ad7476_core.c b/drivers/staging/iio/adc/ad7476_core.c index fd79facc6ca..0b5852030ab 100644 --- a/drivers/staging/iio/adc/ad7476_core.c +++ b/drivers/staging/iio/adc/ad7476_core.c @@ -248,18 +248,7 @@ static struct spi_driver ad7476_driver = { .remove = __devexit_p(ad7476_remove), .id_table = ad7476_id, }; - -static int __init ad7476_init(void) -{ - return spi_register_driver(&ad7476_driver); -} -module_init(ad7476_init); - -static void __exit ad7476_exit(void) -{ - spi_unregister_driver(&ad7476_driver); -} -module_exit(ad7476_exit); +module_spi_driver(ad7476_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD7475/6/7/8(A) AD7466/7/8 ADC"); diff --git a/drivers/staging/iio/adc/ad7606_spi.c b/drivers/staging/iio/adc/ad7606_spi.c index aede1ba5e04..b984bd2048b 100644 --- a/drivers/staging/iio/adc/ad7606_spi.c +++ b/drivers/staging/iio/adc/ad7606_spi.c @@ -109,18 +109,7 @@ static struct spi_driver ad7606_driver = { .remove = __devexit_p(ad7606_spi_remove), .id_table = ad7606_id, }; - -static int __init ad7606_spi_init(void) -{ - return spi_register_driver(&ad7606_driver); -} -module_init(ad7606_spi_init); - -static void __exit ad7606_spi_exit(void) -{ - spi_unregister_driver(&ad7606_driver); -} -module_exit(ad7606_spi_exit); +module_spi_driver(ad7606_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD7606 ADC"); diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c index 7a579a1fd69..ec90261cbc3 100644 --- a/drivers/staging/iio/adc/ad7780.c +++ b/drivers/staging/iio/adc/ad7780.c @@ -283,18 +283,7 @@ static struct spi_driver ad7780_driver = { .remove = __devexit_p(ad7780_remove), .id_table = ad7780_id, }; - -static int __init ad7780_init(void) -{ - return spi_register_driver(&ad7780_driver); -} -module_init(ad7780_init); - -static void __exit ad7780_exit(void) -{ - spi_unregister_driver(&ad7780_driver); -} -module_exit(ad7780_exit); +module_spi_driver(ad7780_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD7780/1 ADC"); diff --git a/drivers/staging/iio/adc/ad7793.c b/drivers/staging/iio/adc/ad7793.c index 999f8f746cf..1c5588e88cd 100644 --- a/drivers/staging/iio/adc/ad7793.c +++ b/drivers/staging/iio/adc/ad7793.c @@ -1045,18 +1045,7 @@ static struct spi_driver ad7793_driver = { .remove = __devexit_p(ad7793_remove), .id_table = ad7793_id, }; - -static int __init ad7793_init(void) -{ - return spi_register_driver(&ad7793_driver); -} -module_init(ad7793_init); - -static void __exit ad7793_exit(void) -{ - spi_unregister_driver(&ad7793_driver); -} -module_exit(ad7793_exit); +module_spi_driver(ad7793_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD7792/3 ADC"); diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c index bdb90492b8a..acbf9363132 100644 --- a/drivers/staging/iio/adc/ad7816.c +++ b/drivers/staging/iio/adc/ad7816.c @@ -466,21 +466,9 @@ static struct spi_driver ad7816_driver = { .remove = __devexit_p(ad7816_remove), .id_table = ad7816_id, }; - -static __init int ad7816_init(void) -{ - return spi_register_driver(&ad7816_driver); -} - -static __exit void ad7816_exit(void) -{ - spi_unregister_driver(&ad7816_driver); -} +module_spi_driver(ad7816_driver); MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); MODULE_DESCRIPTION("Analog Devices AD7816/7/8 digital" " temperature sensor driver"); MODULE_LICENSE("GPL v2"); - -module_init(ad7816_init); -module_exit(ad7816_exit); diff --git a/drivers/staging/iio/adc/ad7887_core.c b/drivers/staging/iio/adc/ad7887_core.c index 609dcd5f2dd..91b8fb09d92 100644 --- a/drivers/staging/iio/adc/ad7887_core.c +++ b/drivers/staging/iio/adc/ad7887_core.c @@ -257,18 +257,7 @@ static struct spi_driver ad7887_driver = { .remove = __devexit_p(ad7887_remove), .id_table = ad7887_id, }; - -static int __init ad7887_init(void) -{ - return spi_register_driver(&ad7887_driver); -} -module_init(ad7887_init); - -static void __exit ad7887_exit(void) -{ - spi_unregister_driver(&ad7887_driver); -} -module_exit(ad7887_exit); +module_spi_driver(ad7887_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD7887 ADC"); diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c index ee6cd792bec..c0d2f886ea2 100644 --- a/drivers/staging/iio/adc/ad799x_core.c +++ b/drivers/staging/iio/adc/ad799x_core.c @@ -929,21 +929,9 @@ static struct i2c_driver ad799x_driver = { .remove = __devexit_p(ad799x_remove), .id_table = ad799x_id, }; - -static __init int ad799x_init(void) -{ - return i2c_add_driver(&ad799x_driver); -} - -static __exit void ad799x_exit(void) -{ - i2c_del_driver(&ad799x_driver); -} +module_i2c_driver(ad799x_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD799x ADC"); MODULE_LICENSE("GPL v2"); MODULE_ALIAS("i2c:ad799x"); - -module_init(ad799x_init); -module_exit(ad799x_exit); diff --git a/drivers/staging/iio/adc/adt7310.c b/drivers/staging/iio/adc/adt7310.c index c9e0be3b1cf..bc307f3b024 100644 --- a/drivers/staging/iio/adc/adt7310.c +++ b/drivers/staging/iio/adc/adt7310.c @@ -884,21 +884,9 @@ static struct spi_driver adt7310_driver = { .remove = __devexit_p(adt7310_remove), .id_table = adt7310_id, }; - -static __init int adt7310_init(void) -{ - return spi_register_driver(&adt7310_driver); -} - -static __exit void adt7310_exit(void) -{ - spi_unregister_driver(&adt7310_driver); -} +module_spi_driver(adt7310_driver); MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); MODULE_DESCRIPTION("Analog Devices ADT7310 digital" " temperature sensor driver"); MODULE_LICENSE("GPL v2"); - -module_init(adt7310_init); -module_exit(adt7310_exit); diff --git a/drivers/staging/iio/adc/adt7410.c b/drivers/staging/iio/adc/adt7410.c index a289e429dc4..3481cf6f757 100644 --- a/drivers/staging/iio/adc/adt7410.c +++ b/drivers/staging/iio/adc/adt7410.c @@ -844,21 +844,9 @@ static struct i2c_driver adt7410_driver = { .remove = __devexit_p(adt7410_remove), .id_table = adt7410_id, }; - -static __init int adt7410_init(void) -{ - return i2c_add_driver(&adt7410_driver); -} - -static __exit void adt7410_exit(void) -{ - i2c_del_driver(&adt7410_driver); -} +module_i2c_driver(adt7410_driver); MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); MODULE_DESCRIPTION("Analog Devices ADT7410 digital" " temperature sensor driver"); MODULE_LICENSE("GPL v2"); - -module_init(adt7410_init); -module_exit(adt7410_exit); diff --git a/drivers/staging/iio/adc/max1363_core.c b/drivers/staging/iio/adc/max1363_core.c index eb699ade34b..3f28f1ab52a 100644 --- a/drivers/staging/iio/adc/max1363_core.c +++ b/drivers/staging/iio/adc/max1363_core.c @@ -1410,20 +1410,8 @@ static struct i2c_driver max1363_driver = { .remove = max1363_remove, .id_table = max1363_id, }; - -static __init int max1363_init(void) -{ - return i2c_add_driver(&max1363_driver); -} - -static __exit void max1363_exit(void) -{ - i2c_del_driver(&max1363_driver); -} +module_i2c_driver(max1363_driver); MODULE_AUTHOR("Jonathan Cameron <jic23@cam.ac.uk>"); MODULE_DESCRIPTION("Maxim 1363 ADC"); MODULE_LICENSE("GPL v2"); - -module_init(max1363_init); -module_exit(max1363_exit); diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/iio/addac/adt7316-i2c.c index 07d718e8fb4..2c03a39220e 100644 --- a/drivers/staging/iio/addac/adt7316-i2c.c +++ b/drivers/staging/iio/addac/adt7316-i2c.c @@ -151,21 +151,9 @@ static struct i2c_driver adt7316_driver = { .resume = adt7316_i2c_resume, .id_table = adt7316_i2c_id, }; - -static __init int adt7316_i2c_init(void) -{ - return i2c_add_driver(&adt7316_driver); -} - -static __exit void adt7316_i2c_exit(void) -{ - i2c_del_driver(&adt7316_driver); -} +module_i2c_driver(adt7316_driver); MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); MODULE_DESCRIPTION("I2C bus driver for Analog Devices ADT7316/7/9 and" "ADT7516/7/8 digital temperature sensor, ADC and DAC"); MODULE_LICENSE("GPL v2"); - -module_init(adt7316_i2c_init); -module_exit(adt7316_i2c_exit); diff --git a/drivers/staging/iio/addac/adt7316-spi.c b/drivers/staging/iio/addac/adt7316-spi.c index 369d4d01ed9..1e93c7b7aed 100644 --- a/drivers/staging/iio/addac/adt7316-spi.c +++ b/drivers/staging/iio/addac/adt7316-spi.c @@ -160,21 +160,9 @@ static struct spi_driver adt7316_driver = { .resume = adt7316_spi_resume, .id_table = adt7316_spi_id, }; - -static __init int adt7316_spi_init(void) -{ - return spi_register_driver(&adt7316_driver); -} - -static __exit void adt7316_spi_exit(void) -{ - spi_unregister_driver(&adt7316_driver); -} +module_spi_driver(adt7316_driver); MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); MODULE_DESCRIPTION("SPI bus driver for Analog Devices ADT7316/7/8 and" "ADT7516/7/9 digital temperature sensor, ADC and DAC"); MODULE_LICENSE("GPL v2"); - -module_init(adt7316_spi_init); -module_exit(adt7316_spi_exit); diff --git a/drivers/staging/iio/cdc/ad7150.c b/drivers/staging/iio/cdc/ad7150.c index a761ca94a17..47181875e11 100644 --- a/drivers/staging/iio/cdc/ad7150.c +++ b/drivers/staging/iio/cdc/ad7150.c @@ -657,20 +657,8 @@ static struct i2c_driver ad7150_driver = { .remove = __devexit_p(ad7150_remove), .id_table = ad7150_id, }; - -static __init int ad7150_init(void) -{ - return i2c_add_driver(&ad7150_driver); -} - -static __exit void ad7150_exit(void) -{ - i2c_del_driver(&ad7150_driver); -} +module_i2c_driver(ad7150_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices AD7150/1/6 capacitive sensor driver"); MODULE_LICENSE("GPL v2"); - -module_init(ad7150_init); -module_exit(ad7150_exit); diff --git a/drivers/staging/iio/cdc/ad7152.c b/drivers/staging/iio/cdc/ad7152.c index 662584d72a7..152d3be6d97 100644 --- a/drivers/staging/iio/cdc/ad7152.c +++ b/drivers/staging/iio/cdc/ad7152.c @@ -540,20 +540,8 @@ static struct i2c_driver ad7152_driver = { .remove = __devexit_p(ad7152_remove), .id_table = ad7152_id, }; - -static __init int ad7152_init(void) -{ - return i2c_add_driver(&ad7152_driver); -} - -static __exit void ad7152_exit(void) -{ - i2c_del_driver(&ad7152_driver); -} +module_i2c_driver(ad7152_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices AD7152/3 capacitive sensor driver"); MODULE_LICENSE("GPL v2"); - -module_init(ad7152_init); -module_exit(ad7152_exit); diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c index 2867943309c..9df590891a6 100644 --- a/drivers/staging/iio/cdc/ad7746.c +++ b/drivers/staging/iio/cdc/ad7746.c @@ -788,20 +788,8 @@ static struct i2c_driver ad7746_driver = { .remove = __devexit_p(ad7746_remove), .id_table = ad7746_id, }; - -static __init int ad7746_init(void) -{ - return i2c_add_driver(&ad7746_driver); -} - -static __exit void ad7746_exit(void) -{ - i2c_del_driver(&ad7746_driver); -} +module_i2c_driver(ad7746_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD7746/5/7 capacitive sensor driver"); MODULE_LICENSE("GPL v2"); - -module_init(ad7746_init); -module_exit(ad7746_exit); diff --git a/drivers/staging/iio/dac/ad5064.c b/drivers/staging/iio/dac/ad5064.c index 24279f2ae41..39cfe6cb02a 100644 --- a/drivers/staging/iio/dac/ad5064.c +++ b/drivers/staging/iio/dac/ad5064.c @@ -445,18 +445,7 @@ static struct spi_driver ad5064_driver = { .remove = __devexit_p(ad5064_remove), .id_table = ad5064_id, }; - -static __init int ad5064_spi_init(void) -{ - return spi_register_driver(&ad5064_driver); -} -module_init(ad5064_spi_init); - -static __exit void ad5064_spi_exit(void) -{ - spi_unregister_driver(&ad5064_driver); -} -module_exit(ad5064_spi_exit); +module_spi_driver(ad5064_driver); MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); MODULE_DESCRIPTION("Analog Devices AD5064/64-1/44/24 DAC"); diff --git a/drivers/staging/iio/dac/ad5360.c b/drivers/staging/iio/dac/ad5360.c index 72d0f3f0d6a..bc0459e32d0 100644 --- a/drivers/staging/iio/dac/ad5360.c +++ b/drivers/staging/iio/dac/ad5360.c @@ -563,18 +563,7 @@ static struct spi_driver ad5360_driver = { .remove = __devexit_p(ad5360_remove), .id_table = ad5360_ids, }; - -static __init int ad5360_spi_init(void) -{ - return spi_register_driver(&ad5360_driver); -} -module_init(ad5360_spi_init); - -static __exit void ad5360_spi_exit(void) -{ - spi_unregister_driver(&ad5360_driver); -} -module_exit(ad5360_spi_exit); +module_spi_driver(ad5360_driver); MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); MODULE_DESCRIPTION("Analog Devices AD5360/61/62/63/70/71/72/73 DAC"); diff --git a/drivers/staging/iio/dac/ad5446.c b/drivers/staging/iio/dac/ad5446.c index e1c204d51d8..ac3bc5f52dc 100644 --- a/drivers/staging/iio/dac/ad5446.c +++ b/drivers/staging/iio/dac/ad5446.c @@ -465,18 +465,7 @@ static struct spi_driver ad5446_driver = { .remove = __devexit_p(ad5446_remove), .id_table = ad5446_id, }; - -static int __init ad5446_init(void) -{ - return spi_register_driver(&ad5446_driver); -} -module_init(ad5446_init); - -static void __exit ad5446_exit(void) -{ - spi_unregister_driver(&ad5446_driver); -} -module_exit(ad5446_exit); +module_spi_driver(ad5446_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD5444/AD5446 DAC"); diff --git a/drivers/staging/iio/dac/ad5504.c b/drivers/staging/iio/dac/ad5504.c index 60dd6404d68..57539ce8e6c 100644 --- a/drivers/staging/iio/dac/ad5504.c +++ b/drivers/staging/iio/dac/ad5504.c @@ -377,18 +377,7 @@ static struct spi_driver ad5504_driver = { .remove = __devexit_p(ad5504_remove), .id_table = ad5504_id, }; - -static __init int ad5504_spi_init(void) -{ - return spi_register_driver(&ad5504_driver); -} -module_init(ad5504_spi_init); - -static __exit void ad5504_spi_exit(void) -{ - spi_unregister_driver(&ad5504_driver); -} -module_exit(ad5504_spi_exit); +module_spi_driver(ad5504_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD5501/AD5501 DAC"); diff --git a/drivers/staging/iio/dac/ad5624r_spi.c b/drivers/staging/iio/dac/ad5624r_spi.c index 284d8790036..6e05f0dbae0 100644 --- a/drivers/staging/iio/dac/ad5624r_spi.c +++ b/drivers/staging/iio/dac/ad5624r_spi.c @@ -317,18 +317,7 @@ static struct spi_driver ad5624r_driver = { .remove = __devexit_p(ad5624r_remove), .id_table = ad5624r_id, }; - -static __init int ad5624r_spi_init(void) -{ - return spi_register_driver(&ad5624r_driver); -} -module_init(ad5624r_spi_init); - -static __exit void ad5624r_spi_exit(void) -{ - spi_unregister_driver(&ad5624r_driver); -} -module_exit(ad5624r_spi_exit); +module_spi_driver(ad5624r_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices AD5624/44/64R DAC spi driver"); diff --git a/drivers/staging/iio/dac/ad5686.c b/drivers/staging/iio/dac/ad5686.c index 974c6f5b60c..e72db2fbfed 100644 --- a/drivers/staging/iio/dac/ad5686.c +++ b/drivers/staging/iio/dac/ad5686.c @@ -447,18 +447,7 @@ static struct spi_driver ad5686_driver = { .remove = __devexit_p(ad5686_remove), .id_table = ad5686_id, }; - -static __init int ad5686_spi_init(void) -{ - return spi_register_driver(&ad5686_driver); -} -module_init(ad5686_spi_init); - -static __exit void ad5686_spi_exit(void) -{ - spi_unregister_driver(&ad5686_driver); -} -module_exit(ad5686_spi_exit); +module_spi_driver(ad5686_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD5686/85/84 DAC"); diff --git a/drivers/staging/iio/dac/ad5791.c b/drivers/staging/iio/dac/ad5791.c index 6fbca8d9615..4a80fd82223 100644 --- a/drivers/staging/iio/dac/ad5791.c +++ b/drivers/staging/iio/dac/ad5791.c @@ -410,18 +410,7 @@ static struct spi_driver ad5791_driver = { .remove = __devexit_p(ad5791_remove), .id_table = ad5791_id, }; - -static __init int ad5791_spi_init(void) -{ - return spi_register_driver(&ad5791_driver); -} -module_init(ad5791_spi_init); - -static __exit void ad5791_spi_exit(void) -{ - spi_unregister_driver(&ad5791_driver); -} -module_exit(ad5791_spi_exit); +module_spi_driver(ad5791_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD5760/AD5780/AD5781/AD5791 DAC"); diff --git a/drivers/staging/iio/dac/max517.c b/drivers/staging/iio/dac/max517.c index adfbd20f898..a4df6d7443c 100644 --- a/drivers/staging/iio/dac/max517.c +++ b/drivers/staging/iio/dac/max517.c @@ -280,20 +280,8 @@ static struct i2c_driver max517_driver = { .resume = max517_resume, .id_table = max517_id, }; - -static int __init max517_init(void) -{ - return i2c_add_driver(&max517_driver); -} - -static void __exit max517_exit(void) -{ - i2c_del_driver(&max517_driver); -} +module_i2c_driver(max517_driver); MODULE_AUTHOR("Roland Stigge <stigge@antcom.de>"); MODULE_DESCRIPTION("MAX517/MAX518/MAX519 8-bit DAC"); MODULE_LICENSE("GPL"); - -module_init(max517_init); -module_exit(max517_exit); diff --git a/drivers/staging/iio/dds/ad5930.c b/drivers/staging/iio/dds/ad5930.c index f5e368b5665..4a360d044a3 100644 --- a/drivers/staging/iio/dds/ad5930.c +++ b/drivers/staging/iio/dds/ad5930.c @@ -143,18 +143,7 @@ static struct spi_driver ad5930_driver = { .probe = ad5930_probe, .remove = __devexit_p(ad5930_remove), }; - -static __init int ad5930_spi_init(void) -{ - return spi_register_driver(&ad5930_driver); -} -module_init(ad5930_spi_init); - -static __exit void ad5930_spi_exit(void) -{ - spi_unregister_driver(&ad5930_driver); -} -module_exit(ad5930_spi_exit); +module_spi_driver(ad5930_driver); MODULE_AUTHOR("Cliff Cai"); MODULE_DESCRIPTION("Analog Devices ad5930 driver"); diff --git a/drivers/staging/iio/dds/ad9832.c b/drivers/staging/iio/dds/ad9832.c index 9b4ff606535..cc32fd65b8b 100644 --- a/drivers/staging/iio/dds/ad9832.c +++ b/drivers/staging/iio/dds/ad9832.c @@ -355,18 +355,7 @@ static struct spi_driver ad9832_driver = { .remove = __devexit_p(ad9832_remove), .id_table = ad9832_id, }; - -static int __init ad9832_init(void) -{ - return spi_register_driver(&ad9832_driver); -} -module_init(ad9832_init); - -static void __exit ad9832_exit(void) -{ - spi_unregister_driver(&ad9832_driver); -} -module_exit(ad9832_exit); +module_spi_driver(ad9832_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD9832/AD9835 DDS"); diff --git a/drivers/staging/iio/dds/ad9834.c b/drivers/staging/iio/dds/ad9834.c index c468f696fe2..2b31e352482 100644 --- a/drivers/staging/iio/dds/ad9834.c +++ b/drivers/staging/iio/dds/ad9834.c @@ -446,18 +446,7 @@ static struct spi_driver ad9834_driver = { .remove = __devexit_p(ad9834_remove), .id_table = ad9834_id, }; - -static int __init ad9834_init(void) -{ - return spi_register_driver(&ad9834_driver); -} -module_init(ad9834_init); - -static void __exit ad9834_exit(void) -{ - spi_unregister_driver(&ad9834_driver); -} -module_exit(ad9834_exit); +module_spi_driver(ad9834_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD9833/AD9834/AD9837/AD9838 DDS"); diff --git a/drivers/staging/iio/dds/ad9850.c b/drivers/staging/iio/dds/ad9850.c index a14771b24c5..f9c96afcb99 100644 --- a/drivers/staging/iio/dds/ad9850.c +++ b/drivers/staging/iio/dds/ad9850.c @@ -129,18 +129,7 @@ static struct spi_driver ad9850_driver = { .probe = ad9850_probe, .remove = __devexit_p(ad9850_remove), }; - -static __init int ad9850_spi_init(void) -{ - return spi_register_driver(&ad9850_driver); -} -module_init(ad9850_spi_init); - -static __exit void ad9850_spi_exit(void) -{ - spi_unregister_driver(&ad9850_driver); -} -module_exit(ad9850_spi_exit); +module_spi_driver(ad9850_driver); MODULE_AUTHOR("Cliff Cai"); MODULE_DESCRIPTION("Analog Devices ad9850 driver"); diff --git a/drivers/staging/iio/dds/ad9852.c b/drivers/staging/iio/dds/ad9852.c index cfceaa64a53..9fc73fdc9c3 100644 --- a/drivers/staging/iio/dds/ad9852.c +++ b/drivers/staging/iio/dds/ad9852.c @@ -280,18 +280,7 @@ static struct spi_driver ad9852_driver = { .probe = ad9852_probe, .remove = __devexit_p(ad9852_remove), }; - -static __init int ad9852_spi_init(void) -{ - return spi_register_driver(&ad9852_driver); -} -module_init(ad9852_spi_init); - -static __exit void ad9852_spi_exit(void) -{ - spi_unregister_driver(&ad9852_driver); -} -module_exit(ad9852_spi_exit); +module_spi_driver(ad9852_driver); MODULE_AUTHOR("Cliff Cai"); MODULE_DESCRIPTION("Analog Devices ad9852 driver"); diff --git a/drivers/staging/iio/dds/ad9910.c b/drivers/staging/iio/dds/ad9910.c index da83d2b88c4..57046b03121 100644 --- a/drivers/staging/iio/dds/ad9910.c +++ b/drivers/staging/iio/dds/ad9910.c @@ -413,18 +413,7 @@ static struct spi_driver ad9910_driver = { .probe = ad9910_probe, .remove = __devexit_p(ad9910_remove), }; - -static __init int ad9910_spi_init(void) -{ - return spi_register_driver(&ad9910_driver); -} -module_init(ad9910_spi_init); - -static __exit void ad9910_spi_exit(void) -{ - spi_unregister_driver(&ad9910_driver); -} -module_exit(ad9910_spi_exit); +module_spi_driver(ad9910_driver); MODULE_AUTHOR("Cliff Cai"); MODULE_DESCRIPTION("Analog Devices ad9910 driver"); diff --git a/drivers/staging/iio/dds/ad9951.c b/drivers/staging/iio/dds/ad9951.c index 20c182576de..d29130e9acd 100644 --- a/drivers/staging/iio/dds/ad9951.c +++ b/drivers/staging/iio/dds/ad9951.c @@ -224,18 +224,7 @@ static struct spi_driver ad9951_driver = { .probe = ad9951_probe, .remove = __devexit_p(ad9951_remove), }; - -static __init int ad9951_spi_init(void) -{ - return spi_register_driver(&ad9951_driver); -} -module_init(ad9951_spi_init); - -static __exit void ad9951_spi_exit(void) -{ - spi_unregister_driver(&ad9951_driver); -} -module_exit(ad9951_spi_exit); +module_spi_driver(ad9951_driver); MODULE_AUTHOR("Cliff Cai"); MODULE_DESCRIPTION("Analog Devices ad9951 driver"); diff --git a/drivers/staging/iio/gyro/adis16080_core.c b/drivers/staging/iio/gyro/adis16080_core.c index 5d7a906fec7..9405f2d368e 100644 --- a/drivers/staging/iio/gyro/adis16080_core.c +++ b/drivers/staging/iio/gyro/adis16080_core.c @@ -189,18 +189,7 @@ static struct spi_driver adis16080_driver = { .probe = adis16080_probe, .remove = __devexit_p(adis16080_remove), }; - -static __init int adis16080_init(void) -{ - return spi_register_driver(&adis16080_driver); -} -module_init(adis16080_init); - -static __exit void adis16080_exit(void) -{ - spi_unregister_driver(&adis16080_driver); -} -module_exit(adis16080_exit); +module_spi_driver(adis16080_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices ADIS16080/100 Yaw Rate Gyroscope Driver"); diff --git a/drivers/staging/iio/gyro/adis16130_core.c b/drivers/staging/iio/gyro/adis16130_core.c index 749240d0d8c..c9aaca9631f 100644 --- a/drivers/staging/iio/gyro/adis16130_core.c +++ b/drivers/staging/iio/gyro/adis16130_core.c @@ -168,18 +168,7 @@ static struct spi_driver adis16130_driver = { .probe = adis16130_probe, .remove = __devexit_p(adis16130_remove), }; - -static __init int adis16130_init(void) -{ - return spi_register_driver(&adis16130_driver); -} -module_init(adis16130_init); - -static __exit void adis16130_exit(void) -{ - spi_unregister_driver(&adis16130_driver); -} -module_exit(adis16130_exit); +module_spi_driver(adis16130_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices ADIS16130 High Precision Angular Rate"); diff --git a/drivers/staging/iio/gyro/adis16260_core.c b/drivers/staging/iio/gyro/adis16260_core.c index aaa3967f8c0..886dddf867e 100644 --- a/drivers/staging/iio/gyro/adis16260_core.c +++ b/drivers/staging/iio/gyro/adis16260_core.c @@ -711,18 +711,7 @@ static struct spi_driver adis16260_driver = { .remove = __devexit_p(adis16260_remove), .id_table = adis16260_id, }; - -static __init int adis16260_init(void) -{ - return spi_register_driver(&adis16260_driver); -} -module_init(adis16260_init); - -static __exit void adis16260_exit(void) -{ - spi_unregister_driver(&adis16260_driver); -} -module_exit(adis16260_exit); +module_spi_driver(adis16260_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices ADIS16260/5 Digital Gyroscope Sensor"); diff --git a/drivers/staging/iio/gyro/adxrs450_core.c b/drivers/staging/iio/gyro/adxrs450_core.c index 3c3ef796d48..70fd468b685 100644 --- a/drivers/staging/iio/gyro/adxrs450_core.c +++ b/drivers/staging/iio/gyro/adxrs450_core.c @@ -381,18 +381,7 @@ static struct spi_driver adxrs450_driver = { .probe = adxrs450_probe, .remove = __devexit_p(adxrs450_remove), }; - -static __init int adxrs450_init(void) -{ - return spi_register_driver(&adxrs450_driver); -} -module_init(adxrs450_init); - -static __exit void adxrs450_exit(void) -{ - spi_unregister_driver(&adxrs450_driver); -} -module_exit(adxrs450_exit); +module_spi_driver(adxrs450_driver); MODULE_AUTHOR("Cliff Cai <cliff.cai@xxxxxxxxxx>"); MODULE_DESCRIPTION("Analog Devices ADXRS450 Gyroscope SPI driver"); diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c index 1086e0befc2..454d131455d 100644 --- a/drivers/staging/iio/impedance-analyzer/ad5933.c +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c @@ -796,18 +796,7 @@ static struct i2c_driver ad5933_driver = { .remove = __devexit_p(ad5933_remove), .id_table = ad5933_id, }; - -static __init int ad5933_init(void) -{ - return i2c_add_driver(&ad5933_driver); -} -module_init(ad5933_init); - -static __exit void ad5933_exit(void) -{ - i2c_del_driver(&ad5933_driver); -} -module_exit(ad5933_exit); +module_i2c_driver(ad5933_driver); MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); MODULE_DESCRIPTION("Analog Devices AD5933 Impedance Conv. Network Analyzer"); diff --git a/drivers/staging/iio/imu/adis16400_core.c b/drivers/staging/iio/imu/adis16400_core.c index d082a37c4fb..efc0f652900 100644 --- a/drivers/staging/iio/imu/adis16400_core.c +++ b/drivers/staging/iio/imu/adis16400_core.c @@ -1128,18 +1128,7 @@ static struct spi_driver adis16400_driver = { .probe = adis16400_probe, .remove = __devexit_p(adis16400_remove), }; - -static __init int adis16400_init(void) -{ - return spi_register_driver(&adis16400_driver); -} -module_init(adis16400_init); - -static __exit void adis16400_exit(void) -{ - spi_unregister_driver(&adis16400_driver); -} -module_exit(adis16400_exit); +module_spi_driver(adis16400_driver); MODULE_AUTHOR("Manuel Stahl <manuel.stahl@iis.fraunhofer.de>"); MODULE_DESCRIPTION("Analog Devices ADIS16400/5 IMU SPI driver"); diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c index 9dc9e635839..47638362224 100644 --- a/drivers/staging/iio/light/isl29018.c +++ b/drivers/staging/iio/light/isl29018.c @@ -603,19 +603,7 @@ static struct i2c_driver isl29018_driver = { .remove = __devexit_p(isl29018_remove), .id_table = isl29018_id, }; - -static int __init isl29018_init(void) -{ - return i2c_add_driver(&isl29018_driver); -} - -static void __exit isl29018_exit(void) -{ - i2c_del_driver(&isl29018_driver); -} - -module_init(isl29018_init); -module_exit(isl29018_exit); +module_i2c_driver(isl29018_driver); MODULE_DESCRIPTION("ISL29018 Ambient Light Sensor driver"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/iio/light/tsl2563.c b/drivers/staging/iio/light/tsl2563.c index 7e984bcf8d7..1942db13b03 100644 --- a/drivers/staging/iio/light/tsl2563.c +++ b/drivers/staging/iio/light/tsl2563.c @@ -866,20 +866,8 @@ static struct i2c_driver tsl2563_i2c_driver = { .remove = __devexit_p(tsl2563_remove), .id_table = tsl2563_id, }; - -static int __init tsl2563_init(void) -{ - return i2c_add_driver(&tsl2563_i2c_driver); -} - -static void __exit tsl2563_exit(void) -{ - i2c_del_driver(&tsl2563_i2c_driver); -} +module_i2c_driver(tsl2563_i2c_driver); MODULE_AUTHOR("Nokia Corporation"); MODULE_DESCRIPTION("tsl2563 light sensor driver"); MODULE_LICENSE("GPL"); - -module_init(tsl2563_init); -module_exit(tsl2563_exit); diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c index 80f77cf8e9c..3836f73a529 100644 --- a/drivers/staging/iio/light/tsl2583.c +++ b/drivers/staging/iio/light/tsl2583.c @@ -933,19 +933,7 @@ static struct i2c_driver taos_driver = { .probe = taos_probe, .remove = __devexit_p(taos_remove), }; - -static int __init taos_init(void) -{ - return i2c_add_driver(&taos_driver); -} - -static void __exit taos_exit(void) -{ - i2c_del_driver(&taos_driver); -} - -module_init(taos_init); -module_exit(taos_exit); +module_i2c_driver(taos_driver); MODULE_AUTHOR("J. August Brenner<jbrenner@taosinc.com>"); MODULE_DESCRIPTION("TAOS tsl2583 ambient light sensor driver"); diff --git a/drivers/staging/iio/magnetometer/ak8975.c b/drivers/staging/iio/magnetometer/ak8975.c index 8b017127fd4..db31d6d0e5b 100644 --- a/drivers/staging/iio/magnetometer/ak8975.c +++ b/drivers/staging/iio/magnetometer/ak8975.c @@ -572,19 +572,7 @@ static struct i2c_driver ak8975_driver = { .remove = __devexit_p(ak8975_remove), .id_table = ak8975_id, }; - -static int __init ak8975_init(void) -{ - return i2c_add_driver(&ak8975_driver); -} - -static void __exit ak8975_exit(void) -{ - i2c_del_driver(&ak8975_driver); -} - -module_init(ak8975_init); -module_exit(ak8975_exit); +module_i2c_driver(ak8975_driver); MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>"); MODULE_DESCRIPTION("AK8975 magnetometer driver"); diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c index fc9ee970888..7bb1bc60513 100644 --- a/drivers/staging/iio/magnetometer/hmc5843.c +++ b/drivers/staging/iio/magnetometer/hmc5843.c @@ -618,20 +618,8 @@ static struct i2c_driver hmc5843_driver = { .suspend = hmc5843_suspend, .resume = hmc5843_resume, }; - -static int __init hmc5843_init(void) -{ - return i2c_add_driver(&hmc5843_driver); -} - -static void __exit hmc5843_exit(void) -{ - i2c_del_driver(&hmc5843_driver); -} +module_i2c_driver(hmc5843_driver); MODULE_AUTHOR("Shubhrajyoti Datta <shubhrajyoti@ti.com"); MODULE_DESCRIPTION("HMC5843 driver"); MODULE_LICENSE("GPL"); - -module_init(hmc5843_init); -module_exit(hmc5843_exit); diff --git a/drivers/staging/iio/meter/ade7753.c b/drivers/staging/iio/meter/ade7753.c index 940fef602b1..4c7b0cbf49f 100644 --- a/drivers/staging/iio/meter/ade7753.c +++ b/drivers/staging/iio/meter/ade7753.c @@ -577,18 +577,7 @@ static struct spi_driver ade7753_driver = { .probe = ade7753_probe, .remove = __devexit_p(ade7753_remove), }; - -static __init int ade7753_init(void) -{ - return spi_register_driver(&ade7753_driver); -} -module_init(ade7753_init); - -static __exit void ade7753_exit(void) -{ - spi_unregister_driver(&ade7753_driver); -} -module_exit(ade7753_exit); +module_spi_driver(ade7753_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices ADE7753/6 Single-Phase Multifunction Meter"); diff --git a/drivers/staging/iio/meter/ade7754.c b/drivers/staging/iio/meter/ade7754.c index 33f0d327c9f..15c98cde76d 100644 --- a/drivers/staging/iio/meter/ade7754.c +++ b/drivers/staging/iio/meter/ade7754.c @@ -600,18 +600,7 @@ static struct spi_driver ade7754_driver = { .probe = ade7754_probe, .remove = __devexit_p(ade7754_remove), }; - -static __init int ade7754_init(void) -{ - return spi_register_driver(&ade7754_driver); -} -module_init(ade7754_init); - -static __exit void ade7754_exit(void) -{ - spi_unregister_driver(&ade7754_driver); -} -module_exit(ade7754_exit); +module_spi_driver(ade7754_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices ADE7754 Polyphase Multifunction Energy Metering IC Driver"); diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c index c5dafbdf3bd..39338bcb187 100644 --- a/drivers/staging/iio/meter/ade7758_core.c +++ b/drivers/staging/iio/meter/ade7758_core.c @@ -853,18 +853,7 @@ static struct spi_driver ade7758_driver = { .remove = __devexit_p(ade7758_remove), .id_table = ade7758_id, }; - -static __init int ade7758_init(void) -{ - return spi_register_driver(&ade7758_driver); -} -module_init(ade7758_init); - -static __exit void ade7758_exit(void) -{ - spi_unregister_driver(&ade7758_driver); -} -module_exit(ade7758_exit); +module_spi_driver(ade7758_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices ADE7758 Polyphase Multifunction Energy Metering IC Driver"); diff --git a/drivers/staging/iio/meter/ade7759.c b/drivers/staging/iio/meter/ade7759.c index b691f10ce98..cfa2a5eff12 100644 --- a/drivers/staging/iio/meter/ade7759.c +++ b/drivers/staging/iio/meter/ade7759.c @@ -521,18 +521,7 @@ static struct spi_driver ade7759_driver = { .probe = ade7759_probe, .remove = __devexit_p(ade7759_remove), }; - -static __init int ade7759_init(void) -{ - return spi_register_driver(&ade7759_driver); -} -module_init(ade7759_init); - -static __exit void ade7759_exit(void) -{ - spi_unregister_driver(&ade7759_driver); -} -module_exit(ade7759_exit); +module_spi_driver(ade7759_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices ADE7759 Active Energy Metering IC Driver"); diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c index cbca3fd8fcd..1e1faa0479d 100644 --- a/drivers/staging/iio/meter/ade7854-i2c.c +++ b/drivers/staging/iio/meter/ade7854-i2c.c @@ -253,19 +253,7 @@ static struct i2c_driver ade7854_i2c_driver = { .remove = __devexit_p(ade7854_i2c_remove), .id_table = ade7854_id, }; - -static __init int ade7854_i2c_init(void) -{ - return i2c_add_driver(&ade7854_i2c_driver); -} -module_init(ade7854_i2c_init); - -static __exit void ade7854_i2c_exit(void) -{ - i2c_del_driver(&ade7854_i2c_driver); -} -module_exit(ade7854_i2c_exit); - +module_i2c_driver(ade7854_i2c_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices ADE7854/58/68/78 Polyphase Multifunction Energy Metering IC I2C Driver"); diff --git a/drivers/staging/iio/meter/ade7854-spi.c b/drivers/staging/iio/meter/ade7854-spi.c index cfa23ba30ef..c485a79aeec 100644 --- a/drivers/staging/iio/meter/ade7854-spi.c +++ b/drivers/staging/iio/meter/ade7854-spi.c @@ -353,18 +353,7 @@ static struct spi_driver ade7854_driver = { .remove = __devexit_p(ade7854_spi_remove), .id_table = ade7854_id, }; - -static __init int ade7854_init(void) -{ - return spi_register_driver(&ade7854_driver); -} -module_init(ade7854_init); - -static __exit void ade7854_exit(void) -{ - spi_unregister_driver(&ade7854_driver); -} -module_exit(ade7854_exit); +module_spi_driver(ade7854_driver); MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>"); MODULE_DESCRIPTION("Analog Devices ADE7854/58/68/78 SPI Driver"); diff --git a/drivers/staging/iio/resolver/ad2s1200.c b/drivers/staging/iio/resolver/ad2s1200.c index d7ad46aed0f..1c6a02bfd45 100644 --- a/drivers/staging/iio/resolver/ad2s1200.c +++ b/drivers/staging/iio/resolver/ad2s1200.c @@ -170,18 +170,7 @@ static struct spi_driver ad2s1200_driver = { .remove = __devexit_p(ad2s1200_remove), .id_table = ad2s1200_id, }; - -static __init int ad2s1200_spi_init(void) -{ - return spi_register_driver(&ad2s1200_driver); -} -module_init(ad2s1200_spi_init); - -static __exit void ad2s1200_spi_exit(void) -{ - spi_unregister_driver(&ad2s1200_driver); -} -module_exit(ad2s1200_spi_exit); +module_spi_driver(ad2s1200_driver); MODULE_AUTHOR("Graff Yang <graff.yang@gmail.com>"); MODULE_DESCRIPTION("Analog Devices AD2S1200/1205 Resolver to Digital SPI driver"); diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c index 6401a627362..ff1b3316d01 100644 --- a/drivers/staging/iio/resolver/ad2s1210.c +++ b/drivers/staging/iio/resolver/ad2s1210.c @@ -759,18 +759,7 @@ static struct spi_driver ad2s1210_driver = { .remove = __devexit_p(ad2s1210_remove), .id_table = ad2s1210_id, }; - -static __init int ad2s1210_spi_init(void) -{ - return spi_register_driver(&ad2s1210_driver); -} -module_init(ad2s1210_spi_init); - -static __exit void ad2s1210_spi_exit(void) -{ - spi_unregister_driver(&ad2s1210_driver); -} -module_exit(ad2s1210_spi_exit); +module_spi_driver(ad2s1210_driver); MODULE_AUTHOR("Graff Yang <graff.yang@gmail.com>"); MODULE_DESCRIPTION("Analog Devices AD2S1210 Resolver to Digital SPI driver"); diff --git a/drivers/staging/iio/resolver/ad2s90.c b/drivers/staging/iio/resolver/ad2s90.c index a9200d949dc..6d0794389e7 100644 --- a/drivers/staging/iio/resolver/ad2s90.c +++ b/drivers/staging/iio/resolver/ad2s90.c @@ -119,18 +119,7 @@ static struct spi_driver ad2s90_driver = { .remove = __devexit_p(ad2s90_remove), .id_table = ad2s90_id, }; - -static __init int ad2s90_spi_init(void) -{ - return spi_register_driver(&ad2s90_driver); -} -module_init(ad2s90_spi_init); - -static __exit void ad2s90_spi_exit(void) -{ - spi_unregister_driver(&ad2s90_driver); -} -module_exit(ad2s90_spi_exit); +module_spi_driver(ad2s90_driver); MODULE_AUTHOR("Graff Yang <graff.yang@gmail.com>"); MODULE_DESCRIPTION("Analog Devices AD2S90 Resolver to Digital SPI driver"); diff --git a/drivers/staging/keucr/usb.c b/drivers/staging/keucr/usb.c index 66aad3a0d1f..48330340273 100644 --- a/drivers/staging/keucr/usb.c +++ b/drivers/staging/keucr/usb.c @@ -701,26 +701,4 @@ static struct usb_driver usb_storage_driver = { .soft_unbind = 1, }; -//----- usb_stor_init() --------------------- -static int __init usb_stor_init(void) -{ - int retval; - pr_info("usb --- usb_stor_init start\n"); - - retval = usb_register(&usb_storage_driver); - if (retval == 0) - pr_info("ENE USB Mass Storage support registered.\n"); - - return retval; -} - -//----- usb_stor_exit() --------------------- -static void __exit usb_stor_exit(void) -{ - pr_info("usb --- usb_stor_exit\n"); - - usb_deregister(&usb_storage_driver) ; -} - -module_init(usb_stor_init); -module_exit(usb_stor_exit); +module_usb_driver(usb_storage_driver); diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c index 3db3b0a91cc..b7175fe1b15 100644 --- a/drivers/staging/media/go7007/go7007-usb.c +++ b/drivers/staging/media/go7007/go7007-usb.c @@ -1272,17 +1272,4 @@ static struct usb_driver go7007_usb_driver = { .id_table = go7007_usb_id_table, }; -static int __init go7007_usb_init(void) -{ - return usb_register(&go7007_usb_driver); -} - -static void __exit go7007_usb_cleanup(void) -{ - usb_deregister(&go7007_usb_driver); -} - -module_init(go7007_usb_init); -module_exit(go7007_usb_cleanup); - -MODULE_LICENSE("GPL v2"); +module_usb_driver(go7007_usb_driver); diff --git a/drivers/staging/media/lirc/lirc_igorplugusb.c b/drivers/staging/media/lirc/lirc_igorplugusb.c index 0dc2c2b22c2..6cd4cd67a1d 100644 --- a/drivers/staging/media/lirc/lirc_igorplugusb.c +++ b/drivers/staging/media/lirc/lirc_igorplugusb.c @@ -541,26 +541,7 @@ static struct usb_driver igorplugusb_remote_driver = { .id_table = igorplugusb_remote_id_table }; -static int __init igorplugusb_remote_init(void) -{ - int ret = 0; - - dprintk(DRIVER_NAME ": loaded, debug mode enabled\n"); - - ret = usb_register(&igorplugusb_remote_driver); - if (ret) - printk(KERN_ERR DRIVER_NAME ": usb register failed!\n"); - - return ret; -} - -static void __exit igorplugusb_remote_exit(void) -{ - usb_deregister(&igorplugusb_remote_driver); -} - -module_init(igorplugusb_remote_init); -module_exit(igorplugusb_remote_exit); +module_usb_driver(igorplugusb_remote_driver); #include <linux/vermagic.h> MODULE_INFO(vermagic, VERMAGIC_STRING); diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index f5308d5929c..f68218012f2 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -1025,26 +1025,4 @@ static int imon_resume(struct usb_interface *intf) return rc; } -static int __init imon_init(void) -{ - int rc; - - printk(KERN_INFO MOD_NAME ": " MOD_DESC ", v" MOD_VERSION "\n"); - - rc = usb_register(&imon_driver); - if (rc) { - err("%s: usb register failed(%d)", __func__, rc); - return -ENODEV; - } - - return 0; -} - -static void __exit imon_exit(void) -{ - usb_deregister(&imon_driver); - printk(KERN_INFO MOD_NAME ": module removed. Goodbye!\n"); -} - -module_init(imon_init); -module_exit(imon_exit); +module_usb_driver(imon_driver); diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index a2d18b0aa04..7855baa18e7 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -913,27 +913,4 @@ static void sasem_disconnect(struct usb_interface *interface) mutex_unlock(&disconnect_lock); } -static int __init sasem_init(void) -{ - int rc; - - printk(KERN_INFO MOD_DESC ", v" MOD_VERSION "\n"); - printk(KERN_INFO MOD_AUTHOR "\n"); - - rc = usb_register(&sasem_driver); - if (rc < 0) { - err("%s: usb register failed (%d)", __func__, rc); - return -ENODEV; - } - return 0; -} - -static void __exit sasem_exit(void) -{ - usb_deregister(&sasem_driver); - printk(KERN_INFO "module removed. Goodbye!\n"); -} - - -module_init(sasem_init); -module_exit(sasem_exit); +module_usb_driver(sasem_driver); diff --git a/drivers/staging/media/lirc/lirc_ttusbir.c b/drivers/staging/media/lirc/lirc_ttusbir.c index e4b329b8caf..7950887ff11 100644 --- a/drivers/staging/media/lirc/lirc_ttusbir.c +++ b/drivers/staging/media/lirc/lirc_ttusbir.c @@ -372,24 +372,4 @@ static void disconnect(struct usb_interface *intf) kfree(ttusbir); } -static int ttusbir_init_module(void) -{ - int result; - - DPRINTK(KERN_DEBUG "Module ttusbir init\n"); - - /* register this driver with the USB subsystem */ - result = usb_register(&usb_driver); - if (result) - err("usb_register failed. Error number %d", result); - return result; -} - -static void ttusbir_exit_module(void) -{ - printk(KERN_DEBUG "Module ttusbir exit\n"); - usb_deregister(&usb_driver); -} - -module_init(ttusbir_init_module); -module_exit(ttusbir_exit_module); +module_usb_driver(usb_driver); diff --git a/drivers/staging/rts5139/rts51x.c b/drivers/staging/rts5139/rts51x.c index d9cee6d0b12..2b9f785954d 100644 --- a/drivers/staging/rts5139/rts51x.c +++ b/drivers/staging/rts5139/rts51x.c @@ -934,34 +934,4 @@ struct usb_driver rts51x_driver = { .soft_unbind = 1, }; -static int __init rts51x_init(void) -{ - int retval; - - printk(KERN_INFO "Initializing %s USB card reader driver...\n", - RTS51X_NAME); - - /* register the driver, return usb_register return code if error */ - retval = usb_register(&rts51x_driver); - if (retval == 0) { - printk(KERN_INFO - "Realtek %s USB card reader support registered.\n", - RTS51X_NAME); - } - return retval; -} - -static void __exit rts51x_exit(void) -{ - RTS51X_DEBUGP("rts51x_exit() called\n"); - - /* Deregister the driver - * This will cause disconnect() to be called for each - * attached unit - */ - RTS51X_DEBUGP("-- calling usb_deregister()\n"); - usb_deregister(&rts51x_driver); -} - -module_init(rts51x_init); -module_exit(rts51x_exit); +module_usb_driver(rts51x_driver); diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 27521b69ce0..541f9aa8ef6 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -2103,16 +2103,4 @@ static struct usb_driver vt6656_driver = { #endif /* CONFIG_PM */ }; -static int __init vt6656_init_module(void) -{ - printk(KERN_NOTICE DEVICE_FULL_DRV_NAM " " DEVICE_VERSION); - return usb_register(&vt6656_driver); -} - -static void __exit vt6656_cleanup_module(void) -{ - usb_deregister(&vt6656_driver); -} - -module_init(vt6656_init_module); -module_exit(vt6656_cleanup_module); +module_usb_driver(vt6656_driver); diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c index f958eb4f0d8..c3751a71838 100644 --- a/drivers/staging/winbond/wbusb.c +++ b/drivers/staging/winbond/wbusb.c @@ -865,15 +865,4 @@ static struct usb_driver wb35_driver = { .disconnect = wb35_disconnect, }; -static int __init wb35_init(void) -{ - return usb_register(&wb35_driver); -} - -static void __exit wb35_exit(void) -{ - usb_deregister(&wb35_driver); -} - -module_init(wb35_init); -module_exit(wb35_exit); +module_usb_driver(wb35_driver); diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c index 4efa027a81e..b1aed1f1f74 100644 --- a/drivers/staging/wlan-ng/prism2usb.c +++ b/drivers/staging/wlan-ng/prism2usb.c @@ -358,16 +358,4 @@ static struct usb_driver prism2_usb_driver = { /* fops, minor? */ }; -static int __init prism2usb_init(void) -{ - /* This call will result in calls to prism2sta_probe_usb. */ - return usb_register(&prism2_usb_driver); -}; - -static void __exit prism2usb_cleanup(void) -{ - usb_deregister(&prism2_usb_driver); -}; - -module_init(prism2usb_init); -module_exit(prism2usb_cleanup); +module_usb_driver(prism2_usb_driver); diff --git a/drivers/uio/uio_pdrv.c b/drivers/uio/uio_pdrv.c index ff505951735..72d3646c736 100644 --- a/drivers/uio/uio_pdrv.c +++ b/drivers/uio/uio_pdrv.c @@ -104,17 +104,7 @@ static struct platform_driver uio_pdrv = { }, }; -static int __init uio_pdrv_init(void) -{ - return platform_driver_register(&uio_pdrv); -} - -static void __exit uio_pdrv_exit(void) -{ - platform_driver_unregister(&uio_pdrv); -} -module_init(uio_pdrv_init); -module_exit(uio_pdrv_exit); +module_platform_driver(uio_pdrv); MODULE_AUTHOR("Uwe Kleine-Koenig"); MODULE_DESCRIPTION("Userspace I/O platform driver"); diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c index 25de302009a..b98371d93a9 100644 --- a/drivers/uio/uio_pdrv_genirq.c +++ b/drivers/uio/uio_pdrv_genirq.c @@ -273,18 +273,7 @@ static struct platform_driver uio_pdrv_genirq = { }, }; -static int __init uio_pdrv_genirq_init(void) -{ - return platform_driver_register(&uio_pdrv_genirq); -} - -static void __exit uio_pdrv_genirq_exit(void) -{ - platform_driver_unregister(&uio_pdrv_genirq); -} - -module_init(uio_pdrv_genirq_init); -module_exit(uio_pdrv_genirq_exit); +module_platform_driver(uio_pdrv_genirq); MODULE_AUTHOR("Magnus Damm"); MODULE_DESCRIPTION("Userspace I/O platform driver with generic IRQ handling"); diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c index e67b566e7aa..33a7a273b45 100644 --- a/drivers/uio/uio_pruss.c +++ b/drivers/uio/uio_pruss.c @@ -227,19 +227,7 @@ static struct platform_driver pruss_driver = { }, }; -static int __init pruss_init_module(void) -{ - return platform_driver_register(&pruss_driver); -} - -module_init(pruss_init_module); - -static void __exit pruss_exit_module(void) -{ - platform_driver_unregister(&pruss_driver); -} - -module_exit(pruss_exit_module); +module_platform_driver(pruss_driver); MODULE_LICENSE("GPL v2"); MODULE_VERSION(DRV_VERSION); diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index a845f8b8382..98b89fe1986 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c @@ -1372,18 +1372,7 @@ static struct usb_driver cxacru_usb_driver = { .id_table = cxacru_usb_ids }; -static int __init cxacru_init(void) -{ - return usb_register(&cxacru_usb_driver); -} - -static void __exit cxacru_cleanup(void) -{ - usb_deregister(&cxacru_usb_driver); -} - -module_init(cxacru_init); -module_exit(cxacru_cleanup); +module_usb_driver(cxacru_usb_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c index 0842cfbf60c..b42092e1f16 100644 --- a/drivers/usb/atm/speedtch.c +++ b/drivers/usb/atm/speedtch.c @@ -953,22 +953,7 @@ static int speedtch_usb_probe(struct usb_interface *intf, const struct usb_devic return usbatm_usb_probe(intf, id, &speedtch_usbatm_driver); } -static int __init speedtch_usb_init(void) -{ - dbg("%s: driver version %s", __func__, DRIVER_VERSION); - - return usb_register(&speedtch_usb_driver); -} - -static void __exit speedtch_usb_cleanup(void) -{ - dbg("%s", __func__); - - usb_deregister(&speedtch_usb_driver); -} - -module_init(speedtch_usb_init); -module_exit(speedtch_usb_cleanup); +module_usb_driver(speedtch_usb_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index 428f36801e0..00f171a7a8a 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c @@ -2753,36 +2753,7 @@ static struct usb_driver uea_driver = { MODULE_DEVICE_TABLE(usb, uea_ids); -/** - * uea_init - Initialize the module. - * Register to USB subsystem - */ -static int __init uea_init(void) -{ - printk(KERN_INFO "[ueagle-atm] driver " EAGLEUSBVERSION " loaded\n"); - - usb_register(&uea_driver); - - return 0; -} - -module_init(uea_init); - -/** - * uea_exit - Destroy module - * Deregister with USB subsystem - */ -static void __exit uea_exit(void) -{ - /* - * This calls automatically the uea_disconnect method if necessary: - */ - usb_deregister(&uea_driver); - - printk(KERN_INFO "[ueagle-atm] driver unloaded\n"); -} - -module_exit(uea_exit); +module_usb_driver(uea_driver); MODULE_AUTHOR("Damien Bergamini/Matthieu Castet/Stanislaw W. Gruszka"); MODULE_DESCRIPTION("ADI 930/Eagle USB ADSL Modem driver"); diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index efe684908c1..1c50baff772 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -895,24 +895,7 @@ static struct usb_driver wdm_driver = { .supports_autosuspend = 1, }; -/* --- low level module stuff --- */ - -static int __init wdm_init(void) -{ - int rv; - - rv = usb_register(&wdm_driver); - - return rv; -} - -static void __exit wdm_exit(void) -{ - usb_deregister(&wdm_driver); -} - -module_init(wdm_init); -module_exit(wdm_exit); +module_usb_driver(wdm_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c index cb3a93243a0..81ef2e207a8 100644 --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c @@ -1412,18 +1412,7 @@ static struct usb_driver usblp_driver = { .supports_autosuspend = 1, }; -static int __init usblp_init(void) -{ - return usb_register(&usblp_driver); -} - -static void __exit usblp_exit(void) -{ - usb_deregister(&usblp_driver); -} - -module_init(usblp_init); -module_exit(usblp_exit); +module_usb_driver(usblp_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 12cf5e7395a..70d69d06054 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c @@ -1116,21 +1116,6 @@ static struct usb_driver usbtmc_driver = { .resume = usbtmc_resume, }; -static int __init usbtmc_init(void) -{ - int retcode; - - retcode = usb_register(&usbtmc_driver); - if (retcode) - printk(KERN_ERR KBUILD_MODNAME": Unable to register driver\n"); - return retcode; -} -module_init(usbtmc_init); - -static void __exit usbtmc_exit(void) -{ - usb_deregister(&usbtmc_driver); -} -module_exit(usbtmc_exit); +module_usb_driver(usbtmc_driver); MODULE_LICENSE("GPL"); diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c index da1ad77d8d5..fcfa91517ea 100644 --- a/drivers/usb/dwc3/debugfs.c +++ b/drivers/usb/dwc3/debugfs.c @@ -51,18 +51,13 @@ #include "gadget.h" #include "io.h" -struct dwc3_register { - const char *name; - u32 offset; -}; - #define dump_register(nm) \ { \ .name = __stringify(nm), \ .offset = DWC3_ ##nm, \ } -static const struct dwc3_register dwc3_regs[] = { +static const struct debugfs_reg32 dwc3_regs[] = { dump_register(GSBUSCFG0), dump_register(GSBUSCFG1), dump_register(GTXTHRCFG), @@ -382,15 +377,10 @@ static const struct dwc3_register dwc3_regs[] = { static int dwc3_regdump_show(struct seq_file *s, void *unused) { struct dwc3 *dwc = s->private; - int i; seq_printf(s, "DesignWare USB3 Core Register Dump\n"); - - for (i = 0; i < ARRAY_SIZE(dwc3_regs); i++) { - seq_printf(s, "%-20s : %08x\n", dwc3_regs[i].name, - dwc3_readl(dwc->regs, dwc3_regs[i].offset)); - } - + debugfs_print_regs32(s, dwc3_regs, ARRAY_SIZE(dwc3_regs), + dwc->regs, ""); return 0; } diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c index 9bfac657572..056fb2d37c8 100644 --- a/drivers/usb/host/hwa-hc.c +++ b/drivers/usb/host/hwa-hc.c @@ -837,18 +837,7 @@ static struct usb_driver hwahc_driver = { .id_table = hwahc_id_table, }; -static int __init hwahc_driver_init(void) -{ - return usb_register(&hwahc_driver); -} -module_init(hwahc_driver_init); - -static void __exit hwahc_driver_exit(void) -{ - usb_deregister(&hwahc_driver); -} -module_exit(hwahc_driver_exit); - +module_usb_driver(hwahc_driver); MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>"); MODULE_DESCRIPTION("Host Wired Adapter USB Host Control Driver"); diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c index 27e209a7222..9c0f8caba3b 100644 --- a/drivers/usb/image/microtek.c +++ b/drivers/usb/image/microtek.c @@ -809,19 +809,7 @@ static void mts_usb_disconnect (struct usb_interface *intf) kfree(desc); } - -static int __init microtek_drv_init(void) -{ - return usb_register(&mts_usb_driver); -} - -static void __exit microtek_drv_exit(void) -{ - usb_deregister(&mts_usb_driver); -} - -module_init(microtek_drv_init); -module_exit(microtek_drv_exit); +module_usb_driver(mts_usb_driver); MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_DESCRIPTION( DRIVER_DESC ); diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index fe858711651..284b8546141 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c @@ -885,40 +885,7 @@ static struct usb_driver adu_driver = { .id_table = device_table, }; -static int __init adu_init(void) -{ - int result; - - dbg(2," %s : enter", __func__); - - /* register this driver with the USB subsystem */ - result = usb_register(&adu_driver); - if (result < 0) { - printk(KERN_ERR "usb_register failed for the "__FILE__ - " driver. Error number %d\n", result); - goto exit; - } - - printk(KERN_INFO "adutux " DRIVER_DESC " " DRIVER_VERSION "\n"); - printk(KERN_INFO "adutux is an experimental driver. " - "Use at your own risk\n"); - -exit: - dbg(2," %s : leave, return value %d", __func__, result); - - return result; -} - -static void __exit adu_exit(void) -{ - dbg(2," %s : enter", __func__); - /* deregister this driver with the USB subsystem */ - usb_deregister(&adu_driver); - dbg(2," %s : leave", __func__); -} - -module_init(adu_init); -module_exit(adu_exit); +module_usb_driver(adu_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c index 9251773ecef..3f7c1a92579 100644 --- a/drivers/usb/misc/cypress_cy7c63.c +++ b/drivers/usb/misc/cypress_cy7c63.c @@ -271,27 +271,7 @@ static struct usb_driver cypress_driver = { .id_table = cypress_table, }; -static int __init cypress_init(void) -{ - int result; - - /* register this driver with the USB subsystem */ - result = usb_register(&cypress_driver); - if (result) - printk(KERN_ERR KBUILD_MODNAME ": usb_register failed! " - "Error number: %d\n", result); - - return result; -} - -static void __exit cypress_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&cypress_driver); -} - -module_init(cypress_init); -module_exit(cypress_exit); +module_usb_driver(cypress_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c index 1d7251bc1b5..5b9831b95d9 100644 --- a/drivers/usb/misc/cytherm.c +++ b/drivers/usb/misc/cytherm.c @@ -417,31 +417,7 @@ static void cytherm_disconnect(struct usb_interface *interface) dev_info(&interface->dev, "Cypress thermometer now disconnected\n"); } - -static int __init usb_cytherm_init(void) -{ - int result; - - result = usb_register(&cytherm_driver); - if (result) { - printk(KERN_ERR KBUILD_MODNAME ": usb_register failed! " - "Error number: %d\n", result); - return result; - } - - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - return 0; -} - -static void __exit usb_cytherm_exit(void) -{ - usb_deregister(&cytherm_driver); -} - - -module_init (usb_cytherm_init); -module_exit (usb_cytherm_exit); +module_usb_driver(cytherm_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c index a6521c95f68..d9b6a035544 100644 --- a/drivers/usb/misc/emi26.c +++ b/drivers/usb/misc/emi26.c @@ -276,18 +276,7 @@ static struct usb_driver emi26_driver = { .id_table = id_table, }; -static int __init emi26_init (void) -{ - return usb_register(&emi26_driver); -} - -static void __exit emi26_exit (void) -{ - usb_deregister (&emi26_driver); -} - -module_init(emi26_init); -module_exit(emi26_exit); +module_usb_driver(emi26_driver); MODULE_AUTHOR("Tapio Laxström"); MODULE_DESCRIPTION("Emagic EMI 2|6 firmware loader."); diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c index fc15ad4c313..9f39062ebb0 100644 --- a/drivers/usb/misc/emi62.c +++ b/drivers/usb/misc/emi62.c @@ -290,22 +290,7 @@ static struct usb_driver emi62_driver = { .id_table = id_table, }; -static int __init emi62_init (void) -{ - int retval; - retval = usb_register (&emi62_driver); - if (retval) - printk(KERN_ERR "adi-emi: registration failed\n"); - return retval; -} - -static void __exit emi62_exit (void) -{ - usb_deregister (&emi62_driver); -} - -module_init(emi62_init); -module_exit(emi62_exit); +module_usb_driver(emi62_driver); MODULE_AUTHOR("Tapio Laxström"); MODULE_DESCRIPTION("Emagic EMI 6|2m firmware loader."); diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c index 515b67fffab..0dee2469850 100644 --- a/drivers/usb/misc/idmouse.c +++ b/drivers/usb/misc/idmouse.c @@ -428,29 +428,7 @@ static void idmouse_disconnect(struct usb_interface *interface) dev_info(&interface->dev, "disconnected\n"); } -static int __init usb_idmouse_init(void) -{ - int result; - - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - - /* register this driver with the USB subsystem */ - result = usb_register(&idmouse_driver); - if (result) - err("Unable to register device (error %d).", result); - - return result; -} - -static void __exit usb_idmouse_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&idmouse_driver); -} - -module_init(usb_idmouse_init); -module_exit(usb_idmouse_exit); +module_usb_driver(idmouse_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 81457904d6b..7676b5b7e17 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c @@ -927,15 +927,4 @@ static struct usb_driver iowarrior_driver = { .id_table = iowarrior_ids, }; -static int __init iowarrior_init(void) -{ - return usb_register(&iowarrior_driver); -} - -static void __exit iowarrior_exit(void) -{ - usb_deregister(&iowarrior_driver); -} - -module_init(iowarrior_init); -module_exit(iowarrior_exit); +module_usb_driver(iowarrior_driver); diff --git a/drivers/usb/misc/isight_firmware.c b/drivers/usb/misc/isight_firmware.c index fe1d44319d0..1dc7e9581cc 100644 --- a/drivers/usb/misc/isight_firmware.c +++ b/drivers/usb/misc/isight_firmware.c @@ -126,18 +126,7 @@ static struct usb_driver isight_firmware_driver = { .id_table = id_table, }; -static int __init isight_firmware_init(void) -{ - return usb_register(&isight_firmware_driver); -} - -static void __exit isight_firmware_exit(void) -{ - usb_deregister(&isight_firmware_driver); -} - -module_init(isight_firmware_init); -module_exit(isight_firmware_exit); +module_usb_driver(isight_firmware_driver); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>"); diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index 48c166f0d76..5db4ab52061 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c @@ -821,30 +821,5 @@ static struct usb_driver ld_usb_driver = { .id_table = ld_usb_table, }; -/** - * ld_usb_init - */ -static int __init ld_usb_init(void) -{ - int retval; - - /* register this driver with the USB subsystem */ - retval = usb_register(&ld_usb_driver); - if (retval) - err("usb_register failed for the %s driver. Error number %d\n", __FILE__, retval); - - return retval; -} - -/** - * ld_usb_exit - */ -static void __exit ld_usb_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&ld_usb_driver); -} - -module_init(ld_usb_init); -module_exit(ld_usb_exit); +module_usb_driver(ld_usb_driver); diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index a989356f693..16937da31cd 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -1043,51 +1043,7 @@ static void tower_disconnect (struct usb_interface *interface) dbg(2, "%s: leave", __func__); } - - -/** - * lego_usb_tower_init - */ -static int __init lego_usb_tower_init(void) -{ - int result; - int retval = 0; - - dbg(2, "%s: enter", __func__); - - /* register this driver with the USB subsystem */ - result = usb_register(&tower_driver); - if (result < 0) { - err("usb_register failed for the %s driver. Error number %d", __FILE__, result); - retval = -1; - goto exit; - } - - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - -exit: - dbg(2, "%s: leave, return value %d", __func__, retval); - - return retval; -} - - -/** - * lego_usb_tower_exit - */ -static void __exit lego_usb_tower_exit(void) -{ - dbg(2, "%s: enter", __func__); - - /* deregister this driver with the USB subsystem */ - usb_deregister (&tower_driver); - - dbg(2, "%s: leave", __func__); -} - -module_init (lego_usb_tower_init); -module_exit (lego_usb_tower_exit); +module_usb_driver(tower_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c index 4e23d3841b4..487a8ce0775 100644 --- a/drivers/usb/misc/rio500.c +++ b/drivers/usb/misc/rio500.c @@ -531,33 +531,7 @@ static struct usb_driver rio_driver = { .id_table = rio_table, }; -static int __init usb_rio_init(void) -{ - int retval; - retval = usb_register(&rio_driver); - if (retval) - goto out; - - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - -out: - return retval; -} - - -static void __exit usb_rio_cleanup(void) -{ - struct rio_usb_data *rio = &rio_instance; - - rio->present = 0; - usb_deregister(&rio_driver); - - -} - -module_init(usb_rio_init); -module_exit(usb_rio_cleanup); +module_usb_driver(rio_driver); MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_DESCRIPTION( DRIVER_DESC ); diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c index f63776a48e2..741efed4a23 100644 --- a/drivers/usb/misc/trancevibrator.c +++ b/drivers/usb/misc/trancevibrator.c @@ -137,26 +137,7 @@ static struct usb_driver tv_driver = { .id_table = id_table, }; -static int __init tv_init(void) -{ - int retval = usb_register(&tv_driver); - if (retval) { - err("usb_register failed. Error number %d", retval); - return retval; - } - - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - return 0; -} - -static void __exit tv_exit(void) -{ - usb_deregister(&tv_driver); -} - -module_init (tv_init); -module_exit (tv_exit); +module_usb_driver(tv_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index 1871cdf10da..e2b4bd31c2b 100644 --- a/drivers/usb/misc/usblcd.c +++ b/drivers/usb/misc/usblcd.c @@ -450,25 +450,7 @@ static struct usb_driver lcd_driver = { .supports_autosuspend = 1, }; -static int __init usb_lcd_init(void) -{ - int result; - - result = usb_register(&lcd_driver); - if (result) - err("usb_register failed. Error number %d", result); - - return result; -} - - -static void __exit usb_lcd_exit(void) -{ - usb_deregister(&lcd_driver); -} - -module_init(usb_lcd_init); -module_exit(usb_lcd_exit); +module_usb_driver(lcd_driver); MODULE_AUTHOR("Georges Toth <g.toth@e-biz.lu>"); MODULE_DESCRIPTION(DRIVER_VERSION); diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index 43f84e50d51..4af56fbc3c0 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c @@ -231,23 +231,7 @@ static struct usb_driver led_driver = { .id_table = id_table, }; -static int __init usb_led_init(void) -{ - int retval = 0; - - retval = usb_register(&led_driver); - if (retval) - err("usb_register failed. Error number %d", retval); - return retval; -} - -static void __exit usb_led_exit(void) -{ - usb_deregister(&led_driver); -} - -module_init(usb_led_init); -module_exit(usb_led_exit); +module_usb_driver(led_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c index 417b8f207e8..107bf13b1cf 100644 --- a/drivers/usb/misc/usbsevseg.c +++ b/drivers/usb/misc/usbsevseg.c @@ -437,23 +437,7 @@ static struct usb_driver sevseg_driver = { .supports_autosuspend = 1, }; -static int __init usb_sevseg_init(void) -{ - int rc = 0; - - rc = usb_register(&sevseg_driver); - if (rc) - err("usb_register failed. Error number %d", rc); - return rc; -} - -static void __exit usb_sevseg_exit(void) -{ - usb_deregister(&sevseg_driver); -} - -module_init(usb_sevseg_init); -module_exit(usb_sevseg_exit); +module_usb_driver(sevseg_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c index ac5bfd619e6..897edda4227 100644 --- a/drivers/usb/misc/yurex.c +++ b/drivers/usb/misc/yurex.c @@ -539,26 +539,6 @@ static const struct file_operations yurex_fops = { .llseek = default_llseek, }; - -static int __init usb_yurex_init(void) -{ - int result; - - /* register this driver with the USB subsystem */ - result = usb_register(&yurex_driver); - if (result) - err("usb_register failed. Error number %d", result); - - return result; -} - -static void __exit usb_yurex_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&yurex_driver); -} - -module_init(usb_yurex_init); -module_exit(usb_yurex_exit); +module_usb_driver(yurex_driver); MODULE_LICENSE("GPL"); diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c index 42d0eaed4a0..3ca87a82334 100644 --- a/drivers/usb/storage/alauda.c +++ b/drivers/usb/storage/alauda.c @@ -1278,15 +1278,4 @@ static struct usb_driver alauda_driver = { .soft_unbind = 1, }; -static int __init alauda_init(void) -{ - return usb_register(&alauda_driver); -} - -static void __exit alauda_exit(void) -{ - usb_deregister(&alauda_driver); -} - -module_init(alauda_init); -module_exit(alauda_exit); +module_usb_driver(alauda_driver); diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c index c8447182118..c7909dfa243 100644 --- a/drivers/usb/storage/cypress_atacb.c +++ b/drivers/usb/storage/cypress_atacb.c @@ -274,15 +274,4 @@ static struct usb_driver cypress_driver = { .soft_unbind = 1, }; -static int __init cypress_init(void) -{ - return usb_register(&cypress_driver); -} - -static void __exit cypress_exit(void) -{ - usb_deregister(&cypress_driver); -} - -module_init(cypress_init); -module_exit(cypress_exit); +module_usb_driver(cypress_driver); diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c index ded836b02d7..a99be857b79 100644 --- a/drivers/usb/storage/datafab.c +++ b/drivers/usb/storage/datafab.c @@ -753,15 +753,4 @@ static struct usb_driver datafab_driver = { .soft_unbind = 1, }; -static int __init datafab_init(void) -{ - return usb_register(&datafab_driver); -} - -static void __exit datafab_exit(void) -{ - usb_deregister(&datafab_driver); -} - -module_init(datafab_init); -module_exit(datafab_exit); +module_usb_driver(datafab_driver); diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c index 9fbe742343c..b0a1687ca94 100644 --- a/drivers/usb/storage/ene_ub6250.c +++ b/drivers/usb/storage/ene_ub6250.c @@ -2409,15 +2409,4 @@ static struct usb_driver ene_ub6250_driver = { .soft_unbind = 1, }; -static int __init ene_ub6250_init(void) -{ - return usb_register(&ene_ub6250_driver); -} - -static void __exit ene_ub6250_exit(void) -{ - usb_deregister(&ene_ub6250_driver); -} - -module_init(ene_ub6250_init); -module_exit(ene_ub6250_exit); +module_usb_driver(ene_ub6250_driver); diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c index 6542ca40d50..03d4a873748 100644 --- a/drivers/usb/storage/freecom.c +++ b/drivers/usb/storage/freecom.c @@ -555,15 +555,4 @@ static struct usb_driver freecom_driver = { .soft_unbind = 1, }; -static int __init freecom_init(void) -{ - return usb_register(&freecom_driver); -} - -static void __exit freecom_exit(void) -{ - usb_deregister(&freecom_driver); -} - -module_init(freecom_init); -module_exit(freecom_exit); +module_usb_driver(freecom_driver); diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c index ffc4193e950..6d6923317f1 100644 --- a/drivers/usb/storage/isd200.c +++ b/drivers/usb/storage/isd200.c @@ -1568,15 +1568,4 @@ static struct usb_driver isd200_driver = { .soft_unbind = 1, }; -static int __init isd200_init(void) -{ - return usb_register(&isd200_driver); -} - -static void __exit isd200_exit(void) -{ - usb_deregister(&isd200_driver); -} - -module_init(isd200_init); -module_exit(isd200_exit); +module_usb_driver(isd200_driver); diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c index 6168596c5ac..54b71650b69 100644 --- a/drivers/usb/storage/jumpshot.c +++ b/drivers/usb/storage/jumpshot.c @@ -679,15 +679,4 @@ static struct usb_driver jumpshot_driver = { .soft_unbind = 1, }; -static int __init jumpshot_init(void) -{ - return usb_register(&jumpshot_driver); -} - -static void __exit jumpshot_exit(void) -{ - usb_deregister(&jumpshot_driver); -} - -module_init(jumpshot_init); -module_exit(jumpshot_exit); +module_usb_driver(jumpshot_driver); diff --git a/drivers/usb/storage/karma.c b/drivers/usb/storage/karma.c index ba1b7890688..35181e29124 100644 --- a/drivers/usb/storage/karma.c +++ b/drivers/usb/storage/karma.c @@ -232,15 +232,4 @@ static struct usb_driver karma_driver = { .soft_unbind = 1, }; -static int __init karma_init(void) -{ - return usb_register(&karma_driver); -} - -static void __exit karma_exit(void) -{ - usb_deregister(&karma_driver); -} - -module_init(karma_init); -module_exit(karma_exit); +module_usb_driver(karma_driver); diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c index 1943be5a291..721c8c58730 100644 --- a/drivers/usb/storage/onetouch.c +++ b/drivers/usb/storage/onetouch.c @@ -314,15 +314,4 @@ static struct usb_driver onetouch_driver = { .soft_unbind = 1, }; -static int __init onetouch_init(void) -{ - return usb_register(&onetouch_driver); -} - -static void __exit onetouch_exit(void) -{ - usb_deregister(&onetouch_driver); -} - -module_init(onetouch_init); -module_exit(onetouch_exit); +module_usb_driver(onetouch_driver); diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c index 0ce5f79197e..c41cd30d2c0 100644 --- a/drivers/usb/storage/realtek_cr.c +++ b/drivers/usb/storage/realtek_cr.c @@ -1104,15 +1104,4 @@ static struct usb_driver realtek_cr_driver = { .supports_autosuspend = 1, }; -static int __init realtek_cr_init(void) -{ - return usb_register(&realtek_cr_driver); -} - -static void __exit realtek_cr_exit(void) -{ - usb_deregister(&realtek_cr_driver); -} - -module_init(realtek_cr_init); -module_exit(realtek_cr_exit); +module_usb_driver(realtek_cr_driver); diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c index bcb9a709d34..83ee49e737b 100644 --- a/drivers/usb/storage/sddr09.c +++ b/drivers/usb/storage/sddr09.c @@ -1789,15 +1789,4 @@ static struct usb_driver sddr09_driver = { .soft_unbind = 1, }; -static int __init sddr09_init(void) -{ - return usb_register(&sddr09_driver); -} - -static void __exit sddr09_exit(void) -{ - usb_deregister(&sddr09_driver); -} - -module_init(sddr09_init); -module_exit(sddr09_exit); +module_usb_driver(sddr09_driver); diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c index 44dfed7754e..8983ec2ffb5 100644 --- a/drivers/usb/storage/sddr55.c +++ b/drivers/usb/storage/sddr55.c @@ -1008,15 +1008,4 @@ static struct usb_driver sddr55_driver = { .soft_unbind = 1, }; -static int __init sddr55_init(void) -{ - return usb_register(&sddr55_driver); -} - -static void __exit sddr55_exit(void) -{ - usb_deregister(&sddr55_driver); -} - -module_init(sddr55_init); -module_exit(sddr55_exit); +module_usb_driver(sddr55_driver); diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c index 0b00091d2ae..a4c02751af4 100644 --- a/drivers/usb/storage/shuttle_usbat.c +++ b/drivers/usb/storage/shuttle_usbat.c @@ -1865,15 +1865,4 @@ static struct usb_driver usbat_driver = { .soft_unbind = 1, }; -static int __init usbat_init(void) -{ - return usb_register(&usbat_driver); -} - -static void __exit usbat_exit(void) -{ - usb_deregister(&usbat_driver); -} - -module_init(usbat_init); -module_exit(usbat_exit); +module_usb_driver(usbat_driver); diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 1d10d5b8204..a33ead5dce2 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -760,18 +760,7 @@ static struct usb_driver uas_driver = { .id_table = uas_usb_ids, }; -static int uas_init(void) -{ - return usb_register(&uas_driver); -} - -static void uas_exit(void) -{ - usb_deregister(&uas_driver); -} - -module_init(uas_init); -module_exit(uas_exit); +module_usb_driver(uas_driver); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Matthew Wilcox and Sarah Sharp"); diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c index 32d6fc95390..5c6c1bdbd45 100644 --- a/drivers/usb/usb-skeleton.c +++ b/drivers/usb/usb-skeleton.c @@ -688,25 +688,6 @@ static struct usb_driver skel_driver = { .supports_autosuspend = 1, }; -static int __init usb_skel_init(void) -{ - int result; - - /* register this driver with the USB subsystem */ - result = usb_register(&skel_driver); - if (result) - err("usb_register failed. Error number %d", result); - - return result; -} - -static void __exit usb_skel_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&skel_driver); -} - -module_init(usb_skel_init); -module_exit(usb_skel_exit); +module_usb_driver(skel_driver); MODULE_LICENSE("GPL"); diff --git a/drivers/usb/wusbcore/cbaf.c b/drivers/usb/wusbcore/cbaf.c index 200fd7c6c7d..7f78f300f8f 100644 --- a/drivers/usb/wusbcore/cbaf.c +++ b/drivers/usb/wusbcore/cbaf.c @@ -655,17 +655,7 @@ static struct usb_driver cbaf_driver = { .disconnect = cbaf_disconnect, }; -static int __init cbaf_driver_init(void) -{ - return usb_register(&cbaf_driver); -} -module_init(cbaf_driver_init); - -static void __exit cbaf_driver_exit(void) -{ - usb_deregister(&cbaf_driver); -} -module_exit(cbaf_driver_exit); +module_usb_driver(cbaf_driver); MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>"); MODULE_DESCRIPTION("Wireless USB Cable Based Association"); diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c index 2babcd4fbfc..66797e9c501 100644 --- a/drivers/uwb/hwa-rc.c +++ b/drivers/uwb/hwa-rc.c @@ -914,17 +914,7 @@ static struct usb_driver hwarc_driver = { .post_reset = hwarc_post_reset, }; -static int __init hwarc_driver_init(void) -{ - return usb_register(&hwarc_driver); -} -module_init(hwarc_driver_init); - -static void __exit hwarc_driver_exit(void) -{ - usb_deregister(&hwarc_driver); -} -module_exit(hwarc_driver_exit); +module_usb_driver(hwarc_driver); MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>"); MODULE_DESCRIPTION("Host Wireless Adapter Radio Control Driver"); diff --git a/drivers/uwb/i1480/dfu/usb.c b/drivers/uwb/i1480/dfu/usb.c index ba8664328af..c8f684833d5 100644 --- a/drivers/uwb/i1480/dfu/usb.c +++ b/drivers/uwb/i1480/dfu/usb.c @@ -451,25 +451,7 @@ static struct usb_driver i1480_dfu_driver = { .disconnect = NULL, }; - -/* - * Initialize the i1480 DFU driver. - * - * We also need to register our function for guessing event sizes. - */ -static int __init i1480_dfu_driver_init(void) -{ - return usb_register(&i1480_dfu_driver); -} -module_init(i1480_dfu_driver_init); - - -static void __exit i1480_dfu_driver_exit(void) -{ - usb_deregister(&i1480_dfu_driver); -} -module_exit(i1480_dfu_driver_exit); - +module_usb_driver(i1480_dfu_driver); MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>"); MODULE_DESCRIPTION("Intel Wireless UWB Link 1480 firmware uploader for USB"); diff --git a/drivers/video/smscufx.c b/drivers/video/smscufx.c index aaccffac67a..3c22994ea31 100644 --- a/drivers/video/smscufx.c +++ b/drivers/video/smscufx.c @@ -1792,24 +1792,7 @@ static struct usb_driver ufx_driver = { .id_table = id_table, }; -static int __init ufx_module_init(void) -{ - int res; - - res = usb_register(&ufx_driver); - if (res) - err("usb_register failed. Error number %d", res); - - return res; -} - -static void __exit ufx_module_exit(void) -{ - usb_deregister(&ufx_driver); -} - -module_init(ufx_module_init); -module_exit(ufx_module_exit); +module_usb_driver(ufx_driver); static void ufx_urb_completion(struct urb *urb) { diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c index 3473e75ce78..1f868d0187a 100644 --- a/drivers/video/udlfb.c +++ b/drivers/video/udlfb.c @@ -1761,24 +1761,7 @@ static struct usb_driver dlfb_driver = { .id_table = id_table, }; -static int __init dlfb_module_init(void) -{ - int res; - - res = usb_register(&dlfb_driver); - if (res) - err("usb_register failed. Error number %d", res); - - return res; -} - -static void __exit dlfb_module_exit(void) -{ - usb_deregister(&dlfb_driver); -} - -module_init(dlfb_module_init); -module_exit(dlfb_module_exit); +module_usb_driver(dlfb_driver); static void dlfb_urb_completion(struct urb *urb) { diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c index b5abaae38e9..4f7e1d770f8 100644 --- a/drivers/w1/masters/ds2490.c +++ b/drivers/w1/masters/ds2490.c @@ -1002,26 +1002,7 @@ static void ds_disconnect(struct usb_interface *intf) kfree(dev); } -static int ds_init(void) -{ - int err; - - err = usb_register(&ds_driver); - if (err) { - printk(KERN_INFO "Failed to register DS9490R USB device: err=%d.\n", err); - return err; - } - - return 0; -} - -static void ds_fini(void) -{ - usb_deregister(&ds_driver); -} - -module_init(ds_init); -module_exit(ds_fini); +module_usb_driver(ds_driver); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Evgeniy Polyakov <zbr@ioremap.net>"); diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c index a1ef9b5b38c..ff29ae747ee 100644 --- a/drivers/w1/slaves/w1_therm.c +++ b/drivers/w1/slaves/w1_therm.c @@ -175,11 +175,13 @@ static ssize_t w1_therm_read(struct device *device, { struct w1_slave *sl = dev_to_w1_slave(device); struct w1_master *dev = sl->master; - u8 rom[9], crc, verdict; + u8 rom[9], crc, verdict, external_power; int i, max_trying = 10; ssize_t c = PAGE_SIZE; - mutex_lock(&dev->mutex); + i = mutex_lock_interruptible(&dev->mutex); + if (i != 0) + return i; memset(rom, 0, sizeof(rom)); @@ -190,13 +192,37 @@ static ssize_t w1_therm_read(struct device *device, if (!w1_reset_select_slave(sl)) { int count = 0; unsigned int tm = 750; + unsigned long sleep_rem; + + w1_write_8(dev, W1_READ_PSUPPLY); + external_power = w1_read_8(dev); + + if (w1_reset_select_slave(sl)) + continue; /* 750ms strong pullup (or delay) after the convert */ - if (w1_strong_pullup) + if (!external_power && w1_strong_pullup) w1_next_pullup(dev, tm); + w1_write_8(dev, W1_CONVERT_TEMP); - if (!w1_strong_pullup) - msleep(tm); + + if (external_power) { + mutex_unlock(&dev->mutex); + + sleep_rem = msleep_interruptible(tm); + if (sleep_rem != 0) + return -EINTR; + + i = mutex_lock_interruptible(&dev->mutex); + if (i != 0) + return i; + } else if (!w1_strong_pullup) { + sleep_rem = msleep_interruptible(tm); + if (sleep_rem != 0) { + mutex_unlock(&dev->mutex); + return -EINTR; + } + } if (!w1_reset_select_slave(sl)) { diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index c3749782385..9761950697b 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c @@ -892,6 +892,16 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb break; } + /* Do fast search on single slave bus */ + if (dev->max_slave_count == 1) { + w1_write_8(dev, W1_READ_ROM); + + if (w1_read_block(dev, (u8 *)&rn, 8) == 8 && rn) + cb(dev, rn); + + break; + } + /* Start the search */ w1_write_8(dev, search_type); for (i = 0; i < 64; ++i) { diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c index 748a74bd85e..d8de1ddd176 100644 --- a/drivers/watchdog/pcwd_usb.c +++ b/drivers/watchdog/pcwd_usb.c @@ -827,37 +827,4 @@ static void usb_pcwd_disconnect(struct usb_interface *interface) printk(KERN_INFO PFX "USB PC Watchdog disconnected\n"); } - - -/** - * usb_pcwd_init - */ -static int __init usb_pcwd_init(void) -{ - int result; - - /* register this driver with the USB subsystem */ - result = usb_register(&usb_pcwd_driver); - if (result) { - printk(KERN_ERR PFX "usb_register failed. Error number %d\n", - result); - return result; - } - - printk(KERN_INFO PFX DRIVER_DESC " v" DRIVER_VERSION "\n"); - return 0; -} - - -/** - * usb_pcwd_exit - */ -static void __exit usb_pcwd_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&usb_pcwd_driver); -} - - -module_init(usb_pcwd_init); -module_exit(usb_pcwd_exit); +module_usb_driver(usb_pcwd_driver); diff --git a/drivers/xen/xen-balloon.c b/drivers/xen/xen-balloon.c index 9cc2259c999..3832e303c33 100644 --- a/drivers/xen/xen-balloon.c +++ b/drivers/xen/xen-balloon.c @@ -32,7 +32,6 @@ #include <linux/kernel.h> #include <linux/module.h> -#include <linux/sysdev.h> #include <linux/capability.h> #include <xen/xen.h> @@ -46,9 +45,9 @@ #define BALLOON_CLASS_NAME "xen_memory" -static struct sys_device balloon_sysdev; +static struct device balloon_dev; -static int register_balloon(struct sys_device *sysdev); +static int register_balloon(struct device *dev); /* React to a change in the target key */ static void watch_target(struct xenbus_watch *watch, @@ -98,9 +97,9 @@ static int __init balloon_init(void) pr_info("xen-balloon: Initialising balloon driver.\n"); - register_balloon(&balloon_sysdev); + register_balloon(&balloon_dev); - register_xen_selfballooning(&balloon_sysdev); + register_xen_selfballooning(&balloon_dev); register_xenstore_notifier(&xenstore_notifier); @@ -117,31 +116,31 @@ static void balloon_exit(void) module_exit(balloon_exit); #define BALLOON_SHOW(name, format, args...) \ - static ssize_t show_##name(struct sys_device *dev, \ - struct sysdev_attribute *attr, \ + static ssize_t show_##name(struct device *dev, \ + struct device_attribute *attr, \ char *buf) \ { \ return sprintf(buf, format, ##args); \ } \ - static SYSDEV_ATTR(name, S_IRUGO, show_##name, NULL) + static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL) BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages)); BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_low)); BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_high)); -static SYSDEV_ULONG_ATTR(schedule_delay, 0444, balloon_stats.schedule_delay); -static SYSDEV_ULONG_ATTR(max_schedule_delay, 0644, balloon_stats.max_schedule_delay); -static SYSDEV_ULONG_ATTR(retry_count, 0444, balloon_stats.retry_count); -static SYSDEV_ULONG_ATTR(max_retry_count, 0644, balloon_stats.max_retry_count); +static DEVICE_ULONG_ATTR(schedule_delay, 0444, balloon_stats.schedule_delay); +static DEVICE_ULONG_ATTR(max_schedule_delay, 0644, balloon_stats.max_schedule_delay); +static DEVICE_ULONG_ATTR(retry_count, 0444, balloon_stats.retry_count); +static DEVICE_ULONG_ATTR(max_retry_count, 0644, balloon_stats.max_retry_count); -static ssize_t show_target_kb(struct sys_device *dev, struct sysdev_attribute *attr, +static ssize_t show_target_kb(struct device *dev, struct device_attribute *attr, char *buf) { return sprintf(buf, "%lu\n", PAGES2KB(balloon_stats.target_pages)); } -static ssize_t store_target_kb(struct sys_device *dev, - struct sysdev_attribute *attr, +static ssize_t store_target_kb(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { @@ -158,11 +157,11 @@ static ssize_t store_target_kb(struct sys_device *dev, return count; } -static SYSDEV_ATTR(target_kb, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(target_kb, S_IRUGO | S_IWUSR, show_target_kb, store_target_kb); -static ssize_t show_target(struct sys_device *dev, struct sysdev_attribute *attr, +static ssize_t show_target(struct device *dev, struct device_attribute *attr, char *buf) { return sprintf(buf, "%llu\n", @@ -170,8 +169,8 @@ static ssize_t show_target(struct sys_device *dev, struct sysdev_attribute *attr << PAGE_SHIFT); } -static ssize_t store_target(struct sys_device *dev, - struct sysdev_attribute *attr, +static ssize_t store_target(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { @@ -188,23 +187,23 @@ static ssize_t store_target(struct sys_device *dev, return count; } -static SYSDEV_ATTR(target, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(target, S_IRUGO | S_IWUSR, show_target, store_target); -static struct sysdev_attribute *balloon_attrs[] = { - &attr_target_kb, - &attr_target, - &attr_schedule_delay.attr, - &attr_max_schedule_delay.attr, - &attr_retry_count.attr, - &attr_max_retry_count.attr +static struct device_attribute *balloon_attrs[] = { + &dev_attr_target_kb, + &dev_attr_target, + &dev_attr_schedule_delay.attr, + &dev_attr_max_schedule_delay.attr, + &dev_attr_retry_count.attr, + &dev_attr_max_retry_count.attr }; static struct attribute *balloon_info_attrs[] = { - &attr_current_kb.attr, - &attr_low_kb.attr, - &attr_high_kb.attr, + &dev_attr_current_kb.attr, + &dev_attr_low_kb.attr, + &dev_attr_high_kb.attr, NULL }; @@ -213,34 +212,35 @@ static struct attribute_group balloon_info_group = { .attrs = balloon_info_attrs }; -static struct sysdev_class balloon_sysdev_class = { - .name = BALLOON_CLASS_NAME +static struct bus_type balloon_subsys = { + .name = BALLOON_CLASS_NAME, + .dev_name = BALLOON_CLASS_NAME, }; -static int register_balloon(struct sys_device *sysdev) +static int register_balloon(struct device *dev) { int i, error; - error = sysdev_class_register(&balloon_sysdev_class); + error = bus_register(&balloon_subsys); if (error) return error; - sysdev->id = 0; - sysdev->cls = &balloon_sysdev_class; + dev->id = 0; + dev->bus = &balloon_subsys; - error = sysdev_register(sysdev); + error = device_register(dev); if (error) { - sysdev_class_unregister(&balloon_sysdev_class); + bus_unregister(&balloon_subsys); return error; } for (i = 0; i < ARRAY_SIZE(balloon_attrs); i++) { - error = sysdev_create_file(sysdev, balloon_attrs[i]); + error = device_create_file(dev, balloon_attrs[i]); if (error) goto fail; } - error = sysfs_create_group(&sysdev->kobj, &balloon_info_group); + error = sysfs_create_group(&dev->kobj, &balloon_info_group); if (error) goto fail; @@ -248,9 +248,9 @@ static int register_balloon(struct sys_device *sysdev) fail: while (--i >= 0) - sysdev_remove_file(sysdev, balloon_attrs[i]); - sysdev_unregister(sysdev); - sysdev_class_unregister(&balloon_sysdev_class); + device_remove_file(dev, balloon_attrs[i]); + device_unregister(dev); + bus_unregister(&balloon_subsys); return error; } diff --git a/drivers/xen/xen-selfballoon.c b/drivers/xen/xen-selfballoon.c index d93c70857e0..b7b9e95f871 100644 --- a/drivers/xen/xen-selfballoon.c +++ b/drivers/xen/xen-selfballoon.c @@ -266,21 +266,20 @@ static void selfballoon_process(struct work_struct *work) #ifdef CONFIG_SYSFS -#include <linux/sysdev.h> #include <linux/capability.h> #define SELFBALLOON_SHOW(name, format, args...) \ - static ssize_t show_##name(struct sys_device *dev, \ - struct sysdev_attribute *attr, \ - char *buf) \ + static ssize_t show_##name(struct device *dev, \ + struct device_attribute *attr, \ + char *buf) \ { \ return sprintf(buf, format, ##args); \ } SELFBALLOON_SHOW(selfballooning, "%d\n", xen_selfballooning_enabled); -static ssize_t store_selfballooning(struct sys_device *dev, - struct sysdev_attribute *attr, +static ssize_t store_selfballooning(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { @@ -303,13 +302,13 @@ static ssize_t store_selfballooning(struct sys_device *dev, return count; } -static SYSDEV_ATTR(selfballooning, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(selfballooning, S_IRUGO | S_IWUSR, show_selfballooning, store_selfballooning); SELFBALLOON_SHOW(selfballoon_interval, "%d\n", selfballoon_interval); -static ssize_t store_selfballoon_interval(struct sys_device *dev, - struct sysdev_attribute *attr, +static ssize_t store_selfballoon_interval(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { @@ -325,13 +324,13 @@ static ssize_t store_selfballoon_interval(struct sys_device *dev, return count; } -static SYSDEV_ATTR(selfballoon_interval, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(selfballoon_interval, S_IRUGO | S_IWUSR, show_selfballoon_interval, store_selfballoon_interval); SELFBALLOON_SHOW(selfballoon_downhys, "%d\n", selfballoon_downhysteresis); -static ssize_t store_selfballoon_downhys(struct sys_device *dev, - struct sysdev_attribute *attr, +static ssize_t store_selfballoon_downhys(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { @@ -347,14 +346,14 @@ static ssize_t store_selfballoon_downhys(struct sys_device *dev, return count; } -static SYSDEV_ATTR(selfballoon_downhysteresis, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(selfballoon_downhysteresis, S_IRUGO | S_IWUSR, show_selfballoon_downhys, store_selfballoon_downhys); SELFBALLOON_SHOW(selfballoon_uphys, "%d\n", selfballoon_uphysteresis); -static ssize_t store_selfballoon_uphys(struct sys_device *dev, - struct sysdev_attribute *attr, +static ssize_t store_selfballoon_uphys(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { @@ -370,14 +369,14 @@ static ssize_t store_selfballoon_uphys(struct sys_device *dev, return count; } -static SYSDEV_ATTR(selfballoon_uphysteresis, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(selfballoon_uphysteresis, S_IRUGO | S_IWUSR, show_selfballoon_uphys, store_selfballoon_uphys); SELFBALLOON_SHOW(selfballoon_min_usable_mb, "%d\n", selfballoon_min_usable_mb); -static ssize_t store_selfballoon_min_usable_mb(struct sys_device *dev, - struct sysdev_attribute *attr, +static ssize_t store_selfballoon_min_usable_mb(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { @@ -393,7 +392,7 @@ static ssize_t store_selfballoon_min_usable_mb(struct sys_device *dev, return count; } -static SYSDEV_ATTR(selfballoon_min_usable_mb, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(selfballoon_min_usable_mb, S_IRUGO | S_IWUSR, show_selfballoon_min_usable_mb, store_selfballoon_min_usable_mb); @@ -401,8 +400,8 @@ static SYSDEV_ATTR(selfballoon_min_usable_mb, S_IRUGO | S_IWUSR, #ifdef CONFIG_FRONTSWAP SELFBALLOON_SHOW(frontswap_selfshrinking, "%d\n", frontswap_selfshrinking); -static ssize_t store_frontswap_selfshrinking(struct sys_device *dev, - struct sysdev_attribute *attr, +static ssize_t store_frontswap_selfshrinking(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { @@ -424,13 +423,13 @@ static ssize_t store_frontswap_selfshrinking(struct sys_device *dev, return count; } -static SYSDEV_ATTR(frontswap_selfshrinking, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(frontswap_selfshrinking, S_IRUGO | S_IWUSR, show_frontswap_selfshrinking, store_frontswap_selfshrinking); SELFBALLOON_SHOW(frontswap_inertia, "%d\n", frontswap_inertia); -static ssize_t store_frontswap_inertia(struct sys_device *dev, - struct sysdev_attribute *attr, +static ssize_t store_frontswap_inertia(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { @@ -447,13 +446,13 @@ static ssize_t store_frontswap_inertia(struct sys_device *dev, return count; } -static SYSDEV_ATTR(frontswap_inertia, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(frontswap_inertia, S_IRUGO | S_IWUSR, show_frontswap_inertia, store_frontswap_inertia); SELFBALLOON_SHOW(frontswap_hysteresis, "%d\n", frontswap_hysteresis); -static ssize_t store_frontswap_hysteresis(struct sys_device *dev, - struct sysdev_attribute *attr, +static ssize_t store_frontswap_hysteresis(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { @@ -469,21 +468,21 @@ static ssize_t store_frontswap_hysteresis(struct sys_device *dev, return count; } -static SYSDEV_ATTR(frontswap_hysteresis, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(frontswap_hysteresis, S_IRUGO | S_IWUSR, show_frontswap_hysteresis, store_frontswap_hysteresis); #endif /* CONFIG_FRONTSWAP */ static struct attribute *selfballoon_attrs[] = { - &attr_selfballooning.attr, - &attr_selfballoon_interval.attr, - &attr_selfballoon_downhysteresis.attr, - &attr_selfballoon_uphysteresis.attr, - &attr_selfballoon_min_usable_mb.attr, + &dev_attr_selfballooning.attr, + &dev_attr_selfballoon_interval.attr, + &dev_attr_selfballoon_downhysteresis.attr, + &dev_attr_selfballoon_uphysteresis.attr, + &dev_attr_selfballoon_min_usable_mb.attr, #ifdef CONFIG_FRONTSWAP - &attr_frontswap_selfshrinking.attr, - &attr_frontswap_hysteresis.attr, - &attr_frontswap_inertia.attr, + &dev_attr_frontswap_selfshrinking.attr, + &dev_attr_frontswap_hysteresis.attr, + &dev_attr_frontswap_inertia.attr, #endif NULL }; @@ -494,12 +493,12 @@ static struct attribute_group selfballoon_group = { }; #endif -int register_xen_selfballooning(struct sys_device *sysdev) +int register_xen_selfballooning(struct device *dev) { int error = -1; #ifdef CONFIG_SYSFS - error = sysfs_create_group(&sysdev->kobj, &selfballoon_group); + error = sysfs_create_group(&dev->kobj, &selfballoon_group); #endif return error; } diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 90f76575c05..989f07fb86f 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -15,9 +15,11 @@ #include <linux/module.h> #include <linux/fs.h> +#include <linux/seq_file.h> #include <linux/pagemap.h> #include <linux/namei.h> #include <linux/debugfs.h> +#include <linux/io.h> static ssize_t default_read_file(struct file *file, char __user *buf, size_t count, loff_t *ppos) @@ -525,3 +527,92 @@ struct dentry *debugfs_create_blob(const char *name, mode_t mode, return debugfs_create_file(name, mode, parent, blob, &fops_blob); } EXPORT_SYMBOL_GPL(debugfs_create_blob); + +/* + * The regset32 stuff is used to print 32-bit registers using the + * seq_file utilities. We offer printing a register set in an already-opened + * sequential file or create a debugfs file that only prints a regset32. + */ + +/** + * debugfs_print_regs32 - use seq_print to describe a set of registers + * @s: the seq_file structure being used to generate output + * @regs: an array if struct debugfs_reg32 structures + * @mregs: the length of the above array + * @base: the base address to be used in reading the registers + * @prefix: a string to be prefixed to every output line + * + * This function outputs a text block describing the current values of + * some 32-bit hardware registers. It is meant to be used within debugfs + * files based on seq_file that need to show registers, intermixed with other + * information. The prefix argument may be used to specify a leading string, + * because some peripherals have several blocks of identical registers, + * for example configuration of dma channels + */ +int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, + int nregs, void __iomem *base, char *prefix) +{ + int i, ret = 0; + + for (i = 0; i < nregs; i++, regs++) { + if (prefix) + ret += seq_printf(s, "%s", prefix); + ret += seq_printf(s, "%s = 0x%08x\n", regs->name, + readl(base + regs->offset)); + } + return ret; +} +EXPORT_SYMBOL_GPL(debugfs_print_regs32); + +static int debugfs_show_regset32(struct seq_file *s, void *data) +{ + struct debugfs_regset32 *regset = s->private; + + debugfs_print_regs32(s, regset->regs, regset->nregs, regset->base, ""); + return 0; +} + +static int debugfs_open_regset32(struct inode *inode, struct file *file) +{ + return single_open(file, debugfs_show_regset32, inode->i_private); +} + +static const struct file_operations fops_regset32 = { + .open = debugfs_open_regset32, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +/** + * debugfs_create_regset32 - create a debugfs file that returns register values + * @name: a pointer to a string containing the name of the file to create. + * @mode: the permission that the file should have + * @parent: a pointer to the parent dentry for this file. This should be a + * directory dentry if set. If this parameter is %NULL, then the + * file will be created in the root of the debugfs filesystem. + * @regset: a pointer to a struct debugfs_regset32, which contains a pointer + * to an array of register definitions, the array size and the base + * address where the register bank is to be found. + * + * This function creates a file in debugfs with the given name that reports + * the names and values of a set of 32-bit registers. If the @mode variable + * is so set it can be read from. Writing is not supported. + * + * This function will return a pointer to a dentry if it succeeds. This + * pointer must be passed to the debugfs_remove() function when the file is + * to be removed (no automatic cleanup happens if your module is unloaded, + * you are responsible here.) If an error occurs, %NULL will be returned. + * + * If debugfs is not enabled in the kernel, the value -%ENODEV will be + * returned. It is not wise to check for this value, but rather, check for + * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling + * code. + */ +struct dentry *debugfs_create_regset32(const char *name, mode_t mode, + struct dentry *parent, + struct debugfs_regset32 *regset) +{ + return debugfs_create_file(name, mode, parent, regset, &fops_regset32); +} +EXPORT_SYMBOL_GPL(debugfs_create_regset32); diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index e7d9b20ddc5..e8c3abc6081 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h @@ -16,6 +16,7 @@ #define _DEBUGFS_H_ #include <linux/fs.h> +#include <linux/seq_file.h> #include <linux/types.h> @@ -26,6 +27,17 @@ struct debugfs_blob_wrapper { unsigned long size; }; +struct debugfs_reg32 { + char *name; + unsigned long offset; +}; + +struct debugfs_regset32 { + struct debugfs_reg32 *regs; + int nregs; + void __iomem *base; +}; + extern struct dentry *arch_debugfs_dir; #if defined(CONFIG_DEBUG_FS) @@ -74,6 +86,13 @@ struct dentry *debugfs_create_blob(const char *name, mode_t mode, struct dentry *parent, struct debugfs_blob_wrapper *blob); +struct dentry *debugfs_create_regset32(const char *name, mode_t mode, + struct dentry *parent, + struct debugfs_regset32 *regset); + +int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, + int nregs, void __iomem *base, char *prefix); + bool debugfs_initialized(void); #else @@ -188,6 +207,13 @@ static inline struct dentry *debugfs_create_blob(const char *name, mode_t mode, return ERR_PTR(-ENODEV); } +static inline struct dentry *debugfs_create_regset32(const char *name, + mode_t mode, struct dentry *parent, + struct debugfs_regset32 *regset) +{ + return ERR_PTR(-ENODEV); +} + static inline bool debugfs_initialized(void) { return false; diff --git a/include/linux/device.h b/include/linux/device.h index 3136ede5a1e..6e8de1e18ed 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 *); * struct bus_type - The bus type of the device * * @name: The name of the bus. + * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id). + * @dev_root: Default device to use as the parent. * @bus_attrs: Default attributes of the bus. * @dev_attrs: Default attributes of the devices on the bus. * @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 *); */ struct bus_type { const char *name; + const char *dev_name; + struct device *dev_root; struct bus_attribute *bus_attrs; struct device_attribute *dev_attrs; struct driver_attribute *drv_attrs; @@ -106,12 +110,30 @@ struct bus_type { struct subsys_private *p; }; -extern int __must_check bus_register(struct bus_type *bus); +/* This is a #define to keep the compiler from merging different + * instances of the __key variable */ +#define bus_register(subsys) \ +({ \ + static struct lock_class_key __key; \ + __bus_register(subsys, &__key); \ +}) +extern int __must_check __bus_register(struct bus_type *bus, + struct lock_class_key *key); extern void bus_unregister(struct bus_type *bus); extern int __must_check bus_rescan_devices(struct bus_type *bus); /* iterator helpers for buses */ +struct subsys_dev_iter { + struct klist_iter ki; + const struct device_type *type; +}; +void subsys_dev_iter_init(struct subsys_dev_iter *iter, + struct bus_type *subsys, + struct device *start, + const struct device_type *type); +struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); +void subsys_dev_iter_exit(struct subsys_dev_iter *iter); int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, int (*fn)(struct device *dev, void *data)); @@ -121,10 +143,10 @@ struct device *bus_find_device(struct bus_type *bus, struct device *start, struct device *bus_find_device_by_name(struct bus_type *bus, struct device *start, const char *name); - +struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id, + struct device *hint); int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, void *data, int (*fn)(struct device_driver *, void *)); - void bus_sort_breadthfirst(struct bus_type *bus, int (*compare)(const struct device *a, const struct device *b)); @@ -256,6 +278,33 @@ struct device *driver_find_device(struct device_driver *drv, int (*match)(struct device *dev, void *data)); /** + * struct subsys_interface - interfaces to device functions + * @name name of the device function + * @subsystem subsytem of the devices to attach to + * @node the list of functions registered at the subsystem + * @add device hookup to device function handler + * @remove device hookup to device function handler + * + * Simple interfaces attached to a subsystem. Multiple interfaces can + * attach to a subsystem and its devices. Unlike drivers, they do not + * exclusively claim or control devices. Interfaces usually represent + * a specific functionality of a subsystem/class of devices. + */ +struct subsys_interface { + const char *name; + struct bus_type *subsys; + struct list_head node; + int (*add_dev)(struct device *dev, struct subsys_interface *sif); + int (*remove_dev)(struct device *dev, struct subsys_interface *sif); +}; + +int subsys_interface_register(struct subsys_interface *sif); +void subsys_interface_unregister(struct subsys_interface *sif); + +int subsys_system_register(struct bus_type *subsys, + const struct attribute_group **groups); + +/** * struct class - device classes * @name: Name of the class. * @owner: The module owner. @@ -438,8 +487,28 @@ struct device_attribute { const char *buf, size_t count); }; +struct dev_ext_attribute { + struct device_attribute attr; + void *var; +}; + +ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr, + char *buf); +ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count); +ssize_t device_show_int(struct device *dev, struct device_attribute *attr, + char *buf); +ssize_t device_store_int(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count); + #define DEVICE_ATTR(_name, _mode, _show, _store) \ -struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) + struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) +#define DEVICE_ULONG_ATTR(_name, _mode, _var) \ + struct dev_ext_attribute dev_attr_##_name = \ + { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } +#define DEVICE_INT_ATTR(_name, _mode, _var) \ + struct dev_ext_attribute dev_attr_##_name = \ + { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } extern int __must_check device_create_file(struct device *device, const struct device_attribute *entry); @@ -490,6 +559,9 @@ extern int devres_release_group(struct device *dev, void *id); extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); extern void devm_kfree(struct device *dev, void *p); +void __iomem *devm_request_and_ioremap(struct device *dev, + struct resource *res); + struct device_dma_parameters { /* * a low level driver may set these to teach IOMMU code about @@ -600,6 +672,7 @@ struct device { struct device_node *of_node; /* associated device tree node */ dev_t devt; /* dev_t, creates the sysfs "dev" */ + u32 id; /* device instance */ spinlock_t devres_lock; struct list_head devres_head; @@ -924,4 +997,25 @@ extern long sysfs_deprecated; #define sysfs_deprecated 0 #endif +/** + * module_driver() - Helper macro for drivers that don't do anything + * special in module init/exit. This eliminates a lot of boilerplate. + * Each module may only use this macro once, and calling it replaces + * module_init() and module_exit(). + * + * Use this macro to construct bus specific macros for registering + * drivers, and do not use it on its own. + */ +#define module_driver(__driver, __register, __unregister) \ +static int __init __driver##_init(void) \ +{ \ + return __register(&(__driver)); \ +} \ +module_init(__driver##_init); \ +static void __exit __driver##_exit(void) \ +{ \ + __unregister(&(__driver)); \ +} \ +module_exit(__driver##_exit); + #endif /* _DEVICE_H_ */ diff --git a/include/linux/edac.h b/include/linux/edac.h index 055b248bdd5..1cd3947987e 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h @@ -13,7 +13,7 @@ #define _LINUX_EDAC_H_ #include <linux/atomic.h> -#include <linux/sysdev.h> +#include <linux/device.h> #define EDAC_OPSTATE_INVAL -1 #define EDAC_OPSTATE_POLL 0 @@ -23,12 +23,12 @@ extern int edac_op_state; extern int edac_err_assert; extern atomic_t edac_handlers; -extern struct sysdev_class edac_class; +extern struct bus_type edac_subsys; extern int edac_handler_set(void); extern void edac_atomic_assert_error(void); -extern struct sysdev_class *edac_get_sysfs_class(void); -extern void edac_put_sysfs_class(void); +extern struct bus_type *edac_get_sysfs_subsys(void); +extern void edac_put_sysfs_subsys(void); static inline void opstate_init(void) { diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 07d103a06d6..8e25a9167f1 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) { return adap->nr; } + +/** + * module_i2c_driver() - Helper macro for registering a I2C driver + * @__i2c_driver: i2c_driver struct + * + * Helper macro for I2C drivers which do not do anything special in module + * init/exit. This eliminates a lot of boilerplate. Each module may only + * use this macro once, and calling it replaces module_init() and module_exit() + */ +#define module_i2c_driver(__i2c_driver) \ + module_driver(__i2c_driver, i2c_add_driver, \ + i2c_del_driver) + #endif /* I2C */ #endif /* __KERNEL__ */ diff --git a/include/linux/kref.h b/include/linux/kref.h index d4a62ab2ee5..abc0120b09b 100644 --- a/include/linux/kref.h +++ b/include/linux/kref.h @@ -15,16 +15,81 @@ #ifndef _KREF_H_ #define _KREF_H_ -#include <linux/types.h> +#include <linux/bug.h> +#include <linux/atomic.h> struct kref { atomic_t refcount; }; -void kref_init(struct kref *kref); -void kref_get(struct kref *kref); -int kref_put(struct kref *kref, void (*release) (struct kref *kref)); -int kref_sub(struct kref *kref, unsigned int count, - void (*release) (struct kref *kref)); +/** + * kref_init - initialize object. + * @kref: object in question. + */ +static inline void kref_init(struct kref *kref) +{ + atomic_set(&kref->refcount, 1); +} + +/** + * kref_get - increment refcount for object. + * @kref: object. + */ +static inline void kref_get(struct kref *kref) +{ + WARN_ON(!atomic_read(&kref->refcount)); + atomic_inc(&kref->refcount); +} +/** + * kref_sub - subtract a number of refcounts for object. + * @kref: object. + * @count: Number of recounts to subtract. + * @release: pointer to the function that will clean up the object when the + * last reference to the object is released. + * This pointer is required, and it is not acceptable to pass kfree + * in as this function. If the caller does pass kfree to this + * function, you will be publicly mocked mercilessly by the kref + * maintainer, and anyone else who happens to notice it. You have + * been warned. + * + * Subtract @count from the refcount, and if 0, call release(). + * Return 1 if the object was removed, otherwise return 0. Beware, if this + * function returns 0, you still can not count on the kref from remaining in + * memory. Only use the return value if you want to see if the kref is now + * gone, not present. + */ +static inline int kref_sub(struct kref *kref, unsigned int count, + void (*release)(struct kref *kref)) +{ + WARN_ON(release == NULL); + + if (atomic_sub_and_test((int) count, &kref->refcount)) { + release(kref); + return 1; + } + return 0; +} + +/** + * kref_put - decrement refcount for object. + * @kref: object. + * @release: pointer to the function that will clean up the object when the + * last reference to the object is released. + * This pointer is required, and it is not acceptable to pass kfree + * in as this function. If the caller does pass kfree to this + * function, you will be publicly mocked mercilessly by the kref + * maintainer, and anyone else who happens to notice it. You have + * been warned. + * + * Decrement the refcount, and if 0, call release(). + * Return 1 if the object was removed, otherwise return 0. Beware, if this + * function returns 0, you still can not count on the kref from remaining in + * memory. Only use the return value if you want to see if the kref is now + * gone, not present. + */ +static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref)) +{ + return kref_sub(kref, 1, release); +} #endif /* _KREF_H_ */ diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 2a23f7d1a82..5622fa24e97 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -63,7 +63,7 @@ struct platform_device_info { u64 dma_mask; }; extern struct platform_device *platform_device_register_full( - struct platform_device_info *pdevinfo); + const struct platform_device_info *pdevinfo); /** * 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 * calling it replaces module_init() and module_exit() */ #define module_platform_driver(__platform_driver) \ -static int __init __platform_driver##_init(void) \ -{ \ - return platform_driver_register(&(__platform_driver)); \ -} \ -module_init(__platform_driver##_init); \ -static void __exit __platform_driver##_exit(void) \ -{ \ - platform_driver_unregister(&(__platform_driver)); \ -} \ -module_exit(__platform_driver##_exit); + module_driver(__platform_driver, platform_driver_register, \ + platform_driver_unregister) extern struct platform_device *platform_create_bundle(struct platform_driver *driver, int (*probe)(struct platform_device *), diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index bb4f5fbbbd8..176fce9cc6b 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) driver_unregister(&sdrv->driver); } +/** + * module_spi_driver() - Helper macro for registering a SPI driver + * @__spi_driver: spi_driver struct + * + * Helper macro for SPI drivers which do not do anything special in module + * init/exit. This eliminates a lot of boilerplate. Each module may only + * use this macro once, and calling it replaces module_init() and module_exit() + */ +#define module_spi_driver(__spi_driver) \ + module_driver(__spi_driver, spi_register_driver, \ + spi_unregister_driver) /** * struct spi_master - interface to SPI master controller diff --git a/include/linux/usb.h b/include/linux/usb.h index d3d0c137433..5d258c3180a 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 *, extern void usb_deregister(struct usb_driver *); +/** + * module_usb_driver() - Helper macro for registering a USB driver + * @__usb_driver: usb_driver struct + * + * Helper macro for USB drivers which do not do anything special in module + * init/exit. This eliminates a lot of boilerplate. Each module may only + * use this macro once, and calling it replaces module_init() and module_exit() + */ +#define module_usb_driver(__usb_driver) \ + module_driver(__usb_driver, usb_register, \ + usb_deregister) + extern int usb_register_device_driver(struct usb_device_driver *, struct module *); extern void usb_deregister_device_driver(struct usb_device_driver *); diff --git a/include/xen/balloon.h b/include/xen/balloon.h index d29c153705b..cc2e1a7e44e 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, bool highmem); void free_xenballooned_pages(int nr_pages, struct page **pages); -struct sys_device; +struct device; #ifdef CONFIG_XEN_SELFBALLOONING -extern int register_xen_selfballooning(struct sys_device *sysdev); +extern int register_xen_selfballooning(struct device *dev); #else -static inline int register_xen_selfballooning(struct sys_device *sysdev) +static inline int register_xen_selfballooning(struct device *dev) { return -ENOSYS; } diff --git a/kernel/rtmutex-tester.c b/kernel/rtmutex-tester.c index 3d9f31cd79e..98ec4947546 100644 --- a/kernel/rtmutex-tester.c +++ b/kernel/rtmutex-tester.c @@ -6,11 +6,11 @@ * Copyright (C) 2006, Timesys Corp., Thomas Gleixner <tglx@timesys.com> * */ +#include <linux/device.h> #include <linux/kthread.h> #include <linux/export.h> #include <linux/sched.h> #include <linux/spinlock.h> -#include <linux/sysdev.h> #include <linux/timer.h> #include <linux/freezer.h> @@ -27,7 +27,7 @@ struct test_thread_data { int opdata; int mutexes[MAX_RT_TEST_MUTEXES]; int event; - struct sys_device sysdev; + struct device dev; }; static struct test_thread_data thread_data[MAX_RT_TEST_THREADS]; @@ -271,7 +271,7 @@ static int test_func(void *data) * * opcode:data */ -static ssize_t sysfs_test_command(struct sys_device *dev, struct sysdev_attribute *attr, +static ssize_t sysfs_test_command(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct sched_param schedpar; @@ -279,8 +279,8 @@ static ssize_t sysfs_test_command(struct sys_device *dev, struct sysdev_attribut char cmdbuf[32]; int op, dat, tid, ret; - td = container_of(dev, struct test_thread_data, sysdev); - tid = td->sysdev.id; + td = container_of(dev, struct test_thread_data, dev); + tid = td->dev.id; /* strings from sysfs write are not 0 terminated! */ if (count >= sizeof(cmdbuf)) @@ -334,7 +334,7 @@ static ssize_t sysfs_test_command(struct sys_device *dev, struct sysdev_attribut * @dev: thread to query * @buf: char buffer to be filled with thread status info */ -static ssize_t sysfs_test_status(struct sys_device *dev, struct sysdev_attribute *attr, +static ssize_t sysfs_test_status(struct device *dev, struct device_attribute *attr, char *buf) { struct test_thread_data *td; @@ -342,8 +342,8 @@ static ssize_t sysfs_test_status(struct sys_device *dev, struct sysdev_attribute char *curr = buf; int i; - td = container_of(dev, struct test_thread_data, sysdev); - tsk = threads[td->sysdev.id]; + td = container_of(dev, struct test_thread_data, dev); + tsk = threads[td->dev.id]; spin_lock(&rttest_lock); @@ -360,28 +360,29 @@ static ssize_t sysfs_test_status(struct sys_device *dev, struct sysdev_attribute spin_unlock(&rttest_lock); curr += sprintf(curr, ", T: %p, R: %p\n", tsk, - mutexes[td->sysdev.id].owner); + mutexes[td->dev.id].owner); return curr - buf; } -static SYSDEV_ATTR(status, 0600, sysfs_test_status, NULL); -static SYSDEV_ATTR(command, 0600, NULL, sysfs_test_command); +static DEVICE_ATTR(status, 0600, sysfs_test_status, NULL); +static DEVICE_ATTR(command, 0600, NULL, sysfs_test_command); -static struct sysdev_class rttest_sysclass = { +static struct bus_type rttest_subsys = { .name = "rttest", + .dev_name = "rttest", }; static int init_test_thread(int id) { - thread_data[id].sysdev.cls = &rttest_sysclass; - thread_data[id].sysdev.id = id; + thread_data[id].dev.bus = &rttest_subsys; + thread_data[id].dev.id = id; threads[id] = kthread_run(test_func, &thread_data[id], "rt-test-%d", id); if (IS_ERR(threads[id])) return PTR_ERR(threads[id]); - return sysdev_register(&thread_data[id].sysdev); + return device_register(&thread_data[id].dev); } static int init_rttest(void) @@ -393,7 +394,7 @@ static int init_rttest(void) for (i = 0; i < MAX_RT_TEST_MUTEXES; i++) rt_mutex_init(&mutexes[i]); - ret = sysdev_class_register(&rttest_sysclass); + ret = subsys_system_register(&rttest_subsys, NULL); if (ret) return ret; @@ -401,10 +402,10 @@ static int init_rttest(void) ret = init_test_thread(i); if (ret) break; - ret = sysdev_create_file(&thread_data[i].sysdev, &attr_status); + ret = device_create_file(&thread_data[i].dev, &dev_attr_status); if (ret) break; - ret = sysdev_create_file(&thread_data[i].sysdev, &attr_command); + ret = device_create_file(&thread_data[i].dev, &dev_attr_command); if (ret) break; } diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index cf52fda2e09..3f5c8512c03 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -23,8 +23,8 @@ * o Allow clocksource drivers to be unregistered */ +#include <linux/device.h> #include <linux/clocksource.h> -#include <linux/sysdev.h> #include <linux/init.h> #include <linux/module.h> #include <linux/sched.h> /* for spin_unlock_irq() using preempt_count() m68k */ @@ -754,8 +754,8 @@ EXPORT_SYMBOL(clocksource_unregister); * Provides sysfs interface for listing current clocksource. */ static ssize_t -sysfs_show_current_clocksources(struct sys_device *dev, - struct sysdev_attribute *attr, char *buf) +sysfs_show_current_clocksources(struct device *dev, + struct device_attribute *attr, char *buf) { ssize_t count = 0; @@ -775,8 +775,8 @@ sysfs_show_current_clocksources(struct sys_device *dev, * Takes input from sysfs interface for manually overriding the default * clocksource selection. */ -static ssize_t sysfs_override_clocksource(struct sys_device *dev, - struct sysdev_attribute *attr, +static ssize_t sysfs_override_clocksource(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { size_t ret = count; @@ -809,8 +809,8 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev, * Provides sysfs interface for listing registered clocksources */ static ssize_t -sysfs_show_available_clocksources(struct sys_device *dev, - struct sysdev_attribute *attr, +sysfs_show_available_clocksources(struct device *dev, + struct device_attribute *attr, char *buf) { struct clocksource *src; @@ -839,35 +839,36 @@ sysfs_show_available_clocksources(struct sys_device *dev, /* * Sysfs setup bits: */ -static SYSDEV_ATTR(current_clocksource, 0644, sysfs_show_current_clocksources, +static DEVICE_ATTR(current_clocksource, 0644, sysfs_show_current_clocksources, sysfs_override_clocksource); -static SYSDEV_ATTR(available_clocksource, 0444, +static DEVICE_ATTR(available_clocksource, 0444, sysfs_show_available_clocksources, NULL); -static struct sysdev_class clocksource_sysclass = { +static struct bus_type clocksource_subsys = { .name = "clocksource", + .dev_name = "clocksource", }; -static struct sys_device device_clocksource = { +static struct device device_clocksource = { .id = 0, - .cls = &clocksource_sysclass, + .bus = &clocksource_subsys, }; static int __init init_clocksource_sysfs(void) { - int error = sysdev_class_register(&clocksource_sysclass); + int error = subsys_system_register(&clocksource_subsys, NULL); if (!error) - error = sysdev_register(&device_clocksource); + error = device_register(&device_clocksource); if (!error) - error = sysdev_create_file( + error = device_create_file( &device_clocksource, - &attr_current_clocksource); + &dev_attr_current_clocksource); if (!error) - error = sysdev_create_file( + error = device_create_file( &device_clocksource, - &attr_available_clocksource); + &dev_attr_available_clocksource); return error; } diff --git a/lib/Makefile b/lib/Makefile index a4da283f5dc..6f195ff6a1a 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -17,7 +17,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \ lib-$(CONFIG_MMU) += ioremap.o lib-$(CONFIG_SMP) += cpumask.o -lib-y += kobject.o kref.o klist.o +lib-y += kobject.o klist.o obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ diff --git a/lib/devres.c b/lib/devres.c index 7c0e953a748..4fbc09e6e9e 100644 --- a/lib/devres.c +++ b/lib/devres.c @@ -85,6 +85,57 @@ void devm_iounmap(struct device *dev, void __iomem *addr) } EXPORT_SYMBOL(devm_iounmap); +/** + * devm_request_and_ioremap() - Check, request region, and ioremap resource + * @dev: Generic device to handle the resource for + * @res: resource to be handled + * + * Takes all necessary steps to ioremap a mem resource. Uses managed device, so + * everything is undone on driver detach. Checks arguments, so you can feed + * it the result from e.g. platform_get_resource() directly. Returns the + * remapped pointer or NULL on error. Usage example: + * + * res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + * base = devm_request_and_ioremap(&pdev->dev, res); + * if (!base) + * return -EADDRNOTAVAIL; + */ +void __iomem *devm_request_and_ioremap(struct device *dev, + struct resource *res) +{ + resource_size_t size; + const char *name; + void __iomem *dest_ptr; + + BUG_ON(!dev); + + if (!res || resource_type(res) != IORESOURCE_MEM) { + dev_err(dev, "invalid resource\n"); + return NULL; + } + + size = resource_size(res); + name = res->name ?: dev_name(dev); + + if (!devm_request_mem_region(dev, res->start, size, name)) { + dev_err(dev, "can't request region for resource %pR\n", res); + return NULL; + } + + if (res->flags & IORESOURCE_CACHEABLE) + dest_ptr = devm_ioremap(dev, res->start, size); + else + dest_ptr = devm_ioremap_nocache(dev, res->start, size); + + if (!dest_ptr) { + dev_err(dev, "ioremap failed for resource %pR\n", res); + devm_release_mem_region(dev, res->start, size); + } + + return dest_ptr; +} +EXPORT_SYMBOL(devm_request_and_ioremap); + #ifdef CONFIG_HAS_IOPORT /* * Generic iomap devres @@ -348,5 +399,5 @@ void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask) } } EXPORT_SYMBOL(pcim_iounmap_regions); -#endif -#endif +#endif /* CONFIG_PCI */ +#endif /* CONFIG_HAS_IOPORT */ diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index ad72a03ce5e..e66e9b63261 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c @@ -259,6 +259,9 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, struct sk_buff *skb; size_t len; + if (!netlink_has_listeners(uevent_sock, 1)) + continue; + /* allocate message with the maximum possible size */ len = strlen(action_string) + strlen(devpath) + 2; skb = alloc_skb(len + env->buflen, GFP_KERNEL); diff --git a/lib/kref.c b/lib/kref.c deleted file mode 100644 index 3efb882b11d..00000000000 --- a/lib/kref.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * kref.c - library routines for handling generic reference counted objects - * - * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com> - * Copyright (C) 2004 IBM Corp. - * - * based on lib/kobject.c which was: - * Copyright (C) 2002-2003 Patrick Mochel <mochel@osdl.org> - * - * This file is released under the GPLv2. - * - */ - -#include <linux/kref.h> -#include <linux/module.h> -#include <linux/slab.h> - -/** - * kref_init - initialize object. - * @kref: object in question. - */ -void kref_init(struct kref *kref) -{ - atomic_set(&kref->refcount, 1); - smp_mb(); -} - -/** - * kref_get - increment refcount for object. - * @kref: object. - */ -void kref_get(struct kref *kref) -{ - WARN_ON(!atomic_read(&kref->refcount)); - atomic_inc(&kref->refcount); - smp_mb__after_atomic_inc(); -} - -/** - * kref_put - decrement refcount for object. - * @kref: object. - * @release: pointer to the function that will clean up the object when the - * last reference to the object is released. - * This pointer is required, and it is not acceptable to pass kfree - * in as this function. - * - * Decrement the refcount, and if 0, call release(). - * Return 1 if the object was removed, otherwise return 0. Beware, if this - * function returns 0, you still can not count on the kref from remaining in - * memory. Only use the return value if you want to see if the kref is now - * gone, not present. - */ -int kref_put(struct kref *kref, void (*release)(struct kref *kref)) -{ - WARN_ON(release == NULL); - WARN_ON(release == (void (*)(struct kref *))kfree); - - if (atomic_dec_and_test(&kref->refcount)) { - release(kref); - return 1; - } - return 0; -} - - -/** - * kref_sub - subtract a number of refcounts for object. - * @kref: object. - * @count: Number of recounts to subtract. - * @release: pointer to the function that will clean up the object when the - * last reference to the object is released. - * This pointer is required, and it is not acceptable to pass kfree - * in as this function. - * - * Subtract @count from the refcount, and if 0, call release(). - * Return 1 if the object was removed, otherwise return 0. Beware, if this - * function returns 0, you still can not count on the kref from remaining in - * memory. Only use the return value if you want to see if the kref is now - * gone, not present. - */ -int kref_sub(struct kref *kref, unsigned int count, - void (*release)(struct kref *kref)) -{ - WARN_ON(release == NULL); - WARN_ON(release == (void (*)(struct kref *))kfree); - - if (atomic_sub_and_test((int) count, &kref->refcount)) { - release(kref); - return 1; - } - return 0; -} - -EXPORT_SYMBOL(kref_init); -EXPORT_SYMBOL(kref_get); -EXPORT_SYMBOL(kref_put); -EXPORT_SYMBOL(kref_sub); diff --git a/sound/usb/6fire/chip.c b/sound/usb/6fire/chip.c index c7dca7b0b9f..ac2d5e10f1a 100644 --- a/sound/usb/6fire/chip.c +++ b/sound/usb/6fire/chip.c @@ -211,22 +211,11 @@ static struct usb_device_id device_table[] = { MODULE_DEVICE_TABLE(usb, device_table); -static struct usb_driver driver = { +static struct usb_driver usb_driver = { .name = "snd-usb-6fire", .probe = usb6fire_chip_probe, .disconnect = usb6fire_chip_disconnect, .id_table = device_table, }; -static int __init usb6fire_chip_init(void) -{ - return usb_register(&driver); -} - -static void __exit usb6fire_chip_cleanup(void) -{ - usb_deregister(&driver); -} - -module_init(usb6fire_chip_init); -module_exit(usb6fire_chip_cleanup); +module_usb_driver(usb_driver); diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c index 3eb605bd950..457fb274ff9 100644 --- a/sound/usb/caiaq/device.c +++ b/sound/usb/caiaq/device.c @@ -538,16 +538,5 @@ static struct usb_driver snd_usb_driver = { .id_table = snd_usb_id_table, }; -static int __init snd_module_init(void) -{ - return usb_register(&snd_usb_driver); -} - -static void __exit snd_module_exit(void) -{ - usb_deregister(&snd_usb_driver); -} - -module_init(snd_module_init) -module_exit(snd_module_exit) +module_usb_driver(snd_usb_driver); diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c index c0609c21030..4c11da911a1 100644 --- a/sound/usb/misc/ua101.c +++ b/sound/usb/misc/ua101.c @@ -1387,16 +1387,4 @@ static struct usb_driver ua101_driver = { #endif }; -static int __init alsa_card_ua101_init(void) -{ - return usb_register(&ua101_driver); -} - -static void __exit alsa_card_ua101_exit(void) -{ - usb_deregister(&ua101_driver); - mutex_destroy(&devices_mutex); -} - -module_init(alsa_card_ua101_init); -module_exit(alsa_card_ua101_exit); +module_usb_driver(ua101_driver); diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 726c1a7b89b..625f7ca6a89 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c @@ -772,16 +772,4 @@ static struct usb_driver snd_us122l_usb_driver = { .supports_autosuspend = 1 }; - -static int __init snd_us122l_module_init(void) -{ - return usb_register(&snd_us122l_usb_driver); -} - -static void __exit snd_us122l_module_exit(void) -{ - usb_deregister(&snd_us122l_usb_driver); -} - -module_init(snd_us122l_module_init) -module_exit(snd_us122l_module_exit) +module_usb_driver(snd_us122l_usb_driver); diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index cbd37f2c76d..0c738ed3ed3 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c @@ -459,15 +459,4 @@ static void usX2Y_usb_disconnect(struct usb_device *device, void* ptr) } } -static int __init snd_usX2Y_module_init(void) -{ - return usb_register(&snd_usX2Y_usb_driver); -} - -static void __exit snd_usX2Y_module_exit(void) -{ - usb_deregister(&snd_usX2Y_usb_driver); -} - -module_init(snd_usX2Y_module_init) -module_exit(snd_usX2Y_module_exit) +module_usb_driver(snd_usX2Y_usb_driver); |