diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-13 00:01:22 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-13 00:01:22 -0700 |
commit | aeced238faea151e353a82fd176557418141e0dc (patch) | |
tree | 9e72ceb99eda68ae14e27d4af2487b46e02240a6 | |
parent | 41278505416d0546bc2988bcb6c71538c5b3db88 (diff) | |
parent | 6e9f440490ff7de2f449e4d9fdc9c6658ffc11e7 (diff) | |
download | patches-aeced238faea151e353a82fd176557418141e0dc.tar.gz |
Merge branch 'master' of ra.kernel.org:/pub/scm/linux/kernel/git/gregkh/patches
Conflicts:
0001-kdbus-interprocess-message-router.patch
87 files changed, 10477 insertions, 4712 deletions
diff --git a/0001-Simulate-fake-Fn-key-on-PS-2-keyboards-w-o-one-eg.-C.patch b/0001-Simulate-fake-Fn-key-on-PS-2-keyboards-w-o-one-eg.-C.patch new file mode 100644 index 00000000000000..8f3b191874c7d4 --- /dev/null +++ b/0001-Simulate-fake-Fn-key-on-PS-2-keyboards-w-o-one-eg.-C.patch @@ -0,0 +1,157 @@ +>From 2b68920c417303e3adb90631ed9a9cbf864c0a94 Mon Sep 17 00:00:00 2001 +From: Dirk Hohndel <dirk@hohndel.org> +Date: Wed, 1 May 2013 11:23:28 -0700 +Subject: [PATCH 1/1] Simulate fake Fn key on PS/2 keyboards w/o one (eg. + Chromebook Pixel) + +This establishes a somewhat generic way to do this and implements a +specific solution for the Pixel where the right ALT key is redefined +to be an Fn key. + +Press/release events for the fake Fn key are no longer reported up, +but if the fake Fn key is pressed, then other keys are potentially +translated. + +Implemented in this patch are the following mappings: + BS -> Delete + Up -> PgUp + Down -> PgDn + Left -> Home + Right -> End + +Signed-off-by: Dirk Hohndel <dirk@hohndel.org> +--- + drivers/input/keyboard/atkbd.c | 80 +++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 80 insertions(+) + +--- a/drivers/input/keyboard/atkbd.c ++++ b/drivers/input/keyboard/atkbd.c +@@ -161,6 +161,19 @@ static const unsigned short atkbd_unxlat + #define ATKBD_KEY_UNKNOWN 0 + #define ATKBD_KEY_NULL 255 + ++#define ATKBD_KEY_IGNORE 0x8000 ++#define ATKBD_KEY_BS 0x0e ++#define ATKBD_KEY_DEL 0x53 /* actually E0 53 - same for the rest here */ ++#define ATKBD_KEY_ALT_R 0x38 ++#define ATKBD_KEY_HOME 0x47 ++#define ATKBD_KEY_UP 0x48 ++#define ATKBD_KEY_PGUP 0x49 ++#define ATKBD_KEY_LEFT 0x4b ++#define ATKBD_KEY_RIGHT 0x4d ++#define ATKBD_KEY_END 0x4f ++#define ATKBD_KEY_DOWN 0x50 ++#define ATKBD_KEY_PGDN 0x51 ++ + #define ATKBD_SCR_1 0xfffe + #define ATKBD_SCR_2 0xfffd + #define ATKBD_SCR_4 0xfffc +@@ -218,6 +231,7 @@ struct atkbd { + bool softraw; + bool scroll; + bool enabled; ++ bool fake_fn; + + /* Accessed only from interrupt */ + unsigned char emul; +@@ -242,6 +256,7 @@ struct atkbd { + static void (*atkbd_platform_fixup)(struct atkbd *, const void *data); + static void *atkbd_platform_fixup_data; + static unsigned int (*atkbd_platform_scancode_fixup)(struct atkbd *, unsigned int); ++static unsigned int (*atkbd_fake_fn_fixup)(struct atkbd *, unsigned int); + + static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf, + ssize_t (*handler)(struct atkbd *, char *)); +@@ -398,6 +413,13 @@ static irqreturn_t atkbd_interrupt(struc + if (!atkbd->enabled) + goto out; + ++ if (atkbd_fake_fn_fixup) { ++ code = atkbd_fake_fn_fixup(atkbd, code); ++ if (code == ATKBD_KEY_IGNORE) ++ /* fake Fn key pressed - ignore */ ++ goto out; ++ } ++ + input_event(dev, EV_MSC, MSC_RAW, code); + + if (atkbd_platform_scancode_fixup) +@@ -988,6 +1010,48 @@ static unsigned int atkbd_oqo_01plus_sca + } + + /* ++ * Google Chromebook Pixel is lacking an Fn key. In order to use as ++ * a regular Linux laptop we steal the left Alt key and turn it into ++ * an Fn key ++ */ ++static unsigned int atkbd_pixel_fake_fn_fixup(struct atkbd *atkbd, unsigned int code) ++{ ++ if (atkbd->emul != 1) { ++ /* handle backspace here as it's the only one w/o ++ * a leading E0/E1 (i.e., emul == 0) */ ++ if (atkbd->emul == 0 && atkbd->fake_fn && (code & 0x7f) == ATKBD_KEY_BS) { ++ /* when pretending that Delete was pressed we need ++ * to set emul as well as Delete is E0 53 */ ++ atkbd->emul = 1; ++ code = (code & 0x80) | ATKBD_KEY_DEL; ++ } ++ } else if ((code & 0x7f) == ATKBD_KEY_ALT_R) { ++ atkbd->fake_fn = (code & 0x80) ? 0 : 1; ++ atkbd->emul = 0; ++ code = ATKBD_KEY_IGNORE; ++ } else if (atkbd->fake_fn) { ++ unsigned int oldcode = code; ++ switch(code & 0x7f) { ++ case ATKBD_KEY_UP: ++ code = ATKBD_KEY_PGUP; ++ break; ++ case ATKBD_KEY_DOWN: ++ code = ATKBD_KEY_PGDN; ++ break; ++ case ATKBD_KEY_LEFT: ++ code = ATKBD_KEY_HOME; ++ break; ++ case ATKBD_KEY_RIGHT: ++ code = ATKBD_KEY_END; ++ break; ++ } ++ code |= oldcode & 0x80; ++ } ++ return code; ++} ++ ++ ++/* + * atkbd_set_keycode_table() initializes keyboard's keycode table + * according to the selected scancode set + */ +@@ -1638,6 +1702,13 @@ static int __init atkbd_setup_scancode_f + return 1; + } + ++static int __init atkbd_setup_fake_fn_fixup(const struct dmi_system_id *id) ++{ ++ atkbd_fake_fn_fixup = id->driver_data; ++ ++ return 1; ++} ++ + static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = { + { + .matches = { +@@ -1775,6 +1846,15 @@ static const struct dmi_system_id atkbd_ + .callback = atkbd_setup_scancode_fixup, + .driver_data = atkbd_oqo_01plus_scancode_fixup, + }, ++ { ++ /* Google Chromebook Pixel */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Link"), ++ }, ++ .callback = atkbd_setup_fake_fn_fixup, ++ .driver_data = atkbd_pixel_fake_fn_fixup, ++ }, + { } + }; + diff --git a/0001-kdbus-interprocess-message-router.patch b/0001-kdbus-interprocess-message-router.patch deleted file mode 100644 index 5f42c13498fa83..00000000000000 --- a/0001-kdbus-interprocess-message-router.patch +++ /dev/null @@ -1,1620 +0,0 @@ -Subject: kdbus: interprocess message router - -Nothing to see here, move along... - - ---- - drivers/Kconfig | 2 - drivers/Makefile | 1 - drivers/kdbus/Kconfig | 5 - drivers/kdbus/Makefile | 4 - drivers/kdbus/bus.c | 122 ++++++++ - drivers/kdbus/ep.c | 200 ++++++++++++++ - drivers/kdbus/kdbus.c | 613 +++++++++++++++++++++++++++++++++++++++++++++ - drivers/kdbus/kdbus.h | 185 +++++++++++++ - drivers/kdbus/ns.c | 217 +++++++++++++++ - include/uapi/kdbus/kdbus.h | 123 +++++++++ - include/uapi/linux/major.h | 2 - kdbus.c | 77 +++++ - 12 files changed, 1551 insertions(+) - ---- a/drivers/Kconfig -+++ b/drivers/Kconfig -@@ -158,4 +158,6 @@ source "drivers/irqchip/Kconfig" - - source "drivers/ipack/Kconfig" - -+source "drivers/kdbus/Kconfig" -+ - endmenu ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -146,3 +146,4 @@ obj-$(CONFIG_MEMORY) += memory/ - obj-$(CONFIG_IIO) += iio/ - obj-$(CONFIG_VME_BUS) += vme/ - obj-$(CONFIG_IPACK_BUS) += ipack/ -+obj-$(CONFIG_KDBUS) += kdbus/ ---- /dev/null -+++ b/drivers/kdbus/Kconfig -@@ -0,0 +1,5 @@ -+config KDBUS -+ tristate "kdbus interprocess message router" -+ help -+ kdbus provides efficient kernel-aided message exchange and routing -+ between processes. It is used as the low-level transport of D-Bus. ---- /dev/null -+++ b/drivers/kdbus/Makefile -@@ -0,0 +1,4 @@ -+dbus-y := kdbus.o ep.o bus.o ns.o -+ -+obj-$(CONFIG_KDBUS) += dbus.o -+ ---- /dev/null -+++ b/drivers/kdbus/bus.c -@@ -0,0 +1,122 @@ -+/* -+ * Copyright (C) 2013 Kay Sievers -+ * Copyright (C) 2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> -+ * Copyright (C) 2013 Linux Foundation -+ * -+ * kdbus is free software; you can redistribute it and/or modify it under -+ * the terms of the GNU Lesser General Public License as published by the -+ * Free Software Foundation; either version 2.1 of the License, or (at -+ * your option) any later version. -+ * -+ */ -+ -+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -+ -+#include <linux/module.h> -+#include <linux/device.h> -+#include <linux/idr.h> -+#include <linux/fs.h> -+#include <linux/slab.h> -+#include <linux/sched.h> -+#include <linux/init.h> -+#include <uapi/kdbus/kdbus.h> -+ -+#include "kdbus.h" -+ -+void kdbus_release(struct device *dev) -+{ -+ kfree(dev); -+} -+ -+ -+struct kdbus_bus *kdbus_bus_ref(struct kdbus_bus *bus) -+{ -+ if (!bus) -+ return NULL; -+ bus->ref++; -+ return bus; -+} -+ -+struct kdbus_bus *kdbus_bus_unref(struct kdbus_bus *bus) -+{ -+ if (!bus) -+ return NULL; -+ bus->ref--; -+ if (bus->ref > 0) -+ return bus; -+ -+ kdbus_bus_disconnect(bus); -+ pr_info("clean up bus %s/%s\n", -+ bus->ns->devpath, bus->name); -+ -+ kfree(bus->name); -+ kfree(bus); -+ return NULL; -+} -+ -+void kdbus_bus_disconnect(struct kdbus_bus *bus) -+{ -+ struct kdbus_ep *ep, *tmp; -+ -+ if (bus->disconnected) -+ return; -+ bus->disconnected = true; -+ -+ /* remove default endpoint */ -+ kdbus_ep_disconnect(bus->ep); -+ kdbus_ep_unref(bus->ep); -+ -+ /* remove any endpoints attached to this bus */ -+ list_for_each_entry_safe(ep, tmp, &bus->ep_list, bus_entry) { -+ kdbus_ep_disconnect(ep); -+ kdbus_ep_unref(ep); -+ } -+ -+ pr_info("closing bus %s/%s\n", bus->ns->devpath, bus->name); -+} -+ -+int kdbus_bus_new(struct kdbus_ns *ns, const char *name, umode_t mode, -+ uid_t uid, gid_t gid, struct kdbus_bus **bus) -+{ -+ struct kdbus_bus *b; -+ int err; -+ -+ b = kzalloc(sizeof(struct kdbus_bus), GFP_KERNEL); -+ if (!b) -+ return -ENOMEM; -+ -+ b->ref = 1; -+ b->ns = ns; -+ /* connection 0 == kernel/multi-cast */ -+ b->conn_id_next = 1; -+ mutex_init(&b->lock); -+ idr_init(&b->conn_idr); -+ INIT_LIST_HEAD(&b->ep_list); -+ -+ if (uid > 0) -+ b->name = kasprintf(GFP_KERNEL, "%u-%s", uid, name); -+ else -+ b->name = kstrdup(name, GFP_KERNEL); -+ if (!b->name) { -+ err = -ENOMEM; -+ goto err; -+ } -+ -+ err = kdbus_ep_new(b, "bus", mode, uid, gid, &b->ep); -+ if (err < 0) -+ goto err; -+ -+ mutex_lock(&ns->lock); -+ b->id = ns->bus_id_next++; -+ mutex_unlock(&ns->lock); -+ -+ *bus = b; -+ pr_info("created bus %llu '%s/%s'\n", -+ (unsigned long long)b->id, ns->devpath, b->name); -+ return 0; -+err: -+ kdbus_bus_unref(b); -+ return err; -+} -+ -+ ---- /dev/null -+++ b/drivers/kdbus/ep.c -@@ -0,0 +1,200 @@ -+/* -+ * Copyright (C) 2013 Kay Sievers -+ * Copyright (C) 2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> -+ * Copyright (C) 2013 Linux Foundation -+ * -+ * kdbus is free software; you can redistribute it and/or modify it under -+ * the terms of the GNU Lesser General Public License as published by the -+ * Free Software Foundation; either version 2.1 of the License, or (at -+ * your option) any later version. -+ * -+ */ -+ -+ -+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -+ -+#include <linux/module.h> -+#include <linux/device.h> -+#include <linux/idr.h> -+#include <linux/fs.h> -+#include <linux/slab.h> -+#include <linux/sched.h> -+#include <linux/init.h> -+#include <uapi/linux/major.h> -+#include <uapi/kdbus/kdbus.h> -+ -+#include "kdbus.h" -+ -+/* endpoints are by default owned by the bus owner */ -+static char *kdbus_devnode_ep(struct device *dev, -+ umode_t *mode, uid_t *uid, gid_t *gid) -+{ -+ struct kdbus_ep *ep = dev_get_drvdata(dev); -+ -+ if (mode) -+ *mode = ep->mode; -+ if (uid) -+ *uid = ep->uid; -+ if (gid) -+ *gid = ep->gid; -+ return NULL; -+} -+ -+static struct device_type kdbus_devtype_ep = { -+ .name = "ep", -+ .release = kdbus_release, -+ .devnode = kdbus_devnode_ep, -+}; -+ -+struct kdbus_ep *kdbus_ep_ref(struct kdbus_ep *ep) -+{ -+ if (!ep) -+ return NULL; -+ ep->ref++; -+ return ep; -+} -+ -+void kdbus_ep_disconnect(struct kdbus_ep *ep) -+{ -+ if (ep->disconnected) -+ return; -+ ep->disconnected = true; -+ -+ if (ep->dev) { -+ device_unregister(ep->dev); -+ ep->dev = NULL; -+ } -+ if (ep->minor > 0) { -+ idr_remove(&ep->bus->ns->idr, ep->minor); -+ ep->minor = 0; -+ } -+ pr_info("closing endpoint %s/%s/%s\n", -+ ep->bus->ns->devpath, ep->bus->name, ep->name); -+} -+ -+struct kdbus_ep *kdbus_ep_unref(struct kdbus_ep *ep) -+{ -+ if (!ep) -+ return NULL; -+ ep->ref--; -+ if (ep->ref > 0) -+ return ep; -+ -+ mutex_lock(&ep->bus->lock); -+ kdbus_ep_disconnect(ep); -+ pr_info("clean up endpoint %s/%s/%s\n", -+ ep->bus->ns->devpath, ep->bus->name, ep->name); -+ kdbus_bus_unref(ep->bus); -+ mutex_unlock(&ep->bus->lock); -+ -+ kfree(ep->name); -+ kfree(ep); -+ return NULL; -+} -+ -+/* Find the endpoint for a specific bus */ -+struct kdbus_ep *kdbus_ep_find(struct kdbus_bus *bus, const char *name) -+{ -+ struct kdbus_ep *ep; -+ -+ mutex_lock(&bus->lock); -+ list_for_each_entry(ep, &bus->ep_list, bus_entry) { -+ if (!strcmp(ep->name, name)) -+ goto exit; -+ } -+ /* Endpoint not found so return NULL */ -+ ep = NULL; -+exit: -+ mutex_unlock(&bus->lock); -+ -+ return ep; -+} -+ -+int kdbus_ep_new(struct kdbus_bus *bus, const char *name, umode_t mode, -+ uid_t uid, gid_t gid, struct kdbus_ep **ep) -+{ -+ struct kdbus_ep *e; -+ int err; -+ int i; -+ -+ e = kzalloc(sizeof(struct kdbus_ep), GFP_KERNEL); -+ if (!e) -+ return -ENOMEM; -+ -+ mutex_lock(&bus->ns->lock); -+ e->ref = 1; -+ e->mode = mode; -+ e->uid = uid; -+ e->gid = gid; -+ -+ e->name = kstrdup(name, GFP_KERNEL); -+ if (!e->name) { -+ err = -ENOMEM; -+ goto err; -+ } -+ -+ /* register minor in our endpoint map */ -+ if (!idr_pre_get(&bus->ns->idr, GFP_KERNEL)) { -+ err = -ENOMEM; -+ goto err_unlock; -+ } -+ err = idr_get_new_above(&bus->ns->idr, e, 1, &i); -+ if (err < 0) -+ goto err_unlock; -+ e->minor = i; -+ -+ /* get id for this endpoint from bus */ -+ mutex_lock(&bus->lock); -+ e->id = bus->ep_id_next++; -+ mutex_unlock(&bus->lock); -+ -+ /* register bus endpoint device */ -+ e->dev = kzalloc(sizeof(struct device), GFP_KERNEL); -+ if (!e->dev) -+ goto err; -+ dev_set_name(e->dev, "%s/%s/%s", bus->ns->devpath, bus->name, name); -+ e->dev->bus = &kdbus_subsys; -+ e->dev->type = &kdbus_devtype_ep; -+ e->dev->devt = MKDEV(bus->ns->major, e->minor); -+ dev_set_drvdata(e->dev, e); -+ err = device_register(e->dev); -+ if (err < 0) { -+ put_device(e->dev); -+ e->dev = NULL; -+ } -+ -+ init_waitqueue_head(&e->wait); -+ -+ /* Link this endpoint to the bus it is on */ -+ e->bus = kdbus_bus_ref(bus); -+ list_add_tail(&e->bus_entry, &bus->ep_list); -+ -+ mutex_unlock(&bus->ns->lock); -+ -+ if (ep) -+ *ep = e; -+ pr_info("created endpoint %llu for bus '%s/%s/%s'\n", -+ (unsigned long long)e->id, bus->ns->devpath, bus->name, name); -+ return 0; -+ -+err_unlock: -+ mutex_unlock(&bus->ns->lock); -+err: -+ kdbus_ep_unref(e); -+ return err; -+} -+ -+int kdbus_ep_remove(struct kdbus_ep *ep) -+{ -+ struct kdbus_bus *bus = ep->bus; -+ -+ mutex_lock(&bus->ns->lock); -+ device_unregister(ep->dev); -+ list_del(&ep->bus_entry); -+ kdbus_ep_unref(ep); -+ mutex_unlock(&bus->ns->lock); -+ kdbus_bus_unref(bus); -+ return 0; -+} -+ -+ ---- /dev/null -+++ b/drivers/kdbus/kdbus.c -@@ -0,0 +1,613 @@ -+/* -+ * kdbus - interprocess message routing -+ * -+ * Copyright (C) 2013 Kay Sievers -+ * Copyright (C) 2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> -+ * Copyright (C) 2013 Linux Foundation -+ * -+ * kdbus is free software; you can redistribute it and/or modify it under -+ * the terms of the GNU Lesser General Public License as published by the -+ * Free Software Foundation; either version 2.1 of the License, or (at -+ * your option) any later version. -+ * -+ */ -+ -+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -+ -+#include <linux/module.h> -+#include <linux/device.h> -+#include <linux/idr.h> -+#include <linux/fs.h> -+#include <linux/slab.h> -+#include <linux/sched.h> -+#include <linux/mutex.h> -+#include <linux/init.h> -+#include <linux/poll.h> -+//#include <asm/uaccess.h> -+#include <uapi/linux/major.h> -+#include <uapi/kdbus/kdbus.h> -+ -+#include "kdbus.h" -+ -+/* -+ * TODO: -+ * - set parent for driver-core /sys/devices/kdbus!... devices to virtual/kdbus/, -+ * the bus subsys misses the "no parent" logic the class subsys has -+ * -+ * - switch to a 64bit idr for connection id <--> kdbus_conn -+ */ -+ -+/* -+ * Example of device nodes in /dev. For any future changes, keep in mind, -+ * that the layout should support a possible /dev/kdbus/ filesystem for the -+ * init namspace and one for each sub-namespace. -+ * -+ * /dev/kdbus/ -+ * |-- control -+ * |-- system -+ * | |-- bus -+ * | |-- ep-epiphany -+ * | `-- ep-firefox -+ * |-- 2702-user -+ * | `-- bus -+ * |-- 1000-user -+ * | `-- bus -+ * `-- ns -+ * |-- myfedoracontainer -+ * | |-- control -+ * | |-- system -+ * | | `-- bus -+ * | `-- 1000-user -+ * | `-- bus -+ * `-- mydebiancontainer -+ * |-- control -+ * |-- system -+ * `-- bus -+ */ -+ -+/* kdbus sysfs subsystem */ -+struct bus_type kdbus_subsys = { -+ .name = "kdbus", -+}; -+ -+/* List of all connections in the system. */ -+/* Well, really only the endpoint connections, -+ * that's all we care about for now */ -+static LIST_HEAD(connection_list); -+ -+/* kdbus initial namespace */ -+static struct kdbus_ns *kdbus_ns_init; -+ -+/* map of majors to namespaces */ -+DEFINE_IDR(kdbus_ns_major_idr); -+ -+/* namespace list lock */ -+DEFINE_MUTEX(kdbus_subsys_lock); -+ -+static int kdbus_msg_new(struct kdbus_conn *conn, struct kdbus_msg __user *umsg, -+ struct kdbus_msg **msg); -+static int kdbus_msg_send(struct kdbus_conn *conn, struct kdbus_msg *msg); -+ -+ -+static void kdbus_msg_release(struct kref *kref) -+{ -+ struct kdbus_test_msg *msg = container_of(kref, struct kdbus_test_msg, kref); -+ kfree(msg); -+} -+ -+ -+/* kdbus file operations */ -+static int kdbus_conn_open(struct inode *inode, struct file *file) -+{ -+ struct kdbus_conn *conn; -+ struct kdbus_ns *ns; -+ struct kdbus_ep *ep; -+ int i; -+ int err; -+ -+ conn = kzalloc(sizeof(struct kdbus_conn), GFP_KERNEL); -+ if (!conn) -+ return -ENOMEM; -+ -+ /* find and reference namespace */ -+ mutex_lock(&kdbus_subsys_lock); -+ ns = idr_find(&kdbus_ns_major_idr, MAJOR(inode->i_rdev)); -+ if (!ns || ns->disconnected) { -+ kfree(conn); -+ mutex_unlock(&kdbus_subsys_lock); -+ return -ENOENT; -+ } -+ conn->ns = kdbus_ns_ref(ns); -+ file->private_data = conn; -+ mutex_unlock(&kdbus_subsys_lock); -+ -+ /* control device node */ -+ if (MINOR(inode->i_rdev) == 0) { -+ conn->type = KDBUS_CONN_CONTROL; -+ file->private_data = conn; -+ pr_info("opened control device '%s/control'\n", -+ conn->ns->devpath); -+ return 0; -+ } -+ -+ /* find endpoint for device node */ -+ mutex_lock(&conn->ns->lock); -+ ep = idr_find(&conn->ns->idr, MINOR(inode->i_rdev)); -+ if (!ep || ep->disconnected) { -+ err = -ENOENT; -+ goto err_unlock; -+ } -+ -+ /* create endpoint connection */ -+ conn->type = KDBUS_CONN_EP; -+ conn->ep = kdbus_ep_ref(ep); -+ -+ /* get and register new id for this connection */ -+ conn->id = conn->ep->bus->conn_id_next++; -+ if (!idr_pre_get(&conn->ep->bus->conn_idr, GFP_KERNEL)) { -+ err = -ENOMEM; -+ goto err_unlock; -+ } -+ /* FIXME: get 64 bit working, this will fail for the 2^31th connection */ -+ /* use a hash table to get 64bit ids working properly, idr is the wrong -+ * thing to use here. */ -+ err = idr_get_new_above(&conn->ep->bus->conn_idr, conn, conn->id, &i); -+ if (err >= 0 && conn->id != i) { -+ idr_remove(&conn->ep->bus->conn_idr, i); -+ err = -EEXIST; -+ goto err_unlock; -+ } -+ -+ mutex_init(&conn->msg_lock); -+ INIT_LIST_HEAD(&conn->msg_list); -+ -+ list_add_tail(&connection_list, &conn->connection_entry); -+ -+ file->private_data = conn; -+ mutex_unlock(&conn->ns->lock); -+ -+ pr_info("created endpoint bus connection %llu '%s/%s'\n", -+ (unsigned long long)conn->id, conn->ns->devpath, -+ conn->ep->bus->name); -+ return 0; -+ -+err_unlock: -+ mutex_unlock(&conn->ns->lock); -+ kfree(conn); -+ return err; -+} -+ -+static int kdbus_conn_release(struct inode *inode, struct file *file) -+{ -+ struct kdbus_conn *conn = file->private_data; -+ struct kdbus_test_msg *msg; -+ struct kdbus_msg_list_entry *msg_entry, *tmp_entry; -+ -+ switch (conn->type) { -+ case KDBUS_CONN_NS_OWNER: -+ break; -+ -+ case KDBUS_CONN_BUS_OWNER: -+ kdbus_bus_disconnect(conn->bus_owner); -+ kdbus_bus_unref(conn->bus_owner); -+ break; -+ -+ case KDBUS_CONN_EP: -+ kdbus_ep_unref(conn->ep); -+ list_del(&conn->connection_entry); -+ /* clean up any messages still left on this endpoint */ -+ mutex_lock(&conn->msg_lock); -+ list_for_each_entry_safe(msg_entry, tmp_entry, &conn->msg_list, entry) { -+ msg = msg_entry->msg; -+ list_del(&msg_entry->entry); -+ kfree(msg_entry); -+ kref_put(&msg->kref, kdbus_msg_release); -+ } -+ mutex_unlock(&conn->msg_lock); -+ -+ break; -+ -+ default: -+ break; -+ } -+ -+ mutex_lock(&conn->ns->lock); -+ kdbus_ns_unref(conn->ns); -+ mutex_unlock(&conn->ns->lock); -+ kfree(conn); -+ return 0; -+} -+ -+/* kdbus control device commands */ -+static long kdbus_conn_ioctl_control(struct file *file, unsigned int cmd, -+ void __user *argp) -+{ -+ struct kdbus_conn *conn = file->private_data; -+ struct kdbus_cmd_name name; -+ struct kdbus_bus *bus = NULL; -+ struct kdbus_ns *ns = NULL; -+ int err; -+ -+ switch (cmd) { -+ case KDBUS_CMD_BUS_CREATE: -+ if (copy_from_user(&name, argp, sizeof(struct kdbus_cmd_name))) -+ return -EFAULT; -+ -+ err = kdbus_bus_new(conn->ns, name.name, -+ 0660, current_fsuid(), current_fsgid(), -+ &bus); -+ if (err < 0) -+ return err; -+ -+ /* turn the control fd into a new bus owner device */ -+ conn->type = KDBUS_CONN_BUS_OWNER; -+ conn->bus_owner = bus; -+ break; -+ -+#if 0 /* FIXME Don't know if we really want this... */ -+ case KDBUS_CMD_BUS_REMOVE: -+ if (copy_from_user(&name, argp, sizeof(struct kdbus_cmd_name))) -+ return -EFAULT; -+ -+ bus = kdbus_bus_find(name.name); -+ if (!bus) -+ return -EINVAL; -+ kdbus_bus_disconnect(bus); // FIXME needed? -+ kdbus_bus_unref(bus); -+ break; -+#endif -+ case KDBUS_CMD_NS_CREATE: -+ if (copy_from_user(&name, argp, sizeof(struct kdbus_cmd_name))) -+ return -EFAULT; -+ -+ err = kdbus_ns_new(kdbus_ns_init, name.name, &ns); -+ if (err < 0) { -+ pr_err("failed to create namespace %s, err=%i\n", -+ name.name, err); -+ return err; -+ } -+ break; -+ -+ case KDBUS_CMD_NS_REMOVE: -+ if (copy_from_user(&name, argp, sizeof(struct kdbus_cmd_name))) -+ return -EFAULT; -+ -+ ns = kdbus_ns_find(name.name); -+ if (!ns) -+ return -EINVAL; -+ -+ /* we can not remove the "default" namespace */ -+ if (ns == kdbus_ns_init) -+ return -EINVAL; -+ -+ kdbus_ns_unref(ns); -+ break; -+ -+ default: -+ return -ENOTTY; -+ } -+ return 0; -+} -+ -+/* kdbus bus endpoint commands */ -+static long kdbus_conn_ioctl_ep(struct file *file, unsigned int cmd, -+ void __user *argp) -+{ -+ struct kdbus_conn *conn = file->private_data; -+ struct kdbus_cmd_name name; -+ struct kdbus_msg *msg; -+ struct kdbus_ep *ep; -+ long err; -+ -+ /* We need a connection before we can do anything with an ioctl */ -+ if (!conn) -+ return -EINVAL; -+ -+ switch (cmd) { -+ case KDBUS_CMD_EP_CREATE: -+ /* create a new endpoint for this bus */ -+ if (copy_from_user(&name, argp, sizeof(struct kdbus_cmd_name))) -+ return -EFAULT; -+ return kdbus_ep_new(conn->ep->bus, name.name, -+ 0660, current_fsuid(), current_fsgid(), -+ NULL); -+ -+ case KDBUS_CMD_EP_REMOVE: -+ /* remove an endpoint from this bus */ -+ if (copy_from_user(&name, argp, sizeof(struct kdbus_cmd_name))) -+ return -EFAULT; -+ ep = kdbus_ep_find(conn->bus_owner, name.name); -+ if (!ep) -+ return -EINVAL; -+ -+ return kdbus_ep_remove(ep); -+ -+ case KDBUS_CMD_EP_POLICY_SET: -+ /* upload a policy for this bus */ -+ return -ENOSYS; -+ -+ case KDBUS_CMD_NAME_ACQUIRE: -+ /* acquire a well-known name */ -+ return -ENOSYS; -+ -+ case KDBUS_CMD_NAME_RELEASE: -+ /* release a well-known name */ -+ return -ENOSYS; -+ -+ case KDBUS_CMD_NAME_LIST: -+ /* return all current well-known names */ -+ return -ENOSYS; -+ -+ case KDBUS_CMD_MATCH_ADD: -+ /* subscribe to/filter for broadcast messages */ -+ return -ENOSYS; -+ -+ case KDBUS_CMD_MATCH_REMOVE: -+ /* unsubscribe from broadcast messages */ -+ return -ENOSYS; -+ -+ case KDBUS_CMD_MSG_SEND: -+ /* send a message */ -+ err = kdbus_msg_new(conn, argp, &msg); -+ if (err < 0) -+ return err; -+ return kdbus_msg_send(conn, msg); -+ -+ case KDBUS_CMD_MSG_RECV: -+ /* receive a message, needs to be freed */ -+ return -ENOSYS; -+ -+ default: -+ return -ENOTTY; -+ } -+} -+ -+static long kdbus_conn_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -+{ -+ struct kdbus_conn *conn = file->private_data; -+ void __user *argp = (void __user *)arg; -+ -+ pr_info("%s, cmd=%d\n", __func__, cmd); -+ switch (conn->type) { -+ case KDBUS_CONN_CONTROL: -+ pr_info("control ioctl\n"); -+ return kdbus_conn_ioctl_control(file, cmd, argp); -+ -+ case KDBUS_CONN_EP: -+ pr_info("endpoint ioctl\n"); -+ return kdbus_conn_ioctl_ep(file, cmd, argp); -+ -+ default: -+ pr_info("bad type\n"); -+ return -EINVAL; -+ } -+} -+ -+static unsigned int kdbus_conn_poll(struct file *file, -+ struct poll_table_struct *wait) -+{ -+ struct kdbus_conn *conn = file->private_data; -+ unsigned int mask = 0; -+ -+ /* Only an endpoint can read/write data */ -+ if (conn->type != KDBUS_CONN_EP) -+ return POLLERR | POLLHUP; -+ -+ poll_wait(file, &conn->ep->wait, wait); -+ -+ mutex_lock(&conn->msg_lock); -+ if (!list_empty(&conn->msg_list)) -+ mask |= POLLIN | POLLRDNORM; -+ mutex_unlock(&conn->msg_lock); -+ -+ return 0; -+} -+ -+static int kdbus_conn_mmap(struct file *file, struct vm_area_struct *vma) -+{ -+ return -EINVAL; -+} -+ -+static ssize_t kdbus_conn_write(struct file *file, const char __user *ubuf, size_t count, loff_t *ppos) -+{ -+ struct kdbus_conn *conn = file->private_data; -+ struct kdbus_conn *temp_conn; -+ struct kdbus_test_msg *msg; -+ -+ /* Only an endpoint can read/write data */ -+ if (conn->type != KDBUS_CONN_EP) -+ return -EINVAL; -+ -+ /* FIXME: Let's cap a message size at PAGE_SIZE for now */ -+ if (count > PAGE_SIZE) -+ return -EINVAL; -+ -+ if (count == 0) -+ return 0; -+ -+ msg = kmalloc((sizeof(*msg) + count), GFP_KERNEL); -+ if (!msg) -+ return -ENOMEM; -+ -+ if (copy_from_user(&msg->data[0], ubuf, count)) -+ return -EFAULT; -+ -+ kref_init(&msg->kref); -+ msg->length = count; -+ -+ /* Walk the list of connections, -+ * find any endpoints that match our endpoint, -+ * create a kdbus_msg_list_entry for it, -+ * attach the message to the endpoint list, -+ * wake the connection up. */ -+ -+ /* what do we lock here? FIXME */ -+ -+ list_for_each_entry(temp_conn, &connection_list, connection_entry) { -+ if (temp_conn->type != KDBUS_CONN_EP) -+ continue; -+ if (temp_conn->ep == conn->ep) { -+ /* Matching endpoints */ -+ struct kdbus_msg_list_entry *msg_list_entry; -+ -+ msg_list_entry = kmalloc(sizeof(*msg_list_entry), GFP_KERNEL); -+ kref_get(&msg->kref); -+ msg_list_entry->msg = msg; -+ mutex_lock(&temp_conn->msg_lock); -+ list_add_tail(&temp_conn->msg_list, &msg_list_entry->entry); -+ mutex_unlock(&temp_conn->msg_lock); -+ /* wake up the other processes. Hopefully... */ -+ wake_up_interruptible_all(&temp_conn->ep->wait); -+ } -+ } -+ -+ /* drop our reference on the message, as we are done with it */ -+ kref_put(&msg->kref, kdbus_msg_release); -+ return count; -+} -+ -+static ssize_t kdbus_conn_read(struct file *file, char __user *ubuf, size_t count, loff_t *ppos) -+{ -+ struct kdbus_conn *conn = file->private_data; -+ struct kdbus_msg_list_entry *msg_list_entry; -+ struct kdbus_test_msg *msg; -+ ssize_t retval = 0; -+ -+ /* Only an endpoint can read/write data */ -+ if (conn->type != KDBUS_CONN_EP) -+ return -EINVAL; -+ -+ if (count == 0) -+ return 0; -+ -+ if (mutex_lock_interruptible(&conn->msg_lock)) -+ return -ERESTARTSYS; -+ -+ while (list_empty(&conn->msg_list)) { -+ /* Nothing to read, so try again or sleep */ -+ mutex_unlock(&conn->msg_lock); -+ -+ if (file->f_flags & O_NONBLOCK) -+ return -EAGAIN; -+ -+ /* sleep until we get something */ -+ if (wait_event_interruptible(conn->ep->wait, list_empty(&conn->msg_list))) -+ return -ERESTARTSYS; -+ -+ if (mutex_lock_interruptible(&conn->msg_lock)) -+ return -ERESTARTSYS; -+ } -+ -+ /* let's grab a message from our list to write out */ -+ if (!list_empty(&conn->msg_list)) { -+ msg_list_entry = list_entry(&conn->msg_list, struct kdbus_msg_list_entry, entry); -+ msg = msg_list_entry->msg; -+ if (msg->length > count) { -+ retval = -E2BIG; // FIXME wrong error code, I know, what should we use? -+ goto exit; -+ } -+ if (copy_to_user(ubuf, &msg->data[0], msg->length)) { -+ retval = -EFAULT; -+ goto exit; -+ } -+ list_del(&msg_list_entry->entry); -+ kfree(msg_list_entry); -+ retval = msg->length; -+ kref_put(&msg->kref, kdbus_msg_release); -+ } -+ -+exit: -+ mutex_unlock(&conn->msg_lock); -+ return retval; -+} -+ -+const struct file_operations kdbus_device_ops = { -+ .owner = THIS_MODULE, -+ .open = kdbus_conn_open, -+ .release = kdbus_conn_release, -+ .unlocked_ioctl = kdbus_conn_ioctl, -+ .compat_ioctl = kdbus_conn_ioctl, -+ .poll = kdbus_conn_poll, -+ .mmap = kdbus_conn_mmap, -+ .llseek = noop_llseek, -+ .write = kdbus_conn_write, -+ .read = kdbus_conn_read, -+}; -+ -+static void kdbus_msg_free(struct kdbus_msg *msg) -+{ -+ kfree(msg); -+} -+ -+static int kdbus_msg_new(struct kdbus_conn *conn, struct kdbus_msg __user *umsg, -+ struct kdbus_msg **msg) -+{ -+ struct kdbus_msg *m; -+ int err; -+ -+ m = kmalloc(sizeof(struct kdbus_msg), GFP_KERNEL); -+ if (!m) -+ return -ENOMEM; -+ if (copy_from_user(m, umsg, sizeof(struct kdbus_msg))) { -+ err = -EFAULT; -+ goto out_err; -+ } -+ -+ m->src_id = conn->id; -+ m->msg_id = conn->ep->bus->msg_id_next++; -+ *msg = m; -+ return 0; -+out_err: -+ kdbus_msg_free(m); -+ return err; -+} -+ -+static int kdbus_msg_send(struct kdbus_conn *conn, struct kdbus_msg *msg) -+{ -+ struct kdbus_conn *conn_dst; -+ -+ conn_dst = idr_find(&conn->ep->bus->conn_idr, msg->dst_id); -+ if (!conn_dst) -+ return -ENOENT; -+ -+ pr_info("sending message %llu from %llu to %llu\n", -+ (unsigned long long)msg->msg_id, -+ (unsigned long long)msg->src_id, -+ (unsigned long long)msg->dst_id); -+ -+ kdbus_msg_free(msg); -+ return 0; -+} -+ -+static int __init kdbus_init(void) -+{ -+ int err; -+ -+ err = bus_register(&kdbus_subsys); -+ if (err < 0) -+ return err; -+ -+ err = kdbus_ns_new(NULL, NULL, &kdbus_ns_init); -+ if (err < 0) { -+ bus_unregister(&kdbus_subsys); -+ pr_err("failed to initialize err=%i\n", err); -+ return err; -+ } -+ -+ pr_info("initialized\n"); -+ return 0; -+} -+ -+static void __exit kdbus_exit(void) -+{ -+ kdbus_ns_unref(kdbus_ns_init); -+ bus_unregister(&kdbus_subsys); -+ pr_info("unloaded\n"); -+} -+ -+module_init(kdbus_init); -+module_exit(kdbus_exit); -+MODULE_LICENSE("GPL"); -+MODULE_DESCRIPTION("kdbus interprocess message router"); -+MODULE_ALIAS_CHARDEV(KDBUS_CHAR_MAJOR, 0); -+MODULE_ALIAS("devname:kdbus/control"); ---- /dev/null -+++ b/drivers/kdbus/kdbus.h -@@ -0,0 +1,185 @@ -+/* -+ * Copyright (C) 2013 Kay Sievers -+ * Copyright (C) 2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> -+ * Copyright (C) 2013 Linux Foundation -+ * -+ * kdbus is free software; you can redistribute it and/or modify it under -+ * the terms of the GNU Lesser General Public License as published by the -+ * Free Software Foundation; either version 2.1 of the License, or (at -+ * your option) any later version. -+ * -+ */ -+ -+ -+#ifndef __INTERNAL_KDBUS_H -+#define __INTERNAL_KDBUS_H -+ -+/* -+ * kdbus namespace -+ * - provides a "control" node -+ * - owns a major number -+ * - owns all created buses -+ * - the initial namespace is unnamed and stays around for forver -+ * - new namespaces are created by opening the control node and -+ * issuing KDBUS_NS_CREATE -+ * - closing the connection destroys the created namespace -+ */ -+struct kdbus_ns { -+ unsigned int ref; /* reference count */ -+ const char *name; /* name of the namespace */ -+ bool disconnected; /* invalidated data */ -+ struct kdbus_ns *parent;/* parent namespace */ -+ __u64 id; /* global id of this namespace */ -+ const char *devpath; /* /dev base directory path */ -+ int major; /* device major number for all nodes */ -+ struct idr idr; /* map of endpoint minors to buses */ -+ struct device *dev; /* control device node, minor == 0 */ -+ struct mutex lock; /* ns data lock */ -+ __u64 bus_id_next; /* next bus id sequence number */ -+ struct list_head list_entry; -+}; -+ -+/* -+ * kdbus bus -+ * - provides a "bus" endpoint -+ * - owns additional endpoints -+ * - own all bus connections -+ * - new buses are created by opening the control node and -+ * issuing KDBUS_BUS_CREATE -+ * - closing the connection destroys the created bus -+ */ -+struct kdbus_bus { -+ unsigned int ref; /* reference count */ -+ bool disconnected; /* invalidated data */ -+ struct kdbus_ns *ns; /* namespace of this bus */ -+ const char *name; /* bus name */ -+ __u64 id; /* id of this bus in the namespace */ -+ struct mutex lock; /* bus data lock */ -+ __u64 ep_id_next; /* next endpoint id sequence number */ -+ __u64 conn_id_next; /* next connection id sequence number */ -+ __u64 msg_id_next; /* next message id sequence number */ -+ struct idr conn_idr; /* map of connection ids */ -+ struct kdbus_ep *ep; /* "bus" default endpoint */ -+ struct list_head ep_list; /* endpoints assigned to this bus */ -+}; -+ -+/* -+ * kdbus endpoint -+ * - offers access to a bus, the default device node name is "bus" -+ * - additional endpoints can carry a specific policy/filters -+ */ -+struct kdbus_ep { -+ unsigned int ref; /* reference count */ -+ bool disconnected; /* invalidated data */ -+ struct kdbus_bus *bus; /* bus behind this endpoint */ -+ const char *name; /* name, prefixed with uid */ -+ __u64 id; /* id of this endpoint on the bus */ -+ unsigned int minor; /* minor of this endpoint in the namespace major */ -+ struct device *dev; /* device node of this endpoint */ -+ umode_t mode; /* file mode of this endpoint device node */ -+ uid_t uid; /* uid owning this endpoint */ -+ gid_t gid; /* gid owning this endpoint */ -+ struct list_head bus_entry; /* list of endpoints for this bus */ -+ struct list_head message_list; /* messages in flight for this endpoint */ -+ wait_queue_head_t wait; /* wake up this endpoint */ -+}; -+ -+/* -+ * kdbus connection -+ * - connection to a control node or an endpoint -+ */ -+enum kdbus_conn_type { -+ KDBUS_CONN_UNDEFINED, -+ KDBUS_CONN_CONTROL, -+ KDBUS_CONN_NS_OWNER, -+ KDBUS_CONN_BUS_OWNER, -+ KDBUS_CONN_EP, -+}; -+ -+struct kdbus_conn { -+ enum kdbus_conn_type type; -+ struct kdbus_ns *ns; -+ union { -+ struct kdbus_ns *ns_owner; -+ struct kdbus_bus *bus_owner; -+ struct kdbus_ep *ep; -+ }; -+ __u64 id; /* id of the connection on the bus */ -+ -+ /* -+ * first, horrible cut at messages assigned to connections -+ * odds are, this is going to be slow, but let's measure it first to -+ * see what the real numbers are, and where the bottlenecks are. -+ * Premature optimization and all... -+ */ -+ struct mutex msg_lock; -+ struct list_head msg_list; -+ -+ /* Ugh a list of all connections in the system? Ugly, but we need to -+ * be able to walk them all somehow. Maybe just have a list on the -+ * endpoints of the connections associated with that endpoint? That's -+ * all we really need in the end... */ -+ struct list_head connection_entry; -+}; -+ -+/* kdbus message */ -+enum kdbus_msg_data_type { -+ KDBUS_MSG_DATA_UNDEFINED, -+ KDBUS_MSG_DATA_MEM, -+}; -+ -+struct kdbus_msg_data { -+ u64 data; -+ u64 size; -+ u32 type; -+ u32 flags; -+}; -+ -+/* To knock around with for now */ -+struct kdbus_test_msg { -+ struct kref kref; -+ u32 length; -+ u8 data[0]; -+}; -+ -+struct kdbus_msg_list_entry { -+ struct kdbus_test_msg *msg; -+ struct list_head entry; -+}; -+ -+/* namespace stuff */ -+ -+extern const struct file_operations kdbus_device_ops; -+extern struct mutex kdbus_subsys_lock; -+extern struct idr kdbus_ns_major_idr; -+struct kdbus_ns *kdbus_ns_ref(struct kdbus_ns *ns); -+void kdbus_ns_disconnect(struct kdbus_ns *ns); -+struct kdbus_ns *kdbus_ns_unref(struct kdbus_ns *ns); -+int kdbus_ns_new(struct kdbus_ns *parent, const char *name, struct kdbus_ns **ns); -+struct kdbus_ns *kdbus_ns_find(const char *name); -+ -+ -+/* bus stuff */ -+extern struct bus_type kdbus_subsys; -+void kdbus_release(struct device *dev); -+ -+struct kdbus_bus *kdbus_bus_unref(struct kdbus_bus *bus); -+struct kdbus_bus *kdbus_bus_ref(struct kdbus_bus *bus); -+void kdbus_bus_disconnect(struct kdbus_bus *bus); -+int kdbus_bus_new(struct kdbus_ns *ns, const char *name, umode_t mode, -+ uid_t uid, gid_t gid, struct kdbus_bus **bus); -+ -+ -+/* endpoint stuff */ -+struct kdbus_ep *kdbus_ep_ref(struct kdbus_ep *ep); -+struct kdbus_ep *kdbus_ep_unref(struct kdbus_ep *ep); -+ -+struct kdbus_ep *kdbus_ep_find(struct kdbus_bus *bus, const char *name); -+int kdbus_ep_new(struct kdbus_bus *bus, const char *name, umode_t mode, -+ uid_t uid, gid_t gid, struct kdbus_ep **ep); -+int kdbus_ep_remove(struct kdbus_ep *ep); -+void kdbus_ep_disconnect(struct kdbus_ep *ep); -+ -+ -+ -+#endif ---- /dev/null -+++ b/drivers/kdbus/ns.c -@@ -0,0 +1,217 @@ -+/* -+ * Copyright (C) 2013 Kay Sievers -+ * Copyright (C) 2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> -+ * Copyright (C) 2013 Linux Foundation -+ * -+ * kdbus is free software; you can redistribute it and/or modify it under -+ * the terms of the GNU Lesser General Public License as published by the -+ * Free Software Foundation; either version 2.1 of the License, or (at -+ * your option) any later version. -+ * -+ */ -+ -+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -+ -+#include <linux/module.h> -+#include <linux/device.h> -+#include <linux/idr.h> -+#include <linux/fs.h> -+#include <linux/slab.h> -+#include <linux/sched.h> -+#include <linux/init.h> -+#include <uapi/linux/major.h> -+#include <uapi/kdbus/kdbus.h> -+ -+#include "kdbus.h" -+ -+/* global list of all namespaces */ -+static LIST_HEAD(namespace_list); -+ -+/* next namespace id sequence number */ -+static __u64 kdbus_ns_id_next; -+ -+/* control nodes are world accessible */ -+static char *kdbus_devnode_control(struct device *dev, -+ umode_t *mode, uid_t *uid, gid_t *gid) -+{ -+ if (mode) -+ *mode = 0666; -+ return NULL; -+} -+ -+static struct device_type kdbus_devtype_control = { -+ .name = "control", -+ .release = kdbus_release, -+ .devnode = kdbus_devnode_control, -+}; -+ -+ -+/* kdbus namespace */ -+struct kdbus_ns *kdbus_ns_ref(struct kdbus_ns *ns) -+{ -+ if (!ns) -+ return NULL; -+ ns->ref++; -+ return ns; -+} -+ -+void kdbus_ns_disconnect(struct kdbus_ns *ns) -+{ -+ if (ns->disconnected) -+ return; -+ ns->disconnected = true; -+ -+ if (ns->dev) { -+ device_unregister(ns->dev); -+ ns->dev = NULL; -+ } -+ if (ns->major > 0) { -+ idr_remove(&kdbus_ns_major_idr, ns->major); -+ unregister_chrdev(ns->major, "kdbus"); -+ ns->major = 0; -+ } -+ pr_info("closing namespace %s\n", ns->devpath); -+} -+ -+struct kdbus_ns *kdbus_ns_unref(struct kdbus_ns *ns) -+{ -+ if (!ns) -+ return NULL; -+ ns->ref--; -+ if (ns->ref > 0) -+ return ns; -+ -+ kdbus_ns_disconnect(ns); -+ pr_info("clean up namespace %s\n", ns->devpath); -+ list_del(&ns->list_entry); -+ kfree(ns->name); -+ kfree(ns->devpath); -+ kfree(ns); -+ return NULL; -+} -+ -+int kdbus_ns_new(struct kdbus_ns *parent, const char *name, struct kdbus_ns **ns) -+{ -+ struct kdbus_ns *n; -+ const char *ns_name = NULL; -+ int i; -+ int err; -+ -+ pr_info("%s, %s\n", __func__, name); -+ -+ if ((parent && !name) || (!parent && name)) -+ return -EINVAL; -+ -+ n = kzalloc(sizeof(struct kdbus_ns), GFP_KERNEL); -+ if (!n) -+ return -ENOMEM; -+ -+ if (name) { -+ ns_name = kstrdup(name, GFP_KERNEL); -+ if (!ns_name) { -+ kfree(n); -+ return -ENOMEM; -+ } -+ } -+ -+ n->ref = 1; -+ idr_init(&n->idr); -+ mutex_init(&n->lock); -+ -+ /* compose name and path of base directory in /dev */ -+ if (!parent) { -+ /* initial namespace */ -+ n->devpath = kstrdup("kdbus", GFP_KERNEL); -+ if (!n->devpath) { -+ err = -ENOMEM; -+ goto err; -+ } -+ -+ /* register static major to support module auto-loading */ -+ err = register_chrdev(KDBUS_CHAR_MAJOR, "kdbus", &kdbus_device_ops); -+ if (err) -+ goto err; -+ n->major = KDBUS_CHAR_MAJOR; -+ } else { -+ n->parent = parent; -+ n->devpath = kasprintf(GFP_KERNEL, "kdbus/ns/%s/%s", parent->devpath, name); -+// n->devpath = kasprintf(GFP_KERNEL, "kdbus/ns/%s", name); -+ if (!n->devpath) { -+ err = -ENOMEM; -+ goto err; -+ } -+ -+ /* get dynamic major */ -+ n->major = register_chrdev(0, "kdbus", &kdbus_device_ops); -+ if (n->major < 0) { -+ err = n->major; -+ goto err; -+ } -+ n->name = ns_name; -+ } -+ -+ /* register major in our namespace map */ -+ mutex_lock(&kdbus_subsys_lock); -+ if (!idr_pre_get(&kdbus_ns_major_idr, GFP_KERNEL)) { -+ err = -ENOMEM; -+ goto err_unlock; -+ } -+ err = idr_get_new_above(&kdbus_ns_major_idr, n, n->major, &i); -+ if (err >= 0 && n->major != i) { -+ idr_remove(&kdbus_ns_major_idr, i); -+ err = -EEXIST; -+ goto err_unlock; -+ } -+ -+ /* get id for this namespace */ -+ n->id = kdbus_ns_id_next++; -+ -+ /* register control device for this namespace */ -+ n->dev = kzalloc(sizeof(struct device), GFP_KERNEL); -+ if (!n->dev) -+ goto err_unlock; -+ dev_set_name(n->dev, "%s/%s", n->devpath, "control"); -+ n->dev->bus = &kdbus_subsys; -+ n->dev->type = &kdbus_devtype_control; -+ n->dev->devt = MKDEV(n->major, 0); -+ dev_set_drvdata(n->dev, n); -+ err = device_register(n->dev); -+ if (err < 0) { -+ put_device(n->dev); -+ n->dev = NULL; -+ goto err_unlock; -+ } -+ -+ /* Add to global list of namespaces so we can find it again */ -+ list_add_tail(&n->list_entry, &namespace_list); -+ -+ mutex_unlock(&kdbus_subsys_lock); -+ -+ *ns = n; -+ pr_info("created namespace %llu '%s/'\n", -+ (unsigned long long)n->id, n->devpath); -+ return 0; -+ -+err_unlock: -+ mutex_unlock(&kdbus_subsys_lock); -+err: -+ kdbus_ns_unref(n); -+ return err; -+} -+ -+struct kdbus_ns *kdbus_ns_find(const char *name) -+{ -+ struct kdbus_ns *ns; -+ -+ mutex_lock(&kdbus_subsys_lock); -+ list_for_each_entry(ns, &namespace_list, list_entry) { -+ if (!strcmp(ns->name, name)) -+ goto exit; -+ } -+ /* namespace not found so return NULL */ -+ ns = NULL; -+exit: -+ mutex_unlock(&kdbus_subsys_lock); -+ return ns; -+} -+ ---- /dev/null -+++ b/include/uapi/kdbus/kdbus.h -@@ -0,0 +1,123 @@ -+/* -+ * Copyright (C) 2013 Kay Sievers -+ * Copyright (C) 2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> -+ * Copyright (C) 2013 Linux Foundation -+ * -+ * kdbus is free software; you can redistribute it and/or modify it under -+ * the terms of the GNU Lesser General Public License as published by the -+ * Free Software Foundation; either version 2.1 of the License, or (at -+ * your option) any later version. -+ * -+ */ -+ -+#ifndef _KDBUS_H_ -+#define _KDBUS_H_ -+ -+#define KDBUS_IOC_MAGIC 0x95 -+ -+/* kdbus control device commands */ -+struct kdbus_cmd_name { -+ uint64_t capabilities; -+ char name[256]; -+ char reserved[256]; -+}; -+ -+struct kdbus_fake_message { -+ char msg[256]; /* FIXME obviously... */ -+}; -+ -+/** -+ * struct kdbus_msg -+ * -+ * set by userspace: -+ * dst_id: destination id -+ * filter: bloom filter for the kernel to use to filter messages -+ * data_count: number of data structures for this message -+ * data: data for the message -+ * -+ * set by kernel: -+ * msg_id: message id, to allow userspace to sort messages -+ * src_id: who sent the message -+ * src_uid: uid of sending process -+ * src_gid: gid of sending process -+ * src_pid: pid of sending process -+ * src_tid: tid of sending process -+ * ts_nsec: timestamp when message was sent to the kernel -+ * -+ */ -+struct kdbus_msg { -+ __u64 dst_id; -+ __u64 filter; -+ -+ __u64 msg_id; -+ __u64 src_id; -+ __u64 flags; -+ __kernel_uid_t src_uid; -+ __kernel_gid_t src_gid; -+ __kernel_pid_t src_pid; -+ __kernel_pid_t src_tid; -+ __u64 ts_nsec; -+ __u64 reserved[8]; -+ __u32 data_count; -+ struct kdbus_msg_data *data; -+}; -+ -+ -+ -+#if 0 -+/* Old-style dbus had the following message type: */ -+struct old_dbus_header { -+ u8 endianness; /* 'l' for little endian, 'B' for big endian */ -+ u8 type; /* message type */ -+ u8 flags; -+ u8 protocol_version; -+ u32 message_length -+ u32 cookie; -+} -+ -+#define DBUS_TYPE_INVALID 0 -+#define DBUS_TYPE_METHOD_CALL 1 -+#define DBUS_TYPE_METHOD_RETURN 2 -+#define DBUS_TYPE_ERROR 3 -+#define DBUS_TYPE_SIGNAL 4 -+ -+#define DBUS_FLAG_NO_REPLY_EXPECTED 0x01 -+#define DBUS_FLAG_NO_AUTO_START 0x02 -+ -+#define DBUS_FIELD_INVALID 0 -+#define DBUS_FIELD_PATH 1 -+#define DBUS_FIELD_INTERFACE 2 -+#define DBUS_FIELD_MEMBER 3 -+#define DBUS_FIELD_ERROR_NAME 4 -+#define DBUS_FIELD_REPLY_SERIAL 5 -+#define DBUS_FIELD_DESTINATION 6 -+#define DBUS_FIELD_SENDER 7 -+#define DBUS_FIELD_SIGNATURE 8 -+#define DBUS_FIELD_UNIX_FDS 9 -+ -+#endif -+ -+enum kdbus_cmd { -+ /* kdbus control commands */ -+ KDBUS_CMD_BUS_CREATE = _IOW(KDBUS_IOC_MAGIC, 0x00, struct kdbus_cmd_name), -+ KDBUS_CMD_BUS_REMOVE = _IOW(KDBUS_IOC_MAGIC, 0x01, struct kdbus_cmd_name), -+ KDBUS_CMD_NS_CREATE = _IOW(KDBUS_IOC_MAGIC, 0x10, struct kdbus_cmd_name), -+ KDBUS_CMD_NS_REMOVE = _IOW(KDBUS_IOC_MAGIC, 0x11, struct kdbus_cmd_name), -+ -+ /* kdbus endpoint commands */ -+ KDBUS_CMD_EP_CREATE = _IOWR(KDBUS_IOC_MAGIC, 0x30, struct kdbus_cmd_name), -+ KDBUS_CMD_EP_REMOVE = _IOWR(KDBUS_IOC_MAGIC, 0x31, struct kdbus_cmd_name), -+ KDBUS_CMD_EP_POLICY_SET = _IOWR(KDBUS_IOC_MAGIC, 0x32, int), -+ -+ KDBUS_CMD_NAME_ACQUIRE = _IOWR(KDBUS_IOC_MAGIC, 0x50, int), -+ KDBUS_CMD_NAME_RELEASE = _IOWR(KDBUS_IOC_MAGIC, 0x51, int), -+ KDBUS_CMD_NAME_LIST = _IOWR(KDBUS_IOC_MAGIC, 0x52, int), -+ -+ KDBUS_CMD_MATCH_ADD = _IOWR(KDBUS_IOC_MAGIC, 0x60, int), -+ KDBUS_CMD_MATCH_REMOVE = _IOWR(KDBUS_IOC_MAGIC, 0x61, int), -+ -+ KDBUS_CMD_MSG_SEND = _IOWR(KDBUS_IOC_MAGIC, 0x80, struct kdbus_fake_message), -+ KDBUS_CMD_MSG_RECV = _IOWR(KDBUS_IOC_MAGIC, 0x81, struct kdbus_fake_message), -+}; -+ -+#endif ---- a/include/uapi/linux/major.h -+++ b/include/uapi/linux/major.h -@@ -166,6 +166,8 @@ - - #define OSST_MAJOR 206 /* OnStream-SCx0 SCSI tape */ - -+#define KDBUS_CHAR_MAJOR 222 -+ - #define IBM_TTY3270_MAJOR 227 - #define IBM_FS3270_MAJOR 228 - ---- /dev/null -+++ b/kdbus.c -@@ -0,0 +1,77 @@ -+#define _GNU_SOURCE -+#include <stdio.h> -+#include <string.h> -+#include <time.h> -+#include <fcntl.h> -+#include <stdlib.h> -+#include <unistd.h> -+#include <stdint.h> -+#include <errno.h> -+#include <assert.h> -+#include <sys/ioctl.h> -+ -+#include "include/uapi/kdbus/kdbus.h" -+ -+int main(int argc, char *argv[]) -+{ -+ int fdc; -+ int fdb; -+ struct kdbus_cmd_name name; -+ char *busname; -+ char *bus; -+ char *ep; -+ char *ns; -+ uid_t uid; -+ int err; -+ -+ uid = getuid(); -+ if (argv[1]) -+ busname = argv[1]; -+ else if (uid > 0) -+ busname = "system"; -+ else -+ busname = "user"; -+ strcpy(name.name, busname); -+ -+ printf("-- opening /dev/kdbus/control\n"); -+ fdc = open("/dev/kdbus/control", O_RDWR|O_CLOEXEC); -+ if (fdc < 0) -+ return EXIT_FAILURE; -+ -+ asprintf(&ns, "mydebiancontainer"); -+ strcpy(name.name, ns); -+ printf("-- creating namespace called %s\n", ns); -+ err = ioctl(fdc, KDBUS_CMD_NS_CREATE, &name); -+ if (err) -+ printf("--- error \"%s\"\n", err, strerror(errno)); -+ -+ printf("-- creating bus '%s'\n", name.name); -+ err = ioctl(fdc, KDBUS_CMD_BUS_CREATE, &name); -+ if (err) -+ printf("--- error \"%s\"\n", err, strerror(errno)); -+ -+ if (uid > 0) -+ asprintf(&bus, "/dev/kdbus/%u-%s/bus", uid, busname); -+ else -+ asprintf(&bus, "/dev/kdbus/%s/bus", busname); -+ printf("-- opening bus connection %s\n", bus); -+ fdb = open(bus, O_RDWR|O_CLOEXEC); -+ -+ -+ asprintf(&ep, "ep-42"); -+ strcpy(name.name, ep); -+ printf("-- creating endpoint for bus %s called %s\n", bus, ep); -+ err = ioctl(fdb, KDBUS_CMD_EP_CREATE, &name); -+ if (err) -+ printf("--- error \"%s\"\n", err, strerror(errno)); -+ -+ printf("-- sleeping 10s\n"); -+ sleep(10); -+ -+ printf("-- closing bus connection\n"); -+ close(fdb); -+ -+ printf("-- closing bus master\n"); -+ close(fdc); -+ return EXIT_SUCCESS; -+} diff --git a/backing-dev-convert-class-code-to-use-dev_groups.patch b/backing-dev-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..710d2624e8a5d4 --- /dev/null +++ b/backing-dev-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,63 @@ +From foo@baz Tue Jul 9 15:34:49 PDT 2013 +Date: Tue, 09 Jul 2013 15:34:49 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: backing-dev: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the backing device class code to +use the correct field. + +Cc: Andrew Morton <akpm@linux-foundation.org> +Cc: Jan Kara <jack@suse.cz> +Cc: Tejun Heo <tj@kernel.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + mm/backing-dev.c | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +--- a/mm/backing-dev.c ++++ b/mm/backing-dev.c +@@ -180,7 +180,8 @@ static ssize_t name##_show(struct device + struct backing_dev_info *bdi = dev_get_drvdata(dev); \ + \ + return snprintf(page, PAGE_SIZE-1, "%lld\n", (long long)expr); \ +-} ++} \ ++static DEVICE_ATTR_RW(name); + + BDI_SHOW(read_ahead_kb, K(bdi->ra_pages)) + +@@ -231,14 +232,16 @@ static ssize_t stable_pages_required_sho + return snprintf(page, PAGE_SIZE-1, "%d\n", + bdi_cap_stable_pages_required(bdi) ? 1 : 0); + } ++static DEVICE_ATTR_RO(stable_pages_required); + +-static struct device_attribute bdi_dev_attrs[] = { +- __ATTR_RW(read_ahead_kb), +- __ATTR_RW(min_ratio), +- __ATTR_RW(max_ratio), +- __ATTR_RO(stable_pages_required), +- __ATTR_NULL, ++static struct attribute *bdi_dev_attrs[] = { ++ &dev_attr_read_ahead_kb.attr, ++ &dev_attr_min_ratio.attr, ++ &dev_attr_max_ratio.attr, ++ &dev_attr_stable_pages_required.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(bdi_dev); + + static __init int bdi_class_init(void) + { +@@ -246,7 +249,7 @@ static __init int bdi_class_init(void) + if (IS_ERR(bdi_class)) + return PTR_ERR(bdi_class); + +- bdi_class->dev_attrs = bdi_dev_attrs; ++ bdi_class->dev_groups = bdi_dev_groups; + bdi_debug_init(); + return 0; + } diff --git a/bsr-convert-bsr_class-to-use-dev_groups.patch b/bsr-convert-bsr_class-to-use-dev_groups.patch new file mode 100644 index 00000000000000..e43d9d812375c1 --- /dev/null +++ b/bsr-convert-bsr_class-to-use-dev_groups.patch @@ -0,0 +1,66 @@ +From foo@baz Tue Jul 9 14:47:37 PDT 2013 +Date: Tue, 09 Jul 2013 14:47:37 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: bsr: convert bsr_class to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the bsr bsr_class code to use +the correct field. + +Cc: Arnd Bergmann <arnd@arndb.de> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/char/bsr.c | 18 +++++++++++------- + 1 file changed, 11 insertions(+), 7 deletions(-) + +--- a/drivers/char/bsr.c ++++ b/drivers/char/bsr.c +@@ -95,6 +95,7 @@ bsr_size_show(struct device *dev, struct + struct bsr_dev *bsr_dev = dev_get_drvdata(dev); + return sprintf(buf, "%u\n", bsr_dev->bsr_bytes); + } ++static DEVICE_ATTR_RO(bsr_size); + + static ssize_t + bsr_stride_show(struct device *dev, struct device_attribute *attr, char *buf) +@@ -102,20 +103,23 @@ bsr_stride_show(struct device *dev, stru + struct bsr_dev *bsr_dev = dev_get_drvdata(dev); + return sprintf(buf, "%u\n", bsr_dev->bsr_stride); + } ++static DEVICE_ATTR_RO(bsr_stride); + + static ssize_t +-bsr_len_show(struct device *dev, struct device_attribute *attr, char *buf) ++bsr_length_show(struct device *dev, struct device_attribute *attr, char *buf) + { + struct bsr_dev *bsr_dev = dev_get_drvdata(dev); + return sprintf(buf, "%llu\n", bsr_dev->bsr_len); + } ++static DEVICE_ATTR_RO(bsr_length); + +-static struct device_attribute bsr_dev_attrs[] = { +- __ATTR(bsr_size, S_IRUGO, bsr_size_show, NULL), +- __ATTR(bsr_stride, S_IRUGO, bsr_stride_show, NULL), +- __ATTR(bsr_length, S_IRUGO, bsr_len_show, NULL), +- __ATTR_NULL ++static struct attribute *bsr_dev_attrs[] = { ++ &dev_attr_bsr_size.attr, ++ &dev_attr_bsr_stride.attr, ++ &dev_attr_bsr_length.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(bsr_dev); + + static int bsr_mmap(struct file *filp, struct vm_area_struct *vma) + { +@@ -308,7 +312,7 @@ static int __init bsr_init(void) + ret = PTR_ERR(bsr_class); + goto out_err_1; + } +- bsr_class->dev_attrs = bsr_dev_attrs; ++ bsr_class->dev_groups = bsr_dev_groups; + + ret = alloc_chrdev_region(&bsr_dev, 0, BSR_MAX_DEVS, "bsr"); + bsr_major = MAJOR(bsr_dev); diff --git a/c2port-convert-class-code-to-use-bin_attrs-in-groups.patch b/c2port-convert-class-code-to-use-bin_attrs-in-groups.patch new file mode 100644 index 00000000000000..7d88166ddee850 --- /dev/null +++ b/c2port-convert-class-code-to-use-bin_attrs-in-groups.patch @@ -0,0 +1,77 @@ +From foo@baz Wed Jul 10 12:20:53 PDT 2013 +Date: Wed, 10 Jul 2013 12:20:53 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: c2port: convert class code to use bin_attrs in groups + +Now that attribute groups support binary attributes, use them instead of +the dev_bin_attrs field in struct class, as that is going away soon. + +Cc: Rodolfo Giometti <giometti@linux.it> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/misc/c2port/core.c | 31 +++++++++++++++++-------------- + 1 file changed, 17 insertions(+), 14 deletions(-) + +--- a/drivers/misc/c2port/core.c ++++ b/drivers/misc/c2port/core.c +@@ -856,6 +856,9 @@ static ssize_t c2port_write_flash_data(s + + return ret; + } ++/* size is computed at run-time */ ++static BIN_ATTR(flash_data, 0644, c2port_read_flash_data, ++ c2port_write_flash_data, 0); + + /* + * Class attributes +@@ -873,19 +876,20 @@ static struct attribute *c2port_attrs[] + &dev_attr_flash_erase.attr, + NULL, + }; +-ATTRIBUTE_GROUPS(c2port); + +-static struct bin_attribute c2port_bin_attrs[] = { +- { +- .attr = { +- .name = "flash_data", +- .mode = 0644 +- }, +- .read = c2port_read_flash_data, +- .write = c2port_write_flash_data, +- /* .size is computed at run-time */ +- }, +- __ATTR_NULL ++static struct bin_attribute *c2port_bin_attrs[] = { ++ &bin_attr_flash_data, ++ NULL, ++}; ++ ++static const struct attribute_group c2port_group = { ++ .attrs = c2port_attrs, ++ .bin_attrs = c2port_bin_attrs, ++}; ++ ++static const struct attribute_group *c2port_groups[] = { ++ &c2port_group, ++ NULL, + }; + + /* +@@ -918,7 +922,7 @@ struct c2port_device *c2port_device_regi + goto error_idr_alloc; + c2dev->id = ret; + +- c2port_bin_attrs[0].size = ops->blocks_num * ops->block_size; ++ bin_attr_flash_data.size = ops->blocks_num * ops->block_size; + + c2dev->dev = device_create(c2port_class, NULL, 0, c2dev, + "c2port%d", c2dev->id); +@@ -988,7 +992,6 @@ static int __init c2port_init(void) + return PTR_ERR(c2port_class); + } + c2port_class->dev_groups = c2port_groups; +- c2port_class->dev_bin_attrs = c2port_bin_attrs; + + return 0; + } diff --git a/c2port-convert-class-code-to-use-dev_groups.patch b/c2port-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..35f65086e635bc --- /dev/null +++ b/c2port-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,161 @@ +From foo@baz Tue Jul 9 15:10:20 PDT 2013 +Date: Tue, 09 Jul 2013 15:10:20 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: c2port: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the c2port class code to use the +correct field. + +Cc: Rodolfo Giometti <giometti@linux.it> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/misc/c2port/core.c | 50 ++++++++++++++++++++++++++------------------- + 1 file changed, 29 insertions(+), 21 deletions(-) + +--- a/drivers/misc/c2port/core.c ++++ b/drivers/misc/c2port/core.c +@@ -311,6 +311,7 @@ static ssize_t c2port_show_name(struct d + + return sprintf(buf, "%s\n", c2dev->name); + } ++static DEVICE_ATTR(name, 0444, c2port_show_name, NULL); + + static ssize_t c2port_show_flash_blocks_num(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -320,6 +321,7 @@ static ssize_t c2port_show_flash_blocks_ + + return sprintf(buf, "%d\n", ops->blocks_num); + } ++static DEVICE_ATTR(flash_blocks_num, 0444, c2port_show_flash_blocks_num, NULL); + + static ssize_t c2port_show_flash_block_size(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -329,6 +331,7 @@ static ssize_t c2port_show_flash_block_s + + return sprintf(buf, "%d\n", ops->block_size); + } ++static DEVICE_ATTR(flash_block_size, 0444, c2port_show_flash_block_size, NULL); + + static ssize_t c2port_show_flash_size(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -338,18 +341,18 @@ static ssize_t c2port_show_flash_size(st + + return sprintf(buf, "%d\n", ops->blocks_num * ops->block_size); + } ++static DEVICE_ATTR(flash_size, 0444, c2port_show_flash_size, NULL); + +-static ssize_t c2port_show_access(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t access_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct c2port_device *c2dev = dev_get_drvdata(dev); + + return sprintf(buf, "%d\n", c2dev->access); + } + +-static ssize_t c2port_store_access(struct device *dev, +- struct device_attribute *attr, +- const char *buf, size_t count) ++static ssize_t access_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct c2port_device *c2dev = dev_get_drvdata(dev); + struct c2port_ops *ops = c2dev->ops; +@@ -375,6 +378,7 @@ static ssize_t c2port_store_access(struc + + return count; + } ++static DEVICE_ATTR_RW(access); + + static ssize_t c2port_store_reset(struct device *dev, + struct device_attribute *attr, +@@ -395,6 +399,7 @@ static ssize_t c2port_store_reset(struct + + return count; + } ++static DEVICE_ATTR(reset, 0200, NULL, c2port_store_reset); + + static ssize_t __c2port_show_dev_id(struct c2port_device *dev, char *buf) + { +@@ -431,6 +436,7 @@ static ssize_t c2port_show_dev_id(struct + + return ret; + } ++static DEVICE_ATTR(dev_id, 0444, c2port_show_dev_id, NULL); + + static ssize_t __c2port_show_rev_id(struct c2port_device *dev, char *buf) + { +@@ -467,6 +473,7 @@ static ssize_t c2port_show_rev_id(struct + + return ret; + } ++static DEVICE_ATTR(rev_id, 0444, c2port_show_rev_id, NULL); + + static ssize_t c2port_show_flash_access(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -536,6 +543,8 @@ static ssize_t c2port_store_flash_access + + return count; + } ++static DEVICE_ATTR(flash_access, 0644, c2port_show_flash_access, ++ c2port_store_flash_access); + + static ssize_t __c2port_write_flash_erase(struct c2port_device *dev) + { +@@ -616,6 +625,7 @@ static ssize_t c2port_store_flash_erase( + + return count; + } ++static DEVICE_ATTR(flash_erase, 0200, NULL, c2port_store_flash_erase); + + static ssize_t __c2port_read_flash_data(struct c2port_device *dev, + char *buffer, loff_t offset, size_t count) +@@ -850,22 +860,20 @@ static ssize_t c2port_write_flash_data(s + /* + * Class attributes + */ +- +-static struct device_attribute c2port_attrs[] = { +- __ATTR(name, 0444, c2port_show_name, NULL), +- __ATTR(flash_blocks_num, 0444, c2port_show_flash_blocks_num, NULL), +- __ATTR(flash_block_size, 0444, c2port_show_flash_block_size, NULL), +- __ATTR(flash_size, 0444, c2port_show_flash_size, NULL), +- __ATTR(access, 0644, c2port_show_access, c2port_store_access), +- __ATTR(reset, 0200, NULL, c2port_store_reset), +- __ATTR(dev_id, 0444, c2port_show_dev_id, NULL), +- __ATTR(rev_id, 0444, c2port_show_rev_id, NULL), +- +- __ATTR(flash_access, 0644, c2port_show_flash_access, +- c2port_store_flash_access), +- __ATTR(flash_erase, 0200, NULL, c2port_store_flash_erase), +- __ATTR_NULL, ++static struct attribute *c2port_attrs[] = { ++ &dev_attr_name.attr, ++ &dev_attr_flash_blocks_num.attr, ++ &dev_attr_flash_block_size.attr, ++ &dev_attr_flash_size.attr, ++ &dev_attr_access.attr, ++ &dev_attr_reset.attr, ++ &dev_attr_dev_id.attr, ++ &dev_attr_rev_id.attr, ++ &dev_attr_flash_access.attr, ++ &dev_attr_flash_erase.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(c2port); + + static struct bin_attribute c2port_bin_attrs[] = { + { +@@ -979,7 +987,7 @@ static int __init c2port_init(void) + printk(KERN_ERR "c2port: failed to allocate class\n"); + return PTR_ERR(c2port_class); + } +- c2port_class->dev_attrs = c2port_attrs; ++ c2port_class->dev_groups = c2port_groups; + c2port_class->dev_bin_attrs = c2port_bin_attrs; + + return 0; diff --git a/cuse-convert-class-code-to-use-dev_groups.patch b/cuse-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..b11e4401de6b64 --- /dev/null +++ b/cuse-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,54 @@ +From foo@baz Tue Jul 9 15:33:17 PDT 2013 +Date: Tue, 09 Jul 2013 15:33:17 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: cuse: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the cuse class code to use the +correct field. + +Cc: Miklos Szeredi <miklos@szeredi.hu> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + fs/fuse/cuse.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +--- a/fs/fuse/cuse.c ++++ b/fs/fuse/cuse.c +@@ -568,6 +568,7 @@ static ssize_t cuse_class_waiting_show(s + + return sprintf(buf, "%d\n", atomic_read(&cc->fc.num_waiting)); + } ++static DEVICE_ATTR(waiting, S_IFREG | 0400, cuse_class_waiting_show, NULL); + + static ssize_t cuse_class_abort_store(struct device *dev, + struct device_attribute *attr, +@@ -578,12 +579,14 @@ static ssize_t cuse_class_abort_store(st + fuse_abort_conn(&cc->fc); + return count; + } ++static DEVICE_ATTR(abort, S_IFREG | 0200, NULL, cuse_class_abort_store); + +-static struct device_attribute cuse_class_dev_attrs[] = { +- __ATTR(waiting, S_IFREG | 0400, cuse_class_waiting_show, NULL), +- __ATTR(abort, S_IFREG | 0200, NULL, cuse_class_abort_store), +- { } ++static struct attribute *cuse_class_dev_attrs[] = { ++ &dev_attr_waiting.attr, ++ &dev_attr_abort.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(cuse_class_dev); + + static struct miscdevice cuse_miscdev = { + .minor = MISC_DYNAMIC_MINOR, +@@ -609,7 +612,7 @@ static int __init cuse_init(void) + if (IS_ERR(cuse_class)) + return PTR_ERR(cuse_class); + +- cuse_class->dev_attrs = cuse_class_dev_attrs; ++ cuse_class->dev_groups = cuse_class_dev_groups; + + rc = misc_register(&cuse_miscdev); + if (rc) { diff --git a/dbus.patch b/dbus.patch deleted file mode 100644 index 51bc79232d0fa1..00000000000000 --- a/dbus.patch +++ /dev/null @@ -1,111 +0,0 @@ -From foo@baz Thu Dec 27 10:01:09 PST 2012 -Date: Thu, 27 Dec 2012 10:01:09 -0800 -To: Greg KH <gregkh@linuxfoundation.org> -From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -Subject: dbus: in the kernel - -Something to play around with, don't take this seriously, yet... - ---- - drivers/char/Kconfig | 3 ++ - drivers/char/Makefile | 1 - drivers/char/dbus.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ - include/linux/dbus.h | 15 +++++++++++++ - 4 files changed, 76 insertions(+) - ---- a/drivers/char/Kconfig -+++ b/drivers/char/Kconfig -@@ -604,5 +604,8 @@ config TILE_SROM - device appear much like a simple EEPROM, and knows - how to partition a single ROM for multiple purposes. - -+config DBUS -+ tristate "Kernel DBUS provider" -+ - endmenu - ---- a/drivers/char/Makefile -+++ b/drivers/char/Makefile -@@ -62,3 +62,4 @@ obj-$(CONFIG_JS_RTC) += js-rtc.o - js-rtc-y = rtc.o - - obj-$(CONFIG_TILE_SROM) += tile-srom.o -+obj-$(CONFIG_DBUS) += dbus.o ---- /dev/null -+++ b/drivers/char/dbus.c -@@ -0,0 +1,57 @@ -+/* -+ * dbus - in kernel dbus functionality -+ * -+ * Copyright (C) 2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> -+ * Copyright (C) 2012 Linux Foundation -+ * -+ * This file is released under the GPLv2 only. -+ */ -+ -+#include <linux/types.h> -+#include <linux/mutex.h> -+#include <linux/idr.h> -+#include <linux/module.h> -+#include <linux/dbus.h> -+ -+static DEFINE_MUTEX(minor_lock); -+static DEFINE_IDR(minor_idr); -+ -+static int minor_get(void) -+{ -+ int minor = -ENOMEM; -+ int retval; -+ -+ mutex_lock(&minor_lock); -+ if (idr_pre_get(&minor_idr, GFP_KERNEL) == 0) -+ goto exit; -+ retval = idr_get_new(&minor_idr, NULL, &minor); -+ if (retval < 0) { -+ minor = retval; -+ if (retval == -EAGAIN) -+ minor = -ENOMEM; -+ } -+exit: -+ mutex_unlock(&minor_lock); -+ return minor; -+} -+ -+static void minor_free(int minor) -+{ -+ mutex_lock(&minor_lock); -+ idr_remove(&minor_idr, minor); -+ mutex_unlock(&minor_lock); -+} -+ -+static int dbus_init(void) -+{ -+ return 0; -+} -+ -+static void dbus_exit(void) -+{ -+} -+ -+module_init(dbus_init); -+module_exit(dbus_exit); -+ -+MODULE_LICENSE("GPLv2"); ---- /dev/null -+++ b/include/linux/dbus.h -@@ -0,0 +1,15 @@ -+/* -+ * dbus.h - user/kernel dbus api -+ * -+ * Copyright (C) 2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> -+ * Copyright (C) 2012 Linux Foundation -+ * -+ * Released under the GPLv2 only. -+ */ -+ -+#ifndef __DBUS_H -+#define __DBUS_H -+ -+ -+ -+#endif /* __DBUS_H */ diff --git a/dev_removal.patch b/dev_removal.patch deleted file mode 100644 index 26888827a32d85..00000000000000 --- a/dev_removal.patch +++ /dev/null @@ -1,2677 +0,0 @@ -From foo@baz Wed Dec 12 11:06:35 PST 2012 -Date: Wed, 12 Dec 2012 11:06:35 -0800 -To: Greg KH <gregkh@linuxfoundation.org> -From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -Subject: [PATCH] remove unneeded __dev* markings - - -Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> - ---- - drivers/ide/aec62xx.c | 8 ++-- - drivers/ide/alim15x3.c | 10 +++--- - drivers/ide/cs5520.c | 4 +- - drivers/ide/cs5535.c | 5 +-- - drivers/ide/hpt366.c | 42 +++++++++++++------------- - drivers/ide/it8213.c | 4 +- - drivers/ide/it821x.c | 10 +++--- - drivers/ide/jmicron.c | 4 +- - drivers/ide/ns87415.c | 8 ++-- - drivers/ide/pdc202xx_new.c | 10 +++--- - drivers/ide/pdc202xx_old.c | 8 ++-- - drivers/ide/scc_pata.c | 20 +++++------- - drivers/ide/serverworks.c | 4 +- - drivers/ide/sgiioc4.c | 13 +++----- - drivers/ide/sis5513.c | 10 +++--- - drivers/ide/sl82c105.c | 4 +- - drivers/ide/triflex.c | 5 +-- - drivers/ide/trm290.c | 6 +-- - drivers/ide/via82cxxx.c | 8 ++-- - drivers/iio/accel/hid-sensor-accel-3d.c | 4 +- - drivers/iio/adc/ad7266.c | 8 ++-- - drivers/iio/adc/ad7298.c | 6 +-- - drivers/iio/adc/ad7476.c | 6 +-- - drivers/iio/adc/ad7791.c | 10 +++--- - drivers/iio/adc/ad7887.c | 6 +-- - drivers/iio/adc/at91_adc.c | 6 +-- - drivers/iio/adc/lp8788_adc.c | 6 +-- - drivers/iio/adc/max1363.c | 10 +++--- - drivers/iio/amplifiers/ad8366.c | 6 +-- - drivers/iio/dac/ad5064.c | 18 +++++------ - drivers/iio/dac/ad5360.c | 8 ++-- - drivers/iio/dac/ad5380.c | 22 ++++++------- - drivers/iio/dac/ad5421.c | 6 +-- - drivers/iio/dac/ad5446.c | 18 +++++------ - drivers/iio/dac/ad5449.c | 6 +-- - drivers/iio/dac/ad5504.c | 6 +-- - drivers/iio/dac/ad5624r_spi.c | 6 +-- - drivers/iio/dac/ad5686.c | 6 +-- - drivers/iio/dac/ad5755.c | 16 ++++----- - drivers/iio/dac/ad5764.c | 6 +-- - drivers/iio/dac/ad5791.c | 6 +-- - drivers/iio/dac/max517.c | 6 +-- - drivers/iio/dac/mcp4725.c | 8 ++-- - drivers/iio/frequency/ad9523.c | 6 +-- - drivers/iio/frequency/adf4350.c | 6 +-- - drivers/iio/gyro/hid-sensor-gyro-3d.c | 4 +- - drivers/iio/light/adjd_s311.c | 8 ++-- - drivers/iio/light/hid-sensor-als.c | 4 +- - drivers/iio/light/lm3533-als.c | 19 +++++------ - drivers/iio/light/vcnl4000.c | 8 ++-- - drivers/iio/magnetometer/hid-sensor-magn-3d.c | 4 +- - drivers/memory/tegra20-mc.c | 4 +- - drivers/memory/tegra30-mc.c | 4 +- - drivers/scsi/NCR_Q720.c | 2 - - drivers/scsi/a100u2w.c | 8 ++-- - drivers/scsi/aacraid/linit.c | 15 ++------- - drivers/scsi/aic94xx/aic94xx_init.c | 23 ++++++-------- - drivers/scsi/arm/cumana_2.c | 8 ++-- - drivers/scsi/bvme6000_scsi.c | 6 +-- - drivers/scsi/ips.c | 10 +++--- - drivers/scsi/jazz_esp.c | 6 +-- - drivers/scsi/lasi700.c | 2 - - drivers/scsi/mac_esp.c | 6 +-- - drivers/scsi/sni_53c710.c | 4 +- - drivers/scsi/stex.c | 5 +-- - drivers/scsi/sun_esp.c | 30 ++++++++---------- - drivers/scsi/zorro7xx.c | 12 +++---- - 67 files changed, 288 insertions(+), 305 deletions(-) - ---- a/drivers/ide/aec62xx.c -+++ b/drivers/ide/aec62xx.c -@@ -181,7 +181,7 @@ static const struct ide_port_ops atp86x_ - .cable_detect = atp86x_cable_detect, - }; - --static const struct ide_port_info aec62xx_chipsets[] __devinitconst = { -+static const struct ide_port_info aec62xx_chipsets[] = { - { /* 0: AEC6210 */ - .name = DRV_NAME, - .init_chipset = init_chipset_aec62xx, -@@ -251,7 +251,7 @@ static const struct ide_port_info aec62x - * chips, pass a local copy of 'struct ide_port_info' down the call chain. - */ - --static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) -+static int aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) - { - const struct chipset_bus_clock_list_entry *bus_clock; - struct ide_port_info d; -@@ -287,7 +287,7 @@ static int __devinit aec62xx_init_one(st - return err; - } - --static void __devexit aec62xx_remove(struct pci_dev *dev) -+static void aec62xx_remove(struct pci_dev *dev) - { - ide_pci_remove(dev); - pci_disable_device(dev); -@@ -307,7 +307,7 @@ static struct pci_driver aec62xx_pci_dri - .name = "AEC62xx_IDE", - .id_table = aec62xx_pci_tbl, - .probe = aec62xx_init_one, -- .remove = __devexit_p(aec62xx_remove), -+ .remove = aec62xx_remove, - .suspend = ide_pci_suspend, - .resume = ide_pci_resume, - }; ---- a/drivers/ide/alim15x3.c -+++ b/drivers/ide/alim15x3.c -@@ -415,7 +415,7 @@ static u8 ali_cable_detect(ide_hwif_t *h - * Sparc systems. - */ - --static void __devinit init_hwif_ali15x3 (ide_hwif_t *hwif) -+static void init_hwif_ali15x3(ide_hwif_t *hwif) - { - u8 ideic, inmir; - s8 irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6, -@@ -464,8 +464,7 @@ static void __devinit init_hwif_ali15x3 - * Set up the DMA functionality on the ALi 15x3. - */ - --static int __devinit init_dma_ali15x3(ide_hwif_t *hwif, -- const struct ide_port_info *d) -+static int init_dma_ali15x3(ide_hwif_t *hwif, const struct ide_port_info *d) - { - struct pci_dev *dev = to_pci_dev(hwif->dev); - unsigned long base = ide_pci_dma_base(hwif, d); -@@ -512,7 +511,7 @@ static const struct ide_dma_ops ali_dma_ - .dma_sff_read_status = ide_dma_sff_read_status, - }; - --static const struct ide_port_info ali15x3_chipset __devinitconst = { -+static const struct ide_port_info ali15x3_chipset = { - .name = DRV_NAME, - .init_chipset = init_chipset_ali15x3, - .init_hwif = init_hwif_ali15x3, -@@ -532,7 +531,8 @@ static const struct ide_port_info ali15x - * hot plug layer. - */ - --static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) -+static int alim15x3_init_one(struct pci_dev *dev, -+ const struct pci_device_id *id) - { - struct ide_port_info d = ali15x3_chipset; - u8 rev = dev->revision, idx = id->driver_data; ---- a/drivers/ide/cs5520.c -+++ b/drivers/ide/cs5520.c -@@ -94,7 +94,7 @@ static const struct ide_port_ops cs5520_ - .set_dma_mode = cs5520_set_dma_mode, - }; - --static const struct ide_port_info cyrix_chipset __devinitconst = { -+static const struct ide_port_info cyrix_chipset = { - .name = DRV_NAME, - .enablebits = { { 0x60, 0x01, 0x01 }, { 0x60, 0x02, 0x02 } }, - .port_ops = &cs5520_port_ops, -@@ -108,7 +108,7 @@ static const struct ide_port_info cyrix_ - * work longhand. - */ - --static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) -+static int cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) - { - const struct ide_port_info *d = &cyrix_chipset; - struct ide_hw hw[2], *hws[] = { NULL, NULL }; ---- a/drivers/ide/cs5535.c -+++ b/drivers/ide/cs5535.c -@@ -170,7 +170,7 @@ static const struct ide_port_ops cs5535_ - .cable_detect = cs5535_cable_detect, - }; - --static const struct ide_port_info cs5535_chipset __devinitconst = { -+static const struct ide_port_info cs5535_chipset = { - .name = DRV_NAME, - .port_ops = &cs5535_port_ops, - .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE, -@@ -179,8 +179,7 @@ static const struct ide_port_info cs5535 - .udma_mask = ATA_UDMA4, - }; - --static int __devinit cs5535_init_one(struct pci_dev *dev, -- const struct pci_device_id *id) -+static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id) - { - return ide_pci_init_one(dev, &cs5535_chipset, NULL); - } ---- a/drivers/ide/hpt366.c -+++ b/drivers/ide/hpt366.c -@@ -443,7 +443,7 @@ static struct hpt_timings hpt37x_timings - } - }; - --static const struct hpt_info hpt36x __devinitconst = { -+static const struct hpt_info hpt36x = { - .chip_name = "HPT36x", - .chip_type = HPT36x, - .udma_mask = HPT366_ALLOW_ATA66_3 ? (HPT366_ALLOW_ATA66_4 ? ATA_UDMA4 : ATA_UDMA3) : ATA_UDMA2, -@@ -451,7 +451,7 @@ static const struct hpt_info hpt36x __de - .timings = &hpt36x_timings - }; - --static const struct hpt_info hpt370 __devinitconst = { -+static const struct hpt_info hpt370 = { - .chip_name = "HPT370", - .chip_type = HPT370, - .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4, -@@ -459,7 +459,7 @@ static const struct hpt_info hpt370 __de - .timings = &hpt37x_timings - }; - --static const struct hpt_info hpt370a __devinitconst = { -+static const struct hpt_info hpt370a = { - .chip_name = "HPT370A", - .chip_type = HPT370A, - .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4, -@@ -467,7 +467,7 @@ static const struct hpt_info hpt370a __d - .timings = &hpt37x_timings - }; - --static const struct hpt_info hpt374 __devinitconst = { -+static const struct hpt_info hpt374 = { - .chip_name = "HPT374", - .chip_type = HPT374, - .udma_mask = ATA_UDMA5, -@@ -475,7 +475,7 @@ static const struct hpt_info hpt374 __de - .timings = &hpt37x_timings - }; - --static const struct hpt_info hpt372 __devinitconst = { -+static const struct hpt_info hpt372 = { - .chip_name = "HPT372", - .chip_type = HPT372, - .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, -@@ -483,7 +483,7 @@ static const struct hpt_info hpt372 __de - .timings = &hpt37x_timings - }; - --static const struct hpt_info hpt372a __devinitconst = { -+static const struct hpt_info hpt372a = { - .chip_name = "HPT372A", - .chip_type = HPT372A, - .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, -@@ -491,7 +491,7 @@ static const struct hpt_info hpt372a __d - .timings = &hpt37x_timings - }; - --static const struct hpt_info hpt302 __devinitconst = { -+static const struct hpt_info hpt302 = { - .chip_name = "HPT302", - .chip_type = HPT302, - .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, -@@ -499,7 +499,7 @@ static const struct hpt_info hpt302 __de - .timings = &hpt37x_timings - }; - --static const struct hpt_info hpt371 __devinitconst = { -+static const struct hpt_info hpt371 = { - .chip_name = "HPT371", - .chip_type = HPT371, - .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, -@@ -507,7 +507,7 @@ static const struct hpt_info hpt371 __de - .timings = &hpt37x_timings - }; - --static const struct hpt_info hpt372n __devinitconst = { -+static const struct hpt_info hpt372n = { - .chip_name = "HPT372N", - .chip_type = HPT372N, - .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, -@@ -515,7 +515,7 @@ static const struct hpt_info hpt372n __d - .timings = &hpt37x_timings - }; - --static const struct hpt_info hpt302n __devinitconst = { -+static const struct hpt_info hpt302n = { - .chip_name = "HPT302N", - .chip_type = HPT302N, - .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, -@@ -523,7 +523,7 @@ static const struct hpt_info hpt302n __d - .timings = &hpt37x_timings - }; - --static const struct hpt_info hpt371n __devinitconst = { -+static const struct hpt_info hpt371n = { - .chip_name = "HPT371N", - .chip_type = HPT371N, - .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, -@@ -1197,7 +1197,7 @@ static u8 hpt3xx_cable_detect(ide_hwif_t - return (scr1 & ata66) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; - } - --static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) -+static void init_hwif_hpt366(ide_hwif_t *hwif) - { - struct hpt_info *info = hpt3xx_get_info(hwif->dev); - u8 chip_type = info->chip_type; -@@ -1221,7 +1221,7 @@ static void __devinit init_hwif_hpt366(i - } - } - --static int __devinit init_dma_hpt366(ide_hwif_t *hwif, -+static int init_dma_hpt366(ide_hwif_t *hwif, - const struct ide_port_info *d) - { - struct pci_dev *dev = to_pci_dev(hwif->dev); -@@ -1265,7 +1265,7 @@ static int __devinit init_dma_hpt366(ide - return 0; - } - --static void __devinit hpt374_init(struct pci_dev *dev, struct pci_dev *dev2) -+static void hpt374_init(struct pci_dev *dev, struct pci_dev *dev2) - { - if (dev2->irq != dev->irq) { - /* FIXME: we need a core pci_set_interrupt() */ -@@ -1275,7 +1275,7 @@ static void __devinit hpt374_init(struct - } - } - --static void __devinit hpt371_init(struct pci_dev *dev) -+static void hpt371_init(struct pci_dev *dev) - { - u8 mcr1 = 0; - -@@ -1290,7 +1290,7 @@ static void __devinit hpt371_init(struct - pci_write_config_byte(dev, 0x50, mcr1 & ~0x04); - } - --static int __devinit hpt36x_init(struct pci_dev *dev, struct pci_dev *dev2) -+static int hpt36x_init(struct pci_dev *dev, struct pci_dev *dev2) - { - u8 mcr1 = 0, pin1 = 0, pin2 = 0; - -@@ -1361,7 +1361,7 @@ static const struct ide_dma_ops hpt36x_d - .dma_sff_read_status = ide_dma_sff_read_status, - }; - --static const struct ide_port_info hpt366_chipsets[] __devinitconst = { -+static const struct ide_port_info hpt366_chipsets[] = { - { /* 0: HPT36x */ - .name = DRV_NAME, - .init_chipset = init_chipset_hpt366, -@@ -1402,7 +1402,7 @@ static const struct ide_port_info hpt366 - * Called when the PCI registration layer (or the IDE initialization) - * finds a device matching our IDE device tables. - */ --static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id) -+static int hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id) - { - const struct hpt_info *info = NULL; - struct hpt_info *dyn_info; -@@ -1499,7 +1499,7 @@ static int __devinit hpt366_init_one(str - return ret; - } - --static void __devexit hpt366_remove(struct pci_dev *dev) -+static void hpt366_remove(struct pci_dev *dev) - { - struct ide_host *host = pci_get_drvdata(dev); - struct ide_info *info = host->host_priv; -@@ -1510,7 +1510,7 @@ static void __devexit hpt366_remove(stru - kfree(info); - } - --static const struct pci_device_id hpt366_pci_tbl[] __devinitconst = { -+static const struct pci_device_id hpt366_pci_tbl[] = { - { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT366), 0 }, - { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT372), 1 }, - { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT302), 2 }, -@@ -1525,7 +1525,7 @@ static struct pci_driver hpt366_pci_driv - .name = "HPT366_IDE", - .id_table = hpt366_pci_tbl, - .probe = hpt366_init_one, -- .remove = __devexit_p(hpt366_remove), -+ .remove = hpt366_remove, - .suspend = ide_pci_suspend, - .resume = ide_pci_resume, - }; ---- a/drivers/ide/it8213.c -+++ b/drivers/ide/it8213.c -@@ -156,7 +156,7 @@ static const struct ide_port_ops it8213_ - .cable_detect = it8213_cable_detect, - }; - --static const struct ide_port_info it8213_chipset __devinitconst = { -+static const struct ide_port_info it8213_chipset = { - .name = DRV_NAME, - .enablebits = { {0x41, 0x80, 0x80} }, - .port_ops = &it8213_port_ops, -@@ -177,7 +177,7 @@ static const struct ide_port_info it8213 - * standard helper functions to do almost all the work for us. - */ - --static int __devinit it8213_init_one(struct pci_dev *dev, const struct pci_device_id *id) -+static int it8213_init_one(struct pci_dev *dev, const struct pci_device_id *id) - { - return ide_pci_init_one(dev, &it8213_chipset, NULL); - } ---- a/drivers/ide/it821x.c -+++ b/drivers/ide/it821x.c -@@ -528,7 +528,7 @@ static struct ide_dma_ops it821x_pass_th - * ide DMA handlers appropriately - */ - --static void __devinit init_hwif_it821x(ide_hwif_t *hwif) -+static void init_hwif_it821x(ide_hwif_t *hwif) - { - struct pci_dev *dev = to_pci_dev(hwif->dev); - struct ide_host *host = pci_get_drvdata(dev); -@@ -630,7 +630,7 @@ static const struct ide_port_ops it821x_ - .cable_detect = it821x_cable_detect, - }; - --static const struct ide_port_info it821x_chipset __devinitconst = { -+static const struct ide_port_info it821x_chipset = { - .name = DRV_NAME, - .init_chipset = init_chipset_it821x, - .init_hwif = init_hwif_it821x, -@@ -647,7 +647,7 @@ static const struct ide_port_info it821x - * We then use the IDE PCI generic helper to do most of the work. - */ - --static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id) -+static int it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id) - { - struct it821x_dev *itdevs; - int rc; -@@ -667,7 +667,7 @@ static int __devinit it821x_init_one(str - return rc; - } - --static void __devexit it821x_remove(struct pci_dev *dev) -+static void it821x_remove(struct pci_dev *dev) - { - struct ide_host *host = pci_get_drvdata(dev); - struct it821x_dev *itdevs = host->host_priv; -@@ -689,7 +689,7 @@ static struct pci_driver it821x_pci_driv - .name = "ITE821x IDE", - .id_table = it821x_pci_tbl, - .probe = it821x_init_one, -- .remove = __devexit_p(it821x_remove), -+ .remove = it821x_remove, - .suspend = ide_pci_suspend, - .resume = ide_pci_resume, - }; ---- a/drivers/ide/jmicron.c -+++ b/drivers/ide/jmicron.c -@@ -102,7 +102,7 @@ static const struct ide_port_ops jmicron - .cable_detect = jmicron_cable_detect, - }; - --static const struct ide_port_info jmicron_chipset __devinitconst = { -+static const struct ide_port_info jmicron_chipset = { - .name = DRV_NAME, - .enablebits = { { 0x40, 0x01, 0x01 }, { 0x40, 0x10, 0x10 } }, - .port_ops = &jmicron_port_ops, -@@ -120,7 +120,7 @@ static const struct ide_port_info jmicro - * We then use the IDE PCI generic helper to do most of the work. - */ - --static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id) -+static int jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id) - { - return ide_pci_init_one(dev, &jmicron_chipset, NULL); - } ---- a/drivers/ide/ns87415.c -+++ b/drivers/ide/ns87415.c -@@ -96,7 +96,7 @@ static const struct ide_tp_ops superio_t - .output_data = ide_output_data, - }; - --static void __devinit superio_init_iops(struct hwif_s *hwif) -+static void superio_init_iops(struct hwif_s *hwif) - { - struct pci_dev *pdev = to_pci_dev(hwif->dev); - u32 dma_stat; -@@ -201,7 +201,7 @@ static int ns87415_dma_end(ide_drive_t * - return (dma_stat & 7) != 4; - } - --static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) -+static void init_hwif_ns87415 (ide_hwif_t *hwif) - { - struct pci_dev *dev = to_pci_dev(hwif->dev); - unsigned int ctrl, using_inta; -@@ -293,7 +293,7 @@ static const struct ide_dma_ops ns87415_ - .dma_sff_read_status = superio_dma_sff_read_status, - }; - --static const struct ide_port_info ns87415_chipset __devinitconst = { -+static const struct ide_port_info ns87415_chipset = { - .name = DRV_NAME, - .init_hwif = init_hwif_ns87415, - .tp_ops = &ns87415_tp_ops, -@@ -302,7 +302,7 @@ static const struct ide_port_info ns8741 - IDE_HFLAG_NO_ATAPI_DMA, - }; - --static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id) -+static int ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id) - { - struct ide_port_info d = ns87415_chipset; - ---- a/drivers/ide/pdc202xx_new.c -+++ b/drivers/ide/pdc202xx_new.c -@@ -422,7 +422,7 @@ static int init_chipset_pdcnew(struct pc - return 0; - } - --static struct pci_dev * __devinit pdc20270_get_dev2(struct pci_dev *dev) -+static struct pci_dev *pdc20270_get_dev2(struct pci_dev *dev) - { - struct pci_dev *dev2; - -@@ -465,7 +465,7 @@ static const struct ide_port_ops pdcnew_ - .udma_mask = udma, \ - } - --static const struct ide_port_info pdcnew_chipsets[] __devinitconst = { -+static const struct ide_port_info pdcnew_chipsets[] = { - /* 0: PDC202{68,70} */ DECLARE_PDCNEW_DEV(ATA_UDMA5), - /* 1: PDC202{69,71,75,76,77} */ DECLARE_PDCNEW_DEV(ATA_UDMA6), - }; -@@ -479,7 +479,7 @@ static const struct ide_port_info pdcnew - * finds a device matching our IDE device tables. - */ - --static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id) -+static int pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id) - { - const struct ide_port_info *d = &pdcnew_chipsets[id->driver_data]; - struct pci_dev *bridge = dev->bus->self; -@@ -514,7 +514,7 @@ static int __devinit pdc202new_init_one( - return ide_pci_init_one(dev, d, NULL); - } - --static void __devexit pdc202new_remove(struct pci_dev *dev) -+static void pdc202new_remove(struct pci_dev *dev) - { - struct ide_host *host = pci_get_drvdata(dev); - struct pci_dev *dev2 = host->dev[1] ? to_pci_dev(host->dev[1]) : NULL; -@@ -539,7 +539,7 @@ static struct pci_driver pdc202new_pci_d - .name = "Promise_IDE", - .id_table = pdc202new_pci_tbl, - .probe = pdc202new_init_one, -- .remove = __devexit_p(pdc202new_remove), -+ .remove = pdc202new_remove, - .suspend = ide_pci_suspend, - .resume = ide_pci_resume, - }; ---- a/drivers/ide/pdc202xx_old.c -+++ b/drivers/ide/pdc202xx_old.c -@@ -211,8 +211,7 @@ out: - return 0; - } - --static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev, -- const char *name) -+static void pdc202ata4_fixup_irq(struct pci_dev *dev, const char *name) - { - if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) { - u8 irq = 0, irq2 = 0; -@@ -270,7 +269,7 @@ static const struct ide_dma_ops pdc2026x - .max_sectors = sectors, \ - } - --static const struct ide_port_info pdc202xx_chipsets[] __devinitconst = { -+static const struct ide_port_info pdc202xx_chipsets[] = { - { /* 0: PDC20246 */ - .name = DRV_NAME, - .init_chipset = init_chipset_pdc202xx, -@@ -297,7 +296,8 @@ static const struct ide_port_info pdc202 - * finds a device matching our IDE device tables. - */ - --static int __devinit pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) -+static int pdc202xx_init_one(struct pci_dev *dev, -+ const struct pci_device_id *id) - { - const struct ide_port_info *d; - u8 idx = id->driver_data; ---- a/drivers/ide/scc_pata.c -+++ b/drivers/ide/scc_pata.c -@@ -585,8 +585,7 @@ static int scc_ide_setup_pci_device(stru - * Perform the initial set up for this device. - */ - --static int __devinit init_setup_scc(struct pci_dev *dev, -- const struct ide_port_info *d) -+static int init_setup_scc(struct pci_dev *dev, const struct ide_port_info *d) - { - unsigned long ctl_base; - unsigned long dma_base; -@@ -718,7 +717,7 @@ static void scc_output_data(ide_drive_t - * - */ - --static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif) -+static void init_mmio_iops_scc(ide_hwif_t *hwif) - { - struct pci_dev *dev = to_pci_dev(hwif->dev); - struct scc_ports *ports = pci_get_drvdata(dev); -@@ -738,7 +737,7 @@ static void __devinit init_mmio_iops_scc - * and then do the MMIO setup. - */ - --static void __devinit init_iops_scc(ide_hwif_t *hwif) -+static void init_iops_scc(ide_hwif_t *hwif) - { - struct pci_dev *dev = to_pci_dev(hwif->dev); - -@@ -748,8 +747,7 @@ static void __devinit init_iops_scc(ide_ - init_mmio_iops_scc(hwif); - } - --static int __devinit scc_init_dma(ide_hwif_t *hwif, -- const struct ide_port_info *d) -+static int scc_init_dma(ide_hwif_t *hwif, const struct ide_port_info *d) - { - return ide_allocate_dma_engine(hwif); - } -@@ -768,7 +766,7 @@ static u8 scc_cable_detect(ide_hwif_t *h - * ide DMA handlers appropriately. - */ - --static void __devinit init_hwif_scc(ide_hwif_t *hwif) -+static void init_hwif_scc(ide_hwif_t *hwif) - { - /* PTERADD */ - out_be32((void __iomem *)(hwif->dma_base + 0x018), hwif->dmatable_dma); -@@ -811,7 +809,7 @@ static const struct ide_dma_ops scc_dma_ - .dma_sff_read_status = scc_dma_sff_read_status, - }; - --static const struct ide_port_info scc_chipset __devinitconst = { -+static const struct ide_port_info scc_chipset = { - .name = "sccIDE", - .init_iops = init_iops_scc, - .init_dma = scc_init_dma, -@@ -834,7 +832,7 @@ static const struct ide_port_info scc_ch - * We then use the IDE PCI generic helper to do most of the work. - */ - --static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_id *id) -+static int scc_init_one(struct pci_dev *dev, const struct pci_device_id *id) - { - return init_setup_scc(dev, &scc_chipset); - } -@@ -846,7 +844,7 @@ static int __devinit scc_init_one(struct - * Called by the PCI code when it removes an SCC PATA controller. - */ - --static void __devexit scc_remove(struct pci_dev *dev) -+static void scc_remove(struct pci_dev *dev) - { - struct scc_ports *ports = pci_get_drvdata(dev); - struct ide_host *host = ports->host; -@@ -869,7 +867,7 @@ static struct pci_driver scc_pci_driver - .name = "SCC IDE", - .id_table = scc_pci_tbl, - .probe = scc_init_one, -- .remove = __devexit_p(scc_remove), -+ .remove = scc_remove, - }; - - static int __init scc_ide_init(void) ---- a/drivers/ide/serverworks.c -+++ b/drivers/ide/serverworks.c -@@ -337,7 +337,7 @@ static const struct ide_port_ops svwks_p - .cable_detect = svwks_cable_detect, - }; - --static const struct ide_port_info serverworks_chipsets[] __devinitconst = { -+static const struct ide_port_info serverworks_chipsets[] = { - { /* 0: OSB4 */ - .name = DRV_NAME, - .init_chipset = init_chipset_svwks, -@@ -391,7 +391,7 @@ static const struct ide_port_info server - * finds a device matching our IDE device tables. - */ - --static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id) -+static int svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id) - { - struct ide_port_info d; - u8 idx = id->driver_data; ---- a/drivers/ide/sgiioc4.c -+++ b/drivers/ide/sgiioc4.c -@@ -307,8 +307,7 @@ static u8 sgiioc4_read_status(ide_hwif_t - } - - /* Creates a DMA map for the scatter-gather list entries */ --static int __devinit ide_dma_sgiioc4(ide_hwif_t *hwif, -- const struct ide_port_info *d) -+static int ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d) - { - struct pci_dev *dev = to_pci_dev(hwif->dev); - unsigned long dma_base = pci_resource_start(dev, 0) + IOC4_DMA_OFFSET; -@@ -520,7 +519,7 @@ static const struct ide_dma_ops sgiioc4_ - .dma_lost_irq = sgiioc4_dma_lost_irq, - }; - --static const struct ide_port_info sgiioc4_port_info __devinitconst = { -+static const struct ide_port_info sgiioc4_port_info = { - .name = DRV_NAME, - .chipset = ide_pci, - .init_dma = ide_dma_sgiioc4, -@@ -532,7 +531,7 @@ static const struct ide_port_info sgiioc - .mwdma_mask = ATA_MWDMA2_ONLY, - }; - --static int __devinit sgiioc4_ide_setup_pci_device(struct pci_dev *dev) -+static int sgiioc4_ide_setup_pci_device(struct pci_dev *dev) - { - unsigned long cmd_base, irqport; - unsigned long bar0, cmd_phys_base, ctl; -@@ -581,7 +580,7 @@ req_mem_rgn_err: - return rc; - } - --static unsigned int __devinit pci_init_sgiioc4(struct pci_dev *dev) -+static unsigned int pci_init_sgiioc4(struct pci_dev *dev) - { - int ret; - -@@ -601,7 +600,7 @@ out: - return ret; - } - --int __devinit ioc4_ide_attach_one(struct ioc4_driver_data *idd) -+int ioc4_ide_attach_one(struct ioc4_driver_data *idd) - { - /* - * PCI-RT does not bring out IDE connection. -@@ -613,7 +612,7 @@ int __devinit ioc4_ide_attach_one(struct - return pci_init_sgiioc4(idd->idd_pdev); - } - --static struct ioc4_submodule __devinitdata ioc4_ide_submodule = { -+static struct ioc4_submodule ioc4_ide_submodule = { - .is_name = "IOC4_ide", - .is_owner = THIS_MODULE, - .is_probe = ioc4_ide_attach_one, ---- a/drivers/ide/sis5513.c -+++ b/drivers/ide/sis5513.c -@@ -362,7 +362,7 @@ static u8 sis_ata133_udma_filter(ide_dri - return (regdw & 0x08) ? ATA_UDMA6 : ATA_UDMA5; - } - --static int __devinit sis_find_family(struct pci_dev *dev) -+static int sis_find_family(struct pci_dev *dev) - { - struct pci_dev *host; - int i = 0; -@@ -563,7 +563,7 @@ static const struct ide_port_ops sis_ata - .cable_detect = sis_cable_detect, - }; - --static const struct ide_port_info sis5513_chipset __devinitconst = { -+static const struct ide_port_info sis5513_chipset = { - .name = DRV_NAME, - .init_chipset = init_chipset_sis5513, - .enablebits = { {0x4a, 0x02, 0x02}, {0x4a, 0x04, 0x04} }, -@@ -572,7 +572,7 @@ static const struct ide_port_info sis551 - .mwdma_mask = ATA_MWDMA2, - }; - --static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id) -+static int sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id) - { - struct ide_port_info d = sis5513_chipset; - u8 udma_rates[] = { 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f }; -@@ -595,7 +595,7 @@ static int __devinit sis5513_init_one(st - return ide_pci_init_one(dev, &d, NULL); - } - --static void __devexit sis5513_remove(struct pci_dev *dev) -+static void sis5513_remove(struct pci_dev *dev) - { - ide_pci_remove(dev); - pci_disable_device(dev); -@@ -613,7 +613,7 @@ static struct pci_driver sis5513_pci_dri - .name = "SIS_IDE", - .id_table = sis5513_pci_tbl, - .probe = sis5513_init_one, -- .remove = __devexit_p(sis5513_remove), -+ .remove = sis5513_remove, - .suspend = ide_pci_suspend, - .resume = ide_pci_resume, - }; ---- a/drivers/ide/sl82c105.c -+++ b/drivers/ide/sl82c105.c -@@ -299,7 +299,7 @@ static const struct ide_dma_ops sl82c105 - .dma_sff_read_status = ide_dma_sff_read_status, - }; - --static const struct ide_port_info sl82c105_chipset __devinitconst = { -+static const struct ide_port_info sl82c105_chipset = { - .name = DRV_NAME, - .init_chipset = init_chipset_sl82c105, - .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, -@@ -313,7 +313,7 @@ static const struct ide_port_info sl82c1 - .mwdma_mask = ATA_MWDMA2, - }; - --static int __devinit sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id) -+static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id) - { - struct ide_port_info d = sl82c105_chipset; - u8 rev = sl82c105_bridge_revision(dev); ---- a/drivers/ide/triflex.c -+++ b/drivers/ide/triflex.c -@@ -92,7 +92,7 @@ static const struct ide_port_ops triflex - .set_dma_mode = triflex_set_mode, - }; - --static const struct ide_port_info triflex_device __devinitconst = { -+static const struct ide_port_info triflex_device = { - .name = DRV_NAME, - .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, - .port_ops = &triflex_port_ops, -@@ -101,8 +101,7 @@ static const struct ide_port_info trifle - .mwdma_mask = ATA_MWDMA2, - }; - --static int __devinit triflex_init_one(struct pci_dev *dev, -- const struct pci_device_id *id) -+static int triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id) - { - return ide_pci_init_one(dev, &triflex_device, NULL); - } ---- a/drivers/ide/trm290.c -+++ b/drivers/ide/trm290.c -@@ -231,7 +231,7 @@ static void trm290_dma_host_set(ide_driv - { - } - --static void __devinit init_hwif_trm290(ide_hwif_t *hwif) -+static void init_hwif_trm290(ide_hwif_t *hwif) - { - struct pci_dev *dev = to_pci_dev(hwif->dev); - unsigned int cfg_base = pci_resource_start(dev, 4); -@@ -324,7 +324,7 @@ static struct ide_dma_ops trm290_dma_ops - .dma_check = trm290_dma_check, - }; - --static const struct ide_port_info trm290_chipset __devinitconst = { -+static const struct ide_port_info trm290_chipset = { - .name = DRV_NAME, - .init_hwif = init_hwif_trm290, - .tp_ops = &trm290_tp_ops, -@@ -338,7 +338,7 @@ static const struct ide_port_info trm290 - IDE_HFLAG_NO_LBA48, - }; - --static int __devinit trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id) -+static int trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id) - { - return ide_pci_init_one(dev, &trm290_chipset, NULL); - } ---- a/drivers/ide/via82cxxx.c -+++ b/drivers/ide/via82cxxx.c -@@ -403,7 +403,7 @@ static const struct ide_port_ops via_por - .cable_detect = via82cxxx_cable_detect, - }; - --static const struct ide_port_info via82cxxx_chipset __devinitconst = { -+static const struct ide_port_info via82cxxx_chipset = { - .name = DRV_NAME, - .init_chipset = init_chipset_via82cxxx, - .enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } }, -@@ -416,7 +416,7 @@ static const struct ide_port_info via82c - .mwdma_mask = ATA_MWDMA2, - }; - --static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) -+static int via_init_one(struct pci_dev *dev, const struct pci_device_id *id) - { - struct pci_dev *isa = NULL; - struct via_isa_bridge *via_config; -@@ -489,7 +489,7 @@ static int __devinit via_init_one(struct - return rc; - } - --static void __devexit via_remove(struct pci_dev *dev) -+static void via_remove(struct pci_dev *dev) - { - struct ide_host *host = pci_get_drvdata(dev); - struct via82cxxx_dev *vdev = host->host_priv; -@@ -514,7 +514,7 @@ static struct pci_driver via_pci_driver - .name = "VIA_IDE", - .id_table = via_pci_tbl, - .probe = via_init_one, -- .remove = __devexit_p(via_remove), -+ .remove = via_remove, - .suspend = ide_pci_suspend, - .resume = ide_pci_resume, - }; ---- a/drivers/iio/accel/hid-sensor-accel-3d.c -+++ b/drivers/iio/accel/hid-sensor-accel-3d.c -@@ -278,7 +278,7 @@ static int accel_3d_parse_report(struct - } - - /* Function to initialize the processing for usage id */ --static int __devinit hid_accel_3d_probe(struct platform_device *pdev) -+static int hid_accel_3d_probe(struct platform_device *pdev) - { - int ret = 0; - static const char *name = "accel_3d"; -@@ -375,7 +375,7 @@ error_ret: - } - - /* Function to deinitialize the processing for usage id */ --static int __devinit hid_accel_3d_remove(struct platform_device *pdev) -+static int hid_accel_3d_remove(struct platform_device *pdev) - { - struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; - struct iio_dev *indio_dev = platform_get_drvdata(pdev); ---- a/drivers/iio/adc/ad7266.c -+++ b/drivers/iio/adc/ad7266.c -@@ -367,7 +367,7 @@ static const struct ad7266_chan_info ad7 - }, - }; - --static void __devinit ad7266_init_channels(struct iio_dev *indio_dev) -+static void ad7266_init_channels(struct iio_dev *indio_dev) - { - struct ad7266_state *st = iio_priv(indio_dev); - bool is_differential, is_signed; -@@ -391,7 +391,7 @@ static const char * const ad7266_gpio_la - "AD0", "AD1", "AD2", - }; - --static int __devinit ad7266_probe(struct spi_device *spi) -+static int ad7266_probe(struct spi_device *spi) - { - struct ad7266_platform_data *pdata = spi->dev.platform_data; - struct iio_dev *indio_dev; -@@ -494,7 +494,7 @@ error_put_reg: - return ret; - } - --static int __devexit ad7266_remove(struct spi_device *spi) -+static int ad7266_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad7266_state *st = iio_priv(indio_dev); -@@ -525,7 +525,7 @@ static struct spi_driver ad7266_driver = - .owner = THIS_MODULE, - }, - .probe = ad7266_probe, -- .remove = __devexit_p(ad7266_remove), -+ .remove = ad7266_remove, - .id_table = ad7266_id, - }; - module_spi_driver(ad7266_driver); ---- a/drivers/iio/adc/ad7298.c -+++ b/drivers/iio/adc/ad7298.c -@@ -292,7 +292,7 @@ static const struct iio_info ad7298_info - .driver_module = THIS_MODULE, - }; - --static int __devinit ad7298_probe(struct spi_device *spi) -+static int ad7298_probe(struct spi_device *spi) - { - struct ad7298_platform_data *pdata = spi->dev.platform_data; - struct ad7298_state *st; -@@ -370,7 +370,7 @@ error_free: - return ret; - } - --static int __devexit ad7298_remove(struct spi_device *spi) -+static int ad7298_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad7298_state *st = iio_priv(indio_dev); -@@ -398,7 +398,7 @@ static struct spi_driver ad7298_driver = - .owner = THIS_MODULE, - }, - .probe = ad7298_probe, -- .remove = __devexit_p(ad7298_remove), -+ .remove = ad7298_remove, - .id_table = ad7298_id, - }; - module_spi_driver(ad7298_driver); ---- a/drivers/iio/adc/ad7476.c -+++ b/drivers/iio/adc/ad7476.c -@@ -207,7 +207,7 @@ static const struct iio_info ad7476_info - .read_raw = &ad7476_read_raw, - }; - --static int __devinit ad7476_probe(struct spi_device *spi) -+static int ad7476_probe(struct spi_device *spi) - { - struct ad7476_state *st; - struct iio_dev *indio_dev; -@@ -277,7 +277,7 @@ error_ret: - return ret; - } - --static int __devexit ad7476_remove(struct spi_device *spi) -+static int ad7476_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad7476_state *st = iio_priv(indio_dev); -@@ -322,7 +322,7 @@ static struct spi_driver ad7476_driver = - .owner = THIS_MODULE, - }, - .probe = ad7476_probe, -- .remove = __devexit_p(ad7476_remove), -+ .remove = ad7476_remove, - .id_table = ad7476_id, - }; - module_spi_driver(ad7476_driver); ---- a/drivers/iio/adc/ad7791.c -+++ b/drivers/iio/adc/ad7791.c -@@ -325,8 +325,8 @@ static const struct iio_info ad7791_no_f - .driver_module = THIS_MODULE, - }; - --static int __devinit ad7791_setup(struct ad7791_state *st, -- struct ad7791_platform_data *pdata) -+static int ad7791_setup(struct ad7791_state *st, -+ struct ad7791_platform_data *pdata) - { - /* Set to poweron-reset default values */ - st->mode = AD7791_MODE_BUFFER; -@@ -349,7 +349,7 @@ static int __devinit ad7791_setup(struct - st->mode); - } - --static int __devinit ad7791_probe(struct spi_device *spi) -+static int ad7791_probe(struct spi_device *spi) - { - struct ad7791_platform_data *pdata = spi->dev.platform_data; - struct iio_dev *indio_dev; -@@ -418,7 +418,7 @@ err_iio_free: - return ret; - } - --static int __devexit ad7791_remove(struct spi_device *spi) -+static int ad7791_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad7791_state *st = iio_priv(indio_dev); -@@ -450,7 +450,7 @@ static struct spi_driver ad7791_driver = - .owner = THIS_MODULE, - }, - .probe = ad7791_probe, -- .remove = __devexit_p(ad7791_remove), -+ .remove = ad7791_remove, - .id_table = ad7791_spi_ids, - }; - module_spi_driver(ad7791_driver); ---- a/drivers/iio/adc/ad7887.c -+++ b/drivers/iio/adc/ad7887.c -@@ -233,7 +233,7 @@ static const struct iio_info ad7887_info - .driver_module = THIS_MODULE, - }; - --static int __devinit ad7887_probe(struct spi_device *spi) -+static int ad7887_probe(struct spi_device *spi) - { - struct ad7887_platform_data *pdata = spi->dev.platform_data; - struct ad7887_state *st; -@@ -340,7 +340,7 @@ error_free: - return ret; - } - --static int __devexit ad7887_remove(struct spi_device *spi) -+static int ad7887_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad7887_state *st = iio_priv(indio_dev); -@@ -368,7 +368,7 @@ static struct spi_driver ad7887_driver = - .owner = THIS_MODULE, - }, - .probe = ad7887_probe, -- .remove = __devexit_p(ad7887_remove), -+ .remove = ad7887_remove, - .id_table = ad7887_id, - }; - module_spi_driver(ad7887_driver); ---- a/drivers/iio/adc/at91_adc.c -+++ b/drivers/iio/adc/at91_adc.c -@@ -514,7 +514,7 @@ static const struct iio_info at91_adc_in - .read_raw = &at91_adc_read_raw, - }; - --static int __devinit at91_adc_probe(struct platform_device *pdev) -+static int at91_adc_probe(struct platform_device *pdev) - { - unsigned int prsc, mstrclk, ticks, adc_clk; - int ret; -@@ -678,7 +678,7 @@ error_ret: - return ret; - } - --static int __devexit at91_adc_remove(struct platform_device *pdev) -+static int at91_adc_remove(struct platform_device *pdev) - { - struct iio_dev *idev = platform_get_drvdata(pdev); - struct at91_adc_state *st = iio_priv(idev); -@@ -702,7 +702,7 @@ MODULE_DEVICE_TABLE(of, at91_adc_dt_ids) - - static struct platform_driver at91_adc_driver = { - .probe = at91_adc_probe, -- .remove = __devexit_p(at91_adc_remove), -+ .remove = at91_adc_remove, - .driver = { - .name = "at91_adc", - .of_match_table = of_match_ptr(at91_adc_dt_ids), ---- a/drivers/iio/adc/lp8788_adc.c -+++ b/drivers/iio/adc/lp8788_adc.c -@@ -193,7 +193,7 @@ static inline void lp8788_iio_map_unregi - iio_map_array_unregister(indio_dev, adc->map); - } - --static int __devinit lp8788_adc_probe(struct platform_device *pdev) -+static int lp8788_adc_probe(struct platform_device *pdev) - { - struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent); - struct iio_dev *indio_dev; -@@ -236,7 +236,7 @@ err_iio_map: - return ret; - } - --static int __devexit lp8788_adc_remove(struct platform_device *pdev) -+static int lp8788_adc_remove(struct platform_device *pdev) - { - struct iio_dev *indio_dev = platform_get_drvdata(pdev); - struct lp8788_adc *adc = iio_priv(indio_dev); -@@ -250,7 +250,7 @@ static int __devexit lp8788_adc_remove(s - - static struct platform_driver lp8788_adc_driver = { - .probe = lp8788_adc_probe, -- .remove = __devexit_p(lp8788_adc_remove), -+ .remove = lp8788_adc_remove, - .driver = { - .name = LP8788_DEV_ADC, - .owner = THIS_MODULE, ---- a/drivers/iio/adc/max1363.c -+++ b/drivers/iio/adc/max1363.c -@@ -1402,7 +1402,7 @@ static int max1363_initial_setup(struct - return max1363_set_scan_mode(st); - } - --static int __devinit max1363_alloc_scan_masks(struct iio_dev *indio_dev) -+static int max1363_alloc_scan_masks(struct iio_dev *indio_dev) - { - struct max1363_state *st = iio_priv(indio_dev); - unsigned long *masks; -@@ -1525,8 +1525,8 @@ static void max1363_buffer_cleanup(struc - iio_kfifo_free(indio_dev->buffer); - } - --static int __devinit max1363_probe(struct i2c_client *client, -- const struct i2c_device_id *id) -+static int max1363_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) - { - int ret; - struct max1363_state *st; -@@ -1624,7 +1624,7 @@ error_out: - return ret; - } - --static int __devexit max1363_remove(struct i2c_client *client) -+static int max1363_remove(struct i2c_client *client) - { - struct iio_dev *indio_dev = i2c_get_clientdata(client); - struct max1363_state *st = iio_priv(indio_dev); -@@ -1690,7 +1690,7 @@ static struct i2c_driver max1363_driver - .name = "max1363", - }, - .probe = max1363_probe, -- .remove = __devexit_p(max1363_remove), -+ .remove = max1363_remove, - .id_table = max1363_id, - }; - module_i2c_driver(max1363_driver); ---- a/drivers/iio/amplifiers/ad8366.c -+++ b/drivers/iio/amplifiers/ad8366.c -@@ -133,7 +133,7 @@ static const struct iio_chan_spec ad8366 - AD8366_CHAN(1), - }; - --static int __devinit ad8366_probe(struct spi_device *spi) -+static int ad8366_probe(struct spi_device *spi) - { - struct iio_dev *indio_dev; - struct ad8366_state *st; -@@ -182,7 +182,7 @@ error_put_reg: - return ret; - } - --static int __devexit ad8366_remove(struct spi_device *spi) -+static int ad8366_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad8366_state *st = iio_priv(indio_dev); -@@ -211,7 +211,7 @@ static struct spi_driver ad8366_driver = - .owner = THIS_MODULE, - }, - .probe = ad8366_probe, -- .remove = __devexit_p(ad8366_remove), -+ .remove = ad8366_remove, - .id_table = ad8366_id, - }; - ---- a/drivers/iio/dac/ad5064.c -+++ b/drivers/iio/dac/ad5064.c -@@ -424,8 +424,8 @@ static const char * const ad5064_vref_na - return st->chip_info->shared_vref ? "vref" : ad5064_vref_names[vref]; - } - --static int __devinit ad5064_probe(struct device *dev, enum ad5064_type type, -- const char *name, ad5064_write_func write) -+static int ad5064_probe(struct device *dev, enum ad5064_type type, -+ const char *name, ad5064_write_func write) - { - struct iio_dev *indio_dev; - struct ad5064_state *st; -@@ -495,7 +495,7 @@ error_free: - return ret; - } - --static int __devexit ad5064_remove(struct device *dev) -+static int ad5064_remove(struct device *dev) - { - struct iio_dev *indio_dev = dev_get_drvdata(dev); - struct ad5064_state *st = iio_priv(indio_dev); -@@ -523,7 +523,7 @@ static int ad5064_spi_write(struct ad506 - return spi_write(spi, &st->data.spi, sizeof(st->data.spi)); - } - --static int __devinit ad5064_spi_probe(struct spi_device *spi) -+static int ad5064_spi_probe(struct spi_device *spi) - { - const struct spi_device_id *id = spi_get_device_id(spi); - -@@ -531,7 +531,7 @@ static int __devinit ad5064_spi_probe(st - ad5064_spi_write); - } - --static int __devexit ad5064_spi_remove(struct spi_device *spi) -+static int ad5064_spi_remove(struct spi_device *spi) - { - return ad5064_remove(&spi->dev); - } -@@ -563,7 +563,7 @@ static struct spi_driver ad5064_spi_driv - .owner = THIS_MODULE, - }, - .probe = ad5064_spi_probe, -- .remove = __devexit_p(ad5064_spi_remove), -+ .remove = ad5064_spi_remove, - .id_table = ad5064_spi_ids, - }; - -@@ -596,14 +596,14 @@ static int ad5064_i2c_write(struct ad506 - return i2c_master_send(i2c, st->data.i2c, 3); - } - --static int __devinit ad5064_i2c_probe(struct i2c_client *i2c, -+static int ad5064_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) - { - return ad5064_probe(&i2c->dev, id->driver_data, id->name, - ad5064_i2c_write); - } - --static int __devexit ad5064_i2c_remove(struct i2c_client *i2c) -+static int ad5064_i2c_remove(struct i2c_client *i2c) - { - return ad5064_remove(&i2c->dev); - } -@@ -625,7 +625,7 @@ static struct i2c_driver ad5064_i2c_driv - .owner = THIS_MODULE, - }, - .probe = ad5064_i2c_probe, -- .remove = __devexit_p(ad5064_i2c_remove), -+ .remove = ad5064_i2c_remove, - .id_table = ad5064_i2c_ids, - }; - ---- a/drivers/iio/dac/ad5360.c -+++ b/drivers/iio/dac/ad5360.c -@@ -433,7 +433,7 @@ static const char * const ad5360_vref_na - "vref0", "vref1", "vref2" - }; - --static int __devinit ad5360_alloc_channels(struct iio_dev *indio_dev) -+static int ad5360_alloc_channels(struct iio_dev *indio_dev) - { - struct ad5360_state *st = iio_priv(indio_dev); - struct iio_chan_spec *channels; -@@ -456,7 +456,7 @@ static int __devinit ad5360_alloc_channe - return 0; - } - --static int __devinit ad5360_probe(struct spi_device *spi) -+static int ad5360_probe(struct spi_device *spi) - { - enum ad5360_type type = spi_get_device_id(spi)->driver_data; - struct iio_dev *indio_dev; -@@ -524,7 +524,7 @@ error_free: - return ret; - } - --static int __devexit ad5360_remove(struct spi_device *spi) -+static int ad5360_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad5360_state *st = iio_priv(indio_dev); -@@ -560,7 +560,7 @@ static struct spi_driver ad5360_driver = - .owner = THIS_MODULE, - }, - .probe = ad5360_probe, -- .remove = __devexit_p(ad5360_remove), -+ .remove = ad5360_remove, - .id_table = ad5360_ids, - }; - module_spi_driver(ad5360_driver); ---- a/drivers/iio/dac/ad5380.c -+++ b/drivers/iio/dac/ad5380.c -@@ -338,7 +338,7 @@ static const struct ad5380_chip_info ad5 - }, - }; - --static int __devinit ad5380_alloc_channels(struct iio_dev *indio_dev) -+static int ad5380_alloc_channels(struct iio_dev *indio_dev) - { - struct ad5380_state *st = iio_priv(indio_dev); - struct iio_chan_spec *channels; -@@ -361,8 +361,8 @@ static int __devinit ad5380_alloc_channe - return 0; - } - --static int __devinit ad5380_probe(struct device *dev, struct regmap *regmap, -- enum ad5380_type type, const char *name) -+static int ad5380_probe(struct device *dev, struct regmap *regmap, -+ enum ad5380_type type, const char *name) - { - struct iio_dev *indio_dev; - struct ad5380_state *st; -@@ -441,7 +441,7 @@ error_out: - return ret; - } - --static int __devexit ad5380_remove(struct device *dev) -+static int ad5380_remove(struct device *dev) - { - struct iio_dev *indio_dev = dev_get_drvdata(dev); - struct ad5380_state *st = iio_priv(indio_dev); -@@ -478,7 +478,7 @@ static const struct regmap_config ad5380 - - #if IS_ENABLED(CONFIG_SPI_MASTER) - --static int __devinit ad5380_spi_probe(struct spi_device *spi) -+static int ad5380_spi_probe(struct spi_device *spi) - { - const struct spi_device_id *id = spi_get_device_id(spi); - struct regmap *regmap; -@@ -491,7 +491,7 @@ static int __devinit ad5380_spi_probe(st - return ad5380_probe(&spi->dev, regmap, id->driver_data, id->name); - } - --static int __devexit ad5380_spi_remove(struct spi_device *spi) -+static int ad5380_spi_remove(struct spi_device *spi) - { - return ad5380_remove(&spi->dev); - } -@@ -523,7 +523,7 @@ static struct spi_driver ad5380_spi_driv - .owner = THIS_MODULE, - }, - .probe = ad5380_spi_probe, -- .remove = __devexit_p(ad5380_spi_remove), -+ .remove = ad5380_spi_remove, - .id_table = ad5380_spi_ids, - }; - -@@ -552,8 +552,8 @@ static inline void ad5380_spi_unregister - - #if IS_ENABLED(CONFIG_I2C) - --static int __devinit ad5380_i2c_probe(struct i2c_client *i2c, -- const struct i2c_device_id *id) -+static int ad5380_i2c_probe(struct i2c_client *i2c, -+ const struct i2c_device_id *id) - { - struct regmap *regmap; - -@@ -565,7 +565,7 @@ static int __devinit ad5380_i2c_probe(st - return ad5380_probe(&i2c->dev, regmap, id->driver_data, id->name); - } - --static int __devexit ad5380_i2c_remove(struct i2c_client *i2c) -+static int ad5380_i2c_remove(struct i2c_client *i2c) - { - return ad5380_remove(&i2c->dev); - } -@@ -597,7 +597,7 @@ static struct i2c_driver ad5380_i2c_driv - .owner = THIS_MODULE, - }, - .probe = ad5380_i2c_probe, -- .remove = __devexit_p(ad5380_i2c_remove), -+ .remove = ad5380_i2c_remove, - .id_table = ad5380_i2c_ids, - }; - ---- a/drivers/iio/dac/ad5421.c -+++ b/drivers/iio/dac/ad5421.c -@@ -449,7 +449,7 @@ static const struct iio_info ad5421_info - .driver_module = THIS_MODULE, - }; - --static int __devinit ad5421_probe(struct spi_device *spi) -+static int ad5421_probe(struct spi_device *spi) - { - struct ad5421_platform_data *pdata = dev_get_platdata(&spi->dev); - struct iio_dev *indio_dev; -@@ -516,7 +516,7 @@ error_free: - return ret; - } - --static int __devexit ad5421_remove(struct spi_device *spi) -+static int ad5421_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - -@@ -534,7 +534,7 @@ static struct spi_driver ad5421_driver = - .owner = THIS_MODULE, - }, - .probe = ad5421_probe, -- .remove = __devexit_p(ad5421_remove), -+ .remove = ad5421_remove, - }; - module_spi_driver(ad5421_driver); - ---- a/drivers/iio/dac/ad5446.c -+++ b/drivers/iio/dac/ad5446.c -@@ -212,8 +212,8 @@ static const struct iio_info ad5446_info - .driver_module = THIS_MODULE, - }; - --static int __devinit ad5446_probe(struct device *dev, const char *name, -- const struct ad5446_chip_info *chip_info) -+static int ad5446_probe(struct device *dev, const char *name, -+ const struct ad5446_chip_info *chip_info) - { - struct ad5446_state *st; - struct iio_dev *indio_dev; -@@ -461,7 +461,7 @@ static const struct spi_device_id ad5446 - }; - MODULE_DEVICE_TABLE(spi, ad5446_spi_ids); - --static int __devinit ad5446_spi_probe(struct spi_device *spi) -+static int ad5446_spi_probe(struct spi_device *spi) - { - const struct spi_device_id *id = spi_get_device_id(spi); - -@@ -469,7 +469,7 @@ static int __devinit ad5446_spi_probe(st - &ad5446_spi_chip_info[id->driver_data]); - } - --static int __devexit ad5446_spi_remove(struct spi_device *spi) -+static int ad5446_spi_remove(struct spi_device *spi) - { - return ad5446_remove(&spi->dev); - } -@@ -480,7 +480,7 @@ static struct spi_driver ad5446_spi_driv - .owner = THIS_MODULE, - }, - .probe = ad5446_spi_probe, -- .remove = __devexit_p(ad5446_spi_remove), -+ .remove = ad5446_spi_remove, - .id_table = ad5446_spi_ids, - }; - -@@ -539,14 +539,14 @@ static const struct ad5446_chip_info ad5 - }, - }; - --static int __devinit ad5446_i2c_probe(struct i2c_client *i2c, -- const struct i2c_device_id *id) -+static int ad5446_i2c_probe(struct i2c_client *i2c, -+ const struct i2c_device_id *id) - { - return ad5446_probe(&i2c->dev, id->name, - &ad5446_i2c_chip_info[id->driver_data]); - } - --static int __devexit ad5446_i2c_remove(struct i2c_client *i2c) -+static int ad5446_i2c_remove(struct i2c_client *i2c) - { - return ad5446_remove(&i2c->dev); - } -@@ -568,7 +568,7 @@ static struct i2c_driver ad5446_i2c_driv - .owner = THIS_MODULE, - }, - .probe = ad5446_i2c_probe, -- .remove = __devexit_p(ad5446_i2c_remove), -+ .remove = ad5446_i2c_remove, - .id_table = ad5446_i2c_ids, - }; - ---- a/drivers/iio/dac/ad5449.c -+++ b/drivers/iio/dac/ad5449.c -@@ -266,7 +266,7 @@ static const char *ad5449_vref_name(stru - return "VREFB"; - } - --static int __devinit ad5449_spi_probe(struct spi_device *spi) -+static int ad5449_spi_probe(struct spi_device *spi) - { - struct ad5449_platform_data *pdata = spi->dev.platform_data; - const struct spi_device_id *id = spi_get_device_id(spi); -@@ -333,7 +333,7 @@ error_free: - return ret; - } - --static int __devexit ad5449_spi_remove(struct spi_device *spi) -+static int ad5449_spi_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad5449 *st = iio_priv(indio_dev); -@@ -366,7 +366,7 @@ static struct spi_driver ad5449_spi_driv - .owner = THIS_MODULE, - }, - .probe = ad5449_spi_probe, -- .remove = __devexit_p(ad5449_spi_remove), -+ .remove = ad5449_spi_remove, - .id_table = ad5449_spi_ids, - }; - module_spi_driver(ad5449_spi_driver); ---- a/drivers/iio/dac/ad5504.c -+++ b/drivers/iio/dac/ad5504.c -@@ -277,7 +277,7 @@ static const struct iio_chan_spec ad5504 - AD5504_CHANNEL(3), - }; - --static int __devinit ad5504_probe(struct spi_device *spi) -+static int ad5504_probe(struct spi_device *spi) - { - struct ad5504_platform_data *pdata = spi->dev.platform_data; - struct iio_dev *indio_dev; -@@ -352,7 +352,7 @@ error_ret: - return ret; - } - --static int __devexit ad5504_remove(struct spi_device *spi) -+static int ad5504_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad5504_state *st = iio_priv(indio_dev); -@@ -383,7 +383,7 @@ static struct spi_driver ad5504_driver = - .owner = THIS_MODULE, - }, - .probe = ad5504_probe, -- .remove = __devexit_p(ad5504_remove), -+ .remove = ad5504_remove, - .id_table = ad5504_id, - }; - module_spi_driver(ad5504_driver); ---- a/drivers/iio/dac/ad5624r_spi.c -+++ b/drivers/iio/dac/ad5624r_spi.c -@@ -220,7 +220,7 @@ static const struct ad5624r_chip_info ad - }, - }; - --static int __devinit ad5624r_probe(struct spi_device *spi) -+static int ad5624r_probe(struct spi_device *spi) - { - struct ad5624r_state *st; - struct iio_dev *indio_dev; -@@ -282,7 +282,7 @@ error_ret: - return ret; - } - --static int __devexit ad5624r_remove(struct spi_device *spi) -+static int ad5624r_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad5624r_state *st = iio_priv(indio_dev); -@@ -314,7 +314,7 @@ static struct spi_driver ad5624r_driver - .owner = THIS_MODULE, - }, - .probe = ad5624r_probe, -- .remove = __devexit_p(ad5624r_remove), -+ .remove = ad5624r_remove, - .id_table = ad5624r_id, - }; - module_spi_driver(ad5624r_driver); ---- a/drivers/iio/dac/ad5686.c -+++ b/drivers/iio/dac/ad5686.c -@@ -313,7 +313,7 @@ static const struct ad5686_chip_info ad5 - }; - - --static int __devinit ad5686_probe(struct spi_device *spi) -+static int ad5686_probe(struct spi_device *spi) - { - struct ad5686_state *st; - struct iio_dev *indio_dev; -@@ -379,7 +379,7 @@ error_put_reg: - return ret; - } - --static int __devexit ad5686_remove(struct spi_device *spi) -+static int ad5686_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad5686_state *st = iio_priv(indio_dev); -@@ -408,7 +408,7 @@ static struct spi_driver ad5686_driver = - .owner = THIS_MODULE, - }, - .probe = ad5686_probe, -- .remove = __devexit_p(ad5686_remove), -+ .remove = ad5686_remove, - .id_table = ad5686_id, - }; - module_spi_driver(ad5686_driver); ---- a/drivers/iio/dac/ad5755.c -+++ b/drivers/iio/dac/ad5755.c -@@ -447,8 +447,8 @@ static bool ad5755_is_valid_mode(struct - } - } - --static int __devinit ad5755_setup_pdata(struct iio_dev *indio_dev, -- const struct ad5755_platform_data *pdata) -+static int ad5755_setup_pdata(struct iio_dev *indio_dev, -+ const struct ad5755_platform_data *pdata) - { - struct ad5755_state *st = iio_priv(indio_dev); - unsigned int val; -@@ -503,7 +503,7 @@ static int __devinit ad5755_setup_pdata( - return 0; - } - --static bool __devinit ad5755_is_voltage_mode(enum ad5755_mode mode) -+static bool ad5755_is_voltage_mode(enum ad5755_mode mode) - { - switch (mode) { - case AD5755_MODE_VOLTAGE_0V_5V: -@@ -516,8 +516,8 @@ static bool __devinit ad5755_is_voltage_ - } - } - --static int __devinit ad5755_init_channels(struct iio_dev *indio_dev, -- const struct ad5755_platform_data *pdata) -+static int ad5755_init_channels(struct iio_dev *indio_dev, -+ const struct ad5755_platform_data *pdata) - { - struct ad5755_state *st = iio_priv(indio_dev); - struct iio_chan_spec *channels = st->channels; -@@ -562,7 +562,7 @@ static const struct ad5755_platform_data - }, - }; - --static int __devinit ad5755_probe(struct spi_device *spi) -+static int ad5755_probe(struct spi_device *spi) - { - enum ad5755_type type = spi_get_device_id(spi)->driver_data; - const struct ad5755_platform_data *pdata = dev_get_platdata(&spi->dev); -@@ -614,7 +614,7 @@ error_free: - return ret; - } - --static int __devexit ad5755_remove(struct spi_device *spi) -+static int ad5755_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - -@@ -640,7 +640,7 @@ static struct spi_driver ad5755_driver = - .owner = THIS_MODULE, - }, - .probe = ad5755_probe, -- .remove = __devexit_p(ad5755_remove), -+ .remove = ad5755_remove, - .id_table = ad5755_id, - }; - module_spi_driver(ad5755_driver); ---- a/drivers/iio/dac/ad5764.c -+++ b/drivers/iio/dac/ad5764.c -@@ -273,7 +273,7 @@ static const struct iio_info ad5764_info - .driver_module = THIS_MODULE, - }; - --static int __devinit ad5764_probe(struct spi_device *spi) -+static int ad5764_probe(struct spi_device *spi) - { - enum ad5764_type type = spi_get_device_id(spi)->driver_data; - struct iio_dev *indio_dev; -@@ -340,7 +340,7 @@ error_free: - return ret; - } - --static int __devexit ad5764_remove(struct spi_device *spi) -+static int ad5764_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad5764_state *st = iio_priv(indio_dev); -@@ -372,7 +372,7 @@ static struct spi_driver ad5764_driver = - .owner = THIS_MODULE, - }, - .probe = ad5764_probe, -- .remove = __devexit_p(ad5764_remove), -+ .remove = ad5764_remove, - .id_table = ad5764_ids, - }; - module_spi_driver(ad5764_driver); ---- a/drivers/iio/dac/ad5791.c -+++ b/drivers/iio/dac/ad5791.c -@@ -346,7 +346,7 @@ static const struct iio_info ad5791_info - .driver_module = THIS_MODULE, - }; - --static int __devinit ad5791_probe(struct spi_device *spi) -+static int ad5791_probe(struct spi_device *spi) - { - struct ad5791_platform_data *pdata = spi->dev.platform_data; - struct iio_dev *indio_dev; -@@ -439,7 +439,7 @@ error_ret: - return ret; - } - --static int __devexit ad5791_remove(struct spi_device *spi) -+static int ad5791_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad5791_state *st = iio_priv(indio_dev); -@@ -475,7 +475,7 @@ static struct spi_driver ad5791_driver = - .owner = THIS_MODULE, - }, - .probe = ad5791_probe, -- .remove = __devexit_p(ad5791_remove), -+ .remove = ad5791_remove, - .id_table = ad5791_id, - }; - module_spi_driver(ad5791_driver); ---- a/drivers/iio/dac/max517.c -+++ b/drivers/iio/dac/max517.c -@@ -156,7 +156,7 @@ static const struct iio_chan_spec max517 - MAX517_CHANNEL(1) - }; - --static int __devinit max517_probe(struct i2c_client *client, -+static int max517_probe(struct i2c_client *client, - const struct i2c_device_id *id) - { - struct max517_data *data; -@@ -210,7 +210,7 @@ exit: - return err; - } - --static int __devexit max517_remove(struct i2c_client *client) -+static int max517_remove(struct i2c_client *client) - { - iio_device_unregister(i2c_get_clientdata(client)); - iio_device_free(i2c_get_clientdata(client)); -@@ -232,7 +232,7 @@ static struct i2c_driver max517_driver = - .pm = MAX517_PM_OPS, - }, - .probe = max517_probe, -- .remove = __devexit_p(max517_remove), -+ .remove = max517_remove, - .id_table = max517_id, - }; - module_i2c_driver(max517_driver); ---- a/drivers/iio/dac/mcp4725.c -+++ b/drivers/iio/dac/mcp4725.c -@@ -141,8 +141,8 @@ static const struct iio_info mcp4725_inf - .driver_module = THIS_MODULE, - }; - --static int __devinit mcp4725_probe(struct i2c_client *client, -- const struct i2c_device_id *id) -+static int mcp4725_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) - { - struct mcp4725_data *data; - struct iio_dev *indio_dev; -@@ -195,7 +195,7 @@ exit: - return err; - } - --static int __devexit mcp4725_remove(struct i2c_client *client) -+static int mcp4725_remove(struct i2c_client *client) - { - struct iio_dev *indio_dev = i2c_get_clientdata(client); - -@@ -217,7 +217,7 @@ static struct i2c_driver mcp4725_driver - .pm = MCP4725_PM_OPS, - }, - .probe = mcp4725_probe, -- .remove = __devexit_p(mcp4725_remove), -+ .remove = mcp4725_remove, - .id_table = mcp4725_id, - }; - module_i2c_driver(mcp4725_driver); ---- a/drivers/iio/frequency/ad9523.c -+++ b/drivers/iio/frequency/ad9523.c -@@ -959,7 +959,7 @@ static int ad9523_setup(struct iio_dev * - return 0; - } - --static int __devinit ad9523_probe(struct spi_device *spi) -+static int ad9523_probe(struct spi_device *spi) - { - struct ad9523_platform_data *pdata = spi->dev.platform_data; - struct iio_dev *indio_dev; -@@ -1020,7 +1020,7 @@ error_put_reg: - return ret; - } - --static int __devexit ad9523_remove(struct spi_device *spi) -+static int ad9523_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad9523_state *st = iio_priv(indio_dev); -@@ -1049,7 +1049,7 @@ static struct spi_driver ad9523_driver = - .owner = THIS_MODULE, - }, - .probe = ad9523_probe, -- .remove = __devexit_p(ad9523_remove), -+ .remove = ad9523_remove, - .id_table = ad9523_id, - }; - module_spi_driver(ad9523_driver); ---- a/drivers/iio/frequency/adf4350.c -+++ b/drivers/iio/frequency/adf4350.c -@@ -355,7 +355,7 @@ static const struct iio_info adf4350_inf - .driver_module = THIS_MODULE, - }; - --static int __devinit adf4350_probe(struct spi_device *spi) -+static int adf4350_probe(struct spi_device *spi) - { - struct adf4350_platform_data *pdata = spi->dev.platform_data; - struct iio_dev *indio_dev; -@@ -440,7 +440,7 @@ error_put_reg: - return ret; - } - --static int __devexit adf4350_remove(struct spi_device *spi) -+static int adf4350_remove(struct spi_device *spi) - { - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct adf4350_state *st = iio_priv(indio_dev); -@@ -476,7 +476,7 @@ static struct spi_driver adf4350_driver - .owner = THIS_MODULE, - }, - .probe = adf4350_probe, -- .remove = __devexit_p(adf4350_remove), -+ .remove = adf4350_remove, - .id_table = adf4350_id, - }; - module_spi_driver(adf4350_driver); ---- a/drivers/iio/gyro/hid-sensor-gyro-3d.c -+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c -@@ -278,7 +278,7 @@ static int gyro_3d_parse_report(struct p - } - - /* Function to initialize the processing for usage id */ --static int __devinit hid_gyro_3d_probe(struct platform_device *pdev) -+static int hid_gyro_3d_probe(struct platform_device *pdev) - { - int ret = 0; - static const char *name = "gyro_3d"; -@@ -375,7 +375,7 @@ error_ret: - } - - /* Function to deinitialize the processing for usage id */ --static int __devinit hid_gyro_3d_remove(struct platform_device *pdev) -+static int hid_gyro_3d_remove(struct platform_device *pdev) - { - struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; - struct iio_dev *indio_dev = platform_get_drvdata(pdev); ---- a/drivers/iio/light/adjd_s311.c -+++ b/drivers/iio/light/adjd_s311.c -@@ -286,8 +286,8 @@ static const struct iio_info adjd_s311_i - .driver_module = THIS_MODULE, - }; - --static int __devinit adjd_s311_probe(struct i2c_client *client, -- const struct i2c_device_id *id) -+static int adjd_s311_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) - { - struct adjd_s311_data *data; - struct iio_dev *indio_dev; -@@ -330,7 +330,7 @@ exit: - return err; - } - --static int __devexit adjd_s311_remove(struct i2c_client *client) -+static int adjd_s311_remove(struct i2c_client *client) - { - struct iio_dev *indio_dev = i2c_get_clientdata(client); - struct adjd_s311_data *data = iio_priv(indio_dev); -@@ -354,7 +354,7 @@ static struct i2c_driver adjd_s311_drive - .name = ADJD_S311_DRV_NAME, - }, - .probe = adjd_s311_probe, -- .remove = __devexit_p(adjd_s311_remove), -+ .remove = adjd_s311_remove, - .id_table = adjd_s311_id, - }; - module_i2c_driver(adjd_s311_driver); ---- a/drivers/iio/light/hid-sensor-als.c -+++ b/drivers/iio/light/hid-sensor-als.c -@@ -245,7 +245,7 @@ static int als_parse_report(struct platf - } - - /* Function to initialize the processing for usage id */ --static int __devinit hid_als_probe(struct platform_device *pdev) -+static int hid_als_probe(struct platform_device *pdev) - { - int ret = 0; - static const char *name = "als"; -@@ -341,7 +341,7 @@ error_ret: - } - - /* Function to deinitialize the processing for usage id */ --static int __devinit hid_als_remove(struct platform_device *pdev) -+static int hid_als_remove(struct platform_device *pdev) - { - struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; - struct iio_dev *indio_dev = platform_get_drvdata(pdev); ---- a/drivers/iio/light/lm3533-als.c -+++ b/drivers/iio/light/lm3533-als.c -@@ -718,8 +718,7 @@ static struct attribute_group lm3533_als - .attrs = lm3533_als_attributes - }; - --static int __devinit lm3533_als_set_input_mode(struct lm3533_als *als, -- bool pwm_mode) -+static int lm3533_als_set_input_mode(struct lm3533_als *als, bool pwm_mode) - { - u8 mask = LM3533_ALS_INPUT_MODE_MASK; - u8 val; -@@ -740,7 +739,7 @@ static int __devinit lm3533_als_set_inpu - return 0; - } - --static int __devinit lm3533_als_set_resistor(struct lm3533_als *als, u8 val) -+static int lm3533_als_set_resistor(struct lm3533_als *als, u8 val) - { - int ret; - -@@ -756,8 +755,8 @@ static int __devinit lm3533_als_set_resi - return 0; - } - --static int __devinit lm3533_als_setup(struct lm3533_als *als, -- struct lm3533_als_platform_data *pdata) -+static int lm3533_als_setup(struct lm3533_als *als, -+ struct lm3533_als_platform_data *pdata) - { - int ret; - -@@ -775,7 +774,7 @@ static int __devinit lm3533_als_setup(st - return 0; - } - --static int __devinit lm3533_als_setup_irq(struct lm3533_als *als, void *dev) -+static int lm3533_als_setup_irq(struct lm3533_als *als, void *dev) - { - u8 mask = LM3533_ALS_INT_ENABLE_MASK; - int ret; -@@ -799,7 +798,7 @@ static int __devinit lm3533_als_setup_ir - return 0; - } - --static int __devinit lm3533_als_enable(struct lm3533_als *als) -+static int lm3533_als_enable(struct lm3533_als *als) - { - u8 mask = LM3533_ALS_ENABLE_MASK; - int ret; -@@ -830,7 +829,7 @@ static const struct iio_info lm3533_als_ - .read_raw = &lm3533_als_read_raw, - }; - --static int __devinit lm3533_als_probe(struct platform_device *pdev) -+static int lm3533_als_probe(struct platform_device *pdev) - { - struct lm3533 *lm3533; - struct lm3533_als_platform_data *pdata; -@@ -901,7 +900,7 @@ err_free_dev: - return ret; - } - --static int __devexit lm3533_als_remove(struct platform_device *pdev) -+static int lm3533_als_remove(struct platform_device *pdev) - { - struct iio_dev *indio_dev = platform_get_drvdata(pdev); - struct lm3533_als *als = iio_priv(indio_dev); -@@ -922,7 +921,7 @@ static struct platform_driver lm3533_als - .owner = THIS_MODULE, - }, - .probe = lm3533_als_probe, -- .remove = __devexit_p(lm3533_als_remove), -+ .remove = lm3533_als_remove, - }; - module_platform_driver(lm3533_als_driver); - ---- a/drivers/iio/light/vcnl4000.c -+++ b/drivers/iio/light/vcnl4000.c -@@ -150,8 +150,8 @@ static const struct iio_info vcnl4000_in - .driver_module = THIS_MODULE, - }; - --static int __devinit vcnl4000_probe(struct i2c_client *client, -- const struct i2c_device_id *id) -+static int vcnl4000_probe(struct i2c_client *client, -+ const struct i2c_device_id *id) - { - struct vcnl4000_data *data; - struct iio_dev *indio_dev; -@@ -190,7 +190,7 @@ error_free_dev: - return ret; - } - --static int __devexit vcnl4000_remove(struct i2c_client *client) -+static int vcnl4000_remove(struct i2c_client *client) - { - struct iio_dev *indio_dev = i2c_get_clientdata(client); - -@@ -206,7 +206,7 @@ static struct i2c_driver vcnl4000_driver - .owner = THIS_MODULE, - }, - .probe = vcnl4000_probe, -- .remove = __devexit_p(vcnl4000_remove), -+ .remove = vcnl4000_remove, - .id_table = vcnl4000_id, - }; - ---- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c -+++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c -@@ -279,7 +279,7 @@ static int magn_3d_parse_report(struct p - } - - /* Function to initialize the processing for usage id */ --static int __devinit hid_magn_3d_probe(struct platform_device *pdev) -+static int hid_magn_3d_probe(struct platform_device *pdev) - { - int ret = 0; - static char *name = "magn_3d"; -@@ -376,7 +376,7 @@ error_ret: - } - - /* Function to deinitialize the processing for usage id */ --static int __devinit hid_magn_3d_remove(struct platform_device *pdev) -+static int hid_magn_3d_remove(struct platform_device *pdev) - { - struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; - struct iio_dev *indio_dev = platform_get_drvdata(pdev); ---- a/drivers/memory/tegra20-mc.c -+++ b/drivers/memory/tegra20-mc.c -@@ -177,7 +177,7 @@ static void tegra20_mc_decode(struct teg - "carveout" : "trustzone") : ""); - } - --static const struct of_device_id tegra20_mc_of_match[] __devinitconst = { -+static const struct of_device_id tegra20_mc_of_match[] = { - { .compatible = "nvidia,tegra20-mc", }, - {}, - }; -@@ -198,7 +198,7 @@ static irqreturn_t tegra20_mc_isr(int ir - return IRQ_HANDLED; - } - --static int __devinit tegra20_mc_probe(struct platform_device *pdev) -+static int tegra20_mc_probe(struct platform_device *pdev) - { - struct resource *irq; - struct tegra20_mc *mc; ---- a/drivers/memory/tegra30-mc.c -+++ b/drivers/memory/tegra30-mc.c -@@ -295,7 +295,7 @@ static UNIVERSAL_DEV_PM_OPS(tegra30_mc_p - tegra30_mc_suspend, - tegra30_mc_resume, NULL); - --static const struct of_device_id tegra30_mc_of_match[] __devinitconst = { -+static const struct of_device_id tegra30_mc_of_match[] = { - { .compatible = "nvidia,tegra30-mc", }, - {}, - }; -@@ -316,7 +316,7 @@ static irqreturn_t tegra30_mc_isr(int ir - return IRQ_HANDLED; - } - --static int __devinit tegra30_mc_probe(struct platform_device *pdev) -+static int tegra30_mc_probe(struct platform_device *pdev) - { - struct resource *irq; - struct tegra30_mc *mc; ---- a/drivers/scsi/NCR_Q720.c -+++ b/drivers/scsi/NCR_Q720.c -@@ -351,7 +351,7 @@ static struct mca_driver NCR_Q720_driver - .name = "NCR_Q720", - .bus = &mca_bus_type, - .probe = NCR_Q720_probe, -- .remove = __devexit_p(NCR_Q720_remove), -+ .remove = NCR_Q720_remove, - }, - }; - ---- a/drivers/scsi/a100u2w.c -+++ b/drivers/scsi/a100u2w.c -@@ -1082,8 +1082,8 @@ static struct scsi_host_template inia100 - .use_clustering = ENABLE_CLUSTERING, - }; - --static int __devinit inia100_probe_one(struct pci_dev *pdev, -- const struct pci_device_id *id) -+static int inia100_probe_one(struct pci_dev *pdev, -+ const struct pci_device_id *id) - { - struct Scsi_Host *shost; - struct orc_host *host; -@@ -1197,7 +1197,7 @@ out: - return error; - } - --static void __devexit inia100_remove_one(struct pci_dev *pdev) -+static void inia100_remove_one(struct pci_dev *pdev) - { - struct Scsi_Host *shost = pci_get_drvdata(pdev); - struct orc_host *host = (struct orc_host *)shost->hostdata; -@@ -1224,7 +1224,7 @@ static struct pci_driver inia100_pci_dri - .name = "inia100", - .id_table = inia100_pci_tbl, - .probe = inia100_probe_one, -- .remove = __devexit_p(inia100_remove_one), -+ .remove = inia100_remove_one, - }; - - static int __init inia100_init(void) ---- a/drivers/scsi/aacraid/linit.c -+++ b/drivers/scsi/aacraid/linit.c -@@ -88,13 +88,7 @@ char aac_driver_version[] = AAC_DRIVER_F - * - * Note: The last field is used to index into aac_drivers below. - */ --#ifdef DECLARE_PCI_DEVICE_TABLE --static DECLARE_PCI_DEVICE_TABLE(aac_pci_tbl) = { --#elif defined(__devinitconst) --static const struct pci_device_id aac_pci_tbl[] __devinitconst = { --#else --static const struct pci_device_id aac_pci_tbl[] __devinitconst = { --#endif -+static const struct pci_device_id aac_pci_tbl[] = { - { 0x1028, 0x0001, 0x1028, 0x0001, 0, 0, 0 }, /* PERC 2/Si (Iguana/PERC2Si) */ - { 0x1028, 0x0002, 0x1028, 0x0002, 0, 0, 1 }, /* PERC 3/Di (Opal/PERC3Di) */ - { 0x1028, 0x0003, 0x1028, 0x0003, 0, 0, 2 }, /* PERC 3/Si (SlimFast/PERC3Si */ -@@ -1107,8 +1101,7 @@ static void __aac_shutdown(struct aac_de - pci_disable_msi(aac->pdev); - } - --static int __devinit aac_probe_one(struct pci_dev *pdev, -- const struct pci_device_id *id) -+static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) - { - unsigned index = id->driver_data; - struct Scsi_Host *shost; -@@ -1310,7 +1303,7 @@ static void aac_shutdown(struct pci_dev - __aac_shutdown((struct aac_dev *)shost->hostdata); - } - --static void __devexit aac_remove_one(struct pci_dev *pdev) -+static void aac_remove_one(struct pci_dev *pdev) - { - struct Scsi_Host *shost = pci_get_drvdata(pdev); - struct aac_dev *aac = (struct aac_dev *)shost->hostdata; -@@ -1341,7 +1334,7 @@ static struct pci_driver aac_pci_driver - .name = AAC_DRIVERNAME, - .id_table = aac_pci_tbl, - .probe = aac_probe_one, -- .remove = __devexit_p(aac_remove_one), -+ .remove = aac_remove_one, - .shutdown = aac_shutdown, - }; - ---- a/drivers/scsi/aic94xx/aic94xx_init.c -+++ b/drivers/scsi/aic94xx/aic94xx_init.c -@@ -85,7 +85,7 @@ static struct scsi_host_template aic94xx - .ioctl = sas_ioctl, - }; - --static int __devinit asd_map_memio(struct asd_ha_struct *asd_ha) -+static int asd_map_memio(struct asd_ha_struct *asd_ha) - { - int err, i; - struct asd_ha_addrspace *io_handle; -@@ -146,7 +146,7 @@ static void asd_unmap_memio(struct asd_h - pci_release_region(asd_ha->pcidev, 0); - } - --static int __devinit asd_map_ioport(struct asd_ha_struct *asd_ha) -+static int asd_map_ioport(struct asd_ha_struct *asd_ha) - { - int i = PCI_IOBAR_OFFSET, err; - struct asd_ha_addrspace *io_handle = &asd_ha->io_handle[0]; -@@ -175,7 +175,7 @@ static void asd_unmap_ioport(struct asd_ - pci_release_region(asd_ha->pcidev, PCI_IOBAR_OFFSET); - } - --static int __devinit asd_map_ha(struct asd_ha_struct *asd_ha) -+static int asd_map_ha(struct asd_ha_struct *asd_ha) - { - int err; - u16 cmd_reg; -@@ -221,7 +221,7 @@ static const char *asd_dev_rev[30] = { - [8] = "B0", - }; - --static int __devinit asd_common_setup(struct asd_ha_struct *asd_ha) -+static int asd_common_setup(struct asd_ha_struct *asd_ha) - { - int err, i; - -@@ -257,7 +257,7 @@ Err: - return err; - } - --static int __devinit asd_aic9410_setup(struct asd_ha_struct *asd_ha) -+static int asd_aic9410_setup(struct asd_ha_struct *asd_ha) - { - int err = asd_common_setup(asd_ha); - -@@ -272,7 +272,7 @@ static int __devinit asd_aic9410_setup(s - return 0; - } - --static int __devinit asd_aic9405_setup(struct asd_ha_struct *asd_ha) -+static int asd_aic9405_setup(struct asd_ha_struct *asd_ha) - { - int err = asd_common_setup(asd_ha); - -@@ -531,7 +531,7 @@ static void asd_remove_dev_attrs(struct - static const struct asd_pcidev_struct { - const char * name; - int (*setup)(struct asd_ha_struct *asd_ha); --} asd_pcidev_data[] __devinitconst = { -+} asd_pcidev_data[] = { - /* Id 0 is used for dynamic ids. */ - { .name = "Adaptec AIC-94xx SAS/SATA Host Adapter", - .setup = asd_aic9410_setup -@@ -731,8 +731,7 @@ static int asd_unregister_sas_ha(struct - return err; - } - --static int __devinit asd_pci_probe(struct pci_dev *dev, -- const struct pci_device_id *id) -+static int asd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) - { - const struct asd_pcidev_struct *asd_dev; - unsigned asd_id = (unsigned) id->driver_data; -@@ -924,7 +923,7 @@ static void asd_turn_off_leds(struct asd - } - } - --static void __devexit asd_pci_remove(struct pci_dev *dev) -+static void asd_pci_remove(struct pci_dev *dev) - { - struct asd_ha_struct *asd_ha = pci_get_drvdata(dev); - -@@ -1012,7 +1011,7 @@ static struct sas_domain_function_templa - .lldd_ata_set_dmamode = asd_set_dmamode, - }; - --static const struct pci_device_id aic94xx_pci_table[] __devinitconst = { -+static const struct pci_device_id aic94xx_pci_table[] = { - {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x410),0, 0, 1}, - {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x412),0, 0, 1}, - {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x416),0, 0, 1}, -@@ -1031,7 +1030,7 @@ static struct pci_driver aic94xx_pci_dri - .name = ASD_DRIVER_NAME, - .id_table = aic94xx_pci_table, - .probe = asd_pci_probe, -- .remove = __devexit_p(asd_pci_remove), -+ .remove = asd_pci_remove, - }; - - static int __init aic94xx_init(void) ---- a/drivers/scsi/arm/cumana_2.c -+++ b/drivers/scsi/arm/cumana_2.c -@@ -397,8 +397,8 @@ static struct scsi_host_template cumanas - .proc_name = "cumanascsi2", - }; - --static int __devinit --cumanascsi2_probe(struct expansion_card *ec, const struct ecard_id *id) -+static int cumanascsi2_probe(struct expansion_card *ec, -+ const struct ecard_id *id) - { - struct Scsi_Host *host; - struct cumanascsi2_info *info; -@@ -495,7 +495,7 @@ cumanascsi2_probe(struct expansion_card - return ret; - } - --static void __devexit cumanascsi2_remove(struct expansion_card *ec) -+static void cumanascsi2_remove(struct expansion_card *ec) - { - struct Scsi_Host *host = ecard_get_drvdata(ec); - struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; -@@ -519,7 +519,7 @@ static const struct ecard_id cumanascsi2 - - static struct ecard_driver cumanascsi2_driver = { - .probe = cumanascsi2_probe, -- .remove = __devexit_p(cumanascsi2_remove), -+ .remove = cumanascsi2_remove, - .id_table = cumanascsi2_cids, - .drv = { - .name = "cumanascsi2", ---- a/drivers/scsi/bvme6000_scsi.c -+++ b/drivers/scsi/bvme6000_scsi.c -@@ -34,7 +34,7 @@ static struct scsi_host_template bvme600 - - static struct platform_device *bvme6000_scsi_device; - --static __devinit int -+static int - bvme6000_probe(struct platform_device *dev) - { - struct Scsi_Host *host; -@@ -88,7 +88,7 @@ bvme6000_probe(struct platform_device *d - return -ENODEV; - } - --static __devexit int -+static int - bvme6000_device_remove(struct platform_device *dev) - { - struct Scsi_Host *host = platform_get_drvdata(dev); -@@ -108,7 +108,7 @@ static struct platform_driver bvme6000_s - .owner = THIS_MODULE, - }, - .probe = bvme6000_probe, -- .remove = __devexit_p(bvme6000_device_remove), -+ .remove = bvme6000_device_remove, - }; - - static int __init bvme6000_scsi_init(void) ---- a/drivers/scsi/ips.c -+++ b/drivers/scsi/ips.c -@@ -389,14 +389,14 @@ MODULE_DEVICE_TABLE( pci, ips_pci_table - - static char ips_hot_plug_name[] = "ips"; - --static int __devinit ips_insert_device(struct pci_dev *pci_dev, const struct pci_device_id *ent); --static void __devexit ips_remove_device(struct pci_dev *pci_dev); -+static int ips_insert_device(struct pci_dev *pci_dev, const struct pci_device_id *ent); -+static void ips_remove_device(struct pci_dev *pci_dev); - - static struct pci_driver ips_pci_driver = { - .name = ips_hot_plug_name, - .id_table = ips_pci_table, - .probe = ips_insert_device, -- .remove = __devexit_p(ips_remove_device), -+ .remove = ips_remove_device, - }; - - -@@ -6837,7 +6837,7 @@ err_out_sh: - /* Routine Description: */ - /* Remove one Adapter ( Hot Plugging ) */ - /*---------------------------------------------------------------------------*/ --static void __devexit -+static void - ips_remove_device(struct pci_dev *pci_dev) - { - struct Scsi_Host *sh = pci_get_drvdata(pci_dev); -@@ -6898,7 +6898,7 @@ module_exit(ips_module_exit); - /* Return Value: */ - /* 0 if Successful, else non-zero */ - /*---------------------------------------------------------------------------*/ --static int __devinit -+static int - ips_insert_device(struct pci_dev *pci_dev, const struct pci_device_id *ent) - { - int index = -1; ---- a/drivers/scsi/jazz_esp.c -+++ b/drivers/scsi/jazz_esp.c -@@ -129,7 +129,7 @@ static const struct esp_driver_ops jazz_ - .dma_error = jazz_esp_dma_error, - }; - --static int __devinit esp_jazz_probe(struct platform_device *dev) -+static int esp_jazz_probe(struct platform_device *dev) - { - struct scsi_host_template *tpnt = &scsi_esp_template; - struct Scsi_Host *host; -@@ -201,7 +201,7 @@ fail: - return err; - } - --static int __devexit esp_jazz_remove(struct platform_device *dev) -+static int esp_jazz_remove(struct platform_device *dev) - { - struct esp *esp = dev_get_drvdata(&dev->dev); - unsigned int irq = esp->host->irq; -@@ -223,7 +223,7 @@ MODULE_ALIAS("platform:jazz_esp"); - - static struct platform_driver esp_jazz_driver = { - .probe = esp_jazz_probe, -- .remove = __devexit_p(esp_jazz_remove), -+ .remove = esp_jazz_remove, - .driver = { - .name = "jazz_esp", - .owner = THIS_MODULE, ---- a/drivers/scsi/lasi700.c -+++ b/drivers/scsi/lasi700.c -@@ -168,7 +168,7 @@ static struct parisc_driver lasi700_driv - .name = "lasi_scsi", - .id_table = lasi700_ids, - .probe = lasi700_probe, -- .remove = __devexit_p(lasi700_driver_remove), -+ .remove = lasi700_driver_remove, - }; - - static int __init ---- a/drivers/scsi/mac_esp.c -+++ b/drivers/scsi/mac_esp.c -@@ -481,7 +481,7 @@ static struct esp_driver_ops mac_esp_ops - .dma_error = mac_esp_dma_error, - }; - --static int __devinit esp_mac_probe(struct platform_device *dev) -+static int esp_mac_probe(struct platform_device *dev) - { - struct scsi_host_template *tpnt = &scsi_esp_template; - struct Scsi_Host *host; -@@ -591,7 +591,7 @@ fail: - return err; - } - --static int __devexit esp_mac_remove(struct platform_device *dev) -+static int esp_mac_remove(struct platform_device *dev) - { - struct mac_esp_priv *mep = platform_get_drvdata(dev); - struct esp *esp = mep->esp; -@@ -614,7 +614,7 @@ static int __devexit esp_mac_remove(stru - - static struct platform_driver esp_mac_driver = { - .probe = esp_mac_probe, -- .remove = __devexit_p(esp_mac_remove), -+ .remove = esp_mac_remove, - .driver = { - .name = DRV_MODULE_NAME, - .owner = THIS_MODULE, ---- a/drivers/scsi/sni_53c710.c -+++ b/drivers/scsi/sni_53c710.c -@@ -65,7 +65,7 @@ static struct scsi_host_template snirm71 - .module = THIS_MODULE, - }; - --static int __devinit snirm710_probe(struct platform_device *dev) -+static int snirm710_probe(struct platform_device *dev) - { - unsigned long base; - struct NCR_700_Host_Parameters *hostdata; -@@ -134,7 +134,7 @@ static int __exit snirm710_driver_remove - - static struct platform_driver snirm710_driver = { - .probe = snirm710_probe, -- .remove = __devexit_p(snirm710_driver_remove), -+ .remove = snirm710_driver_remove, - .driver = { - .name = "snirm_53c710", - .owner = THIS_MODULE, ---- a/drivers/scsi/stex.c -+++ b/drivers/scsi/stex.c -@@ -1540,8 +1540,7 @@ static void stex_free_irq(struct st_hba - pci_disable_msi(pdev); - } - --static int __devinit --stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) -+static int stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) - { - struct st_hba *hba; - struct Scsi_Host *host; -@@ -1815,7 +1814,7 @@ static struct pci_driver stex_pci_driver - .name = DRV_NAME, - .id_table = stex_pci_tbl, - .probe = stex_probe, -- .remove = __devexit_p(stex_remove), -+ .remove = stex_remove, - .shutdown = stex_shutdown, - }; - ---- a/drivers/scsi/sun_esp.c -+++ b/drivers/scsi/sun_esp.c -@@ -43,8 +43,7 @@ enum dvma_rev { - dvmahme - }; - --static int __devinit esp_sbus_setup_dma(struct esp *esp, -- struct platform_device *dma_of) -+static int esp_sbus_setup_dma(struct esp *esp, struct platform_device *dma_of) - { - esp->dma = dma_of; - -@@ -79,7 +78,7 @@ static int __devinit esp_sbus_setup_dma( - - } - --static int __devinit esp_sbus_map_regs(struct esp *esp, int hme) -+static int esp_sbus_map_regs(struct esp *esp, int hme) - { - struct platform_device *op = esp->dev; - struct resource *res; -@@ -99,7 +98,7 @@ static int __devinit esp_sbus_map_regs(s - return 0; - } - --static int __devinit esp_sbus_map_command_block(struct esp *esp) -+static int esp_sbus_map_command_block(struct esp *esp) - { - struct platform_device *op = esp->dev; - -@@ -111,7 +110,7 @@ static int __devinit esp_sbus_map_comman - return 0; - } - --static int __devinit esp_sbus_register_irq(struct esp *esp) -+static int esp_sbus_register_irq(struct esp *esp) - { - struct Scsi_Host *host = esp->host; - struct platform_device *op = esp->dev; -@@ -120,7 +119,7 @@ static int __devinit esp_sbus_register_i - return request_irq(host->irq, scsi_esp_intr, IRQF_SHARED, "ESP", esp); - } - --static void __devinit esp_get_scsi_id(struct esp *esp, struct platform_device *espdma) -+static void esp_get_scsi_id(struct esp *esp, struct platform_device *espdma) - { - struct platform_device *op = esp->dev; - struct device_node *dp; -@@ -142,7 +141,7 @@ done: - esp->scsi_id_mask = (1 << esp->scsi_id); - } - --static void __devinit esp_get_differential(struct esp *esp) -+static void esp_get_differential(struct esp *esp) - { - struct platform_device *op = esp->dev; - struct device_node *dp; -@@ -154,7 +153,7 @@ static void __devinit esp_get_differenti - esp->flags &= ~ESP_FLAG_DIFFERENTIAL; - } - --static void __devinit esp_get_clock_params(struct esp *esp) -+static void esp_get_clock_params(struct esp *esp) - { - struct platform_device *op = esp->dev; - struct device_node *bus_dp, *dp; -@@ -170,7 +169,7 @@ static void __devinit esp_get_clock_para - esp->cfreq = fmhz; - } - --static void __devinit esp_get_bursts(struct esp *esp, struct platform_device *dma_of) -+static void esp_get_bursts(struct esp *esp, struct platform_device *dma_of) - { - struct device_node *dma_dp = dma_of->dev.of_node; - struct platform_device *op = esp->dev; -@@ -195,7 +194,7 @@ static void __devinit esp_get_bursts(str - esp->bursts = bursts; - } - --static void __devinit esp_sbus_get_props(struct esp *esp, struct platform_device *espdma) -+static void esp_sbus_get_props(struct esp *esp, struct platform_device *espdma) - { - esp_get_scsi_id(esp, espdma); - esp_get_differential(esp); -@@ -487,9 +486,8 @@ static const struct esp_driver_ops sbus_ - .dma_error = sbus_esp_dma_error, - }; - --static int __devinit esp_sbus_probe_one(struct platform_device *op, -- struct platform_device *espdma, -- int hme) -+static int esp_sbus_probe_one(struct platform_device *op, -+ struct platform_device *espdma, int hme) - { - struct scsi_host_template *tpnt = &scsi_esp_template; - struct Scsi_Host *host; -@@ -562,7 +560,7 @@ fail: - return err; - } - --static int __devinit esp_sbus_probe(struct platform_device *op) -+static int esp_sbus_probe(struct platform_device *op) - { - struct device_node *dma_node = NULL; - struct device_node *dp = op->dev.of_node; -@@ -585,7 +583,7 @@ static int __devinit esp_sbus_probe(stru - return esp_sbus_probe_one(op, dma_of, hme); - } - --static int __devexit esp_sbus_remove(struct platform_device *op) -+static int esp_sbus_remove(struct platform_device *op) - { - struct esp *esp = dev_get_drvdata(&op->dev); - struct platform_device *dma_of = esp->dma; -@@ -639,7 +637,7 @@ static struct platform_driver esp_sbus_d - .of_match_table = esp_match, - }, - .probe = esp_sbus_probe, -- .remove = __devexit_p(esp_sbus_remove), -+ .remove = esp_sbus_remove, - }; - - static int __init sunesp_init(void) ---- a/drivers/scsi/zorro7xx.c -+++ b/drivers/scsi/zorro7xx.c -@@ -38,7 +38,7 @@ static struct zorro_driver_data { - const char *name; - unsigned long offset; - int absolute; /* offset is absolute address */ --} zorro7xx_driver_data[] __devinitdata = { -+} zorro7xx_driver_data[] = { - { .name = "PowerUP 603e+", .offset = 0xf40000, .absolute = 1 }, - { .name = "WarpEngine 40xx", .offset = 0x40000 }, - { .name = "A4091", .offset = 0x800000 }, -@@ -46,7 +46,7 @@ static struct zorro_driver_data { - { 0 } - }; - --static struct zorro_device_id zorro7xx_zorro_tbl[] __devinitdata = { -+static struct zorro_device_id zorro7xx_zorro_tbl[] = { - { - .id = ZORRO_PROD_PHASE5_BLIZZARD_603E_PLUS, - .driver_data = (unsigned long)&zorro7xx_driver_data[0], -@@ -71,8 +71,8 @@ static struct zorro_device_id zorro7xx_z - }; - MODULE_DEVICE_TABLE(zorro, zorro7xx_zorro_tbl); - --static int __devinit zorro7xx_init_one(struct zorro_dev *z, -- const struct zorro_device_id *ent) -+static int zorro7xx_init_one(struct zorro_dev *z, -+ const struct zorro_device_id *ent) - { - struct Scsi_Host *host; - struct NCR_700_Host_Parameters *hostdata; -@@ -150,7 +150,7 @@ static int __devinit zorro7xx_init_one(s - return -ENODEV; - } - --static __devexit void zorro7xx_remove_one(struct zorro_dev *z) -+static void zorro7xx_remove_one(struct zorro_dev *z) - { - struct Scsi_Host *host = zorro_get_drvdata(z); - struct NCR_700_Host_Parameters *hostdata = shost_priv(host); -@@ -167,7 +167,7 @@ static struct zorro_driver zorro7xx_driv - .name = "zorro7xx-scsi", - .id_table = zorro7xx_zorro_tbl, - .probe = zorro7xx_init_one, -- .remove = __devexit_p(zorro7xx_remove_one), -+ .remove = zorro7xx_remove_one, - }; - - static int __init zorro7xx_scsi_init(void) diff --git a/devfreq-convert-devfreq_class-to-use-dev_groups.patch b/devfreq-convert-devfreq_class-to-use-dev_groups.patch new file mode 100644 index 00000000000000..13a039626f758f --- /dev/null +++ b/devfreq-convert-devfreq_class-to-use-dev_groups.patch @@ -0,0 +1,199 @@ +From foo@baz Tue Jul 9 14:52:00 PDT 2013 +Date: Tue, 09 Jul 2013 14:52:00 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: devfreq: convert devfreq_class to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the devfreq_class code to use the +correct field. + +Cc: MyungJoo Ham <myungjoo.ham@samsung.com> +Cc: Kyungmin Park <kyungmin.park@samsung.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/devfreq/devfreq.c | 76 ++++++++++++++++++++++++++-------------------- + 1 file changed, 43 insertions(+), 33 deletions(-) + +--- a/drivers/devfreq/devfreq.c ++++ b/drivers/devfreq/devfreq.c +@@ -703,7 +703,7 @@ err_out: + } + EXPORT_SYMBOL(devfreq_remove_governor); + +-static ssize_t show_governor(struct device *dev, ++static ssize_t governor_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + if (!to_devfreq(dev)->governor) +@@ -712,7 +712,7 @@ static ssize_t show_governor(struct devi + return sprintf(buf, "%s\n", to_devfreq(dev)->governor->name); + } + +-static ssize_t store_governor(struct device *dev, struct device_attribute *attr, ++static ssize_t governor_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) + { + struct devfreq *df = to_devfreq(dev); +@@ -754,9 +754,11 @@ out: + ret = count; + return ret; + } +-static ssize_t show_available_governors(struct device *d, +- struct device_attribute *attr, +- char *buf) ++static DEVICE_ATTR_RW(governor); ++ ++static ssize_t available_governors_show(struct device *d, ++ struct device_attribute *attr, ++ char *buf) + { + struct devfreq_governor *tmp_governor; + ssize_t count = 0; +@@ -775,9 +777,10 @@ static ssize_t show_available_governors( + + return count; + } ++static DEVICE_ATTR_RO(available_governors); + +-static ssize_t show_freq(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t cur_freq_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + unsigned long freq; + struct devfreq *devfreq = to_devfreq(dev); +@@ -788,20 +791,22 @@ static ssize_t show_freq(struct device * + + return sprintf(buf, "%lu\n", devfreq->previous_freq); + } ++static DEVICE_ATTR_RO(cur_freq); + +-static ssize_t show_target_freq(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t target_freq_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + return sprintf(buf, "%lu\n", to_devfreq(dev)->previous_freq); + } ++static DEVICE_ATTR_RO(target_freq); + +-static ssize_t show_polling_interval(struct device *dev, ++static ssize_t polling_interval_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + return sprintf(buf, "%d\n", to_devfreq(dev)->profile->polling_ms); + } + +-static ssize_t store_polling_interval(struct device *dev, ++static ssize_t polling_interval_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) + { +@@ -821,8 +826,9 @@ static ssize_t store_polling_interval(st + + return ret; + } ++static DEVICE_ATTR_RW(polling_interval); + +-static ssize_t store_min_freq(struct device *dev, struct device_attribute *attr, ++static ssize_t min_freq_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) + { + struct devfreq *df = to_devfreq(dev); +@@ -849,13 +855,13 @@ unlock: + return ret; + } + +-static ssize_t show_min_freq(struct device *dev, struct device_attribute *attr, ++static ssize_t min_freq_show(struct device *dev, struct device_attribute *attr, + char *buf) + { + return sprintf(buf, "%lu\n", to_devfreq(dev)->min_freq); + } + +-static ssize_t store_max_freq(struct device *dev, struct device_attribute *attr, ++static ssize_t max_freq_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) + { + struct devfreq *df = to_devfreq(dev); +@@ -881,16 +887,18 @@ unlock: + mutex_unlock(&df->lock); + return ret; + } ++static DEVICE_ATTR_RW(min_freq); + +-static ssize_t show_max_freq(struct device *dev, struct device_attribute *attr, ++static ssize_t max_freq_show(struct device *dev, struct device_attribute *attr, + char *buf) + { + return sprintf(buf, "%lu\n", to_devfreq(dev)->max_freq); + } ++static DEVICE_ATTR_RW(max_freq); + +-static ssize_t show_available_freqs(struct device *d, +- struct device_attribute *attr, +- char *buf) ++static ssize_t available_frequencies_show(struct device *d, ++ struct device_attribute *attr, ++ char *buf) + { + struct devfreq *df = to_devfreq(d); + struct device *dev = df->dev.parent; +@@ -918,9 +926,10 @@ static ssize_t show_available_freqs(stru + + return count; + } ++static DEVICE_ATTR_RO(available_frequencies); + +-static ssize_t show_trans_table(struct device *dev, struct device_attribute *attr, +- char *buf) ++static ssize_t trans_stat_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct devfreq *devfreq = to_devfreq(dev); + ssize_t len; +@@ -959,20 +968,21 @@ static ssize_t show_trans_table(struct d + devfreq->total_trans); + return len; + } ++static DEVICE_ATTR_RO(trans_stat); + +-static struct device_attribute devfreq_attrs[] = { +- __ATTR(governor, S_IRUGO | S_IWUSR, show_governor, store_governor), +- __ATTR(available_governors, S_IRUGO, show_available_governors, NULL), +- __ATTR(cur_freq, S_IRUGO, show_freq, NULL), +- __ATTR(available_frequencies, S_IRUGO, show_available_freqs, NULL), +- __ATTR(target_freq, S_IRUGO, show_target_freq, NULL), +- __ATTR(polling_interval, S_IRUGO | S_IWUSR, show_polling_interval, +- store_polling_interval), +- __ATTR(min_freq, S_IRUGO | S_IWUSR, show_min_freq, store_min_freq), +- __ATTR(max_freq, S_IRUGO | S_IWUSR, show_max_freq, store_max_freq), +- __ATTR(trans_stat, S_IRUGO, show_trans_table, NULL), +- { }, ++static struct attribute *devfreq_attrs[] = { ++ &dev_attr_governor.attr, ++ &dev_attr_available_governors.attr, ++ &dev_attr_cur_freq.attr, ++ &dev_attr_available_frequencies.attr, ++ &dev_attr_target_freq.attr, ++ &dev_attr_polling_interval.attr, ++ &dev_attr_min_freq.attr, ++ &dev_attr_max_freq.attr, ++ &dev_attr_trans_stat.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(devfreq); + + static int __init devfreq_init(void) + { +@@ -988,7 +998,7 @@ static int __init devfreq_init(void) + pr_err("%s: couldn't create workqueue\n", __FILE__); + return PTR_ERR(devfreq_wq); + } +- devfreq_class->dev_attrs = devfreq_attrs; ++ devfreq_class->dev_groups = devfreq_groups; + + return 0; + } diff --git a/devnode_gid.patch b/devnode_gid.patch deleted file mode 100644 index f6ca7f9d7f2e0b..00000000000000 --- a/devnode_gid.patch +++ /dev/null @@ -1,206 +0,0 @@ -From 8c41f3b1fb98a30664c73d61745b346d4013ced5 Mon Sep 17 00:00:00 2001 -From: Kay Sievers <kay@vrfy.org> -Date: Sat, 22 Dec 2012 18:36:55 +0100 -Subject: [PATCH] driver core: add uid and gid to devtmpfs - - ---- - block/genhd.c | 3 ++- - drivers/base/core.c | 17 +++++++++++++---- - drivers/base/devtmpfs.c | 27 +++++++++++++++++---------- - drivers/usb/core/usb.c | 3 ++- - include/linux/device.h | 7 +++++-- - 5 files changed, 39 insertions(+), 18 deletions(-) - ---- a/block/genhd.c -+++ b/block/genhd.c -@@ -1107,7 +1107,8 @@ struct class block_class = { - .name = "block", - }; - --static char *block_devnode(struct device *dev, umode_t *mode) -+static char *block_devnode(struct device *dev, umode_t *mode, -+ uid_t *uid, gid_t *gid) - { - struct gendisk *disk = dev_to_disk(dev); - ---- a/drivers/base/core.c -+++ b/drivers/base/core.c -@@ -283,15 +283,21 @@ static int dev_uevent(struct kset *kset, - const char *tmp; - const char *name; - umode_t mode = 0; -+ uid_t uid = 0; -+ gid_t gid = 0; - - add_uevent_var(env, "MAJOR=%u", MAJOR(dev->devt)); - add_uevent_var(env, "MINOR=%u", MINOR(dev->devt)); -- name = device_get_devnode(dev, &mode, &tmp); -+ name = device_get_devnode(dev, &mode, &uid, &gid, &tmp); - if (name) { - add_uevent_var(env, "DEVNAME=%s", name); -- kfree(tmp); - if (mode) - add_uevent_var(env, "DEVMODE=%#o", mode & 0777); -+ if (uid) -+ add_uevent_var(env, "DEVUID=%u", uid); -+ if (gid) -+ add_uevent_var(env, "DEVGID=%u", gid); -+ kfree(tmp); - } - } - -@@ -1274,6 +1280,8 @@ static struct device *next_device(struct - * device_get_devnode - path of device node file - * @dev: device - * @mode: returned file access mode -+ * @uid: returned file owner -+ * @gid: returned file group - * @tmp: possibly allocated string - * - * Return the relative path of a possible device node. -@@ -1282,7 +1290,8 @@ static struct device *next_device(struct - * freed by the caller. - */ - const char *device_get_devnode(struct device *dev, -- umode_t *mode, const char **tmp) -+ umode_t *mode, uid_t *uid, gid_t *gid, -+ const char **tmp) - { - char *s; - -@@ -1290,7 +1299,7 @@ const char *device_get_devnode(struct de - - /* the device type may provide a specific name */ - if (dev->type && dev->type->devnode) -- *tmp = dev->type->devnode(dev, mode); -+ *tmp = dev->type->devnode(dev, mode, uid, gid); - if (*tmp) - return *tmp; - ---- a/drivers/base/devtmpfs.c -+++ b/drivers/base/devtmpfs.c -@@ -41,6 +41,8 @@ static struct req { - int err; - const char *name; - umode_t mode; /* 0 => delete */ -+ uid_t uid; -+ gid_t gid; - struct device *dev; - } *requests; - -@@ -85,7 +87,9 @@ int devtmpfs_create_node(struct device * - return 0; - - req.mode = 0; -- req.name = device_get_devnode(dev, &req.mode, &tmp); -+ req.uid = 0; -+ req.gid = 0; -+ req.name = device_get_devnode(dev, &req.mode, &req.uid, &req.gid, &tmp); - if (!req.name) - return -ENOMEM; - -@@ -121,7 +125,7 @@ int devtmpfs_delete_node(struct device * - if (!thread) - return 0; - -- req.name = device_get_devnode(dev, NULL, &tmp); -+ req.name = device_get_devnode(dev, NULL, NULL, NULL, &tmp); - if (!req.name) - return -ENOMEM; - -@@ -187,7 +191,8 @@ static int create_path(const char *nodep - return err; - } - --static int handle_create(const char *nodename, umode_t mode, struct device *dev) -+static int handle_create(const char *nodename, umode_t mode, uid_t uid, -+ gid_t gid, struct device *dev) - { - struct dentry *dentry; - struct path path; -@@ -201,14 +206,14 @@ static int handle_create(const char *nod - if (IS_ERR(dentry)) - return PTR_ERR(dentry); - -- err = vfs_mknod(path.dentry->d_inode, -- dentry, mode, dev->devt); -+ err = vfs_mknod(path.dentry->d_inode, dentry, mode, dev->devt); - if (!err) { - struct iattr newattrs; - -- /* fixup possibly umasked mode */ - newattrs.ia_mode = mode; -- newattrs.ia_valid = ATTR_MODE; -+ newattrs.ia_uid = uid; -+ newattrs.ia_gid = gid; -+ newattrs.ia_valid = ATTR_MODE|ATTR_UID|ATTR_GID; - mutex_lock(&dentry->d_inode->i_mutex); - notify_change(dentry, &newattrs); - mutex_unlock(&dentry->d_inode->i_mutex); -@@ -357,10 +362,11 @@ int devtmpfs_mount(const char *mntdir) - - static DECLARE_COMPLETION(setup_done); - --static int handle(const char *name, umode_t mode, struct device *dev) -+static int handle(const char *name, umode_t mode, uid_t uid, gid_t gid, -+ struct device *dev) - { - if (mode) -- return handle_create(name, mode, dev); -+ return handle_create(name, mode, uid, gid, dev); - else - return handle_remove(name, dev); - } -@@ -386,7 +392,8 @@ static int devtmpfsd(void *p) - spin_unlock(&req_lock); - while (req) { - struct req *next = req->next; -- req->err = handle(req->name, req->mode, req->dev); -+ req->err = handle(req->name, req->mode, -+ req->uid, req->gid, req->dev); - complete(&req->done); - req = next; - } ---- a/drivers/usb/core/usb.c -+++ b/drivers/usb/core/usb.c -@@ -317,7 +317,8 @@ static const struct dev_pm_ops usb_devic - #endif /* CONFIG_PM */ - - --static char *usb_devnode(struct device *dev, umode_t *mode) -+static char *usb_devnode(struct device *dev, -+ umode_t *mode, uid_t *uid, gid_t *gid) - { - struct usb_device *usb_dev; - ---- a/include/linux/device.h -+++ b/include/linux/device.h -@@ -24,6 +24,7 @@ - #include <linux/pm.h> - #include <linux/atomic.h> - #include <linux/ratelimit.h> -+#include <linux/uidgid.h> - #include <asm/device.h> - - struct device; -@@ -470,7 +471,8 @@ struct device_type { - const char *name; - const struct attribute_group **groups; - int (*uevent)(struct device *dev, struct kobj_uevent_env *env); -- char *(*devnode)(struct device *dev, umode_t *mode); -+ char *(*devnode)(struct device *dev, umode_t *mode, -+ uid_t *uid, gid_t *gid); - void (*release)(struct device *dev); - - const struct dev_pm_ops *pm; -@@ -841,7 +843,8 @@ extern int device_rename(struct device * - extern int device_move(struct device *dev, struct device *new_parent, - enum dpm_order dpm_order); - extern const char *device_get_devnode(struct device *dev, -- umode_t *mode, const char **tmp); -+ umode_t *mode, uid_t *uid, gid_t *gid, -+ const char **tmp); - extern void *dev_get_drvdata(const struct device *dev); - extern int dev_set_drvdata(struct device *dev, void *data); - diff --git a/dma-convert-dma_devclass-to-use-dev_groups.patch b/dma-convert-dma_devclass-to-use-dev_groups.patch new file mode 100644 index 00000000000000..759d18025cb647 --- /dev/null +++ b/dma-convert-dma_devclass-to-use-dev_groups.patch @@ -0,0 +1,84 @@ +From foo@baz Tue Jul 9 14:50:40 PDT 2013 +Date: Tue, 09 Jul 2013 14:50:40 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: dma: convert dma_devclass to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the dma dma_devclass code to use +the correct field. + +Cc: Dan Williams <djbw@fb.com> +Cc: Vinod Koul <vinod.koul@intel.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/dma/dmaengine.c | 26 ++++++++++++++++---------- + 1 file changed, 16 insertions(+), 10 deletions(-) + +--- a/drivers/dma/dmaengine.c ++++ b/drivers/dma/dmaengine.c +@@ -87,7 +87,8 @@ static struct dma_chan *dev_to_dma_chan( + return chan_dev->chan; + } + +-static ssize_t show_memcpy_count(struct device *dev, struct device_attribute *attr, char *buf) ++static ssize_t memcpy_count_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct dma_chan *chan; + unsigned long count = 0; +@@ -106,9 +107,10 @@ static ssize_t show_memcpy_count(struct + + return err; + } ++static DEVICE_ATTR_RO(memcpy_count); + +-static ssize_t show_bytes_transferred(struct device *dev, struct device_attribute *attr, +- char *buf) ++static ssize_t bytes_transferred_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct dma_chan *chan; + unsigned long count = 0; +@@ -127,8 +129,10 @@ static ssize_t show_bytes_transferred(st + + return err; + } ++static DEVICE_ATTR_RO(bytes_transferred); + +-static ssize_t show_in_use(struct device *dev, struct device_attribute *attr, char *buf) ++static ssize_t in_use_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct dma_chan *chan; + int err; +@@ -143,13 +147,15 @@ static ssize_t show_in_use(struct device + + return err; + } ++static DEVICE_ATTR_RO(in_use); + +-static struct device_attribute dma_attrs[] = { +- __ATTR(memcpy_count, S_IRUGO, show_memcpy_count, NULL), +- __ATTR(bytes_transferred, S_IRUGO, show_bytes_transferred, NULL), +- __ATTR(in_use, S_IRUGO, show_in_use, NULL), +- __ATTR_NULL ++static struct attribute *dma_dev_attrs[] = { ++ &dev_attr_memcpy_count.attr, ++ &dev_attr_bytes_transferred.attr, ++ &dev_attr_in_use.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(dma_dev); + + static void chan_dev_release(struct device *dev) + { +@@ -167,7 +173,7 @@ static void chan_dev_release(struct devi + + static struct class dma_devclass = { + .name = "dma", +- .dev_attrs = dma_attrs, ++ .dev_groups = dma_dev_groups, + .dev_release = chan_dev_release, + }; + diff --git a/driver-core-add-default-groups-to-struct-class.patch b/driver-core-add-default-groups-to-struct-class.patch new file mode 100644 index 00000000000000..b9fdfc05ff7445 --- /dev/null +++ b/driver-core-add-default-groups-to-struct-class.patch @@ -0,0 +1,73 @@ +From foo@baz Tue Jul 9 12:00:06 PDT 2013 +Date: Tue, 09 Jul 2013 12:00:06 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: driver core: add default groups to struct class + +We should be using groups, not attribute lists, for classes to allow +subdirectories, and soon, binary files. Groups are just more flexible +overall, so add them. + +The dev_attrs list will go away after all in-kernel users are converted +to use dev_groups. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/base/core.c | 9 ++++++++- + include/linux/device.h | 4 +++- + 2 files changed, 11 insertions(+), 2 deletions(-) + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -528,9 +528,12 @@ static int device_add_attrs(struct devic + int error; + + if (class) { +- error = device_add_attributes(dev, class->dev_attrs); ++ error = device_add_groups(dev, class->dev_groups); + if (error) + return error; ++ error = device_add_attributes(dev, class->dev_attrs); ++ if (error) ++ goto err_remove_class_groups; + error = device_add_bin_attributes(dev, class->dev_bin_attrs); + if (error) + goto err_remove_class_attrs; +@@ -563,6 +566,9 @@ static int device_add_attrs(struct devic + err_remove_class_attrs: + if (class) + device_remove_attributes(dev, class->dev_attrs); ++ err_remove_class_groups: ++ if (class) ++ device_remove_groups(dev, class->dev_groups); + + return error; + } +@@ -581,6 +587,7 @@ static void device_remove_attrs(struct d + if (class) { + device_remove_attributes(dev, class->dev_attrs); + device_remove_bin_attributes(dev, class->dev_bin_attrs); ++ device_remove_groups(dev, class->dev_groups); + } + } + +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -320,6 +320,7 @@ int subsys_virtual_register(struct bus_t + * @name: Name of the class. + * @owner: The module owner. + * @class_attrs: Default attributes of this class. ++ * @dev_groups: Default attributes of the devices that belong to the class. + * @dev_attrs: Default attributes of the devices belong to the class. + * @dev_bin_attrs: Default binary attributes of the devices belong to the class. + * @dev_kobj: The kobject that represents this class and links it into the hierarchy. +@@ -349,7 +350,8 @@ struct class { + struct module *owner; + + struct class_attribute *class_attrs; +- struct device_attribute *dev_attrs; ++ struct device_attribute *dev_attrs; /* use dev_groups instead */ ++ const struct attribute_group **dev_groups; + struct bin_attribute *dev_bin_attrs; + struct kobject *dev_kobj; + diff --git a/driver-core-add-device_attr_rw-and-device_attr_ro-macros.patch b/driver-core-add-device_attr_rw-and-device_attr_ro-macros.patch new file mode 100644 index 00000000000000..492bb0de5cc31a --- /dev/null +++ b/driver-core-add-device_attr_rw-and-device_attr_ro-macros.patch @@ -0,0 +1,80 @@ +From foo@baz Mon Jul 8 22:44:37 PDT 2013 +Date: Mon, 08 Jul 2013 22:44:37 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: driver core: device.h: add RW and RO attribute macros + +Make it easier to create attributes without having to always audit the +mode settings. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + include/linux/device.h | 28 +++++++++++++++++++++------- + 1 file changed, 21 insertions(+), 7 deletions(-) + +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -47,7 +47,11 @@ struct bus_attribute { + }; + + #define BUS_ATTR(_name, _mode, _show, _store) \ +-struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store) ++ struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store) ++#define BUS_ATTR_RW(_name) \ ++ struct bus_attribute bus_attr_##_name = __ATTR_RW(_name) ++#define BUS_ATTR_RO(_name) \ ++ struct bus_attribute bus_attr_##_name = __ATTR_RO(_name) + + extern int __must_check bus_create_file(struct bus_type *, + struct bus_attribute *); +@@ -261,9 +265,12 @@ struct driver_attribute { + size_t count); + }; + +-#define DRIVER_ATTR(_name, _mode, _show, _store) \ +-struct driver_attribute driver_attr_##_name = \ +- __ATTR(_name, _mode, _show, _store) ++#define DRIVER_ATTR(_name, _mode, _show, _store) \ ++ struct driver_attribute driver_attr_##_name = __ATTR(_name, _mode, _show, _store) ++#define DRIVER_ATTR_RW(_name) \ ++ struct driver_attribute driver_attr_##_name = __ATTR_RW(_name) ++#define DRIVER_ATTR_RO(_name) \ ++ struct driver_attribute driver_attr_##_name = __ATTR_RO(_name) + + extern int __must_check driver_create_file(struct device_driver *driver, + const struct driver_attribute *attr); +@@ -414,8 +421,12 @@ struct class_attribute { + const struct class_attribute *attr); + }; + +-#define CLASS_ATTR(_name, _mode, _show, _store) \ +-struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store) ++#define CLASS_ATTR(_name, _mode, _show, _store) \ ++ struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store) ++#define CLASS_ATTR_RW(_name) \ ++ struct class_attribute class_attr_##_name = __ATTR_RW(_name) ++#define CLASS_ATTR_RO(_name) \ ++ struct class_attribute class_attr_##_name = __ATTR_RO(_name) + + extern int __must_check class_create_file(struct class *class, + const struct class_attribute *attr); +@@ -423,7 +434,6 @@ extern void class_remove_file(struct cla + const struct class_attribute *attr); + + /* Simple class attribute that is just a static string */ +- + struct class_attribute_string { + struct class_attribute attr; + char *str; +@@ -512,6 +522,10 @@ ssize_t device_store_bool(struct device + + #define DEVICE_ATTR(_name, _mode, _show, _store) \ + struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) ++#define DEVICE_ATTR_RW(_name) \ ++ struct device_attribute dev_attr_##_name = __ATTR_RW(_name) ++#define DEVICE_ATTR_RO(_name) \ ++ struct device_attribute dev_attr_##_name = __ATTR_RO(_name) + #define DEVICE_ULONG_ATTR(_name, _mode, _var) \ + struct dev_ext_attribute dev_attr_##_name = \ + { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } diff --git a/driver-core-bus_type-add-bus_groups.patch b/driver-core-bus_type-add-bus_groups.patch new file mode 100644 index 00000000000000..f3dda29edf3211 --- /dev/null +++ b/driver-core-bus_type-add-bus_groups.patch @@ -0,0 +1,105 @@ +From foo@baz Wed Jul 10 15:53:39 PDT 2013 +Date: Wed, 10 Jul 2013 15:53:39 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: driver core: bus_type: add bus_groups + +attribute groups are much more flexible than just a list of attributes, +due to their support for visibility of the attributes, and binary +attributes. Add bus_groups to struct bus_type which should be used +instead of bus_attrs. + +bus_attrs will be removed from the structure soon. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/base/bus.c | 37 +++++++++++++++++++++++++++++++++++++ + include/linux/device.h | 4 +++- + 2 files changed, 40 insertions(+), 1 deletion(-) + +--- a/drivers/base/bus.c ++++ b/drivers/base/bus.c +@@ -881,6 +881,37 @@ static void bus_remove_attrs(struct bus_ + } + } + ++static int bus_add_groups(struct bus_type *bus, ++ const struct attribute_group **groups) ++{ ++ int error = 0; ++ int i; ++ ++ if (groups) { ++ for (i = 0; groups[i]; i++) { ++ error = sysfs_create_group(&bus->p->subsys.kobj, ++ groups[i]); ++ if (error) { ++ while (--i >= 0) ++ sysfs_remove_group(&bus->p->subsys.kobj, ++ groups[i]); ++ break; ++ } ++ } ++ } ++ return error; ++} ++ ++static void bus_remove_groups(struct bus_type *bus, ++ const struct attribute_group **groups) ++{ ++ int i; ++ ++ if (groups) ++ for (i = 0; groups[i]; i++) ++ sysfs_remove_group(&bus->p->subsys.kobj, groups[i]); ++} ++ + static void klist_devices_get(struct klist_node *n) + { + struct device_private *dev_prv = to_device_private_bus(n); +@@ -973,10 +1004,15 @@ int bus_register(struct bus_type *bus) + retval = bus_add_attrs(bus); + if (retval) + goto bus_attrs_fail; ++ retval = bus_add_groups(bus, bus->bus_groups); ++ if (retval) ++ goto bus_groups_fail; + + pr_debug("bus: '%s': registered\n", bus->name); + return 0; + ++bus_groups_fail: ++ bus_remove_attrs(bus); + bus_attrs_fail: + remove_probe_files(bus); + bus_probe_files_fail: +@@ -1007,6 +1043,7 @@ void bus_unregister(struct bus_type *bus + if (bus->dev_root) + device_unregister(bus->dev_root); + bus_remove_attrs(bus); ++ bus_remove_groups(bus, bus->bus_groups); + remove_probe_files(bus); + kset_unregister(bus->p->drivers_kset); + kset_unregister(bus->p->devices_kset); +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -66,6 +66,7 @@ extern void bus_remove_file(struct bus_t + * @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. ++ * @bus_groups: Default attributes of the bus. + * @dev_groups: Default attributes of the devices on the bus. + * @drv_groups: Default attributes of the device drivers on the bus. + * @match: Called, perhaps multiple times, whenever a new device or driver +@@ -105,9 +106,10 @@ struct bus_type { + const char *name; + const char *dev_name; + struct device *dev_root; +- struct bus_attribute *bus_attrs; ++ struct bus_attribute *bus_attrs; /* use bus_groups instead */ + struct device_attribute *dev_attrs; /* use dev_groups instead */ + struct driver_attribute *drv_attrs; /* use drv_groups instead */ ++ const struct attribute_group **bus_groups; + const struct attribute_group **dev_groups; + const struct attribute_group **drv_groups; + diff --git a/driver-core-bus_type-add-dev_groups.patch b/driver-core-bus_type-add-dev_groups.patch new file mode 100644 index 00000000000000..b312a37ecbc34b --- /dev/null +++ b/driver-core-bus_type-add-dev_groups.patch @@ -0,0 +1,108 @@ +From foo@baz Wed Jul 10 15:50:50 PDT 2013 +Date: Wed, 10 Jul 2013 15:50:50 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: driver core: bus_type: add dev_groups + +attribute groups are much more flexible than just a list of attributes, +due to their support for visibility of the attributes, and binary +attributes. Add dev_groups to struct bus_type which should be used +instead of dev_attrs. + +dev_attrs will be removed from the structure soon. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/base/base.h | 5 +++++ + drivers/base/bus.c | 6 ++++++ + drivers/base/core.c | 7 +++---- + include/linux/device.h | 4 +++- + 4 files changed, 17 insertions(+), 5 deletions(-) + +--- a/drivers/base/base.h ++++ b/drivers/base/base.h +@@ -119,6 +119,11 @@ static inline int driver_match_device(st + return drv->bus->match ? drv->bus->match(dev, drv) : 1; + } + ++extern int device_add_groups(struct device *dev, ++ const struct attribute_group **groups); ++extern void device_remove_groups(struct device *dev, ++ const struct attribute_group **groups); ++ + extern char *make_class_name(const char *name, struct kobject *kobj); + + extern int devres_release_all(struct device *dev); +--- a/drivers/base/bus.c ++++ b/drivers/base/bus.c +@@ -499,6 +499,9 @@ int bus_add_device(struct device *dev) + error = device_add_attrs(bus, dev); + if (error) + goto out_put; ++ error = device_add_groups(dev, bus->dev_groups); ++ if (error) ++ goto out_groups; + error = sysfs_create_link(&bus->p->devices_kset->kobj, + &dev->kobj, dev_name(dev)); + if (error) +@@ -513,6 +516,8 @@ int bus_add_device(struct device *dev) + + out_subsys: + sysfs_remove_link(&bus->p->devices_kset->kobj, dev_name(dev)); ++out_groups: ++ device_remove_groups(dev, bus->dev_groups); + out_id: + device_remove_attrs(bus, dev); + out_put: +@@ -575,6 +580,7 @@ void bus_remove_device(struct device *de + sysfs_remove_link(&dev->bus->p->devices_kset->kobj, + dev_name(dev)); + device_remove_attrs(dev->bus, dev); ++ device_remove_groups(dev, dev->bus->dev_groups); + if (klist_node_attached(&dev->p->knode_bus)) + klist_del(&dev->p->knode_bus); + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -433,8 +433,7 @@ static ssize_t store_online(struct devic + static struct device_attribute online_attr = + __ATTR(online, S_IRUGO | S_IWUSR, show_online, store_online); + +-static int device_add_groups(struct device *dev, +- const struct attribute_group **groups) ++int device_add_groups(struct device *dev, const struct attribute_group **groups) + { + int error = 0; + int i; +@@ -453,8 +452,8 @@ static int device_add_groups(struct devi + return error; + } + +-static void device_remove_groups(struct device *dev, +- const struct attribute_group **groups) ++void device_remove_groups(struct device *dev, ++ const struct attribute_group **groups) + { + int i; + +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -66,6 +66,7 @@ extern void bus_remove_file(struct bus_t + * @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. ++ * @dev_groups: Default attributes of the devices on the bus. + * @match: Called, perhaps multiple times, whenever a new device or driver + * is added for this bus. It should return a nonzero value if the + * given device can be handled by the given driver. +@@ -104,8 +105,9 @@ struct bus_type { + const char *dev_name; + struct device *dev_root; + struct bus_attribute *bus_attrs; +- struct device_attribute *dev_attrs; ++ struct device_attribute *dev_attrs; /* use dev_groups instead */ + struct driver_attribute *drv_attrs; ++ const struct attribute_group **dev_groups; + + int (*match)(struct device *dev, struct device_driver *drv); + int (*uevent)(struct device *dev, struct kobj_uevent_env *env); diff --git a/driver-core-bus_type-add-drv_groups.patch b/driver-core-bus_type-add-drv_groups.patch new file mode 100644 index 00000000000000..76cefe15b5f092 --- /dev/null +++ b/driver-core-bus_type-add-drv_groups.patch @@ -0,0 +1,101 @@ +From foo@baz Wed Jul 10 15:53:04 PDT 2013 +Date: Wed, 10 Jul 2013 15:53:04 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: driver core: bus_type: add drv_groups + +attribute groups are much more flexible than just a list of attributes, +due to their support for visibility of the attributes, and binary +attributes. Add drv_groups to struct bus_type which should be used +instead of drv_attrs. + +drv_attrs will be removed from the structure soon. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/base/base.h | 5 +++++ + drivers/base/bus.c | 5 +++++ + drivers/base/driver.c | 8 ++++---- + include/linux/device.h | 4 +++- + 4 files changed, 17 insertions(+), 5 deletions(-) + +--- a/drivers/base/base.h ++++ b/drivers/base/base.h +@@ -119,6 +119,11 @@ static inline int driver_match_device(st + return drv->bus->match ? drv->bus->match(dev, drv) : 1; + } + ++extern int driver_add_groups(struct device_driver *drv, ++ const struct attribute_group **groups); ++extern void driver_remove_groups(struct device_driver *drv, ++ const struct attribute_group **groups); ++ + extern int device_add_groups(struct device *dev, + const struct attribute_group **groups); + extern void device_remove_groups(struct device *dev, +--- a/drivers/base/bus.c ++++ b/drivers/base/bus.c +@@ -725,6 +725,10 @@ int bus_add_driver(struct device_driver + printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n", + __func__, drv->name); + } ++ error = driver_add_groups(drv, bus->drv_groups); ++ if (error) ++ printk(KERN_ERR "%s: driver_create_groups(%s) failed\n", ++ __func__, drv->name); + + if (!drv->suppress_bind_attrs) { + error = add_bind_files(drv); +@@ -762,6 +766,7 @@ void bus_remove_driver(struct device_dri + if (!drv->suppress_bind_attrs) + remove_bind_files(drv); + driver_remove_attrs(drv->bus, drv); ++ driver_remove_groups(drv, drv->bus->drv_groups); + driver_remove_file(drv, &driver_attr_uevent); + klist_remove(&drv->p->knode_bus); + pr_debug("bus: '%s': remove driver %s\n", drv->bus->name, drv->name); +--- a/drivers/base/driver.c ++++ b/drivers/base/driver.c +@@ -123,8 +123,8 @@ void driver_remove_file(struct device_dr + } + EXPORT_SYMBOL_GPL(driver_remove_file); + +-static int driver_add_groups(struct device_driver *drv, +- const struct attribute_group **groups) ++int driver_add_groups(struct device_driver *drv, ++ const struct attribute_group **groups) + { + int error = 0; + int i; +@@ -143,8 +143,8 @@ static int driver_add_groups(struct devi + return error; + } + +-static void driver_remove_groups(struct device_driver *drv, +- const struct attribute_group **groups) ++void driver_remove_groups(struct device_driver *drv, ++ const struct attribute_group **groups) + { + int i; + +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -67,6 +67,7 @@ extern void bus_remove_file(struct bus_t + * @dev_attrs: Default attributes of the devices on the bus. + * @drv_attrs: Default attributes of the device drivers on the bus. + * @dev_groups: Default attributes of the devices on the bus. ++ * @drv_groups: Default attributes of the device drivers on the bus. + * @match: Called, perhaps multiple times, whenever a new device or driver + * is added for this bus. It should return a nonzero value if the + * given device can be handled by the given driver. +@@ -106,8 +107,9 @@ struct bus_type { + struct device *dev_root; + struct bus_attribute *bus_attrs; + struct device_attribute *dev_attrs; /* use dev_groups instead */ +- struct driver_attribute *drv_attrs; ++ struct driver_attribute *drv_attrs; /* use drv_groups instead */ + const struct attribute_group **dev_groups; ++ const struct attribute_group **drv_groups; + + int (*match)(struct device *dev, struct device_driver *drv); + int (*uevent)(struct device *dev, struct kobj_uevent_env *env); diff --git a/driver-core-introduce-device_create_groups.patch b/driver-core-introduce-device_create_groups.patch new file mode 100644 index 00000000000000..e73fe6ef2236d6 --- /dev/null +++ b/driver-core-introduce-device_create_groups.patch @@ -0,0 +1,179 @@ +From groeck7@gmail.com Sat Jul 6 10:25:17 2013 +From: Guenter Roeck <linux@roeck-us.net> +Date: Sat, 6 Jul 2013 10:24:51 -0700 +Subject: driver core: Introduce device_create_groups +To: Jean Delvare <khali@linux-fr.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Cc: lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org, Guenter Roeck <linux@roeck-us.net> + +From: Guenter Roeck <linux@roeck-us.net> + +device_create_groups lets callers create devices as well as associated +sysfs attributes with a single call. This avoids race conditions seen +if sysfs attributes on new devices are created later. + +[fixed up comment block placement and add checks for printk buffer +formats - gregkh] + +Signed-off-by: Guenter Roeck <linux@roeck-us.net> +Cc: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/base/core.c | 111 ++++++++++++++++++++++++++++++++++++------------- + include/linux/device.h | 5 ++ + 2 files changed, 88 insertions(+), 28 deletions(-) + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -1667,34 +1667,11 @@ static void device_create_release(struct + kfree(dev); + } + +-/** +- * device_create_vargs - creates a device and registers it with sysfs +- * @class: pointer to the struct class that this device should be registered to +- * @parent: pointer to the parent struct device of this new device, if any +- * @devt: the dev_t for the char device to be added +- * @drvdata: the data to be added to the device for callbacks +- * @fmt: string for the device's name +- * @args: va_list for the device's name +- * +- * This function can be used by char device classes. A struct device +- * will be created in sysfs, registered to the specified class. +- * +- * A "dev" file will be created, showing the dev_t for the device, if +- * the dev_t is not 0,0. +- * If a pointer to a parent struct device is passed in, the newly created +- * struct device will be a child of that device in sysfs. +- * The pointer to the struct device will be returned from the call. +- * Any further sysfs files that might be required can be created using this +- * pointer. +- * +- * Returns &struct device pointer on success, or ERR_PTR() on error. +- * +- * Note: the struct class passed to this function must have previously +- * been created with a call to class_create(). +- */ +-struct device *device_create_vargs(struct class *class, struct device *parent, +- dev_t devt, void *drvdata, const char *fmt, +- va_list args) ++static struct device * ++device_create_groups_vargs(struct class *class, struct device *parent, ++ dev_t devt, void *drvdata, ++ const struct attribute_group **groups, ++ const char *fmt, va_list args) + { + struct device *dev = NULL; + int retval = -ENODEV; +@@ -1711,6 +1688,7 @@ struct device *device_create_vargs(struc + dev->devt = devt; + dev->class = class; + dev->parent = parent; ++ dev->groups = groups; + dev->release = device_create_release; + dev_set_drvdata(dev, drvdata); + +@@ -1728,6 +1706,39 @@ error: + put_device(dev); + return ERR_PTR(retval); + } ++ ++/** ++ * device_create_vargs - creates a device and registers it with sysfs ++ * @class: pointer to the struct class that this device should be registered to ++ * @parent: pointer to the parent struct device of this new device, if any ++ * @devt: the dev_t for the char device to be added ++ * @drvdata: the data to be added to the device for callbacks ++ * @fmt: string for the device's name ++ * @args: va_list for the device's name ++ * ++ * This function can be used by char device classes. A struct device ++ * will be created in sysfs, registered to the specified class. ++ * ++ * A "dev" file will be created, showing the dev_t for the device, if ++ * the dev_t is not 0,0. ++ * If a pointer to a parent struct device is passed in, the newly created ++ * struct device will be a child of that device in sysfs. ++ * The pointer to the struct device will be returned from the call. ++ * Any further sysfs files that might be required can be created using this ++ * pointer. ++ * ++ * Returns &struct device pointer on success, or ERR_PTR() on error. ++ * ++ * Note: the struct class passed to this function must have previously ++ * been created with a call to class_create(). ++ */ ++struct device *device_create_vargs(struct class *class, struct device *parent, ++ dev_t devt, void *drvdata, const char *fmt, ++ va_list args) ++{ ++ return device_create_groups_vargs(class, parent, devt, drvdata, NULL, ++ fmt, args); ++} + EXPORT_SYMBOL_GPL(device_create_vargs); + + /** +@@ -1767,6 +1778,50 @@ struct device *device_create(struct clas + } + EXPORT_SYMBOL_GPL(device_create); + ++/** ++ * device_create_with_groups - creates a device and registers it with sysfs ++ * @class: pointer to the struct class that this device should be registered to ++ * @parent: pointer to the parent struct device of this new device, if any ++ * @devt: the dev_t for the char device to be added ++ * @drvdata: the data to be added to the device for callbacks ++ * @groups: NULL-terminated list of attribute groups to be created ++ * @fmt: string for the device's name ++ * ++ * This function can be used by char device classes. A struct device ++ * will be created in sysfs, registered to the specified class. ++ * Additional attributes specified in the groups parameter will also ++ * be created automatically. ++ * ++ * A "dev" file will be created, showing the dev_t for the device, if ++ * the dev_t is not 0,0. ++ * If a pointer to a parent struct device is passed in, the newly created ++ * struct device will be a child of that device in sysfs. ++ * The pointer to the struct device will be returned from the call. ++ * Any further sysfs files that might be required can be created using this ++ * pointer. ++ * ++ * Returns &struct device pointer on success, or ERR_PTR() on error. ++ * ++ * Note: the struct class passed to this function must have previously ++ * been created with a call to class_create(). ++ */ ++struct device *device_create_with_groups(struct class *class, ++ struct device *parent, dev_t devt, ++ void *drvdata, ++ const struct attribute_group **groups, ++ const char *fmt, ...) ++{ ++ va_list vargs; ++ struct device *dev; ++ ++ va_start(vargs, fmt); ++ dev = device_create_groups_vargs(class, parent, devt, drvdata, groups, ++ fmt, vargs); ++ va_end(vargs); ++ return dev; ++} ++EXPORT_SYMBOL_GPL(device_create_with_groups); ++ + static int __match_devt(struct device *dev, const void *data) + { + const dev_t *devt = data; +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -938,6 +938,11 @@ extern __printf(5, 6) + struct device *device_create(struct class *cls, struct device *parent, + dev_t devt, void *drvdata, + const char *fmt, ...); ++extern __printf(6, 7) ++struct device *device_create_with_groups(struct class *cls, ++ struct device *parent, dev_t devt, void *drvdata, ++ const struct attribute_group **groups, ++ const char *fmt, ...); + extern void device_destroy(struct class *cls, dev_t devt); + + /* diff --git a/driver-core-remove-dev_attrs-from-struct-class.patch b/driver-core-remove-dev_attrs-from-struct-class.patch new file mode 100644 index 00000000000000..bea741a07f5754 --- /dev/null +++ b/driver-core-remove-dev_attrs-from-struct-class.patch @@ -0,0 +1,103 @@ +From foo@baz Tue Jul 9 12:07:03 PDT 2013 +Date: Tue, 09 Jul 2013 12:07:03 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: driver core: remove dev_attrs from struct class + +Now that all in-kernel users of the dev_attrs field are converted to use +dev_groups, we can safely remove dev_attrs from struct class. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/base/core.c | 38 +------------------------------------- + include/linux/device.h | 2 -- + 2 files changed, 1 insertion(+), 39 deletions(-) + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -433,35 +433,6 @@ static ssize_t store_online(struct devic + static struct device_attribute online_attr = + __ATTR(online, S_IRUGO | S_IWUSR, show_online, store_online); + +-static int device_add_attributes(struct device *dev, +- struct device_attribute *attrs) +-{ +- int error = 0; +- int i; +- +- if (attrs) { +- for (i = 0; attr_name(attrs[i]); i++) { +- error = device_create_file(dev, &attrs[i]); +- if (error) +- break; +- } +- if (error) +- while (--i >= 0) +- device_remove_file(dev, &attrs[i]); +- } +- return error; +-} +- +-static void device_remove_attributes(struct device *dev, +- struct device_attribute *attrs) +-{ +- int i; +- +- if (attrs) +- for (i = 0; attr_name(attrs[i]); i++) +- device_remove_file(dev, &attrs[i]); +-} +- + static int device_add_bin_attributes(struct device *dev, + struct bin_attribute *attrs) + { +@@ -531,12 +502,9 @@ static int device_add_attrs(struct devic + error = device_add_groups(dev, class->dev_groups); + if (error) + return error; +- error = device_add_attributes(dev, class->dev_attrs); +- if (error) +- goto err_remove_class_groups; + error = device_add_bin_attributes(dev, class->dev_bin_attrs); + if (error) +- goto err_remove_class_attrs; ++ goto err_remove_class_groups; + } + + if (type) { +@@ -563,9 +531,6 @@ static int device_add_attrs(struct devic + err_remove_class_bin_attrs: + if (class) + device_remove_bin_attributes(dev, class->dev_bin_attrs); +- err_remove_class_attrs: +- if (class) +- device_remove_attributes(dev, class->dev_attrs); + err_remove_class_groups: + if (class) + device_remove_groups(dev, class->dev_groups); +@@ -585,7 +550,6 @@ static void device_remove_attrs(struct d + device_remove_groups(dev, type->groups); + + if (class) { +- device_remove_attributes(dev, class->dev_attrs); + device_remove_bin_attributes(dev, class->dev_bin_attrs); + device_remove_groups(dev, class->dev_groups); + } +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -321,7 +321,6 @@ int subsys_virtual_register(struct bus_t + * @owner: The module owner. + * @class_attrs: Default attributes of this class. + * @dev_groups: Default attributes of the devices that belong to the class. +- * @dev_attrs: Default attributes of the devices belong to the class. + * @dev_bin_attrs: Default binary attributes of the devices belong to the class. + * @dev_kobj: The kobject that represents this class and links it into the hierarchy. + * @dev_uevent: Called when a device is added, removed from this class, or a +@@ -350,7 +349,6 @@ struct class { + struct module *owner; + + struct class_attribute *class_attrs; +- struct device_attribute *dev_attrs; /* use dev_groups instead */ + const struct attribute_group **dev_groups; + struct bin_attribute *dev_bin_attrs; + struct kobject *dev_kobj; diff --git a/driver-core-remove-dev_bin_attrs-from-struct-class.patch b/driver-core-remove-dev_bin_attrs-from-struct-class.patch new file mode 100644 index 00000000000000..e1b863ee2fe98c --- /dev/null +++ b/driver-core-remove-dev_bin_attrs-from-struct-class.patch @@ -0,0 +1,112 @@ +From foo@baz Wed Jul 10 12:18:18 PDT 2013 +Date: Wed, 10 Jul 2013 12:18:18 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: driver core: remove dev_bin_attrs from struct class + +No in-kernel code is now using this, they have all be converted over to +using the bin_attrs support in attribute groups, so this field, and the +code in the driver core that was creating/remove the binary files can be +removed. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/base/core.c | 41 ++--------------------------------------- + include/linux/device.h | 2 -- + 2 files changed, 2 insertions(+), 41 deletions(-) + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -433,35 +433,6 @@ static ssize_t store_online(struct devic + static struct device_attribute online_attr = + __ATTR(online, S_IRUGO | S_IWUSR, show_online, store_online); + +-static int device_add_bin_attributes(struct device *dev, +- struct bin_attribute *attrs) +-{ +- int error = 0; +- int i; +- +- if (attrs) { +- for (i = 0; attr_name(attrs[i]); i++) { +- error = device_create_bin_file(dev, &attrs[i]); +- if (error) +- break; +- } +- if (error) +- while (--i >= 0) +- device_remove_bin_file(dev, &attrs[i]); +- } +- return error; +-} +- +-static void device_remove_bin_attributes(struct device *dev, +- struct bin_attribute *attrs) +-{ +- int i; +- +- if (attrs) +- for (i = 0; attr_name(attrs[i]); i++) +- device_remove_bin_file(dev, &attrs[i]); +-} +- + static int device_add_groups(struct device *dev, + const struct attribute_group **groups) + { +@@ -502,15 +473,12 @@ static int device_add_attrs(struct devic + error = device_add_groups(dev, class->dev_groups); + if (error) + return error; +- error = device_add_bin_attributes(dev, class->dev_bin_attrs); +- if (error) +- goto err_remove_class_groups; + } + + if (type) { + error = device_add_groups(dev, type->groups); + if (error) +- goto err_remove_class_bin_attrs; ++ goto err_remove_class_groups; + } + + error = device_add_groups(dev, dev->groups); +@@ -528,9 +496,6 @@ static int device_add_attrs(struct devic + err_remove_type_groups: + if (type) + device_remove_groups(dev, type->groups); +- err_remove_class_bin_attrs: +- if (class) +- device_remove_bin_attributes(dev, class->dev_bin_attrs); + err_remove_class_groups: + if (class) + device_remove_groups(dev, class->dev_groups); +@@ -549,10 +514,8 @@ static void device_remove_attrs(struct d + if (type) + device_remove_groups(dev, type->groups); + +- if (class) { +- device_remove_bin_attributes(dev, class->dev_bin_attrs); ++ if (class) + device_remove_groups(dev, class->dev_groups); +- } + } + + +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -321,7 +321,6 @@ int subsys_virtual_register(struct bus_t + * @owner: The module owner. + * @class_attrs: Default attributes of this class. + * @dev_groups: Default attributes of the devices that belong to the class. +- * @dev_bin_attrs: Default binary attributes of the devices belong to the class. + * @dev_kobj: The kobject that represents this class and links it into the hierarchy. + * @dev_uevent: Called when a device is added, removed from this class, or a + * few other things that generate uevents to add the environment +@@ -350,7 +349,6 @@ struct class { + + struct class_attribute *class_attrs; + const struct attribute_group **dev_groups; +- struct bin_attribute *dev_bin_attrs; + struct kobject *dev_kobj; + + int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); diff --git a/enclosure-convert-class-code-to-use-dev_groups.patch b/enclosure-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..ac3d0fd0d1e22f --- /dev/null +++ b/enclosure-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,88 @@ +From foo@baz Tue Jul 9 15:11:14 PDT 2013 +Date: Tue, 09 Jul 2013 15:11:14 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: enclosure: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the enclosure class code to use +the correct field. + +Cc: Arnd Bergmann <arnd@arndb.de> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/misc/enclosure.c | 29 +++++++++++------------------ + 1 file changed, 11 insertions(+), 18 deletions(-) + +--- a/drivers/misc/enclosure.c ++++ b/drivers/misc/enclosure.c +@@ -239,7 +239,7 @@ static void enclosure_component_release( + put_device(dev->parent); + } + +-static const struct attribute_group *enclosure_groups[]; ++static const struct attribute_group *enclosure_component_groups[]; + + /** + * enclosure_component_register - add a particular component to an enclosure +@@ -282,7 +282,7 @@ enclosure_component_register(struct encl + dev_set_name(cdev, "%u", number); + + cdev->release = enclosure_component_release; +- cdev->groups = enclosure_groups; ++ cdev->groups = enclosure_component_groups; + + err = device_register(cdev); + if (err) { +@@ -365,25 +365,26 @@ EXPORT_SYMBOL_GPL(enclosure_remove_devic + * sysfs pieces below + */ + +-static ssize_t enclosure_show_components(struct device *cdev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t components_show(struct device *cdev, ++ struct device_attribute *attr, char *buf) + { + struct enclosure_device *edev = to_enclosure_device(cdev); + + return snprintf(buf, 40, "%d\n", edev->components); + } ++static DEVICE_ATTR_RO(components); + +-static struct device_attribute enclosure_attrs[] = { +- __ATTR(components, S_IRUGO, enclosure_show_components, NULL), +- __ATTR_NULL ++static struct attribute *enclosure_class_attrs[] = { ++ &dev_attr_components.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(enclosure_class); + + static struct class enclosure_class = { + .name = "enclosure", + .owner = THIS_MODULE, + .dev_release = enclosure_release, +- .dev_attrs = enclosure_attrs, ++ .dev_groups = enclosure_class_groups, + }; + + static const char *const enclosure_status [] = { +@@ -536,15 +537,7 @@ static struct attribute *enclosure_compo + &dev_attr_type.attr, + NULL + }; +- +-static struct attribute_group enclosure_group = { +- .attrs = enclosure_component_attrs, +-}; +- +-static const struct attribute_group *enclosure_groups[] = { +- &enclosure_group, +- NULL +-}; ++ATTRIBUTE_GROUPS(enclosure_component); + + static int __init enclosure_init(void) + { diff --git a/extcon-convert-extcon_class-to-use-dev_groups.patch b/extcon-convert-extcon_class-to-use-dev_groups.patch new file mode 100644 index 00000000000000..8f4ac940be9cca --- /dev/null +++ b/extcon-convert-extcon_class-to-use-dev_groups.patch @@ -0,0 +1,62 @@ +From foo@baz Tue Jul 9 14:53:12 PDT 2013 +Date: Tue, 09 Jul 2013 14:53:12 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: extcon: convert extcon_class to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the extcon_class code to use the +correct field. + +Cc: MyungJoo Ham <myungjoo.ham@samsung.com> +Cc: Chanwoo Choi <cw00.choi@samsung.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/extcon/extcon-class.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +--- a/drivers/extcon/extcon-class.c ++++ b/drivers/extcon/extcon-class.c +@@ -148,6 +148,7 @@ static ssize_t state_store(struct device + + return count; + } ++static DEVICE_ATTR_RW(state); + + static ssize_t name_show(struct device *dev, struct device_attribute *attr, + char *buf) +@@ -163,6 +164,7 @@ static ssize_t name_show(struct device * + + return sprintf(buf, "%s\n", dev_name(edev->dev)); + } ++static DEVICE_ATTR_RO(name); + + static ssize_t cable_name_show(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -527,11 +529,12 @@ int extcon_unregister_notifier(struct ex + } + EXPORT_SYMBOL_GPL(extcon_unregister_notifier); + +-static struct device_attribute extcon_attrs[] = { +- __ATTR(state, S_IRUGO | S_IWUSR, state_show, state_store), +- __ATTR_RO(name), +- __ATTR_NULL, ++static struct attribute *extcon_attrs[] = { ++ &dev_attr_state.attr, ++ &dev_attr_name.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(extcon); + + static int create_extcon_class(void) + { +@@ -539,7 +542,7 @@ static int create_extcon_class(void) + extcon_class = class_create(THIS_MODULE, "extcon"); + if (IS_ERR(extcon_class)) + return PTR_ERR(extcon_class); +- extcon_class->dev_attrs = extcon_attrs; ++ extcon_class->dev_groups = extcon_groups; + + #if defined(CONFIG_ANDROID) + switch_class = class_compat_register("switch"); diff --git a/f1.patch b/f1.patch new file mode 100644 index 00000000000000..a876248b348178 --- /dev/null +++ b/f1.patch @@ -0,0 +1,95 @@ +--- + drivers/base/bus.c | 42 ------------------------------------------ + include/linux/device.h | 2 -- + 2 files changed, 44 deletions(-) + +--- a/drivers/base/bus.c ++++ b/drivers/base/bus.c +@@ -845,42 +845,6 @@ struct bus_type *find_bus(char *name) + } + #endif /* 0 */ + +- +-/** +- * bus_add_attrs - Add default attributes for this bus. +- * @bus: Bus that has just been registered. +- */ +- +-static int bus_add_attrs(struct bus_type *bus) +-{ +- int error = 0; +- int i; +- +- if (bus->bus_attrs) { +- for (i = 0; attr_name(bus->bus_attrs[i]); i++) { +- error = bus_create_file(bus, &bus->bus_attrs[i]); +- if (error) +- goto err; +- } +- } +-done: +- return error; +-err: +- while (--i >= 0) +- bus_remove_file(bus, &bus->bus_attrs[i]); +- goto done; +-} +- +-static void bus_remove_attrs(struct bus_type *bus) +-{ +- int i; +- +- if (bus->bus_attrs) { +- for (i = 0; attr_name(bus->bus_attrs[i]); i++) +- bus_remove_file(bus, &bus->bus_attrs[i]); +- } +-} +- + static int bus_add_groups(struct bus_type *bus, + const struct attribute_group **groups) + { +@@ -1001,9 +965,6 @@ int bus_register(struct bus_type *bus) + if (retval) + goto bus_probe_files_fail; + +- retval = bus_add_attrs(bus); +- if (retval) +- goto bus_attrs_fail; + retval = bus_add_groups(bus, bus->bus_groups); + if (retval) + goto bus_groups_fail; +@@ -1012,8 +973,6 @@ int bus_register(struct bus_type *bus) + return 0; + + bus_groups_fail: +- bus_remove_attrs(bus); +-bus_attrs_fail: + remove_probe_files(bus); + bus_probe_files_fail: + kset_unregister(bus->p->drivers_kset); +@@ -1042,7 +1001,6 @@ 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); + bus_remove_groups(bus, bus->bus_groups); + remove_probe_files(bus); + kset_unregister(bus->p->drivers_kset); +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -63,7 +63,6 @@ extern void bus_remove_file(struct bus_t + * @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. + * @bus_groups: Default attributes of the bus. +@@ -106,7 +105,6 @@ struct bus_type { + const char *name; + const char *dev_name; + struct device *dev_root; +- struct bus_attribute *bus_attrs; /* use bus_groups instead */ + struct device_attribute *dev_attrs; /* use dev_groups instead */ + struct driver_attribute *drv_attrs; /* use drv_groups instead */ + const struct attribute_group **bus_groups; diff --git a/f2.patch b/f2.patch new file mode 100644 index 00000000000000..1df7c8d67ff1a0 --- /dev/null +++ b/f2.patch @@ -0,0 +1,199 @@ +--- + arch/powerpc/kernel/ibmebus.c | 12 +++++++----- + drivers/block/rbd.c | 14 +++++++++----- + drivers/pci/pci-driver.c | 2 +- + drivers/pci/pci-sysfs.c | 16 +++++++++++++--- + drivers/pci/pci.h | 2 +- + drivers/rapidio/rio-driver.c | 2 +- + drivers/rapidio/rio-sysfs.c | 16 +++++++++++++--- + drivers/rapidio/rio.h | 2 +- + drivers/scsi/fcoe/fcoe_sysfs.c | 14 +++++++++----- + 9 files changed, 55 insertions(+), 25 deletions(-) + +--- a/arch/powerpc/kernel/ibmebus.c ++++ b/arch/powerpc/kernel/ibmebus.c +@@ -292,6 +292,7 @@ out: + return rc; + return count; + } ++static BUS_ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove); + + static ssize_t ibmebus_store_remove(struct bus_type *bus, + const char *buf, size_t count) +@@ -317,13 +318,14 @@ static ssize_t ibmebus_store_remove(stru + return -ENODEV; + } + } +- ++static BUS_ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove); + + static struct bus_attribute ibmebus_bus_attrs[] = { +- __ATTR(probe, S_IWUSR, NULL, ibmebus_store_probe), +- __ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove), +- __ATTR_NULL ++ &bus_attr_probe.attr, ++ &bus_attr_probe.remove, ++ NULL, + }; ++ATTRIBUTE_GROUPS(ibmbus_bus); + + static int ibmebus_bus_bus_match(struct device *dev, struct device_driver *drv) + { +@@ -713,7 +715,7 @@ static struct dev_pm_ops ibmebus_bus_dev + struct bus_type ibmebus_bus_type = { + .name = "ibmebus", + .uevent = of_device_uevent_modalias, +- .bus_attrs = ibmebus_bus_attrs, ++ .bus_groups = ibmbus_bus_groups, + .match = ibmebus_bus_bus_match, + .probe = ibmebus_bus_device_probe, + .remove = ibmebus_bus_device_remove, +--- a/drivers/block/rbd.c ++++ b/drivers/block/rbd.c +@@ -397,15 +397,19 @@ static ssize_t rbd_remove(struct bus_typ + static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping); + static void rbd_spec_put(struct rbd_spec *spec); + +-static struct bus_attribute rbd_bus_attrs[] = { +- __ATTR(add, S_IWUSR, NULL, rbd_add), +- __ATTR(remove, S_IWUSR, NULL, rbd_remove), +- __ATTR_NULL ++static BUS_ATTR(add, S_IWUSR, NULL, rbd_add); ++static BUS_ATTR(remove, S_IWUSR, NULL, rbd_remove); ++ ++static struct attribute *rbd_bus_attrs[] = { ++ &bus_attr_add.attr, ++ &bus_attr_remove.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(rbd_bus); + + static struct bus_type rbd_bus_type = { + .name = "rbd", +- .bus_attrs = rbd_bus_attrs, ++ .bus_groups = rbd_bus_groups, + }; + + static void rbd_root_dev_release(struct device *dev) +--- a/drivers/pci/pci-driver.c ++++ b/drivers/pci/pci-driver.c +@@ -1274,7 +1274,7 @@ struct bus_type pci_bus_type = { + .remove = pci_device_remove, + .shutdown = pci_device_shutdown, + .dev_attrs = pci_dev_attrs, +- .bus_attrs = pci_bus_attrs, ++ .bus_groups = pci_bus_groups, + .drv_attrs = pci_drv_attrs, + .pm = PCI_PM_OPS_PTR, + }; +--- a/drivers/pci/pci-sysfs.c ++++ b/drivers/pci/pci-sysfs.c +@@ -302,10 +302,20 @@ static ssize_t bus_rescan_store(struct b + } + return count; + } ++static BUS_ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, bus_rescan_store); + +-struct bus_attribute pci_bus_attrs[] = { +- __ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, bus_rescan_store), +- __ATTR_NULL ++struct attribute *pci_bus_attrs[] = { ++ &bus_attr_rescan.attr, ++ NULL, ++}; ++ ++static const struct attribute_group pci_bus_group = { ++ .attrs = pci_bus_attrs, ++}; ++ ++const struct attribute_group *pci_bus_groups[] = { ++ &pci_bus_group, ++ NULL, + }; + + static ssize_t +--- a/drivers/pci/pci.h ++++ b/drivers/pci/pci.h +@@ -153,7 +153,7 @@ static inline int pci_no_d1d2(struct pci + extern struct device_attribute pci_dev_attrs[]; + extern const struct attribute_group *pcibus_groups[]; + extern struct device_type pci_dev_type; +-extern struct bus_attribute pci_bus_attrs[]; ++extern const struct attribute_group *pci_bus_groups[]; + + + /** +--- a/drivers/rapidio/rio-driver.c ++++ b/drivers/rapidio/rio-driver.c +@@ -224,7 +224,7 @@ struct bus_type rio_bus_type = { + .name = "rapidio", + .match = rio_match_bus, + .dev_attrs = rio_dev_attrs, +- .bus_attrs = rio_bus_attrs, ++ .bus_groups = rio_bus_groups, + .probe = rio_device_probe, + .remove = rio_device_remove, + .uevent = rio_uevent, +--- a/drivers/rapidio/rio-sysfs.c ++++ b/drivers/rapidio/rio-sysfs.c +@@ -316,8 +316,18 @@ exit: + + return rc; + } ++static BUS_ATTR(scan, (S_IWUSR|S_IWGRP), NULL, bus_scan_store); + +-struct bus_attribute rio_bus_attrs[] = { +- __ATTR(scan, (S_IWUSR|S_IWGRP), NULL, bus_scan_store), +- __ATTR_NULL ++static struct bus_attribute rio_bus_attrs[] = { ++ &bus_attr_scan.attr, ++ NULL, ++}; ++ ++static const struct attribute_group rio_bus_group = { ++ .attrs = rio_bus_attrs, ++}; ++ ++const struct attribute_group *rio_bus_groups[] = { ++ &rio_bus_group, ++ NULL, + }; +--- a/drivers/rapidio/rio.h ++++ b/drivers/rapidio/rio.h +@@ -49,7 +49,7 @@ extern int rio_mport_scan(int mport_id); + + /* Structures internal to the RIO core code */ + extern struct device_attribute rio_dev_attrs[]; +-extern struct bus_attribute rio_bus_attrs[]; ++extern const struct attribute_group *rio_bus_groups[]; + + #define RIO_GET_DID(size, x) (size ? (x & 0xffff) : ((x & 0x00ff0000) >> 16)) + #define RIO_SET_DID(size, x) (size ? (x & 0xffff) : ((x & 0x000000ff) << 16)) +--- a/drivers/scsi/fcoe/fcoe_sysfs.c ++++ b/drivers/scsi/fcoe/fcoe_sysfs.c +@@ -553,16 +553,20 @@ struct device_type fcoe_fcf_device_type + .release = fcoe_fcf_device_release, + }; + +-struct bus_attribute fcoe_bus_attr_group[] = { +- __ATTR(ctlr_create, S_IWUSR, NULL, fcoe_ctlr_create_store), +- __ATTR(ctlr_destroy, S_IWUSR, NULL, fcoe_ctlr_destroy_store), +- __ATTR_NULL ++static BUS_ATTR(ctlr_create, S_IWUSR, NULL, fcoe_ctlr_create_store); ++static BUS_ATTR(ctlr_destroy, S_IWUSR, NULL, fcoe_ctlr_destroy_store); ++ ++static struct attribute *fcoe_bus_attrs[] = { ++ &bus_attr_ctlr_create.attr, ++ &bus_attr_ctrl_destroy.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(fcoe_bus); + + struct bus_type fcoe_bus_type = { + .name = "fcoe", + .match = &fcoe_bus_match, +- .bus_attrs = fcoe_bus_attr_group, ++ .bus_groups = fcoe_bus_groups, + }; + + /** diff --git a/f3.patch b/f3.patch new file mode 100644 index 00000000000000..8ab1eb3fdaac37 --- /dev/null +++ b/f3.patch @@ -0,0 +1,266 @@ +--- + drivers/base/bus.c | 40 +------------------------------------- + drivers/input/gameport/gameport.c | 12 ++++++----- + drivers/input/serio/serio.c | 21 ++++++++++--------- + drivers/pci/pci-driver.c | 13 +++++++----- + drivers/usb/serial/bus.c | 14 +++++++------ + include/linux/device.h | 2 - + 6 files changed, 36 insertions(+), 66 deletions(-) + +--- a/drivers/base/bus.c ++++ b/drivers/base/bus.c +@@ -590,37 +590,6 @@ void bus_remove_device(struct device *de + bus_put(dev->bus); + } + +-static int driver_add_attrs(struct bus_type *bus, struct device_driver *drv) +-{ +- int error = 0; +- int i; +- +- if (bus->drv_attrs) { +- for (i = 0; attr_name(bus->drv_attrs[i]); i++) { +- error = driver_create_file(drv, &bus->drv_attrs[i]); +- if (error) +- goto err; +- } +- } +-done: +- return error; +-err: +- while (--i >= 0) +- driver_remove_file(drv, &bus->drv_attrs[i]); +- goto done; +-} +- +-static void driver_remove_attrs(struct bus_type *bus, +- struct device_driver *drv) +-{ +- int i; +- +- if (bus->drv_attrs) { +- for (i = 0; attr_name(bus->drv_attrs[i]); i++) +- driver_remove_file(drv, &bus->drv_attrs[i]); +- } +-} +- + static int __must_check add_bind_files(struct device_driver *drv) + { + int ret; +@@ -719,16 +688,12 @@ int bus_add_driver(struct device_driver + printk(KERN_ERR "%s: uevent attr (%s) failed\n", + __func__, drv->name); + } +- error = driver_add_attrs(bus, drv); ++ error = driver_add_groups(drv, bus->drv_groups); + if (error) { + /* How the hell do we get out of this pickle? Give up */ +- printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n", +- __func__, drv->name); +- } +- error = driver_add_groups(drv, bus->drv_groups); +- if (error) + printk(KERN_ERR "%s: driver_create_groups(%s) failed\n", + __func__, drv->name); ++ } + + if (!drv->suppress_bind_attrs) { + error = add_bind_files(drv); +@@ -765,7 +730,6 @@ void bus_remove_driver(struct device_dri + + if (!drv->suppress_bind_attrs) + remove_bind_files(drv); +- driver_remove_attrs(drv->bus, drv); + driver_remove_groups(drv, drv->bus->drv_groups); + driver_remove_file(drv, &driver_attr_uevent); + klist_remove(&drv->p->knode_bus); +--- a/drivers/input/gameport/gameport.c ++++ b/drivers/input/gameport/gameport.c +@@ -639,16 +639,18 @@ EXPORT_SYMBOL(gameport_unregister_port); + * Gameport driver operations + */ + +-static ssize_t gameport_driver_show_description(struct device_driver *drv, char *buf) ++static ssize_t description_show(struct device_driver *drv, char *buf) + { + struct gameport_driver *driver = to_gameport_driver(drv); + return sprintf(buf, "%s\n", driver->description ? driver->description : "(none)"); + } ++static DRIVER_ATTR_RO(description); + +-static struct driver_attribute gameport_driver_attrs[] = { +- __ATTR(description, S_IRUGO, gameport_driver_show_description, NULL), +- __ATTR_NULL ++static struct attribute *gameport_driver_attrs[] = { ++ &driver_attr_description.attr, ++ NULL + }; ++ATTRIBUTE_GROUPS(gameport_driver); + + static int gameport_driver_probe(struct device *dev) + { +@@ -749,7 +751,7 @@ static int gameport_bus_match(struct dev + static struct bus_type gameport_bus = { + .name = "gameport", + .dev_attrs = gameport_device_attrs, +- .drv_attrs = gameport_driver_attrs, ++ .drv_groups = gameport_driver_groups, + .match = gameport_bus_match, + .probe = gameport_driver_probe, + .remove = gameport_driver_remove, +--- a/drivers/input/serio/serio.c ++++ b/drivers/input/serio/serio.c +@@ -732,19 +732,20 @@ EXPORT_SYMBOL(serio_unregister_child_por + * Serio driver operations + */ + +-static ssize_t serio_driver_show_description(struct device_driver *drv, char *buf) ++static ssize_t description_show(struct device_driver *drv, char *buf) + { + struct serio_driver *driver = to_serio_driver(drv); + return sprintf(buf, "%s\n", driver->description ? driver->description : "(none)"); + } ++static DRIVER_ATTR_RO(description); + +-static ssize_t serio_driver_show_bind_mode(struct device_driver *drv, char *buf) ++static ssize_t bind_mode_show(struct device_driver *drv, char *buf) + { + struct serio_driver *serio_drv = to_serio_driver(drv); + return sprintf(buf, "%s\n", serio_drv->manual_bind ? "manual" : "auto"); + } + +-static ssize_t serio_driver_set_bind_mode(struct device_driver *drv, const char *buf, size_t count) ++static ssize_t bind_mode_store(struct device_driver *drv, const char *buf, size_t count) + { + struct serio_driver *serio_drv = to_serio_driver(drv); + int retval; +@@ -760,14 +761,14 @@ static ssize_t serio_driver_set_bind_mod + + return retval; + } ++static DRIVER_ATTR_RW(bind_mode); + +- +-static struct driver_attribute serio_driver_attrs[] = { +- __ATTR(description, S_IRUGO, serio_driver_show_description, NULL), +- __ATTR(bind_mode, S_IWUSR | S_IRUGO, +- serio_driver_show_bind_mode, serio_driver_set_bind_mode), +- __ATTR_NULL ++static struct attribute *serio_driver_attrs[] = { ++ &driver_attr_description.attr, ++ &driver_attr_bind_mode.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(serio_driver); + + static int serio_driver_probe(struct device *dev) + { +@@ -996,7 +997,7 @@ EXPORT_SYMBOL(serio_interrupt); + static struct bus_type serio_bus = { + .name = "serio", + .dev_attrs = serio_device_attrs, +- .drv_attrs = serio_driver_attrs, ++ .drv_groups = serio_driver_groups, + .match = serio_bus_match, + .uevent = serio_uevent, + .probe = serio_driver_probe, +--- a/drivers/pci/pci-driver.c ++++ b/drivers/pci/pci-driver.c +@@ -135,6 +135,7 @@ store_new_id(struct device_driver *drive + return retval; + return count; + } ++static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id); + + /** + * store_remove_id - remove a PCI device ID from this driver +@@ -180,12 +181,14 @@ store_remove_id(struct device_driver *dr + return retval; + return count; + } ++static DRIVER_ATTR(remove_id, S_IWUSR, NULL, store_remove_id); + +-static struct driver_attribute pci_drv_attrs[] = { +- __ATTR(new_id, S_IWUSR, NULL, store_new_id), +- __ATTR(remove_id, S_IWUSR, NULL, store_remove_id), +- __ATTR_NULL, ++static struct attribute *pci_drv_attrs[] = { ++ &driver_attr_new_id.attr, ++ &driver_attr_remove_id.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(pci_drv); + + /** + * pci_match_id - See if a pci device matches a given pci_id table +@@ -1275,7 +1278,7 @@ struct bus_type pci_bus_type = { + .shutdown = pci_device_shutdown, + .dev_attrs = pci_dev_attrs, + .bus_groups = pci_bus_groups, +- .drv_attrs = pci_drv_attrs, ++ .drv_groups = pci_drv_groups, + .pm = PCI_PM_OPS_PTR, + }; + +--- a/drivers/usb/serial/bus.c ++++ b/drivers/usb/serial/bus.c +@@ -122,7 +122,7 @@ static int usb_serial_device_remove(stru + return retval; + } + +-static ssize_t store_new_id(struct device_driver *driver, ++static ssize_t new_id_store(struct device_driver *driver, + const char *buf, size_t count) + { + struct usb_serial_driver *usb_drv = to_usb_serial_driver(driver); +@@ -135,17 +135,19 @@ static ssize_t store_new_id(struct devic + return retval; + } + +-static ssize_t show_dynids(struct device_driver *driver, char *buf) ++static ssize_t new_id_show(struct device_driver *driver, char *buf) + { + struct usb_serial_driver *usb_drv = to_usb_serial_driver(driver); + + return usb_show_dynids(&usb_drv->dynids, buf); + } ++static DRIVER_ATTR_RW(new_id); + +-static struct driver_attribute drv_attrs[] = { +- __ATTR(new_id, S_IRUGO | S_IWUSR, show_dynids, store_new_id), +- __ATTR_NULL, ++static struct attribute *usb_serial_drv_attrs[] = { ++ &driver_attr_new_id.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(usb_serial_drv); + + static void free_dynids(struct usb_serial_driver *drv) + { +@@ -164,7 +166,7 @@ struct bus_type usb_serial_bus_type = { + .match = usb_serial_device_match, + .probe = usb_serial_device_probe, + .remove = usb_serial_device_remove, +- .drv_attrs = drv_attrs, ++ .drv_groups = usb_serial_drv_groups, + }; + + int usb_serial_bus_register(struct usb_serial_driver *driver) +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -64,7 +64,6 @@ extern void bus_remove_file(struct bus_t + * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id). + * @dev_root: Default device to use as the parent. + * @dev_attrs: Default attributes of the devices on the bus. +- * @drv_attrs: Default attributes of the device drivers on the bus. + * @bus_groups: Default attributes of the bus. + * @dev_groups: Default attributes of the devices on the bus. + * @drv_groups: Default attributes of the device drivers on the bus. +@@ -106,7 +105,6 @@ struct bus_type { + const char *dev_name; + struct device *dev_root; + struct device_attribute *dev_attrs; /* use dev_groups instead */ +- struct driver_attribute *drv_attrs; /* use drv_groups instead */ + const struct attribute_group **bus_groups; + const struct attribute_group **dev_groups; + const struct attribute_group **drv_groups; diff --git a/f4.patch b/f4.patch new file mode 100644 index 00000000000000..7a9a2787ac5bba --- /dev/null +++ b/f4.patch @@ -0,0 +1,285 @@ +--- + drivers/base/bus.c | 39 ++------------------------------------- + drivers/base/platform.c | 10 ++++++---- + drivers/hid/hid-core.c | 10 ++++++---- + drivers/misc/mei/bus.c | 10 ++++++---- + include/linux/device.h | 2 -- + kernel/events/core.c | 13 ++++++++----- + kernel/workqueue.c | 27 +++++++++++++++------------ + 7 files changed, 43 insertions(+), 68 deletions(-) + +--- a/drivers/base/bus.c ++++ b/drivers/base/bus.c +@@ -452,35 +452,6 @@ int bus_for_each_drv(struct bus_type *bu + } + EXPORT_SYMBOL_GPL(bus_for_each_drv); + +-static int device_add_attrs(struct bus_type *bus, struct device *dev) +-{ +- int error = 0; +- int i; +- +- if (!bus->dev_attrs) +- return 0; +- +- for (i = 0; attr_name(bus->dev_attrs[i]); i++) { +- error = device_create_file(dev, &bus->dev_attrs[i]); +- if (error) { +- while (--i >= 0) +- device_remove_file(dev, &bus->dev_attrs[i]); +- break; +- } +- } +- return error; +-} +- +-static void device_remove_attrs(struct bus_type *bus, struct device *dev) +-{ +- int i; +- +- if (bus->dev_attrs) { +- for (i = 0; attr_name(bus->dev_attrs[i]); i++) +- device_remove_file(dev, &bus->dev_attrs[i]); +- } +-} +- + /** + * bus_add_device - add device to bus + * @dev: device being added +@@ -496,16 +467,13 @@ int bus_add_device(struct device *dev) + + if (bus) { + pr_debug("bus: '%s': add device %s\n", bus->name, dev_name(dev)); +- error = device_add_attrs(bus, dev); +- if (error) +- goto out_put; + error = device_add_groups(dev, bus->dev_groups); + if (error) +- goto out_groups; ++ goto out_put; + error = sysfs_create_link(&bus->p->devices_kset->kobj, + &dev->kobj, dev_name(dev)); + if (error) +- goto out_id; ++ goto out_groups; + error = sysfs_create_link(&dev->kobj, + &dev->bus->p->subsys.kobj, "subsystem"); + if (error) +@@ -518,8 +486,6 @@ out_subsys: + sysfs_remove_link(&bus->p->devices_kset->kobj, dev_name(dev)); + out_groups: + device_remove_groups(dev, bus->dev_groups); +-out_id: +- device_remove_attrs(bus, dev); + out_put: + bus_put(dev->bus); + return error; +@@ -579,7 +545,6 @@ void bus_remove_device(struct device *de + sysfs_remove_link(&dev->kobj, "subsystem"); + sysfs_remove_link(&dev->bus->p->devices_kset->kobj, + dev_name(dev)); +- device_remove_attrs(dev->bus, dev); + device_remove_groups(dev, dev->bus->dev_groups); + if (klist_node_attached(&dev->p->knode_bus)) + klist_del(&dev->p->knode_bus); +--- a/drivers/base/platform.c ++++ b/drivers/base/platform.c +@@ -671,11 +671,13 @@ static ssize_t modalias_show(struct devi + + return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len; + } ++static DEVICE_ATTR_RO(modalias); + +-static struct device_attribute platform_dev_attrs[] = { +- __ATTR_RO(modalias), +- __ATTR_NULL, ++static struct attribute *platform_dev_attrs[] = { ++ &dev_attr_modalias.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(platform_dev); + + static int platform_uevent(struct device *dev, struct kobj_uevent_env *env) + { +@@ -892,7 +894,7 @@ static const struct dev_pm_ops platform_ + + struct bus_type platform_bus_type = { + .name = "platform", +- .dev_attrs = platform_dev_attrs, ++ .dev_groups = platform_dev_groups, + .match = platform_match, + .uevent = platform_uevent, + .pm = &platform_dev_pm_ops, +--- a/drivers/hid/hid-core.c ++++ b/drivers/hid/hid-core.c +@@ -1917,11 +1917,13 @@ static ssize_t modalias_show(struct devi + + return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len; + } ++static DEVICE_ATTR_RO(modalias); + +-static struct device_attribute hid_dev_attrs[] = { +- __ATTR_RO(modalias), +- __ATTR_NULL, ++static struct attribute *hid_dev_attrs[] = { ++ &dev_attr_modalias.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(hid_dev); + + static int hid_uevent(struct device *dev, struct kobj_uevent_env *env) + { +@@ -1949,7 +1951,7 @@ static int hid_uevent(struct device *dev + + static struct bus_type hid_bus_type = { + .name = "hid", +- .dev_attrs = hid_dev_attrs, ++ .dev_groups = hid_dev_groups, + .match = hid_bus_match, + .probe = hid_device_probe, + .remove = hid_device_remove, +--- a/drivers/misc/mei/bus.c ++++ b/drivers/misc/mei/bus.c +@@ -108,11 +108,13 @@ static ssize_t modalias_show(struct devi + + return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len; + } ++static DEVICE_ATTR_RO(modalias); + +-static struct device_attribute mei_cl_dev_attrs[] = { +- __ATTR_RO(modalias), +- __ATTR_NULL, ++static struct attribute *mei_cl_dev_attrs[] = { ++ &dev_attr_modalias.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(mei_cl_dev); + + static int mei_cl_uevent(struct device *dev, struct kobj_uevent_env *env) + { +@@ -124,7 +126,7 @@ static int mei_cl_uevent(struct device * + + static struct bus_type mei_cl_bus_type = { + .name = "mei", +- .dev_attrs = mei_cl_dev_attrs, ++ .dev_groups = mei_cl_dev_groups, + .match = mei_cl_device_match, + .probe = mei_cl_device_probe, + .remove = mei_cl_device_remove, +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -63,7 +63,6 @@ extern void bus_remove_file(struct bus_t + * @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. +- * @dev_attrs: Default attributes of the devices on the bus. + * @bus_groups: Default attributes of the bus. + * @dev_groups: Default attributes of the devices on the bus. + * @drv_groups: Default attributes of the device drivers on the bus. +@@ -104,7 +103,6 @@ struct bus_type { + const char *name; + const char *dev_name; + struct device *dev_root; +- struct device_attribute *dev_attrs; /* use dev_groups instead */ + const struct attribute_group **bus_groups; + const struct attribute_group **dev_groups; + const struct attribute_group **drv_groups; +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -6167,6 +6167,7 @@ type_show(struct device *dev, struct dev + + return snprintf(page, PAGE_SIZE-1, "%d\n", pmu->type); + } ++static DEVICE_ATTR_RO(type); + + static ssize_t + perf_event_mux_interval_ms_show(struct device *dev, +@@ -6211,17 +6212,19 @@ perf_event_mux_interval_ms_store(struct + + return count; + } ++static DEVICE_ATTR_RW(perf_event_mux_interval_ms); + +-static struct device_attribute pmu_dev_attrs[] = { +- __ATTR_RO(type), +- __ATTR_RW(perf_event_mux_interval_ms), +- __ATTR_NULL, ++static struct attribute *pmu_dev_attrs[] = { ++ &dev_attr_type.attr, ++ &dev_attr_perf_event_mux_interval_ms.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(pmu_dev); + + static int pmu_bus_running; + static struct bus_type pmu_bus = { + .name = "event_source", +- .dev_attrs = pmu_dev_attrs, ++ .dev_groups = pmu_dev_groups, + }; + + static void pmu_dev_release(struct device *dev) +--- a/kernel/workqueue.c ++++ b/kernel/workqueue.c +@@ -3081,25 +3081,26 @@ static struct workqueue_struct *dev_to_w + return wq_dev->wq; + } + +-static ssize_t wq_per_cpu_show(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t per_cpu_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct workqueue_struct *wq = dev_to_wq(dev); + + return scnprintf(buf, PAGE_SIZE, "%d\n", (bool)!(wq->flags & WQ_UNBOUND)); + } ++static DEVICE_ATTR_RO(per_cpu); + +-static ssize_t wq_max_active_show(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t max_active_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct workqueue_struct *wq = dev_to_wq(dev); + + return scnprintf(buf, PAGE_SIZE, "%d\n", wq->saved_max_active); + } + +-static ssize_t wq_max_active_store(struct device *dev, +- struct device_attribute *attr, +- const char *buf, size_t count) ++static ssize_t max_active_store(struct device *dev, ++ struct device_attribute *attr, const char *buf, ++ size_t count) + { + struct workqueue_struct *wq = dev_to_wq(dev); + int val; +@@ -3110,12 +3111,14 @@ static ssize_t wq_max_active_store(struc + workqueue_set_max_active(wq, val); + return count; + } ++static DEVICE_ATTR_RW(max_active); + +-static struct device_attribute wq_sysfs_attrs[] = { +- __ATTR(per_cpu, 0444, wq_per_cpu_show, NULL), +- __ATTR(max_active, 0644, wq_max_active_show, wq_max_active_store), +- __ATTR_NULL, ++static struct attribute *wq_sysfs_attrs[] = { ++ &dev_attr_per_cpu.attr, ++ &dev_attr_max_active.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(wq_sysfs); + + static ssize_t wq_pool_ids_show(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -3265,7 +3268,7 @@ static struct device_attribute wq_sysfs_ + + static struct bus_type wq_subsys = { + .name = "workqueue", +- .dev_attrs = wq_sysfs_attrs, ++ .dev_groups = wq_sysfs_groups, + }; + + static int __init wq_sysfs_init(void) diff --git a/hid-roccat-convert-class-code-to-use-bin_attrs-in-groups.patch b/hid-roccat-convert-class-code-to-use-bin_attrs-in-groups.patch new file mode 100644 index 00000000000000..b96010eabf3322 --- /dev/null +++ b/hid-roccat-convert-class-code-to-use-bin_attrs-in-groups.patch @@ -0,0 +1,1081 @@ +From foo@baz Wed Jul 10 12:22:35 PDT 2013 +Date: Wed, 10 Jul 2013 12:22:35 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: hid: roccat: convert class code to use bin_attrs in groups + +Now that attribute groups support binary attributes, use them instead of +the dev_bin_attrs field in struct class, as that is going away soon. + +Note, there is now a compiler warning about an unused function in the +hid-roccat-pyra.c file with this patch: +drivers/hid/hid-roccat-pyra.c:246:16: warning: ‘pyra_sysfs_write_settings’ defined but not used [-Wunused-function] + +That is because the settings binary sysfs file was previously setting +the write field to be able to call this function on a write, yet the +sysfs file was always marked read-only, so it was never being called. I +left the sysfs file the same permissions, but didn't hook up the write +function as that makes no sense. If wanted, I can just delete the +function, but I'm not quite sure what is going on here with it. + +Cc: Jiri Kosina <jkosina@suse.cz> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/hid/hid-roccat-arvo.c | 32 ++++---- + drivers/hid/hid-roccat-isku.c | 87 ++++++++++++--------- + drivers/hid/hid-roccat-kone.c | 78 ++++++++----------- + drivers/hid/hid-roccat-koneplus.c | 151 ++++++++++++++++---------------------- + drivers/hid/hid-roccat-konepure.c | 67 ++++++++++------ + drivers/hid/hid-roccat-kovaplus.c | 135 +++++++++++++-------------------- + drivers/hid/hid-roccat-pyra.c | 134 ++++++++++++++------------------- + drivers/hid/hid-roccat-savu.c | 58 +++++++------- + 8 files changed, 346 insertions(+), 396 deletions(-) + +--- a/drivers/hid/hid-roccat-arvo.c ++++ b/drivers/hid/hid-roccat-arvo.c +@@ -237,6 +237,8 @@ static ssize_t arvo_sysfs_write_button(s + return arvo_sysfs_write(fp, kobj, buf, off, count, + sizeof(struct arvo_button), ARVO_COMMAND_BUTTON); + } ++static BIN_ATTR(button, 0220, NULL, arvo_sysfs_write_button, ++ sizeof(struct arvo_button)); + + static ssize_t arvo_sysfs_read_info(struct file *fp, + struct kobject *kobj, struct bin_attribute *attr, char *buf, +@@ -245,6 +247,8 @@ static ssize_t arvo_sysfs_read_info(stru + return arvo_sysfs_read(fp, kobj, buf, off, count, + sizeof(struct arvo_info), ARVO_COMMAND_INFO); + } ++static BIN_ATTR(info, 0440, arvo_sysfs_read_info, NULL, ++ sizeof(struct arvo_info)); + + static struct attribute *arvo_attrs[] = { + &dev_attr_mode_key.attr, +@@ -252,20 +256,21 @@ static struct attribute *arvo_attrs[] = + &dev_attr_actual_profile.attr, + NULL, + }; +-ATTRIBUTE_GROUPS(arvo); + +-static struct bin_attribute arvo_bin_attributes[] = { +- { +- .attr = { .name = "button", .mode = 0220 }, +- .size = sizeof(struct arvo_button), +- .write = arvo_sysfs_write_button +- }, +- { +- .attr = { .name = "info", .mode = 0440 }, +- .size = sizeof(struct arvo_info), +- .read = arvo_sysfs_read_info +- }, +- __ATTR_NULL ++static struct bin_attribute *arvo_bin_attributes[] = { ++ &bin_attr_button, ++ &bin_attr_info, ++ NULL, ++}; ++ ++static const struct attribute_group arvo_group = { ++ .attrs = arvo_attrs, ++ .bin_attrs = arvo_bin_attributes, ++}; ++ ++static const struct attribute_group *arvo_groups[] = { ++ &arvo_group, ++ NULL, + }; + + static int arvo_init_arvo_device_struct(struct usb_device *usb_dev, +@@ -434,7 +439,6 @@ static int __init arvo_init(void) + if (IS_ERR(arvo_class)) + return PTR_ERR(arvo_class); + arvo_class->dev_groups = arvo_groups; +- arvo_class->dev_bin_attrs = arvo_bin_attributes; + + retval = hid_register_driver(&arvo_driver); + if (retval) +--- a/drivers/hid/hid-roccat-isku.c ++++ b/drivers/hid/hid-roccat-isku.c +@@ -116,7 +116,6 @@ static struct attribute *isku_attrs[] = + &dev_attr_actual_profile.attr, + NULL, + }; +-ATTRIBUTE_GROUPS(isku); + + static ssize_t isku_sysfs_read(struct file *fp, struct kobject *kobj, + char *buf, loff_t off, size_t count, +@@ -185,7 +184,8 @@ ISKU_SYSFS_R(thingy, THINGY) \ + ISKU_SYSFS_W(thingy, THINGY) + + #define ISKU_BIN_ATTR_RW(thingy, THINGY) \ +-{ \ ++ISKU_SYSFS_RW(thingy, THINGY); \ ++static struct bin_attribute bin_attr_##thingy = { \ + .attr = { .name = #thingy, .mode = 0660 }, \ + .size = ISKU_SIZE_ ## THINGY, \ + .read = isku_sysfs_read_ ## thingy, \ +@@ -193,52 +193,64 @@ ISKU_SYSFS_W(thingy, THINGY) + } + + #define ISKU_BIN_ATTR_R(thingy, THINGY) \ +-{ \ ++ISKU_SYSFS_R(thingy, THINGY); \ ++static struct bin_attribute bin_attr_##thingy = { \ + .attr = { .name = #thingy, .mode = 0440 }, \ + .size = ISKU_SIZE_ ## THINGY, \ + .read = isku_sysfs_read_ ## thingy, \ + } + + #define ISKU_BIN_ATTR_W(thingy, THINGY) \ +-{ \ ++ISKU_SYSFS_W(thingy, THINGY); \ ++static struct bin_attribute bin_attr_##thingy = { \ + .attr = { .name = #thingy, .mode = 0220 }, \ + .size = ISKU_SIZE_ ## THINGY, \ + .write = isku_sysfs_write_ ## thingy \ + } + +-ISKU_SYSFS_RW(macro, MACRO) +-ISKU_SYSFS_RW(keys_function, KEYS_FUNCTION) +-ISKU_SYSFS_RW(keys_easyzone, KEYS_EASYZONE) +-ISKU_SYSFS_RW(keys_media, KEYS_MEDIA) +-ISKU_SYSFS_RW(keys_thumbster, KEYS_THUMBSTER) +-ISKU_SYSFS_RW(keys_macro, KEYS_MACRO) +-ISKU_SYSFS_RW(keys_capslock, KEYS_CAPSLOCK) +-ISKU_SYSFS_RW(light, LIGHT) +-ISKU_SYSFS_RW(key_mask, KEY_MASK) +-ISKU_SYSFS_RW(last_set, LAST_SET) +-ISKU_SYSFS_W(talk, TALK) +-ISKU_SYSFS_W(talkfx, TALKFX) +-ISKU_SYSFS_R(info, INFO) +-ISKU_SYSFS_W(control, CONTROL) +-ISKU_SYSFS_W(reset, RESET) +- +-static struct bin_attribute isku_bin_attributes[] = { +- ISKU_BIN_ATTR_RW(macro, MACRO), +- ISKU_BIN_ATTR_RW(keys_function, KEYS_FUNCTION), +- ISKU_BIN_ATTR_RW(keys_easyzone, KEYS_EASYZONE), +- ISKU_BIN_ATTR_RW(keys_media, KEYS_MEDIA), +- ISKU_BIN_ATTR_RW(keys_thumbster, KEYS_THUMBSTER), +- ISKU_BIN_ATTR_RW(keys_macro, KEYS_MACRO), +- ISKU_BIN_ATTR_RW(keys_capslock, KEYS_CAPSLOCK), +- ISKU_BIN_ATTR_RW(light, LIGHT), +- ISKU_BIN_ATTR_RW(key_mask, KEY_MASK), +- ISKU_BIN_ATTR_RW(last_set, LAST_SET), +- ISKU_BIN_ATTR_W(talk, TALK), +- ISKU_BIN_ATTR_W(talkfx, TALKFX), +- ISKU_BIN_ATTR_R(info, INFO), +- ISKU_BIN_ATTR_W(control, CONTROL), +- ISKU_BIN_ATTR_W(reset, RESET), +- __ATTR_NULL ++ISKU_BIN_ATTR_RW(macro, MACRO); ++ISKU_BIN_ATTR_RW(keys_function, KEYS_FUNCTION); ++ISKU_BIN_ATTR_RW(keys_easyzone, KEYS_EASYZONE); ++ISKU_BIN_ATTR_RW(keys_media, KEYS_MEDIA); ++ISKU_BIN_ATTR_RW(keys_thumbster, KEYS_THUMBSTER); ++ISKU_BIN_ATTR_RW(keys_macro, KEYS_MACRO); ++ISKU_BIN_ATTR_RW(keys_capslock, KEYS_CAPSLOCK); ++ISKU_BIN_ATTR_RW(light, LIGHT); ++ISKU_BIN_ATTR_RW(key_mask, KEY_MASK); ++ISKU_BIN_ATTR_RW(last_set, LAST_SET); ++ISKU_BIN_ATTR_W(talk, TALK); ++ISKU_BIN_ATTR_W(talkfx, TALKFX); ++ISKU_BIN_ATTR_W(control, CONTROL); ++ISKU_BIN_ATTR_W(reset, RESET); ++ISKU_BIN_ATTR_R(info, INFO); ++ ++static struct bin_attribute *isku_bin_attributes[] = { ++ &bin_attr_macro, ++ &bin_attr_keys_function, ++ &bin_attr_keys_easyzone, ++ &bin_attr_keys_media, ++ &bin_attr_keys_thumbster, ++ &bin_attr_keys_macro, ++ &bin_attr_keys_capslock, ++ &bin_attr_light, ++ &bin_attr_key_mask, ++ &bin_attr_last_set, ++ &bin_attr_talk, ++ &bin_attr_talkfx, ++ &bin_attr_control, ++ &bin_attr_reset, ++ &bin_attr_info, ++ NULL, ++}; ++ ++static const struct attribute_group isku_group = { ++ .attrs = isku_attrs, ++ .bin_attrs = isku_bin_attributes, ++}; ++ ++static const struct attribute_group *isku_groups[] = { ++ &isku_group, ++ NULL, + }; + + static int isku_init_isku_device_struct(struct usb_device *usb_dev, +@@ -429,7 +441,6 @@ static int __init isku_init(void) + if (IS_ERR(isku_class)) + return PTR_ERR(isku_class); + isku_class->dev_groups = isku_groups; +- isku_class->dev_bin_attrs = isku_bin_attributes; + + retval = hid_register_driver(&isku_driver); + if (retval) +--- a/drivers/hid/hid-roccat-kone.c ++++ b/drivers/hid/hid-roccat-kone.c +@@ -324,6 +324,8 @@ static ssize_t kone_sysfs_write_settings + + return sizeof(struct kone_settings); + } ++static BIN_ATTR(settings, 0660, kone_sysfs_read_settings, ++ kone_sysfs_write_settings, sizeof(struct kone_settings)); + + static ssize_t kone_sysfs_read_profilex(struct file *fp, + struct kobject *kobj, struct bin_attribute *attr, +@@ -378,6 +380,19 @@ static ssize_t kone_sysfs_write_profilex + + return sizeof(struct kone_profile); + } ++#define PROFILE_ATTR(number) \ ++static struct bin_attribute bin_attr_profile##number = { \ ++ .attr = { .name = "profile##number", .mode = 0660 }, \ ++ .size = sizeof(struct kone_profile), \ ++ .read = kone_sysfs_read_profilex, \ ++ .write = kone_sysfs_write_profilex, \ ++ .private = &profile_numbers[number], \ ++}; ++PROFILE_ATTR(1); ++PROFILE_ATTR(2); ++PROFILE_ATTR(3); ++PROFILE_ATTR(4); ++PROFILE_ATTR(5); + + static ssize_t kone_sysfs_show_actual_profile(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -616,51 +631,25 @@ static struct attribute *kone_attrs[] = + &dev_attr_startup_profile.attr, + NULL, + }; +-ATTRIBUTE_GROUPS(kone); + +-static struct bin_attribute kone_bin_attributes[] = { +- { +- .attr = { .name = "settings", .mode = 0660 }, +- .size = sizeof(struct kone_settings), +- .read = kone_sysfs_read_settings, +- .write = kone_sysfs_write_settings +- }, +- { +- .attr = { .name = "profile1", .mode = 0660 }, +- .size = sizeof(struct kone_profile), +- .read = kone_sysfs_read_profilex, +- .write = kone_sysfs_write_profilex, +- .private = &profile_numbers[0] +- }, +- { +- .attr = { .name = "profile2", .mode = 0660 }, +- .size = sizeof(struct kone_profile), +- .read = kone_sysfs_read_profilex, +- .write = kone_sysfs_write_profilex, +- .private = &profile_numbers[1] +- }, +- { +- .attr = { .name = "profile3", .mode = 0660 }, +- .size = sizeof(struct kone_profile), +- .read = kone_sysfs_read_profilex, +- .write = kone_sysfs_write_profilex, +- .private = &profile_numbers[2] +- }, +- { +- .attr = { .name = "profile4", .mode = 0660 }, +- .size = sizeof(struct kone_profile), +- .read = kone_sysfs_read_profilex, +- .write = kone_sysfs_write_profilex, +- .private = &profile_numbers[3] +- }, +- { +- .attr = { .name = "profile5", .mode = 0660 }, +- .size = sizeof(struct kone_profile), +- .read = kone_sysfs_read_profilex, +- .write = kone_sysfs_write_profilex, +- .private = &profile_numbers[4] +- }, +- __ATTR_NULL ++static struct bin_attribute *kone_bin_attributes[] = { ++ &bin_attr_settings, ++ &bin_attr_profile1, ++ &bin_attr_profile2, ++ &bin_attr_profile3, ++ &bin_attr_profile4, ++ &bin_attr_profile5, ++ NULL, ++}; ++ ++static const struct attribute_group kone_group = { ++ .attrs = kone_attrs, ++ .bin_attrs = kone_bin_attributes, ++}; ++ ++static const struct attribute_group *kone_groups[] = { ++ &kone_group, ++ NULL, + }; + + static int kone_init_kone_device_struct(struct usb_device *usb_dev, +@@ -898,7 +887,6 @@ static int __init kone_init(void) + if (IS_ERR(kone_class)) + return PTR_ERR(kone_class); + kone_class->dev_groups = kone_groups; +- kone_class->dev_bin_attrs = kone_bin_attributes; + + retval = hid_register_driver(&kone_driver); + if (retval) +--- a/drivers/hid/hid-roccat-koneplus.c ++++ b/drivers/hid/hid-roccat-koneplus.c +@@ -156,7 +156,8 @@ KONEPLUS_SYSFS_W(thingy, THINGY) \ + KONEPLUS_SYSFS_R(thingy, THINGY) + + #define KONEPLUS_BIN_ATTRIBUTE_RW(thingy, THINGY) \ +-{ \ ++KONEPLUS_SYSFS_RW(thingy, THINGY); \ ++static struct bin_attribute bin_attr_##thingy = { \ + .attr = { .name = #thingy, .mode = 0660 }, \ + .size = KONEPLUS_SIZE_ ## THINGY, \ + .read = koneplus_sysfs_read_ ## thingy, \ +@@ -164,28 +165,29 @@ KONEPLUS_SYSFS_R(thingy, THINGY) + } + + #define KONEPLUS_BIN_ATTRIBUTE_R(thingy, THINGY) \ +-{ \ ++KONEPLUS_SYSFS_R(thingy, THINGY); \ ++static struct bin_attribute bin_attr_##thingy = { \ + .attr = { .name = #thingy, .mode = 0440 }, \ + .size = KONEPLUS_SIZE_ ## THINGY, \ + .read = koneplus_sysfs_read_ ## thingy, \ + } + + #define KONEPLUS_BIN_ATTRIBUTE_W(thingy, THINGY) \ +-{ \ ++KONEPLUS_SYSFS_W(thingy, THINGY); \ ++static struct bin_attribute bin_attr_##thingy = { \ + .attr = { .name = #thingy, .mode = 0220 }, \ + .size = KONEPLUS_SIZE_ ## THINGY, \ + .write = koneplus_sysfs_write_ ## thingy \ + } +- +-KONEPLUS_SYSFS_W(control, CONTROL) +-KONEPLUS_SYSFS_RW(info, INFO) +-KONEPLUS_SYSFS_W(talk, TALK) +-KONEPLUS_SYSFS_W(macro, MACRO) +-KONEPLUS_SYSFS_RW(sensor, SENSOR) +-KONEPLUS_SYSFS_RW(tcu, TCU) +-KONEPLUS_SYSFS_R(tcu_image, TCU_IMAGE) +-KONEPLUS_SYSFS_RW(profile_settings, PROFILE_SETTINGS) +-KONEPLUS_SYSFS_RW(profile_buttons, PROFILE_BUTTONS) ++KONEPLUS_BIN_ATTRIBUTE_W(control, CONTROL); ++KONEPLUS_BIN_ATTRIBUTE_W(talk, TALK); ++KONEPLUS_BIN_ATTRIBUTE_W(macro, MACRO); ++KONEPLUS_BIN_ATTRIBUTE_R(tcu_image, TCU_IMAGE); ++KONEPLUS_BIN_ATTRIBUTE_RW(info, INFO); ++KONEPLUS_BIN_ATTRIBUTE_RW(sensor, SENSOR); ++KONEPLUS_BIN_ATTRIBUTE_RW(tcu, TCU); ++KONEPLUS_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS); ++KONEPLUS_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS); + + static ssize_t koneplus_sysfs_read_profilex_settings(struct file *fp, + struct kobject *kobj, struct bin_attribute *attr, char *buf, +@@ -225,6 +227,25 @@ static ssize_t koneplus_sysfs_read_profi + KONEPLUS_COMMAND_PROFILE_BUTTONS); + } + ++#define PROFILE_ATTR(number) \ ++static struct bin_attribute bin_attr_profile##number##_settings = { \ ++ .attr = { .name = "profile##number##_settings", .mode = 0440 }, \ ++ .size = KONEPLUS_SIZE_PROFILE_SETTINGS, \ ++ .read = koneplus_sysfs_read_profilex_settings, \ ++ .private = &profile_numbers[number-1], \ ++}; \ ++static struct bin_attribute bin_attr_profile##number##_buttons = { \ ++ .attr = { .name = "profile##number##_buttons", .mode = 0440 }, \ ++ .size = KONEPLUS_SIZE_PROFILE_BUTTONS, \ ++ .read = koneplus_sysfs_read_profilex_buttons, \ ++ .private = &profile_numbers[number-1], \ ++}; ++PROFILE_ATTR(1); ++PROFILE_ATTR(2); ++PROFILE_ATTR(3); ++PROFILE_ATTR(4); ++PROFILE_ATTR(5); ++ + static ssize_t koneplus_sysfs_show_actual_profile(struct device *dev, + struct device_attribute *attr, char *buf) + { +@@ -308,79 +329,38 @@ static struct attribute *koneplus_attrs[ + &dev_attr_firmware_version.attr, + NULL, + }; +-ATTRIBUTE_GROUPS(koneplus); + +-static struct bin_attribute koneplus_bin_attributes[] = { +- KONEPLUS_BIN_ATTRIBUTE_W(control, CONTROL), +- KONEPLUS_BIN_ATTRIBUTE_RW(info, INFO), +- KONEPLUS_BIN_ATTRIBUTE_W(talk, TALK), +- KONEPLUS_BIN_ATTRIBUTE_W(macro, MACRO), +- KONEPLUS_BIN_ATTRIBUTE_RW(sensor, SENSOR), +- KONEPLUS_BIN_ATTRIBUTE_RW(tcu, TCU), +- KONEPLUS_BIN_ATTRIBUTE_R(tcu_image, TCU_IMAGE), +- KONEPLUS_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS), +- KONEPLUS_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS), +- { +- .attr = { .name = "profile1_settings", .mode = 0440 }, +- .size = KONEPLUS_SIZE_PROFILE_SETTINGS, +- .read = koneplus_sysfs_read_profilex_settings, +- .private = &profile_numbers[0] +- }, +- { +- .attr = { .name = "profile2_settings", .mode = 0440 }, +- .size = KONEPLUS_SIZE_PROFILE_SETTINGS, +- .read = koneplus_sysfs_read_profilex_settings, +- .private = &profile_numbers[1] +- }, +- { +- .attr = { .name = "profile3_settings", .mode = 0440 }, +- .size = KONEPLUS_SIZE_PROFILE_SETTINGS, +- .read = koneplus_sysfs_read_profilex_settings, +- .private = &profile_numbers[2] +- }, +- { +- .attr = { .name = "profile4_settings", .mode = 0440 }, +- .size = KONEPLUS_SIZE_PROFILE_SETTINGS, +- .read = koneplus_sysfs_read_profilex_settings, +- .private = &profile_numbers[3] +- }, +- { +- .attr = { .name = "profile5_settings", .mode = 0440 }, +- .size = KONEPLUS_SIZE_PROFILE_SETTINGS, +- .read = koneplus_sysfs_read_profilex_settings, +- .private = &profile_numbers[4] +- }, +- { +- .attr = { .name = "profile1_buttons", .mode = 0440 }, +- .size = KONEPLUS_SIZE_PROFILE_BUTTONS, +- .read = koneplus_sysfs_read_profilex_buttons, +- .private = &profile_numbers[0] +- }, +- { +- .attr = { .name = "profile2_buttons", .mode = 0440 }, +- .size = KONEPLUS_SIZE_PROFILE_BUTTONS, +- .read = koneplus_sysfs_read_profilex_buttons, +- .private = &profile_numbers[1] +- }, +- { +- .attr = { .name = "profile3_buttons", .mode = 0440 }, +- .size = KONEPLUS_SIZE_PROFILE_BUTTONS, +- .read = koneplus_sysfs_read_profilex_buttons, +- .private = &profile_numbers[2] +- }, +- { +- .attr = { .name = "profile4_buttons", .mode = 0440 }, +- .size = KONEPLUS_SIZE_PROFILE_BUTTONS, +- .read = koneplus_sysfs_read_profilex_buttons, +- .private = &profile_numbers[3] +- }, +- { +- .attr = { .name = "profile5_buttons", .mode = 0440 }, +- .size = KONEPLUS_SIZE_PROFILE_BUTTONS, +- .read = koneplus_sysfs_read_profilex_buttons, +- .private = &profile_numbers[4] +- }, +- __ATTR_NULL ++static struct bin_attribute *koneplus_bin_attributes[] = { ++ &bin_attr_control, ++ &bin_attr_talk, ++ &bin_attr_macro, ++ &bin_attr_tcu_image, ++ &bin_attr_info, ++ &bin_attr_sensor, ++ &bin_attr_tcu, ++ &bin_attr_profile_settings, ++ &bin_attr_profile_buttons, ++ &bin_attr_profile1_settings, ++ &bin_attr_profile2_settings, ++ &bin_attr_profile3_settings, ++ &bin_attr_profile4_settings, ++ &bin_attr_profile5_settings, ++ &bin_attr_profile1_buttons, ++ &bin_attr_profile2_buttons, ++ &bin_attr_profile3_buttons, ++ &bin_attr_profile4_buttons, ++ &bin_attr_profile5_buttons, ++ NULL, ++}; ++ ++static const struct attribute_group koneplus_group = { ++ .attrs = koneplus_attrs, ++ .bin_attrs = koneplus_bin_attributes, ++}; ++ ++static const struct attribute_group *koneplus_groups[] = { ++ &koneplus_group, ++ NULL, + }; + + static int koneplus_init_koneplus_device_struct(struct usb_device *usb_dev, +@@ -577,7 +557,6 @@ static int __init koneplus_init(void) + if (IS_ERR(koneplus_class)) + return PTR_ERR(koneplus_class); + koneplus_class->dev_groups = koneplus_groups; +- koneplus_class->dev_bin_attrs = koneplus_bin_attributes; + + retval = hid_register_driver(&koneplus_driver); + if (retval) +--- a/drivers/hid/hid-roccat-konepure.c ++++ b/drivers/hid/hid-roccat-konepure.c +@@ -94,7 +94,8 @@ KONEPURE_SYSFS_W(thingy, THINGY) \ + KONEPURE_SYSFS_R(thingy, THINGY) + + #define KONEPURE_BIN_ATTRIBUTE_RW(thingy, THINGY) \ +-{ \ ++KONEPURE_SYSFS_RW(thingy, THINGY); \ ++static struct bin_attribute bin_attr_##thingy = { \ + .attr = { .name = #thingy, .mode = 0660 }, \ + .size = KONEPURE_SIZE_ ## THINGY, \ + .read = konepure_sysfs_read_ ## thingy, \ +@@ -102,44 +103,56 @@ KONEPURE_SYSFS_R(thingy, THINGY) + } + + #define KONEPURE_BIN_ATTRIBUTE_R(thingy, THINGY) \ +-{ \ ++KONEPURE_SYSFS_R(thingy, THINGY); \ ++static struct bin_attribute bin_attr_##thingy = { \ + .attr = { .name = #thingy, .mode = 0440 }, \ + .size = KONEPURE_SIZE_ ## THINGY, \ + .read = konepure_sysfs_read_ ## thingy, \ + } + + #define KONEPURE_BIN_ATTRIBUTE_W(thingy, THINGY) \ +-{ \ ++KONEPURE_SYSFS_W(thingy, THINGY); \ ++static struct bin_attribute bin_attr_##thingy = { \ + .attr = { .name = #thingy, .mode = 0220 }, \ + .size = KONEPURE_SIZE_ ## THINGY, \ + .write = konepure_sysfs_write_ ## thingy \ + } + +-KONEPURE_SYSFS_RW(actual_profile, ACTUAL_PROFILE) +-KONEPURE_SYSFS_W(control, CONTROL) +-KONEPURE_SYSFS_RW(info, INFO) +-KONEPURE_SYSFS_W(talk, TALK) +-KONEPURE_SYSFS_W(macro, MACRO) +-KONEPURE_SYSFS_RW(sensor, SENSOR) +-KONEPURE_SYSFS_RW(tcu, TCU) +-KONEPURE_SYSFS_R(tcu_image, TCU_IMAGE) +-KONEPURE_SYSFS_RW(profile_settings, PROFILE_SETTINGS) +-KONEPURE_SYSFS_RW(profile_buttons, PROFILE_BUTTONS) +- +-static struct bin_attribute konepure_bin_attributes[] = { +- KONEPURE_BIN_ATTRIBUTE_RW(actual_profile, ACTUAL_PROFILE), +- KONEPURE_BIN_ATTRIBUTE_W(control, CONTROL), +- KONEPURE_BIN_ATTRIBUTE_RW(info, INFO), +- KONEPURE_BIN_ATTRIBUTE_W(talk, TALK), +- KONEPURE_BIN_ATTRIBUTE_W(macro, MACRO), +- KONEPURE_BIN_ATTRIBUTE_RW(sensor, SENSOR), +- KONEPURE_BIN_ATTRIBUTE_RW(tcu, TCU), +- KONEPURE_BIN_ATTRIBUTE_R(tcu_image, TCU_IMAGE), +- KONEPURE_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS), +- KONEPURE_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS), +- __ATTR_NULL ++KONEPURE_BIN_ATTRIBUTE_RW(actual_profile, ACTUAL_PROFILE); ++KONEPURE_BIN_ATTRIBUTE_RW(info, INFO); ++KONEPURE_BIN_ATTRIBUTE_RW(sensor, SENSOR); ++KONEPURE_BIN_ATTRIBUTE_RW(tcu, TCU); ++KONEPURE_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS); ++KONEPURE_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS); ++KONEPURE_BIN_ATTRIBUTE_W(control, CONTROL); ++KONEPURE_BIN_ATTRIBUTE_W(talk, TALK); ++KONEPURE_BIN_ATTRIBUTE_W(macro, MACRO); ++KONEPURE_BIN_ATTRIBUTE_R(tcu_image, TCU_IMAGE); ++ ++static struct bin_attribute *konepure_bin_attributes[] = { ++ &bin_attr_actual_profile, ++ &bin_attr_info, ++ &bin_attr_sensor, ++ &bin_attr_tcu, ++ &bin_attr_profile_settings, ++ &bin_attr_profile_buttons, ++ &bin_attr_control, ++ &bin_attr_talk, ++ &bin_attr_macro, ++ &bin_attr_tcu_image, ++ NULL, + }; + ++static const struct attribute_group konepure_group = { ++ .bin_attrs = konepure_bin_attributes, ++}; ++ ++static const struct attribute_group *konepure_groups[] = { ++ &konepure_group, ++ NULL, ++}; ++ ++ + static int konepure_init_konepure_device_struct(struct usb_device *usb_dev, + struct konepure_device *konepure) + { +@@ -282,7 +295,7 @@ static int __init konepure_init(void) + konepure_class = class_create(THIS_MODULE, "konepure"); + if (IS_ERR(konepure_class)) + return PTR_ERR(konepure_class); +- konepure_class->dev_bin_attrs = konepure_bin_attributes; ++ konepure_class->dev_groups = konepure_groups; + + retval = hid_register_driver(&konepure_driver); + if (retval) +--- a/drivers/hid/hid-roccat-kovaplus.c ++++ b/drivers/hid/hid-roccat-kovaplus.c +@@ -197,31 +197,25 @@ KOVAPLUS_SYSFS_W(thingy, THINGY) \ + KOVAPLUS_SYSFS_R(thingy, THINGY) + + #define KOVAPLUS_BIN_ATTRIBUTE_RW(thingy, THINGY) \ +-{ \ ++KOVAPLUS_SYSFS_RW(thingy, THINGY); \ ++static struct bin_attribute bin_attr_##thingy = { \ + .attr = { .name = #thingy, .mode = 0660 }, \ + .size = KOVAPLUS_SIZE_ ## THINGY, \ + .read = kovaplus_sysfs_read_ ## thingy, \ + .write = kovaplus_sysfs_write_ ## thingy \ + } + +-#define KOVAPLUS_BIN_ATTRIBUTE_R(thingy, THINGY) \ +-{ \ +- .attr = { .name = #thingy, .mode = 0440 }, \ +- .size = KOVAPLUS_SIZE_ ## THINGY, \ +- .read = kovaplus_sysfs_read_ ## thingy, \ +-} +- + #define KOVAPLUS_BIN_ATTRIBUTE_W(thingy, THINGY) \ +-{ \ ++KOVAPLUS_SYSFS_W(thingy, THINGY); \ ++static struct bin_attribute bin_attr_##thingy = { \ + .attr = { .name = #thingy, .mode = 0220 }, \ + .size = KOVAPLUS_SIZE_ ## THINGY, \ + .write = kovaplus_sysfs_write_ ## thingy \ + } +- +-KOVAPLUS_SYSFS_W(control, CONTROL) +-KOVAPLUS_SYSFS_RW(info, INFO) +-KOVAPLUS_SYSFS_RW(profile_settings, PROFILE_SETTINGS) +-KOVAPLUS_SYSFS_RW(profile_buttons, PROFILE_BUTTONS) ++KOVAPLUS_BIN_ATTRIBUTE_W(control, CONTROL); ++KOVAPLUS_BIN_ATTRIBUTE_RW(info, INFO); ++KOVAPLUS_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS); ++KOVAPLUS_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS); + + static ssize_t kovaplus_sysfs_read_profilex_settings(struct file *fp, + struct kobject *kobj, struct bin_attribute *attr, char *buf, +@@ -261,6 +255,25 @@ static ssize_t kovaplus_sysfs_read_profi + KOVAPLUS_COMMAND_PROFILE_BUTTONS); + } + ++#define PROFILE_ATTR(number) \ ++static struct bin_attribute bin_attr_profile##number##_settings = { \ ++ .attr = { .name = "profile##number##_settings", .mode = 0440 }, \ ++ .size = KOVAPLUS_SIZE_PROFILE_SETTINGS, \ ++ .read = kovaplus_sysfs_read_profilex_settings, \ ++ .private = &profile_numbers[number-1], \ ++}; \ ++static struct bin_attribute bin_attr_profile##number##_buttons = { \ ++ .attr = { .name = "profile##number##_buttons", .mode = 0440 }, \ ++ .size = KOVAPLUS_SIZE_PROFILE_BUTTONS, \ ++ .read = kovaplus_sysfs_read_profilex_buttons, \ ++ .private = &profile_numbers[number-1], \ ++}; ++PROFILE_ATTR(1); ++PROFILE_ATTR(2); ++PROFILE_ATTR(3); ++PROFILE_ATTR(4); ++PROFILE_ATTR(5); ++ + static ssize_t kovaplus_sysfs_show_actual_profile(struct device *dev, + struct device_attribute *attr, char *buf) + { +@@ -372,74 +385,33 @@ static struct attribute *kovaplus_attrs[ + &dev_attr_actual_sensitivity_y.attr, + NULL, + }; +-ATTRIBUTE_GROUPS(kovaplus); + +-static struct bin_attribute kovaplus_bin_attributes[] = { +- KOVAPLUS_BIN_ATTRIBUTE_W(control, CONTROL), +- KOVAPLUS_BIN_ATTRIBUTE_RW(info, INFO), +- KOVAPLUS_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS), +- KOVAPLUS_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS), +- { +- .attr = { .name = "profile1_settings", .mode = 0440 }, +- .size = KOVAPLUS_SIZE_PROFILE_SETTINGS, +- .read = kovaplus_sysfs_read_profilex_settings, +- .private = &profile_numbers[0] +- }, +- { +- .attr = { .name = "profile2_settings", .mode = 0440 }, +- .size = KOVAPLUS_SIZE_PROFILE_SETTINGS, +- .read = kovaplus_sysfs_read_profilex_settings, +- .private = &profile_numbers[1] +- }, +- { +- .attr = { .name = "profile3_settings", .mode = 0440 }, +- .size = KOVAPLUS_SIZE_PROFILE_SETTINGS, +- .read = kovaplus_sysfs_read_profilex_settings, +- .private = &profile_numbers[2] +- }, +- { +- .attr = { .name = "profile4_settings", .mode = 0440 }, +- .size = KOVAPLUS_SIZE_PROFILE_SETTINGS, +- .read = kovaplus_sysfs_read_profilex_settings, +- .private = &profile_numbers[3] +- }, +- { +- .attr = { .name = "profile5_settings", .mode = 0440 }, +- .size = KOVAPLUS_SIZE_PROFILE_SETTINGS, +- .read = kovaplus_sysfs_read_profilex_settings, +- .private = &profile_numbers[4] +- }, +- { +- .attr = { .name = "profile1_buttons", .mode = 0440 }, +- .size = KOVAPLUS_SIZE_PROFILE_BUTTONS, +- .read = kovaplus_sysfs_read_profilex_buttons, +- .private = &profile_numbers[0] +- }, +- { +- .attr = { .name = "profile2_buttons", .mode = 0440 }, +- .size = KOVAPLUS_SIZE_PROFILE_BUTTONS, +- .read = kovaplus_sysfs_read_profilex_buttons, +- .private = &profile_numbers[1] +- }, +- { +- .attr = { .name = "profile3_buttons", .mode = 0440 }, +- .size = KOVAPLUS_SIZE_PROFILE_BUTTONS, +- .read = kovaplus_sysfs_read_profilex_buttons, +- .private = &profile_numbers[2] +- }, +- { +- .attr = { .name = "profile4_buttons", .mode = 0440 }, +- .size = KOVAPLUS_SIZE_PROFILE_BUTTONS, +- .read = kovaplus_sysfs_read_profilex_buttons, +- .private = &profile_numbers[3] +- }, +- { +- .attr = { .name = "profile5_buttons", .mode = 0440 }, +- .size = KOVAPLUS_SIZE_PROFILE_BUTTONS, +- .read = kovaplus_sysfs_read_profilex_buttons, +- .private = &profile_numbers[4] +- }, +- __ATTR_NULL ++static struct bin_attribute *kovaplus_bin_attributes[] = { ++ &bin_attr_control, ++ &bin_attr_info, ++ &bin_attr_profile_settings, ++ &bin_attr_profile_buttons, ++ &bin_attr_profile1_settings, ++ &bin_attr_profile2_settings, ++ &bin_attr_profile3_settings, ++ &bin_attr_profile4_settings, ++ &bin_attr_profile5_settings, ++ &bin_attr_profile1_buttons, ++ &bin_attr_profile2_buttons, ++ &bin_attr_profile3_buttons, ++ &bin_attr_profile4_buttons, ++ &bin_attr_profile5_buttons, ++ NULL, ++}; ++ ++static const struct attribute_group kovaplus_group = { ++ .attrs = kovaplus_attrs, ++ .bin_attrs = kovaplus_bin_attributes, ++}; ++ ++static const struct attribute_group *kovaplus_groups[] = { ++ &kovaplus_group, ++ NULL, + }; + + static int kovaplus_init_kovaplus_device_struct(struct usb_device *usb_dev, +@@ -668,7 +640,6 @@ static int __init kovaplus_init(void) + if (IS_ERR(kovaplus_class)) + return PTR_ERR(kovaplus_class); + kovaplus_class->dev_groups = kovaplus_groups; +- kovaplus_class->dev_bin_attrs = kovaplus_bin_attributes; + + retval = hid_register_driver(&kovaplus_driver); + if (retval) +--- a/drivers/hid/hid-roccat-pyra.c ++++ b/drivers/hid/hid-roccat-pyra.c +@@ -156,7 +156,8 @@ PYRA_SYSFS_W(thingy, THINGY) \ + PYRA_SYSFS_R(thingy, THINGY) + + #define PYRA_BIN_ATTRIBUTE_RW(thingy, THINGY) \ +-{ \ ++PYRA_SYSFS_RW(thingy, THINGY); \ ++static struct bin_attribute bin_attr_##thingy = { \ + .attr = { .name = #thingy, .mode = 0660 }, \ + .size = PYRA_SIZE_ ## THINGY, \ + .read = pyra_sysfs_read_ ## thingy, \ +@@ -164,24 +165,26 @@ PYRA_SYSFS_R(thingy, THINGY) + } + + #define PYRA_BIN_ATTRIBUTE_R(thingy, THINGY) \ +-{ \ ++PYRA_SYSFS_R(thingy, THINGY); \ ++static struct bin_attribute bin_attr_##thingy = { \ + .attr = { .name = #thingy, .mode = 0440 }, \ + .size = PYRA_SIZE_ ## THINGY, \ + .read = pyra_sysfs_read_ ## thingy, \ + } + + #define PYRA_BIN_ATTRIBUTE_W(thingy, THINGY) \ +-{ \ ++PYRA_SYSFS_W(thingy, THINGY); \ ++static struct bin_attribute bin_attr_##thingy = { \ + .attr = { .name = #thingy, .mode = 0220 }, \ + .size = PYRA_SIZE_ ## THINGY, \ + .write = pyra_sysfs_write_ ## thingy \ + } + +-PYRA_SYSFS_W(control, CONTROL) +-PYRA_SYSFS_RW(info, INFO) +-PYRA_SYSFS_RW(profile_settings, PROFILE_SETTINGS) +-PYRA_SYSFS_RW(profile_buttons, PROFILE_BUTTONS) +-PYRA_SYSFS_R(settings, SETTINGS) ++PYRA_BIN_ATTRIBUTE_W(control, CONTROL); ++PYRA_BIN_ATTRIBUTE_RW(info, INFO); ++PYRA_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS); ++PYRA_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS); ++PYRA_BIN_ATTRIBUTE_R(settings, SETTINGS); + + static ssize_t pyra_sysfs_read_profilex_settings(struct file *fp, + struct kobject *kobj, struct bin_attribute *attr, char *buf, +@@ -221,6 +224,25 @@ static ssize_t pyra_sysfs_read_profilex_ + PYRA_COMMAND_PROFILE_BUTTONS); + } + ++#define PROFILE_ATTR(number) \ ++static struct bin_attribute bin_attr_profile##number##_settings = { \ ++ .attr = { .name = "profile##number##_settings", .mode = 0440 }, \ ++ .size = PYRA_SIZE_PROFILE_SETTINGS, \ ++ .read = pyra_sysfs_read_profilex_settings, \ ++ .private = &profile_numbers[number-1], \ ++}; \ ++static struct bin_attribute bin_attr_profile##number##_buttons = { \ ++ .attr = { .name = "profile##number##_buttons", .mode = 0440 }, \ ++ .size = PYRA_SIZE_PROFILE_BUTTONS, \ ++ .read = pyra_sysfs_read_profilex_buttons, \ ++ .private = &profile_numbers[number-1], \ ++}; ++PROFILE_ATTR(1); ++PROFILE_ATTR(2); ++PROFILE_ATTR(3); ++PROFILE_ATTR(4); ++PROFILE_ATTR(5); ++ + static ssize_t pyra_sysfs_write_settings(struct file *fp, + struct kobject *kobj, struct bin_attribute *attr, char *buf, + loff_t off, size_t count) +@@ -314,75 +336,34 @@ static struct attribute *pyra_attrs[] = + &dev_attr_startup_profile.attr, + NULL, + }; +-ATTRIBUTE_GROUPS(pyra); + +-static struct bin_attribute pyra_bin_attributes[] = { +- PYRA_BIN_ATTRIBUTE_W(control, CONTROL), +- PYRA_BIN_ATTRIBUTE_RW(info, INFO), +- PYRA_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS), +- PYRA_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS), +- PYRA_BIN_ATTRIBUTE_RW(settings, SETTINGS), +- { +- .attr = { .name = "profile1_settings", .mode = 0440 }, +- .size = PYRA_SIZE_PROFILE_SETTINGS, +- .read = pyra_sysfs_read_profilex_settings, +- .private = &profile_numbers[0] +- }, +- { +- .attr = { .name = "profile2_settings", .mode = 0440 }, +- .size = PYRA_SIZE_PROFILE_SETTINGS, +- .read = pyra_sysfs_read_profilex_settings, +- .private = &profile_numbers[1] +- }, +- { +- .attr = { .name = "profile3_settings", .mode = 0440 }, +- .size = PYRA_SIZE_PROFILE_SETTINGS, +- .read = pyra_sysfs_read_profilex_settings, +- .private = &profile_numbers[2] +- }, +- { +- .attr = { .name = "profile4_settings", .mode = 0440 }, +- .size = PYRA_SIZE_PROFILE_SETTINGS, +- .read = pyra_sysfs_read_profilex_settings, +- .private = &profile_numbers[3] +- }, +- { +- .attr = { .name = "profile5_settings", .mode = 0440 }, +- .size = PYRA_SIZE_PROFILE_SETTINGS, +- .read = pyra_sysfs_read_profilex_settings, +- .private = &profile_numbers[4] +- }, +- { +- .attr = { .name = "profile1_buttons", .mode = 0440 }, +- .size = PYRA_SIZE_PROFILE_BUTTONS, +- .read = pyra_sysfs_read_profilex_buttons, +- .private = &profile_numbers[0] +- }, +- { +- .attr = { .name = "profile2_buttons", .mode = 0440 }, +- .size = PYRA_SIZE_PROFILE_BUTTONS, +- .read = pyra_sysfs_read_profilex_buttons, +- .private = &profile_numbers[1] +- }, +- { +- .attr = { .name = "profile3_buttons", .mode = 0440 }, +- .size = PYRA_SIZE_PROFILE_BUTTONS, +- .read = pyra_sysfs_read_profilex_buttons, +- .private = &profile_numbers[2] +- }, +- { +- .attr = { .name = "profile4_buttons", .mode = 0440 }, +- .size = PYRA_SIZE_PROFILE_BUTTONS, +- .read = pyra_sysfs_read_profilex_buttons, +- .private = &profile_numbers[3] +- }, +- { +- .attr = { .name = "profile5_buttons", .mode = 0440 }, +- .size = PYRA_SIZE_PROFILE_BUTTONS, +- .read = pyra_sysfs_read_profilex_buttons, +- .private = &profile_numbers[4] +- }, +- __ATTR_NULL ++static struct bin_attribute *pyra_bin_attributes[] = { ++ &bin_attr_control, ++ &bin_attr_info, ++ &bin_attr_profile_settings, ++ &bin_attr_profile_buttons, ++ &bin_attr_settings, ++ &bin_attr_profile1_settings, ++ &bin_attr_profile2_settings, ++ &bin_attr_profile3_settings, ++ &bin_attr_profile4_settings, ++ &bin_attr_profile5_settings, ++ &bin_attr_profile1_buttons, ++ &bin_attr_profile2_buttons, ++ &bin_attr_profile3_buttons, ++ &bin_attr_profile4_buttons, ++ &bin_attr_profile5_buttons, ++ NULL, ++}; ++ ++static const struct attribute_group pyra_group = { ++ .attrs = pyra_attrs, ++ .bin_attrs = pyra_bin_attributes, ++}; ++ ++static const struct attribute_group *pyra_groups[] = { ++ &pyra_group, ++ NULL, + }; + + static int pyra_init_pyra_device_struct(struct usb_device *usb_dev, +@@ -605,7 +586,6 @@ static int __init pyra_init(void) + if (IS_ERR(pyra_class)) + return PTR_ERR(pyra_class); + pyra_class->dev_groups = pyra_groups; +- pyra_class->dev_bin_attrs = pyra_bin_attributes; + + retval = hid_register_driver(&pyra_driver); + if (retval) +--- a/drivers/hid/hid-roccat-savu.c ++++ b/drivers/hid/hid-roccat-savu.c +@@ -94,44 +94,48 @@ SAVU_SYSFS_W(thingy, THINGY) \ + SAVU_SYSFS_R(thingy, THINGY) + + #define SAVU_BIN_ATTRIBUTE_RW(thingy, THINGY) \ +-{ \ ++SAVU_SYSFS_RW(thingy, THINGY); \ ++static struct bin_attribute bin_attr_##thingy = { \ + .attr = { .name = #thingy, .mode = 0660 }, \ + .size = SAVU_SIZE_ ## THINGY, \ + .read = savu_sysfs_read_ ## thingy, \ + .write = savu_sysfs_write_ ## thingy \ + } + +-#define SAVU_BIN_ATTRIBUTE_R(thingy, THINGY) \ +-{ \ +- .attr = { .name = #thingy, .mode = 0440 }, \ +- .size = SAVU_SIZE_ ## THINGY, \ +- .read = savu_sysfs_read_ ## thingy, \ +-} +- + #define SAVU_BIN_ATTRIBUTE_W(thingy, THINGY) \ +-{ \ ++SAVU_SYSFS_W(thingy, THINGY); \ ++static struct bin_attribute bin_attr_##thingy = { \ + .attr = { .name = #thingy, .mode = 0220 }, \ + .size = SAVU_SIZE_ ## THINGY, \ + .write = savu_sysfs_write_ ## thingy \ + } + +-SAVU_SYSFS_W(control, CONTROL) +-SAVU_SYSFS_RW(profile, PROFILE) +-SAVU_SYSFS_RW(general, GENERAL) +-SAVU_SYSFS_RW(buttons, BUTTONS) +-SAVU_SYSFS_RW(macro, MACRO) +-SAVU_SYSFS_RW(info, INFO) +-SAVU_SYSFS_RW(sensor, SENSOR) +- +-static struct bin_attribute savu_bin_attributes[] = { +- SAVU_BIN_ATTRIBUTE_W(control, CONTROL), +- SAVU_BIN_ATTRIBUTE_RW(profile, PROFILE), +- SAVU_BIN_ATTRIBUTE_RW(general, GENERAL), +- SAVU_BIN_ATTRIBUTE_RW(buttons, BUTTONS), +- SAVU_BIN_ATTRIBUTE_RW(macro, MACRO), +- SAVU_BIN_ATTRIBUTE_RW(info, INFO), +- SAVU_BIN_ATTRIBUTE_RW(sensor, SENSOR), +- __ATTR_NULL ++SAVU_BIN_ATTRIBUTE_W(control, CONTROL); ++SAVU_BIN_ATTRIBUTE_RW(profile, PROFILE); ++SAVU_BIN_ATTRIBUTE_RW(general, GENERAL); ++SAVU_BIN_ATTRIBUTE_RW(buttons, BUTTONS); ++SAVU_BIN_ATTRIBUTE_RW(macro, MACRO); ++SAVU_BIN_ATTRIBUTE_RW(info, INFO); ++SAVU_BIN_ATTRIBUTE_RW(sensor, SENSOR); ++ ++static struct bin_attribute *savu_bin_attributes[] = { ++ &bin_attr_control, ++ &bin_attr_profile, ++ &bin_attr_general, ++ &bin_attr_buttons, ++ &bin_attr_macro, ++ &bin_attr_info, ++ &bin_attr_sensor, ++ NULL, ++}; ++ ++static const struct attribute_group savu_group = { ++ .bin_attrs = savu_bin_attributes, ++}; ++ ++static const struct attribute_group *savu_groups[] = { ++ &savu_group, ++ NULL, + }; + + static int savu_init_savu_device_struct(struct usb_device *usb_dev, +@@ -294,7 +298,7 @@ static int __init savu_init(void) + savu_class = class_create(THIS_MODULE, "savu"); + if (IS_ERR(savu_class)) + return PTR_ERR(savu_class); +- savu_class->dev_bin_attrs = savu_bin_attributes; ++ savu_class->dev_groups = savu_groups; + + retval = hid_register_driver(&savu_driver); + if (retval) diff --git a/hid-roccat-convert-class-code-to-use-dev_groups.patch b/hid-roccat-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..b32e5729c31eb9 --- /dev/null +++ b/hid-roccat-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,410 @@ +From foo@baz Tue Jul 9 14:54:09 PDT 2013 +Date: Tue, 09 Jul 2013 14:54:09 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: HID: roccat: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the roccat class code to use the +correct field. + +Cc: Jiri Kosina <jkosina@suse.cz> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/hid/hid-roccat-arvo.c | 25 ++++++++++++++----------- + drivers/hid/hid-roccat-isku.c | 13 +++++++------ + drivers/hid/hid-roccat-kone.c | 30 ++++++++++++++++++------------ + drivers/hid/hid-roccat-koneplus.c | 26 +++++++++++++++----------- + drivers/hid/hid-roccat-kovaplus.c | 33 +++++++++++++++++++-------------- + drivers/hid/hid-roccat-pyra.c | 22 +++++++++++++--------- + 6 files changed, 86 insertions(+), 63 deletions(-) + +--- a/drivers/hid/hid-roccat-arvo.c ++++ b/drivers/hid/hid-roccat-arvo.c +@@ -75,6 +75,8 @@ static ssize_t arvo_sysfs_set_mode_key(s + + return size; + } ++static DEVICE_ATTR(mode_key, 0660, ++ arvo_sysfs_show_mode_key, arvo_sysfs_set_mode_key); + + static ssize_t arvo_sysfs_show_key_mask(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -123,6 +125,8 @@ static ssize_t arvo_sysfs_set_key_mask(s + + return size; + } ++static DEVICE_ATTR(key_mask, 0660, ++ arvo_sysfs_show_key_mask, arvo_sysfs_set_key_mask); + + /* retval is 1-5 on success, < 0 on error */ + static int arvo_get_actual_profile(struct usb_device *usb_dev) +@@ -179,6 +183,9 @@ static ssize_t arvo_sysfs_set_actual_pro + mutex_unlock(&arvo->arvo_lock); + return retval; + } ++static DEVICE_ATTR(actual_profile, 0660, ++ arvo_sysfs_show_actual_profile, ++ arvo_sysfs_set_actual_profile); + + static ssize_t arvo_sysfs_write(struct file *fp, + struct kobject *kobj, void const *buf, +@@ -239,17 +246,13 @@ static ssize_t arvo_sysfs_read_info(stru + sizeof(struct arvo_info), ARVO_COMMAND_INFO); + } + +- +-static struct device_attribute arvo_attributes[] = { +- __ATTR(mode_key, 0660, +- arvo_sysfs_show_mode_key, arvo_sysfs_set_mode_key), +- __ATTR(key_mask, 0660, +- arvo_sysfs_show_key_mask, arvo_sysfs_set_key_mask), +- __ATTR(actual_profile, 0660, +- arvo_sysfs_show_actual_profile, +- arvo_sysfs_set_actual_profile), +- __ATTR_NULL ++static struct attribute *arvo_attrs[] = { ++ &dev_attr_mode_key.attr, ++ &dev_attr_key_mask.attr, ++ &dev_attr_actual_profile.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(arvo); + + static struct bin_attribute arvo_bin_attributes[] = { + { +@@ -430,7 +433,7 @@ static int __init arvo_init(void) + arvo_class = class_create(THIS_MODULE, "arvo"); + if (IS_ERR(arvo_class)) + return PTR_ERR(arvo_class); +- arvo_class->dev_attrs = arvo_attributes; ++ arvo_class->dev_groups = arvo_groups; + arvo_class->dev_bin_attrs = arvo_bin_attributes; + + retval = hid_register_driver(&arvo_driver); +--- a/drivers/hid/hid-roccat-isku.c ++++ b/drivers/hid/hid-roccat-isku.c +@@ -109,13 +109,14 @@ static ssize_t isku_sysfs_set_actual_pro + + return size; + } ++static DEVICE_ATTR(actual_profile, 0660, isku_sysfs_show_actual_profile, ++ isku_sysfs_set_actual_profile); + +-static struct device_attribute isku_attributes[] = { +- __ATTR(actual_profile, 0660, +- isku_sysfs_show_actual_profile, +- isku_sysfs_set_actual_profile), +- __ATTR_NULL ++static struct attribute *isku_attrs[] = { ++ &dev_attr_actual_profile.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(isku); + + static ssize_t isku_sysfs_read(struct file *fp, struct kobject *kobj, + char *buf, loff_t off, size_t count, +@@ -427,7 +428,7 @@ static int __init isku_init(void) + isku_class = class_create(THIS_MODULE, "isku"); + if (IS_ERR(isku_class)) + return PTR_ERR(isku_class); +- isku_class->dev_attrs = isku_attributes; ++ isku_class->dev_groups = isku_groups; + isku_class->dev_bin_attrs = isku_bin_attributes; + + retval = hid_register_driver(&isku_driver); +--- a/drivers/hid/hid-roccat-kone.c ++++ b/drivers/hid/hid-roccat-kone.c +@@ -386,6 +386,7 @@ static ssize_t kone_sysfs_show_actual_pr + hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); + return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_profile); + } ++static DEVICE_ATTR(actual_profile, 0440, kone_sysfs_show_actual_profile, NULL); + + static ssize_t kone_sysfs_show_actual_dpi(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -394,6 +395,7 @@ static ssize_t kone_sysfs_show_actual_dp + hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); + return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_dpi); + } ++static DEVICE_ATTR(actual_dpi, 0440, kone_sysfs_show_actual_dpi, NULL); + + /* weight is read each time, since we don't get informed when it's changed */ + static ssize_t kone_sysfs_show_weight(struct device *dev, +@@ -416,6 +418,7 @@ static ssize_t kone_sysfs_show_weight(st + return retval; + return snprintf(buf, PAGE_SIZE, "%d\n", weight); + } ++static DEVICE_ATTR(weight, 0440, kone_sysfs_show_weight, NULL); + + static ssize_t kone_sysfs_show_firmware_version(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -424,6 +427,8 @@ static ssize_t kone_sysfs_show_firmware_ + hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); + return snprintf(buf, PAGE_SIZE, "%d\n", kone->firmware_version); + } ++static DEVICE_ATTR(firmware_version, 0440, kone_sysfs_show_firmware_version, ++ NULL); + + static ssize_t kone_sysfs_show_tcu(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -524,6 +529,7 @@ exit_unlock: + mutex_unlock(&kone->kone_lock); + return retval; + } ++static DEVICE_ATTR(tcu, 0660, kone_sysfs_show_tcu, kone_sysfs_set_tcu); + + static ssize_t kone_sysfs_show_startup_profile(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -570,15 +576,17 @@ static ssize_t kone_sysfs_set_startup_pr + mutex_unlock(&kone->kone_lock); + return size; + } ++static DEVICE_ATTR(startup_profile, 0660, kone_sysfs_show_startup_profile, ++ kone_sysfs_set_startup_profile); + +-static struct device_attribute kone_attributes[] = { ++static struct attribute *kone_attrs[] = { + /* + * Read actual dpi settings. + * Returns raw value for further processing. Refer to enum + * kone_polling_rates to get real value. + */ +- __ATTR(actual_dpi, 0440, kone_sysfs_show_actual_dpi, NULL), +- __ATTR(actual_profile, 0440, kone_sysfs_show_actual_profile, NULL), ++ &dev_attr_actual_dpi.attr, ++ &dev_attr_actual_profile.attr, + + /* + * The mouse can be equipped with one of four supplied weights from 5 +@@ -587,7 +595,7 @@ static struct device_attribute kone_attr + * by software. Refer to enum kone_weights to get corresponding real + * weight. + */ +- __ATTR(weight, 0440, kone_sysfs_show_weight, NULL), ++ &dev_attr_weight.attr, + + /* + * Prints firmware version stored in mouse as integer. +@@ -595,22 +603,20 @@ static struct device_attribute kone_attr + * to get the real version number the decimal point has to be shifted 2 + * positions to the left. E.g. a value of 138 means 1.38. + */ +- __ATTR(firmware_version, 0440, +- kone_sysfs_show_firmware_version, NULL), ++ &dev_attr_firmware_version.attr, + + /* + * Prints state of Tracking Control Unit as number where 0 = off and + * 1 = on. Writing 0 deactivates tcu and writing 1 calibrates and + * activates the tcu + */ +- __ATTR(tcu, 0660, kone_sysfs_show_tcu, kone_sysfs_set_tcu), ++ &dev_attr_tcu.attr, + + /* Prints and takes the number of the profile the mouse starts with */ +- __ATTR(startup_profile, 0660, +- kone_sysfs_show_startup_profile, +- kone_sysfs_set_startup_profile), +- __ATTR_NULL ++ &dev_attr_startup_profile.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(kone); + + static struct bin_attribute kone_bin_attributes[] = { + { +@@ -891,7 +897,7 @@ static int __init kone_init(void) + kone_class = class_create(THIS_MODULE, "kone"); + if (IS_ERR(kone_class)) + return PTR_ERR(kone_class); +- kone_class->dev_attrs = kone_attributes; ++ kone_class->dev_groups = kone_groups; + kone_class->dev_bin_attrs = kone_bin_attributes; + + retval = hid_register_driver(&kone_driver); +--- a/drivers/hid/hid-roccat-koneplus.c ++++ b/drivers/hid/hid-roccat-koneplus.c +@@ -274,6 +274,12 @@ static ssize_t koneplus_sysfs_set_actual + + return size; + } ++static DEVICE_ATTR(actual_profile, 0660, ++ koneplus_sysfs_show_actual_profile, ++ koneplus_sysfs_set_actual_profile); ++static DEVICE_ATTR(startup_profile, 0660, ++ koneplus_sysfs_show_actual_profile, ++ koneplus_sysfs_set_actual_profile); + + static ssize_t koneplus_sysfs_show_firmware_version(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -293,18 +299,16 @@ static ssize_t koneplus_sysfs_show_firmw + + return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version); + } ++static DEVICE_ATTR(firmware_version, 0440, ++ koneplus_sysfs_show_firmware_version, NULL); + +-static struct device_attribute koneplus_attributes[] = { +- __ATTR(actual_profile, 0660, +- koneplus_sysfs_show_actual_profile, +- koneplus_sysfs_set_actual_profile), +- __ATTR(startup_profile, 0660, +- koneplus_sysfs_show_actual_profile, +- koneplus_sysfs_set_actual_profile), +- __ATTR(firmware_version, 0440, +- koneplus_sysfs_show_firmware_version, NULL), +- __ATTR_NULL ++static struct attribute *koneplus_attrs[] = { ++ &dev_attr_actual_profile.attr, ++ &dev_attr_startup_profile.attr, ++ &dev_attr_firmware_version.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(koneplus); + + static struct bin_attribute koneplus_bin_attributes[] = { + KONEPLUS_BIN_ATTRIBUTE_W(control, CONTROL), +@@ -572,7 +576,7 @@ static int __init koneplus_init(void) + koneplus_class = class_create(THIS_MODULE, "koneplus"); + if (IS_ERR(koneplus_class)) + return PTR_ERR(koneplus_class); +- koneplus_class->dev_attrs = koneplus_attributes; ++ koneplus_class->dev_groups = koneplus_groups; + koneplus_class->dev_bin_attrs = koneplus_bin_attributes; + + retval = hid_register_driver(&koneplus_driver); +--- a/drivers/hid/hid-roccat-kovaplus.c ++++ b/drivers/hid/hid-roccat-kovaplus.c +@@ -310,6 +310,9 @@ static ssize_t kovaplus_sysfs_set_actual + + return size; + } ++static DEVICE_ATTR(actual_profile, 0660, ++ kovaplus_sysfs_show_actual_profile, ++ kovaplus_sysfs_set_actual_profile); + + static ssize_t kovaplus_sysfs_show_actual_cpi(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -318,6 +321,7 @@ static ssize_t kovaplus_sysfs_show_actua + hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); + return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_cpi); + } ++static DEVICE_ATTR(actual_cpi, 0440, kovaplus_sysfs_show_actual_cpi, NULL); + + static ssize_t kovaplus_sysfs_show_actual_sensitivity_x(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -326,6 +330,8 @@ static ssize_t kovaplus_sysfs_show_actua + hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); + return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_x_sensitivity); + } ++static DEVICE_ATTR(actual_sensitivity_x, 0440, ++ kovaplus_sysfs_show_actual_sensitivity_x, NULL); + + static ssize_t kovaplus_sysfs_show_actual_sensitivity_y(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -334,6 +340,8 @@ static ssize_t kovaplus_sysfs_show_actua + hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); + return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_y_sensitivity); + } ++static DEVICE_ATTR(actual_sensitivity_y, 0440, ++ kovaplus_sysfs_show_actual_sensitivity_y, NULL); + + static ssize_t kovaplus_sysfs_show_firmware_version(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -353,21 +361,18 @@ static ssize_t kovaplus_sysfs_show_firmw + + return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version); + } ++static DEVICE_ATTR(firmware_version, 0440, ++ kovaplus_sysfs_show_firmware_version, NULL); + +-static struct device_attribute kovaplus_attributes[] = { +- __ATTR(actual_cpi, 0440, +- kovaplus_sysfs_show_actual_cpi, NULL), +- __ATTR(firmware_version, 0440, +- kovaplus_sysfs_show_firmware_version, NULL), +- __ATTR(actual_profile, 0660, +- kovaplus_sysfs_show_actual_profile, +- kovaplus_sysfs_set_actual_profile), +- __ATTR(actual_sensitivity_x, 0440, +- kovaplus_sysfs_show_actual_sensitivity_x, NULL), +- __ATTR(actual_sensitivity_y, 0440, +- kovaplus_sysfs_show_actual_sensitivity_y, NULL), +- __ATTR_NULL ++static struct attribute *kovaplus_attrs[] = { ++ &dev_attr_actual_cpi.attr, ++ &dev_attr_firmware_version.attr, ++ &dev_attr_actual_profile.attr, ++ &dev_attr_actual_sensitivity_x.attr, ++ &dev_attr_actual_sensitivity_y.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(kovaplus); + + static struct bin_attribute kovaplus_bin_attributes[] = { + KOVAPLUS_BIN_ATTRIBUTE_W(control, CONTROL), +@@ -662,7 +667,7 @@ static int __init kovaplus_init(void) + kovaplus_class = class_create(THIS_MODULE, "kovaplus"); + if (IS_ERR(kovaplus_class)) + return PTR_ERR(kovaplus_class); +- kovaplus_class->dev_attrs = kovaplus_attributes; ++ kovaplus_class->dev_groups = kovaplus_groups; + kovaplus_class->dev_bin_attrs = kovaplus_bin_attributes; + + retval = hid_register_driver(&kovaplus_driver); +--- a/drivers/hid/hid-roccat-pyra.c ++++ b/drivers/hid/hid-roccat-pyra.c +@@ -266,6 +266,7 @@ static ssize_t pyra_sysfs_show_actual_cp + hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); + return snprintf(buf, PAGE_SIZE, "%d\n", pyra->actual_cpi); + } ++static DEVICE_ATTR(actual_cpi, 0440, pyra_sysfs_show_actual_cpi, NULL); + + static ssize_t pyra_sysfs_show_actual_profile(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -282,6 +283,8 @@ static ssize_t pyra_sysfs_show_actual_pr + + return snprintf(buf, PAGE_SIZE, "%d\n", settings.startup_profile); + } ++static DEVICE_ATTR(actual_profile, 0440, pyra_sysfs_show_actual_profile, NULL); ++static DEVICE_ATTR(startup_profile, 0440, pyra_sysfs_show_actual_profile, NULL); + + static ssize_t pyra_sysfs_show_firmware_version(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -301,16 +304,17 @@ static ssize_t pyra_sysfs_show_firmware_ + + return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version); + } ++static DEVICE_ATTR(firmware_version, 0440, pyra_sysfs_show_firmware_version, ++ NULL); + +-static struct device_attribute pyra_attributes[] = { +- __ATTR(actual_cpi, 0440, pyra_sysfs_show_actual_cpi, NULL), +- __ATTR(actual_profile, 0440, pyra_sysfs_show_actual_profile, NULL), +- __ATTR(firmware_version, 0440, +- pyra_sysfs_show_firmware_version, NULL), +- __ATTR(startup_profile, 0440, +- pyra_sysfs_show_actual_profile, NULL), +- __ATTR_NULL ++static struct attribute *pyra_attrs[] = { ++ &dev_attr_actual_cpi.attr, ++ &dev_attr_actual_profile.attr, ++ &dev_attr_firmware_version.attr, ++ &dev_attr_startup_profile.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(pyra); + + static struct bin_attribute pyra_bin_attributes[] = { + PYRA_BIN_ATTRIBUTE_W(control, CONTROL), +@@ -600,7 +604,7 @@ static int __init pyra_init(void) + pyra_class = class_create(THIS_MODULE, "pyra"); + if (IS_ERR(pyra_class)) + return PTR_ERR(pyra_class); +- pyra_class->dev_attrs = pyra_attributes; ++ pyra_class->dev_groups = pyra_groups; + pyra_class->dev_bin_attrs = pyra_bin_attributes; + + retval = hid_register_driver(&pyra_driver); diff --git a/isdn-convert-class-code-to-use-dev_groups.patch b/isdn-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..b5478287095c64 --- /dev/null +++ b/isdn-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,159 @@ +From foo@baz Tue Jul 9 14:55:31 PDT 2013 +Date: Tue, 09 Jul 2013 14:55:31 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: ISDN: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the mISDN class code to use the +correct field. + +Cc: Karsten Keil <isdn@linux-pingi.de> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/isdn/mISDN/core.c | 62 +++++++++++++++++++++++++--------------------- + 1 file changed, 35 insertions(+), 27 deletions(-) + +--- a/drivers/isdn/mISDN/core.c ++++ b/drivers/isdn/mISDN/core.c +@@ -37,8 +37,8 @@ static void mISDN_dev_release(struct dev + /* nothing to do: the device is part of its parent's data structure */ + } + +-static ssize_t _show_id(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t id_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct mISDNdevice *mdev = dev_to_mISDN(dev); + +@@ -46,9 +46,10 @@ static ssize_t _show_id(struct device *d + return -ENODEV; + return sprintf(buf, "%d\n", mdev->id); + } ++static DEVICE_ATTR_RO(id); + +-static ssize_t _show_nrbchan(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t nrbchan_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct mISDNdevice *mdev = dev_to_mISDN(dev); + +@@ -56,9 +57,10 @@ static ssize_t _show_nrbchan(struct devi + return -ENODEV; + return sprintf(buf, "%d\n", mdev->nrbchan); + } ++static DEVICE_ATTR_RO(nrbchan); + +-static ssize_t _show_d_protocols(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t d_protocols_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct mISDNdevice *mdev = dev_to_mISDN(dev); + +@@ -66,9 +68,10 @@ static ssize_t _show_d_protocols(struct + return -ENODEV; + return sprintf(buf, "%d\n", mdev->Dprotocols); + } ++static DEVICE_ATTR_RO(d_protocols); + +-static ssize_t _show_b_protocols(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t b_protocols_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct mISDNdevice *mdev = dev_to_mISDN(dev); + +@@ -76,9 +79,10 @@ static ssize_t _show_b_protocols(struct + return -ENODEV; + return sprintf(buf, "%d\n", mdev->Bprotocols | get_all_Bprotocols()); + } ++static DEVICE_ATTR_RO(b_protocols); + +-static ssize_t _show_protocol(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t protocol_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct mISDNdevice *mdev = dev_to_mISDN(dev); + +@@ -86,17 +90,19 @@ static ssize_t _show_protocol(struct dev + return -ENODEV; + return sprintf(buf, "%d\n", mdev->D.protocol); + } ++static DEVICE_ATTR_RO(protocol); + +-static ssize_t _show_name(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t name_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + strcpy(buf, dev_name(dev)); + return strlen(buf); + } ++static DEVICE_ATTR_RO(name); + + #if 0 /* hangs */ +-static ssize_t _set_name(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t count) ++static ssize_t name_set(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + int err = 0; + char *out = kmalloc(count + 1, GFP_KERNEL); +@@ -113,10 +119,11 @@ static ssize_t _set_name(struct device * + + return (err < 0) ? err : count; + } ++static DEVICE_ATTR_RW(name); + #endif + +-static ssize_t _show_channelmap(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t channelmap_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct mISDNdevice *mdev = dev_to_mISDN(dev); + char *bp = buf; +@@ -127,18 +134,19 @@ static ssize_t _show_channelmap(struct d + + return bp - buf; + } ++static DEVICE_ATTR_RO(channelmap); + +-static struct device_attribute mISDN_dev_attrs[] = { +- __ATTR(id, S_IRUGO, _show_id, NULL), +- __ATTR(d_protocols, S_IRUGO, _show_d_protocols, NULL), +- __ATTR(b_protocols, S_IRUGO, _show_b_protocols, NULL), +- __ATTR(protocol, S_IRUGO, _show_protocol, NULL), +- __ATTR(channelmap, S_IRUGO, _show_channelmap, NULL), +- __ATTR(nrbchan, S_IRUGO, _show_nrbchan, NULL), +- __ATTR(name, S_IRUGO, _show_name, NULL), +-/* __ATTR(name, S_IRUGO | S_IWUSR, _show_name, _set_name), */ +- {} ++static struct attribute *mISDN_attrs[] = { ++ &dev_attr_id.attr, ++ &dev_attr_d_protocols.attr, ++ &dev_attr_b_protocols.attr, ++ &dev_attr_protocol.attr, ++ &dev_attr_channelmap.attr, ++ &dev_attr_nrbchan.attr, ++ &dev_attr_name.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(mISDN); + + static int mISDN_uevent(struct device *dev, struct kobj_uevent_env *env) + { +@@ -162,7 +170,7 @@ static struct class mISDN_class = { + .name = "mISDN", + .owner = THIS_MODULE, + .dev_uevent = mISDN_uevent, +- .dev_attrs = mISDN_dev_attrs, ++ .dev_groups = mISDN_groups, + .dev_release = mISDN_dev_release, + .class_release = mISDN_class_release, + }; diff --git a/leds-convert-class-code-to-use-dev_groups.patch b/leds-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..ace9ceac4fa186 --- /dev/null +++ b/leds-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,95 @@ +From foo@baz Tue Jul 9 14:58:19 PDT 2013 +Date: Tue, 09 Jul 2013 14:58:19 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: leds: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the led class code to use the +correct field. + +Cc: Bryan Wu <cooloney@gmail.com> +Cc: Richard Purdie <rpurdie@rpsys.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/leds/led-class.c | 38 ++++++++++++++++++++++++++++++-------- + 1 file changed, 30 insertions(+), 8 deletions(-) + +--- a/drivers/leds/led-class.c ++++ b/drivers/leds/led-class.c +@@ -29,7 +29,7 @@ static void led_update_brightness(struct + led_cdev->brightness = led_cdev->brightness_get(led_cdev); + } + +-static ssize_t led_brightness_show(struct device *dev, ++static ssize_t brightness_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct led_classdev *led_cdev = dev_get_drvdata(dev); +@@ -40,7 +40,7 @@ static ssize_t led_brightness_show(struc + return sprintf(buf, "%u\n", led_cdev->brightness); + } + +-static ssize_t led_brightness_store(struct device *dev, ++static ssize_t brightness_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t size) + { + struct led_classdev *led_cdev = dev_get_drvdata(dev); +@@ -57,6 +57,7 @@ static ssize_t led_brightness_store(stru + + return size; + } ++static DEVICE_ATTR_RW(brightness); + + static ssize_t led_max_brightness_show(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -65,14 +66,35 @@ static ssize_t led_max_brightness_show(s + + return sprintf(buf, "%u\n", led_cdev->max_brightness); + } ++static DEVICE_ATTR(max_brightness, 0444, led_max_brightness_show, NULL); + +-static struct device_attribute led_class_attrs[] = { +- __ATTR(brightness, 0644, led_brightness_show, led_brightness_store), +- __ATTR(max_brightness, 0444, led_max_brightness_show, NULL), + #ifdef CONFIG_LEDS_TRIGGERS +- __ATTR(trigger, 0644, led_trigger_show, led_trigger_store), ++static DEVICE_ATTR(trigger, 0644, led_trigger_show, led_trigger_store); ++static struct attribute *led_trigger_attrs[] = { ++ &dev_attr_trigger.attr, ++ NULL, ++}; ++static const struct attribute_group led_trigger_group = { ++ .attrs = led_trigger_attrs, ++}; ++#endif ++ ++static struct attribute *led_class_attrs[] = { ++ &dev_attr_brightness.attr, ++ &dev_attr_max_brightness.attr, ++ NULL, ++}; ++ ++static const struct attribute_group led_group = { ++ .attrs = led_class_attrs, ++}; ++ ++static const struct attribute_group *led_groups[] = { ++ &led_group, ++#ifdef CONFIG_LEDS_TRIGGERS ++ &led_trigger_group, + #endif +- __ATTR_NULL, ++ NULL, + }; + + static void led_timer_function(unsigned long data) +@@ -258,7 +280,7 @@ static int __init leds_init(void) + if (IS_ERR(leds_class)) + return PTR_ERR(leds_class); + leds_class->pm = &leds_class_dev_pm_ops; +- leds_class->dev_attrs = led_class_attrs; ++ leds_class->dev_groups = led_groups; + return 0; + } + diff --git a/mips-convert-vpe_class-to-use-dev_groups.patch b/mips-convert-vpe_class-to-use-dev_groups.patch new file mode 100644 index 00000000000000..e40022b38932d6 --- /dev/null +++ b/mips-convert-vpe_class-to-use-dev_groups.patch @@ -0,0 +1,67 @@ +From foo@baz Tue Jul 9 14:46:12 PDT 2013 +Date: Tue, 09 Jul 2013 14:46:12 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: mips: convert vpe_class to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the MIPS vpe_class code to use +the correct field. + +Cc: Ralf Baechle <ralf@linux-mips.org> +Cc: John Crispin <blogic@openwrt.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + arch/mips/kernel/vpe.c | 17 ++++++++++------- + 1 file changed, 10 insertions(+), 7 deletions(-) + +--- a/arch/mips/kernel/vpe.c ++++ b/arch/mips/kernel/vpe.c +@@ -1335,8 +1335,9 @@ static ssize_t store_kill(struct device + + return len; + } ++static DEVICE_ATTR(kill, S_IWUSR, NULL, store_kill); + +-static ssize_t show_ntcs(struct device *cd, struct device_attribute *attr, ++static ssize_t ntcs_show(struct device *cd, struct device_attribute *attr, + char *buf) + { + struct vpe *vpe = get_vpe(tclimit); +@@ -1344,7 +1345,7 @@ static ssize_t show_ntcs(struct device * + return sprintf(buf, "%d\n", vpe->ntcs); + } + +-static ssize_t store_ntcs(struct device *dev, struct device_attribute *attr, ++static ssize_t ntcs_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t len) + { + struct vpe *vpe = get_vpe(tclimit); +@@ -1365,12 +1366,14 @@ static ssize_t store_ntcs(struct device + out_einval: + return -EINVAL; + } ++static DEVICE_ATTR_RW(ntcs); + +-static struct device_attribute vpe_class_attributes[] = { +- __ATTR(kill, S_IWUSR, NULL, store_kill), +- __ATTR(ntcs, S_IRUGO | S_IWUSR, show_ntcs, store_ntcs), +- {} ++static struct attribute vpe_attrs[] = { ++ &dev_attr_kill.attr, ++ &dev_attr_ntcs.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(vpe); + + static void vpe_device_release(struct device *cd) + { +@@ -1381,7 +1384,7 @@ struct class vpe_class = { + .name = "vpe", + .owner = THIS_MODULE, + .dev_release = vpe_device_release, +- .dev_attrs = vpe_class_attributes, ++ .dev_groups = vpe_groups, + }; + + struct device vpe_device; diff --git a/misc-c2port-use-dev_bin_attrs-instead-of-hand-coding-it.patch b/misc-c2port-use-dev_bin_attrs-instead-of-hand-coding-it.patch new file mode 100644 index 00000000000000..79a279f1d14c21 --- /dev/null +++ b/misc-c2port-use-dev_bin_attrs-instead-of-hand-coding-it.patch @@ -0,0 +1,93 @@ +From foo@baz Mon Jul 8 11:31:26 PDT 2013 +Date: Mon, 08 Jul 2013 11:31:26 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: [PATCH] misc: c2port: use dev_bin_attrs instead of hand-coding it + +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +Classes support a list of default binary attributes, so use that in the +c2port driver, instead of hand creating and destroying the file, which +is racing with userspace. Bonus is this removes lines of code. + +Cc: Rodolfo Giometti <giometti@linux.it> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +-- + drivers/misc/c2port/core.c | 30 +++++++++++++----------------- + 1 file changed, 13 insertions(+), 17 deletions(-) + +--- a/drivers/misc/c2port/core.c ++++ b/drivers/misc/c2port/core.c +@@ -867,14 +867,17 @@ static struct device_attribute c2port_at + __ATTR_NULL, + }; + +-static struct bin_attribute c2port_bin_attrs = { +- .attr = { +- .name = "flash_data", +- .mode = 0644 ++static struct bin_attribute c2port_bin_attrs[] = { ++ { ++ .attr = { ++ .name = "flash_data", ++ .mode = 0644 ++ }, ++ .read = c2port_read_flash_data, ++ .write = c2port_write_flash_data, ++ /* .size is computed at run-time */ + }, +- .read = c2port_read_flash_data, +- .write = c2port_write_flash_data, +- /* .size is computed at run-time */ ++ __ATTR_NULL + }; + + /* +@@ -907,6 +910,8 @@ struct c2port_device *c2port_device_regi + goto error_idr_alloc; + c2dev->id = ret; + ++ c2port_bin_attrs[0].size = ops->blocks_num * ops->block_size; ++ + c2dev->dev = device_create(c2port_class, NULL, 0, c2dev, + "c2port%d", c2dev->id); + if (unlikely(IS_ERR(c2dev->dev))) { +@@ -919,12 +924,6 @@ struct c2port_device *c2port_device_regi + c2dev->ops = ops; + mutex_init(&c2dev->mutex); + +- /* Create binary file */ +- c2port_bin_attrs.size = ops->blocks_num * ops->block_size; +- ret = device_create_bin_file(c2dev->dev, &c2port_bin_attrs); +- if (unlikely(ret)) +- goto error_device_create_bin_file; +- + /* By default C2 port access is off */ + c2dev->access = c2dev->flash_access = 0; + ops->access(c2dev, 0); +@@ -937,9 +936,6 @@ struct c2port_device *c2port_device_regi + + return c2dev; + +-error_device_create_bin_file: +- device_destroy(c2port_class, 0); +- + error_device_create: + spin_lock_irq(&c2port_idr_lock); + idr_remove(&c2port_idr, c2dev->id); +@@ -959,7 +955,6 @@ void c2port_device_unregister(struct c2p + + dev_info(c2dev->dev, "C2 port %s removed\n", c2dev->name); + +- device_remove_bin_file(c2dev->dev, &c2port_bin_attrs); + spin_lock_irq(&c2port_idr_lock); + idr_remove(&c2port_idr, c2dev->id); + spin_unlock_irq(&c2port_idr_lock); +@@ -985,6 +980,7 @@ static int __init c2port_init(void) + return PTR_ERR(c2port_class); + } + c2port_class->dev_attrs = c2port_attrs; ++ c2port_class->dev_bin_attrs = c2port_bin_attrs; + + return 0; + } diff --git a/net-core-convert-class-code-to-use-dev_groups.patch b/net-core-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..31aecfb7d86d41 --- /dev/null +++ b/net-core-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,337 @@ +From foo@baz Tue Jul 9 16:17:49 PDT 2013 +Date: Tue, 09 Jul 2013 16:17:49 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: net: core: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the networking core class code to +use the correct field. + +In order to do this in the "cleanest" way, some of the macros had to be +changed to reflect the driver core format of naming show/store +functions, which accounts for the majority of the churn in this file. + +Cc: netdev@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + + +--- + net/core/net-sysfs.c | 134 ++++++++++++++++++++++++++++----------------------- + 1 file changed, 74 insertions(+), 60 deletions(-) + +--- a/net/core/net-sysfs.c ++++ b/net/core/net-sysfs.c +@@ -60,12 +60,19 @@ static ssize_t format_##field(const stru + { \ + return sprintf(buf, format_string, net->field); \ + } \ +-static ssize_t show_##field(struct device *dev, \ ++static ssize_t field##_show(struct device *dev, \ + struct device_attribute *attr, char *buf) \ + { \ + return netdev_show(dev, attr, buf, format_##field); \ +-} ++} \ + ++#define NETDEVICE_SHOW_RO(field, format_string) \ ++NETDEVICE_SHOW(field, format_string); \ ++static DEVICE_ATTR_RO(field) ++ ++#define NETDEVICE_SHOW_RW(field, format_string) \ ++NETDEVICE_SHOW(field, format_string); \ ++static DEVICE_ATTR_RW(field) + + /* use same locking and permission rules as SIF* ioctl's */ + static ssize_t netdev_store(struct device *dev, struct device_attribute *attr, +@@ -96,16 +103,16 @@ static ssize_t netdev_store(struct devic + return ret; + } + +-NETDEVICE_SHOW(dev_id, fmt_hex); +-NETDEVICE_SHOW(addr_assign_type, fmt_dec); +-NETDEVICE_SHOW(addr_len, fmt_dec); +-NETDEVICE_SHOW(iflink, fmt_dec); +-NETDEVICE_SHOW(ifindex, fmt_dec); +-NETDEVICE_SHOW(type, fmt_dec); +-NETDEVICE_SHOW(link_mode, fmt_dec); ++NETDEVICE_SHOW_RO(dev_id, fmt_hex); ++NETDEVICE_SHOW_RO(addr_assign_type, fmt_dec); ++NETDEVICE_SHOW_RO(addr_len, fmt_dec); ++NETDEVICE_SHOW_RO(iflink, fmt_dec); ++NETDEVICE_SHOW_RO(ifindex, fmt_dec); ++NETDEVICE_SHOW_RO(type, fmt_dec); ++NETDEVICE_SHOW_RO(link_mode, fmt_dec); + + /* use same locking rules as GIFHWADDR ioctl's */ +-static ssize_t show_address(struct device *dev, struct device_attribute *attr, ++static ssize_t address_show(struct device *dev, struct device_attribute *attr, + char *buf) + { + struct net_device *net = to_net_dev(dev); +@@ -117,15 +124,17 @@ static ssize_t show_address(struct devic + read_unlock(&dev_base_lock); + return ret; + } ++static DEVICE_ATTR_RO(address); + +-static ssize_t show_broadcast(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t broadcast_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct net_device *net = to_net_dev(dev); + if (dev_isalive(net)) + return sysfs_format_mac(buf, net->broadcast, net->addr_len); + return -EINVAL; + } ++static DEVICE_ATTR_RO(broadcast); + + static int change_carrier(struct net_device *net, unsigned long new_carrier) + { +@@ -134,13 +143,13 @@ static int change_carrier(struct net_dev + return dev_change_carrier(net, (bool) new_carrier); + } + +-static ssize_t store_carrier(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t len) ++static ssize_t carrier_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t len) + { + return netdev_store(dev, attr, buf, len, change_carrier); + } + +-static ssize_t show_carrier(struct device *dev, ++static ssize_t carrier_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct net_device *netdev = to_net_dev(dev); +@@ -149,8 +158,9 @@ static ssize_t show_carrier(struct devic + } + return -EINVAL; + } ++static DEVICE_ATTR_RW(carrier); + +-static ssize_t show_speed(struct device *dev, ++static ssize_t speed_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct net_device *netdev = to_net_dev(dev); +@@ -167,8 +177,9 @@ static ssize_t show_speed(struct device + rtnl_unlock(); + return ret; + } ++static DEVICE_ATTR_RO(speed); + +-static ssize_t show_duplex(struct device *dev, ++static ssize_t duplex_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct net_device *netdev = to_net_dev(dev); +@@ -198,8 +209,9 @@ static ssize_t show_duplex(struct device + rtnl_unlock(); + return ret; + } ++static DEVICE_ATTR_RO(duplex); + +-static ssize_t show_dormant(struct device *dev, ++static ssize_t dormant_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct net_device *netdev = to_net_dev(dev); +@@ -209,6 +221,7 @@ static ssize_t show_dormant(struct devic + + return -EINVAL; + } ++static DEVICE_ATTR_RO(dormant); + + static const char *const operstates[] = { + "unknown", +@@ -220,7 +233,7 @@ static const char *const operstates[] = + "up" + }; + +-static ssize_t show_operstate(struct device *dev, ++static ssize_t operstate_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + const struct net_device *netdev = to_net_dev(dev); +@@ -237,35 +250,33 @@ static ssize_t show_operstate(struct dev + + return sprintf(buf, "%s\n", operstates[operstate]); + } ++static DEVICE_ATTR_RO(operstate); + + /* read-write attributes */ +-NETDEVICE_SHOW(mtu, fmt_dec); + + static int change_mtu(struct net_device *net, unsigned long new_mtu) + { + return dev_set_mtu(net, (int) new_mtu); + } + +-static ssize_t store_mtu(struct device *dev, struct device_attribute *attr, ++static ssize_t mtu_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t len) + { + return netdev_store(dev, attr, buf, len, change_mtu); + } +- +-NETDEVICE_SHOW(flags, fmt_hex); ++NETDEVICE_SHOW_RW(mtu, fmt_dec); + + static int change_flags(struct net_device *net, unsigned long new_flags) + { + return dev_change_flags(net, (unsigned int) new_flags); + } + +-static ssize_t store_flags(struct device *dev, struct device_attribute *attr, ++static ssize_t flags_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t len) + { + return netdev_store(dev, attr, buf, len, change_flags); + } +- +-NETDEVICE_SHOW(tx_queue_len, fmt_ulong); ++NETDEVICE_SHOW_RW(flags, fmt_hex); + + static int change_tx_queue_len(struct net_device *net, unsigned long new_len) + { +@@ -273,7 +284,7 @@ static int change_tx_queue_len(struct ne + return 0; + } + +-static ssize_t store_tx_queue_len(struct device *dev, ++static ssize_t tx_queue_len_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) + { +@@ -282,8 +293,9 @@ static ssize_t store_tx_queue_len(struct + + return netdev_store(dev, attr, buf, len, change_tx_queue_len); + } ++NETDEVICE_SHOW_RW(tx_queue_len, fmt_ulong); + +-static ssize_t store_ifalias(struct device *dev, struct device_attribute *attr, ++static ssize_t ifalias_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t len) + { + struct net_device *netdev = to_net_dev(dev); +@@ -306,7 +318,7 @@ static ssize_t store_ifalias(struct devi + return ret < 0 ? ret : len; + } + +-static ssize_t show_ifalias(struct device *dev, ++static ssize_t ifalias_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + const struct net_device *netdev = to_net_dev(dev); +@@ -319,8 +331,7 @@ static ssize_t show_ifalias(struct devic + rtnl_unlock(); + return ret; + } +- +-NETDEVICE_SHOW(group, fmt_dec); ++static DEVICE_ATTR_RW(ifalias); + + static int change_group(struct net_device *net, unsigned long new_group) + { +@@ -328,35 +339,37 @@ static int change_group(struct net_devic + return 0; + } + +-static ssize_t store_group(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t len) ++static ssize_t group_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t len) + { + return netdev_store(dev, attr, buf, len, change_group); + } ++NETDEVICE_SHOW(group, fmt_dec); ++static DEVICE_ATTR(netdev_group, S_IRUGO | S_IWUSR, group_show, group_store); + +-static struct device_attribute net_class_attributes[] = { +- __ATTR(addr_assign_type, S_IRUGO, show_addr_assign_type, NULL), +- __ATTR(addr_len, S_IRUGO, show_addr_len, NULL), +- __ATTR(dev_id, S_IRUGO, show_dev_id, NULL), +- __ATTR(ifalias, S_IRUGO | S_IWUSR, show_ifalias, store_ifalias), +- __ATTR(iflink, S_IRUGO, show_iflink, NULL), +- __ATTR(ifindex, S_IRUGO, show_ifindex, NULL), +- __ATTR(type, S_IRUGO, show_type, NULL), +- __ATTR(link_mode, S_IRUGO, show_link_mode, NULL), +- __ATTR(address, S_IRUGO, show_address, NULL), +- __ATTR(broadcast, S_IRUGO, show_broadcast, NULL), +- __ATTR(carrier, S_IRUGO | S_IWUSR, show_carrier, store_carrier), +- __ATTR(speed, S_IRUGO, show_speed, NULL), +- __ATTR(duplex, S_IRUGO, show_duplex, NULL), +- __ATTR(dormant, S_IRUGO, show_dormant, NULL), +- __ATTR(operstate, S_IRUGO, show_operstate, NULL), +- __ATTR(mtu, S_IRUGO | S_IWUSR, show_mtu, store_mtu), +- __ATTR(flags, S_IRUGO | S_IWUSR, show_flags, store_flags), +- __ATTR(tx_queue_len, S_IRUGO | S_IWUSR, show_tx_queue_len, +- store_tx_queue_len), +- __ATTR(netdev_group, S_IRUGO | S_IWUSR, show_group, store_group), +- {} ++static struct attribute *net_class_attrs[] = { ++ &dev_attr_netdev_group.attr, ++ &dev_attr_type.attr, ++ &dev_attr_dev_id.attr, ++ &dev_attr_iflink.attr, ++ &dev_attr_ifindex.attr, ++ &dev_attr_addr_assign_type.attr, ++ &dev_attr_addr_len.attr, ++ &dev_attr_link_mode.attr, ++ &dev_attr_address.attr, ++ &dev_attr_broadcast.attr, ++ &dev_attr_speed.attr, ++ &dev_attr_duplex.attr, ++ &dev_attr_dormant.attr, ++ &dev_attr_operstate.attr, ++ &dev_attr_ifalias.attr, ++ &dev_attr_carrier.attr, ++ &dev_attr_mtu.attr, ++ &dev_attr_flags.attr, ++ &dev_attr_tx_queue_len.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(net_class); + + /* Show a given an attribute in the statistics group */ + static ssize_t netstat_show(const struct device *d, +@@ -382,13 +395,13 @@ static ssize_t netstat_show(const struct + + /* generate a read-only statistics attribute */ + #define NETSTAT_ENTRY(name) \ +-static ssize_t show_##name(struct device *d, \ ++static ssize_t name##_show(struct device *d, \ + struct device_attribute *attr, char *buf) \ + { \ + return netstat_show(d, attr, buf, \ + offsetof(struct rtnl_link_stats64, name)); \ + } \ +-static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL) ++static DEVICE_ATTR_RO(name) + + NETSTAT_ENTRY(rx_packets); + NETSTAT_ENTRY(tx_packets); +@@ -457,6 +470,9 @@ static struct attribute_group wireless_g + .attrs = wireless_attrs, + }; + #endif ++ ++#else /* CONFIG_SYSFS */ ++#define net_class_groups NULL + #endif /* CONFIG_SYSFS */ + + #ifdef CONFIG_RPS +@@ -1229,9 +1245,7 @@ static const void *net_namespace(struct + static struct class net_class = { + .name = "net", + .dev_release = netdev_release, +-#ifdef CONFIG_SYSFS +- .dev_attrs = net_class_attributes, +-#endif /* CONFIG_SYSFS */ ++ .dev_groups = net_class_groups, + .dev_uevent = netdev_uevent, + .ns_type = &net_ns_type_operations, + .namespace = net_namespace, diff --git a/net-ieee802154-convert-class-code-to-use-dev_groups.patch b/net-ieee802154-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..53d0526a29b7a2 --- /dev/null +++ b/net-ieee802154-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,66 @@ +From foo@baz Tue Jul 9 16:20:29 PDT 2013 +Date: Tue, 09 Jul 2013 16:20:29 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: net: ieee802154: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the ieee802154 class code to use +the correct field. + +Cc: Alexander Smirnov <alex.bluesman.smirnov@gmail.com> +Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> +Cc: netdev@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + + +--- + net/ieee802154/wpan-class.c | 21 ++++++++++++--------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +--- a/net/ieee802154/wpan-class.c ++++ b/net/ieee802154/wpan-class.c +@@ -36,7 +36,8 @@ static ssize_t name ## _show(struct devi + ret = snprintf(buf, PAGE_SIZE, format_string "\n", args); \ + mutex_unlock(&phy->pib_lock); \ + return ret; \ +-} ++} \ ++static DEVICE_ATTR_RO(name); + + #define MASTER_SHOW(field, format_string) \ + MASTER_SHOW_COMPLEX(field, format_string, phy->field) +@@ -66,15 +67,17 @@ static ssize_t channels_supported_show(s + mutex_unlock(&phy->pib_lock); + return len; + } ++static DEVICE_ATTR_RO(channels_supported); + +-static struct device_attribute pmib_attrs[] = { +- __ATTR_RO(current_channel), +- __ATTR_RO(current_page), +- __ATTR_RO(channels_supported), +- __ATTR_RO(transmit_power), +- __ATTR_RO(cca_mode), +- {}, ++static struct attribute *pmib_attrs[] = { ++ &dev_attr_current_channel.attr, ++ &dev_attr_current_page.attr, ++ &dev_attr_channels_supported.attr, ++ &dev_attr_transmit_power.attr, ++ &dev_attr_cca_mode.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(pmib); + + static void wpan_phy_release(struct device *d) + { +@@ -85,7 +88,7 @@ static void wpan_phy_release(struct devi + static struct class wpan_phy_class = { + .name = "ieee802154", + .dev_release = wpan_phy_release, +- .dev_attrs = pmib_attrs, ++ .dev_groups = pmib_groups, + }; + + static DEFINE_MUTEX(wpan_phy_mutex); diff --git a/net-rfkill-convert-class-code-to-use-dev_groups.patch b/net-rfkill-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..71f66e171bacf6 --- /dev/null +++ b/net-rfkill-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,199 @@ +From foo@baz Tue Jul 9 16:22:33 PDT 2013 +Date: Tue, 09 Jul 2013 16:22:33 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: net: rfkill: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the rfkill class code to use the +correct field. + +Cc: Johannes Berg <johannes@sipsolutions.net> +Cc: John W. Linville <linville@tuxdriver.com> +Cc: linux-wireless@vger.kernel.org +Cc: netdev@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + net/rfkill/core.c | 88 ++++++++++++++++++++++++------------------------------ + 1 file changed, 40 insertions(+), 48 deletions(-) + +--- a/net/rfkill/core.c ++++ b/net/rfkill/core.c +@@ -576,14 +576,14 @@ void rfkill_set_states(struct rfkill *rf + } + EXPORT_SYMBOL(rfkill_set_states); + +-static ssize_t rfkill_name_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t name_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct rfkill *rfkill = to_rfkill(dev); + + return sprintf(buf, "%s\n", rfkill->name); + } ++static DEVICE_ATTR_RO(name); + + static const char *rfkill_get_type_str(enum rfkill_type type) + { +@@ -611,54 +611,52 @@ static const char *rfkill_get_type_str(e + } + } + +-static ssize_t rfkill_type_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t type_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct rfkill *rfkill = to_rfkill(dev); + + return sprintf(buf, "%s\n", rfkill_get_type_str(rfkill->type)); + } ++static DEVICE_ATTR_RO(type); + +-static ssize_t rfkill_idx_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t index_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct rfkill *rfkill = to_rfkill(dev); + + return sprintf(buf, "%d\n", rfkill->idx); + } ++static DEVICE_ATTR_RO(index); + +-static ssize_t rfkill_persistent_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t persistent_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct rfkill *rfkill = to_rfkill(dev); + + return sprintf(buf, "%d\n", rfkill->persistent); + } ++static DEVICE_ATTR_RO(persistent); + +-static ssize_t rfkill_hard_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t hard_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct rfkill *rfkill = to_rfkill(dev); + + return sprintf(buf, "%d\n", (rfkill->state & RFKILL_BLOCK_HW) ? 1 : 0 ); + } ++static DEVICE_ATTR_RO(hard); + +-static ssize_t rfkill_soft_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t soft_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct rfkill *rfkill = to_rfkill(dev); + + return sprintf(buf, "%d\n", (rfkill->state & RFKILL_BLOCK_SW) ? 1 : 0 ); + } + +-static ssize_t rfkill_soft_store(struct device *dev, +- struct device_attribute *attr, +- const char *buf, size_t count) ++static ssize_t soft_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct rfkill *rfkill = to_rfkill(dev); + unsigned long state; +@@ -680,6 +678,7 @@ static ssize_t rfkill_soft_store(struct + + return count; + } ++static DEVICE_ATTR_RW(soft); + + static u8 user_state_from_blocked(unsigned long state) + { +@@ -691,18 +690,16 @@ static u8 user_state_from_blocked(unsign + return RFKILL_USER_STATE_UNBLOCKED; + } + +-static ssize_t rfkill_state_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t state_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct rfkill *rfkill = to_rfkill(dev); + + return sprintf(buf, "%d\n", user_state_from_blocked(rfkill->state)); + } + +-static ssize_t rfkill_state_store(struct device *dev, +- struct device_attribute *attr, +- const char *buf, size_t count) ++static ssize_t state_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct rfkill *rfkill = to_rfkill(dev); + unsigned long state; +@@ -725,32 +722,27 @@ static ssize_t rfkill_state_store(struct + + return count; + } ++static DEVICE_ATTR_RW(state); + +-static ssize_t rfkill_claim_show(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t claim_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + return sprintf(buf, "%d\n", 0); + } ++static DEVICE_ATTR_RO(claim); + +-static ssize_t rfkill_claim_store(struct device *dev, +- struct device_attribute *attr, +- const char *buf, size_t count) +-{ +- return -EOPNOTSUPP; +-} +- +-static struct device_attribute rfkill_dev_attrs[] = { +- __ATTR(name, S_IRUGO, rfkill_name_show, NULL), +- __ATTR(type, S_IRUGO, rfkill_type_show, NULL), +- __ATTR(index, S_IRUGO, rfkill_idx_show, NULL), +- __ATTR(persistent, S_IRUGO, rfkill_persistent_show, NULL), +- __ATTR(state, S_IRUGO|S_IWUSR, rfkill_state_show, rfkill_state_store), +- __ATTR(claim, S_IRUGO|S_IWUSR, rfkill_claim_show, rfkill_claim_store), +- __ATTR(soft, S_IRUGO|S_IWUSR, rfkill_soft_show, rfkill_soft_store), +- __ATTR(hard, S_IRUGO, rfkill_hard_show, NULL), +- __ATTR_NULL ++static struct attribute *rfkill_dev_attrs[] = { ++ &dev_attr_name.attr, ++ &dev_attr_type.attr, ++ &dev_attr_index.attr, ++ &dev_attr_persistent.attr, ++ &dev_attr_state.attr, ++ &dev_attr_claim.attr, ++ &dev_attr_soft.attr, ++ &dev_attr_hard.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(rfkill_dev); + + static void rfkill_release(struct device *dev) + { +@@ -830,7 +822,7 @@ static int rfkill_resume(struct device * + static struct class rfkill_class = { + .name = "rfkill", + .dev_release = rfkill_release, +- .dev_attrs = rfkill_dev_attrs, ++ .dev_groups = rfkill_dev_groups, + .dev_uevent = rfkill_dev_uevent, + .suspend = rfkill_suspend, + .resume = rfkill_resume, diff --git a/net-wireless-convert-class-code-to-use-dev_groups.patch b/net-wireless-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..1c15569d5ba047 --- /dev/null +++ b/net-wireless-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,75 @@ +From foo@baz Tue Jul 9 16:21:34 PDT 2013 +Date: Tue, 09 Jul 2013 16:21:34 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: net: wireless: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the networking wireless class +code to use the correct field. + +Cc: Johannes Berg <johannes@sipsolutions.net> +Cc: John W. Linville <linville@tuxdriver.com> +Cc: linux-wireless@vger.kernel.org +Cc: netdev@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + net/wireless/sysfs.c | 23 +++++++++++++---------- + 1 file changed, 13 insertions(+), 10 deletions(-) + +--- a/net/wireless/sysfs.c ++++ b/net/wireless/sysfs.c +@@ -30,7 +30,8 @@ static ssize_t name ## _show(struct devi + char *buf) \ + { \ + return sprintf(buf, fmt "\n", dev_to_rdev(dev)->member); \ +-} ++} \ ++static DEVICE_ATTR_RO(name) + + SHOW_FMT(index, "%d", wiphy_idx); + SHOW_FMT(macaddress, "%pM", wiphy.perm_addr); +@@ -42,7 +43,7 @@ static ssize_t name_show(struct device * + struct wiphy *wiphy = &dev_to_rdev(dev)->wiphy; + return sprintf(buf, "%s\n", dev_name(&wiphy->dev)); + } +- ++static DEVICE_ATTR_RO(name); + + static ssize_t addresses_show(struct device *dev, + struct device_attribute *attr, +@@ -60,15 +61,17 @@ static ssize_t addresses_show(struct dev + + return buf - start; + } ++static DEVICE_ATTR_RO(addresses); + +-static struct device_attribute ieee80211_dev_attrs[] = { +- __ATTR_RO(index), +- __ATTR_RO(macaddress), +- __ATTR_RO(address_mask), +- __ATTR_RO(addresses), +- __ATTR_RO(name), +- {} ++static struct attribute *ieee80211_attrs[] = { ++ &dev_attr_index.attr, ++ &dev_attr_macaddress.attr, ++ &dev_attr_address_mask.attr, ++ &dev_attr_addresses.attr, ++ &dev_attr_name.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(ieee80211); + + static void wiphy_dev_release(struct device *dev) + { +@@ -146,7 +149,7 @@ struct class ieee80211_class = { + .name = "ieee80211", + .owner = THIS_MODULE, + .dev_release = wiphy_dev_release, +- .dev_attrs = ieee80211_dev_attrs, ++ .dev_groups = ieee80211_groups, + .dev_uevent = wiphy_uevent, + #ifdef CONFIG_PM + .suspend = wiphy_suspend, diff --git a/pci-convert-class-code-to-use-dev_groups.patch b/pci-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..73f40d843edfee --- /dev/null +++ b/pci-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,102 @@ +From foo@baz Tue Jul 9 15:12:13 PDT 2013 +Date: Tue, 09 Jul 2013 15:12:13 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: PCI: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the PCI class code to use the +correct field. + +Cc: Bjorn Helgaas <bhelgaas@google.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/pci/pci-sysfs.c | 32 +++++++++++++++++++++----------- + drivers/pci/pci.h | 2 +- + drivers/pci/probe.c | 2 +- + 3 files changed, 23 insertions(+), 13 deletions(-) + +--- a/drivers/pci/pci-sysfs.c ++++ b/drivers/pci/pci-sysfs.c +@@ -131,19 +131,19 @@ static ssize_t pci_bus_show_cpuaffinity( + return ret; + } + +-static inline ssize_t pci_bus_show_cpumaskaffinity(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t cpuaffinity_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + return pci_bus_show_cpuaffinity(dev, 0, attr, buf); + } ++static DEVICE_ATTR_RO(cpuaffinity); + +-static inline ssize_t pci_bus_show_cpulistaffinity(struct device *dev, +- struct device_attribute *attr, +- char *buf) ++static ssize_t cpulistaffinity_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + return pci_bus_show_cpuaffinity(dev, 1, attr, buf); + } ++static DEVICE_ATTR_RO(cpulistaffinity); + + /* show resources */ + static ssize_t +@@ -379,6 +379,7 @@ dev_bus_rescan_store(struct device *dev, + } + return count; + } ++static DEVICE_ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_bus_rescan_store); + + #if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI) + static ssize_t d3cold_allowed_store(struct device *dev, +@@ -514,11 +515,20 @@ struct device_attribute pci_dev_attrs[] + __ATTR_NULL, + }; + +-struct device_attribute pcibus_dev_attrs[] = { +- __ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_bus_rescan_store), +- __ATTR(cpuaffinity, S_IRUGO, pci_bus_show_cpumaskaffinity, NULL), +- __ATTR(cpulistaffinity, S_IRUGO, pci_bus_show_cpulistaffinity, NULL), +- __ATTR_NULL, ++static struct attribute *pcibus_attrs[] = { ++ &dev_attr_rescan.attr, ++ &dev_attr_cpuaffinity.attr, ++ &dev_attr_cpulistaffinity.attr, ++ NULL, ++}; ++ ++static const struct attribute_group pcibus_group = { ++ .attrs = pcibus_attrs, ++}; ++ ++const struct attribute_group *pcibus_groups[] = { ++ &pcibus_group, ++ NULL, + }; + + static ssize_t +--- a/drivers/pci/pci.h ++++ b/drivers/pci/pci.h +@@ -151,7 +151,7 @@ static inline int pci_no_d1d2(struct pci + + } + extern struct device_attribute pci_dev_attrs[]; +-extern struct device_attribute pcibus_dev_attrs[]; ++extern const struct attribute_group *pcibus_groups[]; + extern struct device_type pci_dev_type; + extern struct bus_attribute pci_bus_attrs[]; + +--- a/drivers/pci/probe.c ++++ b/drivers/pci/probe.c +@@ -96,7 +96,7 @@ static void release_pcibus_dev(struct de + static struct class pcibus_class = { + .name = "pci_bus", + .dev_release = &release_pcibus_dev, +- .dev_attrs = pcibus_dev_attrs, ++ .dev_groups = pcibus_groups, + }; + + static int __init pcibus_class_init(void) diff --git a/pending/driver-core-add-binary-attributes-to-struct-device.patch b/pending/driver-core-add-binary-attributes-to-struct-device.patch new file mode 100644 index 00000000000000..caf89bac3621ad --- /dev/null +++ b/pending/driver-core-add-binary-attributes-to-struct-device.patch @@ -0,0 +1,65 @@ +From foo@baz Sat Jul 6 17:21:15 PDT 2013 +Date: Sat, 06 Jul 2013 17:21:15 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: driver core: add binary attributes to struct device + +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +This lets a device provide a set of default binary attributes, like +normal attributes, that are initialized and torn down by the driver core +at the proper times, so that there are no races with userspace. + + +Reported-by: Oliver Schinagl <oliver+list@schinagl.nl> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + + +--- + drivers/base/core.c | 7 +++++++ + include/linux/device.h | 2 ++ + 2 files changed, 9 insertions(+) + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -491,8 +491,14 @@ static int device_add_attrs(struct devic + goto err_remove_type_groups; + } + ++ error = device_add_bin_attributes(dev, dev->bin_attrs); ++ if (error) ++ goto err_remove_groups; + return 0; + ++ err_remove_groups: ++ device_remove_groups(dev, dev->groups); ++ + err_remove_type_groups: + if (type) + device_remove_groups(dev, type->groups); +@@ -510,6 +516,7 @@ static void device_remove_attrs(struct d + + device_remove_file(dev, &online_attr); + device_remove_groups(dev, dev->groups); ++ device_remove_bin_attributes(dev, dev->bin_attrs); + + if (type) + device_remove_groups(dev, type->groups); +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -656,6 +656,7 @@ struct acpi_dev_node { + * @knode_class: The node used to add the device to the class list. + * @class: The class of the device. + * @groups: Optional attribute groups. ++ * @bin_attrs: Optional binary attributes for this device. + * @release: Callback to free the device after all references have + * gone away. This should be set by the allocator of the + * device (i.e. the bus driver that discovered the device). +@@ -732,6 +733,7 @@ struct device { + struct klist_node knode_class; + struct class *class; + const struct attribute_group **groups; /* optional groups */ ++ const struct bin_attribute *bin_attrs; + + void (*release)(struct device *dev); + struct iommu_group *iommu_group; diff --git a/pending/driver-core-remove-bin_attrs-from-struct-device.patch b/pending/driver-core-remove-bin_attrs-from-struct-device.patch new file mode 100644 index 00000000000000..fb15c4c0a7e05f --- /dev/null +++ b/pending/driver-core-remove-bin_attrs-from-struct-device.patch @@ -0,0 +1,59 @@ +From foo@baz Wed Jul 10 11:59:39 PDT 2013 +Date: Wed, 10 Jul 2013 11:59:39 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: driver core: remove bin_attrs from struct device + +No one is using the bin_attrs field in struct device, and now that you +can add them properly through an attribute group, it isn't needed +either, so remove it. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/base/core.c | 7 ------- + include/linux/device.h | 2 -- + 2 files changed, 9 deletions(-) + +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -491,14 +491,8 @@ static int device_add_attrs(struct devic + goto err_remove_type_groups; + } + +- error = device_add_bin_attributes(dev, dev->bin_attrs); +- if (error) +- goto err_remove_groups; + return 0; + +- err_remove_groups: +- device_remove_groups(dev, dev->groups); +- + err_remove_type_groups: + if (type) + device_remove_groups(dev, type->groups); +@@ -516,7 +510,6 @@ static void device_remove_attrs(struct d + + device_remove_file(dev, &online_attr); + device_remove_groups(dev, dev->groups); +- device_remove_bin_attributes(dev, dev->bin_attrs); + + if (type) + device_remove_groups(dev, type->groups); +--- a/include/linux/device.h ++++ b/include/linux/device.h +@@ -656,7 +656,6 @@ struct acpi_dev_node { + * @knode_class: The node used to add the device to the class list. + * @class: The class of the device. + * @groups: Optional attribute groups. +- * @bin_attrs: Optional binary attributes for this device. + * @release: Callback to free the device after all references have + * gone away. This should be set by the allocator of the + * device (i.e. the bus driver that discovered the device). +@@ -733,7 +732,6 @@ struct device { + struct klist_node knode_class; + struct class *class; + const struct attribute_group **groups; /* optional groups */ +- const struct bin_attribute *bin_attrs; + + void (*release)(struct device *dev); + struct iommu_group *iommu_group; diff --git a/pps-convert-class-code-to-use-dev_groups.patch b/pps-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..7f8da06fae3ffa --- /dev/null +++ b/pps-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,143 @@ +From foo@baz Tue Jul 9 15:16:41 PDT 2013 +Date: Tue, 09 Jul 2013 15:16:42 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: PPS: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the pps class code to use the +correct field. + +Cc: Rodolfo Giometti <giometti@enneenne.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/pps/pps.c | 2 - + drivers/pps/sysfs.c | 55 ++++++++++++++++++++++++++++----------------- + include/linux/pps_kernel.h | 2 - + 3 files changed, 37 insertions(+), 22 deletions(-) + +--- a/drivers/pps/pps.c ++++ b/drivers/pps/pps.c +@@ -406,7 +406,7 @@ static int __init pps_init(void) + pr_err("failed to allocate class\n"); + return PTR_ERR(pps_class); + } +- pps_class->dev_attrs = pps_attrs; ++ pps_class->dev_groups = pps_groups; + + err = alloc_chrdev_region(&pps_devt, 0, PPS_MAX_SOURCES, "pps"); + if (err < 0) { +--- a/drivers/pps/sysfs.c ++++ b/drivers/pps/sysfs.c +@@ -29,8 +29,8 @@ + * Attribute functions + */ + +-static ssize_t pps_show_assert(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t assert_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct pps_device *pps = dev_get_drvdata(dev); + +@@ -41,9 +41,10 @@ static ssize_t pps_show_assert(struct de + (long long) pps->assert_tu.sec, pps->assert_tu.nsec, + pps->assert_sequence); + } ++static DEVICE_ATTR_RO(assert); + +-static ssize_t pps_show_clear(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t clear_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct pps_device *pps = dev_get_drvdata(dev); + +@@ -54,45 +55,59 @@ static ssize_t pps_show_clear(struct dev + (long long) pps->clear_tu.sec, pps->clear_tu.nsec, + pps->clear_sequence); + } ++static DEVICE_ATTR_RO(clear); + +-static ssize_t pps_show_mode(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t mode_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct pps_device *pps = dev_get_drvdata(dev); + + return sprintf(buf, "%4x\n", pps->info.mode); + } ++static DEVICE_ATTR_RO(mode); + +-static ssize_t pps_show_echo(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t echo_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct pps_device *pps = dev_get_drvdata(dev); + + return sprintf(buf, "%d\n", !!pps->info.echo); + } ++static DEVICE_ATTR_RO(echo); + +-static ssize_t pps_show_name(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t name_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct pps_device *pps = dev_get_drvdata(dev); + + return sprintf(buf, "%s\n", pps->info.name); + } ++static DEVICE_ATTR_RO(name); + +-static ssize_t pps_show_path(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t path_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct pps_device *pps = dev_get_drvdata(dev); + + return sprintf(buf, "%s\n", pps->info.path); + } ++static DEVICE_ATTR_RO(path); + +-struct device_attribute pps_attrs[] = { +- __ATTR(assert, S_IRUGO, pps_show_assert, NULL), +- __ATTR(clear, S_IRUGO, pps_show_clear, NULL), +- __ATTR(mode, S_IRUGO, pps_show_mode, NULL), +- __ATTR(echo, S_IRUGO, pps_show_echo, NULL), +- __ATTR(name, S_IRUGO, pps_show_name, NULL), +- __ATTR(path, S_IRUGO, pps_show_path, NULL), +- __ATTR_NULL, ++static struct attribute *pps_attrs[] = { ++ &dev_attr_assert.attr, ++ &dev_attr_clear.attr, ++ &dev_attr_mode.attr, ++ &dev_attr_echo.attr, ++ &dev_attr_name.attr, ++ &dev_attr_path.attr, ++ NULL, ++}; ++ ++static const struct attribute_group pps_group = { ++ .attrs = pps_attrs, ++}; ++ ++const struct attribute_group *pps_groups[] = { ++ &pps_group, ++ NULL, + }; +--- a/include/linux/pps_kernel.h ++++ b/include/linux/pps_kernel.h +@@ -80,7 +80,7 @@ struct pps_device { + * Global variables + */ + +-extern struct device_attribute pps_attrs[]; ++extern const struct attribute_group *pps_groups[]; + + /* + * Internal functions. diff --git a/ptp-convert-class-code-to-use-dev_groups.patch b/ptp-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..181426831d3ee9 --- /dev/null +++ b/ptp-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,109 @@ +From foo@baz Tue Jul 9 15:17:24 PDT 2013 +Date: Tue, 09 Jul 2013 15:17:24 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: PTP: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the ptp class code to use the +correct field. + +Cc: Richard Cochran <richardcochran@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/ptp/ptp_clock.c | 2 - + drivers/ptp/ptp_private.h | 2 - + drivers/ptp/ptp_sysfs.c | 51 ++++++++++++++++++++++++++-------------------- + 3 files changed, 31 insertions(+), 24 deletions(-) + +--- a/drivers/ptp/ptp_clock.c ++++ b/drivers/ptp/ptp_clock.c +@@ -330,7 +330,7 @@ static int __init ptp_init(void) + goto no_region; + } + +- ptp_class->dev_attrs = ptp_dev_attrs; ++ ptp_class->dev_groups = ptp_groups; + pr_info("PTP clock support registered\n"); + return 0; + +--- a/drivers/ptp/ptp_private.h ++++ b/drivers/ptp/ptp_private.h +@@ -84,7 +84,7 @@ uint ptp_poll(struct posix_clock *pc, + * see ptp_sysfs.c + */ + +-extern struct device_attribute ptp_dev_attrs[]; ++extern const struct attribute_group *ptp_groups[]; + + int ptp_cleanup_sysfs(struct ptp_clock *ptp); + +--- a/drivers/ptp/ptp_sysfs.c ++++ b/drivers/ptp/ptp_sysfs.c +@@ -27,36 +27,43 @@ static ssize_t clock_name_show(struct de + struct ptp_clock *ptp = dev_get_drvdata(dev); + return snprintf(page, PAGE_SIZE-1, "%s\n", ptp->info->name); + } ++static DEVICE_ATTR(clock_name, 0444, clock_name_show, NULL); + +-#define PTP_SHOW_INT(name) \ +-static ssize_t name##_show(struct device *dev, \ ++#define PTP_SHOW_INT(name, var) \ ++static ssize_t var##_show(struct device *dev, \ + struct device_attribute *attr, char *page) \ + { \ + struct ptp_clock *ptp = dev_get_drvdata(dev); \ +- return snprintf(page, PAGE_SIZE-1, "%d\n", ptp->info->name); \ +-} ++ return snprintf(page, PAGE_SIZE-1, "%d\n", ptp->info->var); \ ++} \ ++static DEVICE_ATTR(name, 0444, var##_show, NULL); + +-PTP_SHOW_INT(max_adj); +-PTP_SHOW_INT(n_alarm); +-PTP_SHOW_INT(n_ext_ts); +-PTP_SHOW_INT(n_per_out); +-PTP_SHOW_INT(pps); +- +-#define PTP_RO_ATTR(_var, _name) { \ +- .attr = { .name = __stringify(_name), .mode = 0444 }, \ +- .show = _var##_show, \ +-} ++PTP_SHOW_INT(max_adjustment, max_adj); ++PTP_SHOW_INT(n_alarms, n_alarm); ++PTP_SHOW_INT(n_external_timestamps, n_ext_ts); ++PTP_SHOW_INT(n_periodic_outputs, n_per_out); ++PTP_SHOW_INT(pps_available, pps); ++ ++static struct attribute *ptp_attrs[] = { ++ &dev_attr_clock_name.attr, ++ &dev_attr_max_adjustment.attr, ++ &dev_attr_n_alarms.attr, ++ &dev_attr_n_external_timestamps.attr, ++ &dev_attr_n_periodic_outputs.attr, ++ &dev_attr_pps_available.attr, ++ NULL, ++}; + +-struct device_attribute ptp_dev_attrs[] = { +- PTP_RO_ATTR(clock_name, clock_name), +- PTP_RO_ATTR(max_adj, max_adjustment), +- PTP_RO_ATTR(n_alarm, n_alarms), +- PTP_RO_ATTR(n_ext_ts, n_external_timestamps), +- PTP_RO_ATTR(n_per_out, n_periodic_outputs), +- PTP_RO_ATTR(pps, pps_available), +- __ATTR_NULL, ++static const struct attribute_group ptp_group = { ++ .attrs = ptp_attrs, + }; + ++const struct attribute_group *ptp_groups[] = { ++ &ptp_group, ++ NULL, ++}; ++ ++ + static ssize_t extts_enable_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) diff --git a/regulator-convert-class-code-to-use-dev_groups.patch b/regulator-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..72e68d60131728 --- /dev/null +++ b/regulator-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,94 @@ +From foo@baz Tue Jul 9 15:18:23 PDT 2013 +Date: Tue, 09 Jul 2013 15:18:23 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: regulator: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the regulator class code to use +the correct field. + +Cc: Liam Girdwood <lgirdwood@gmail.com> +Cc: Mark Brown <broonie@kernel.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/regulator/core.c | 28 ++++++++++++++++------------ + 1 file changed, 16 insertions(+), 12 deletions(-) + +--- a/drivers/regulator/core.c ++++ b/drivers/regulator/core.c +@@ -323,13 +323,14 @@ static ssize_t regulator_uA_show(struct + } + static DEVICE_ATTR(microamps, 0444, regulator_uA_show, NULL); + +-static ssize_t regulator_name_show(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t name_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct regulator_dev *rdev = dev_get_drvdata(dev); + + return sprintf(buf, "%s\n", rdev_get_name(rdev)); + } ++static DEVICE_ATTR_RO(name); + + static ssize_t regulator_print_opmode(char *buf, int mode) + { +@@ -489,15 +490,16 @@ static ssize_t regulator_total_uA_show(s + } + static DEVICE_ATTR(requested_microamps, 0444, regulator_total_uA_show, NULL); + +-static ssize_t regulator_num_users_show(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t num_users_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct regulator_dev *rdev = dev_get_drvdata(dev); + return sprintf(buf, "%d\n", rdev->use_count); + } ++static DEVICE_ATTR_RO(num_users); + +-static ssize_t regulator_type_show(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t type_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct regulator_dev *rdev = dev_get_drvdata(dev); + +@@ -509,6 +511,7 @@ static ssize_t regulator_type_show(struc + } + return sprintf(buf, "unknown\n"); + } ++static DEVICE_ATTR_RO(type); + + static ssize_t regulator_suspend_mem_uV_show(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -632,12 +635,13 @@ static DEVICE_ATTR(bypass, 0444, + * These are the only attributes are present for all regulators. + * Other attributes are a function of regulator functionality. + */ +-static struct device_attribute regulator_dev_attrs[] = { +- __ATTR(name, 0444, regulator_name_show, NULL), +- __ATTR(num_users, 0444, regulator_num_users_show, NULL), +- __ATTR(type, 0444, regulator_type_show, NULL), +- __ATTR_NULL, ++static struct attribute *regulator_dev_attrs[] = { ++ &dev_attr_name.attr, ++ &dev_attr_num_users.attr, ++ &dev_attr_type.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(regulator_dev); + + static void regulator_dev_release(struct device *dev) + { +@@ -648,7 +652,7 @@ static void regulator_dev_release(struct + static struct class regulator_class = { + .name = "regulator", + .dev_release = regulator_dev_release, +- .dev_attrs = regulator_dev_attrs, ++ .dev_groups = regulator_dev_groups, + }; + + /* Calculate the new optimum regulator operating mode based on the new total diff --git a/rtc-convert-class-code-to-use-dev_groups.patch b/rtc-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..422b897ae3e8ef --- /dev/null +++ b/rtc-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,137 @@ +From foo@baz Tue Jul 9 15:19:10 PDT 2013 +Date: Tue, 09 Jul 2013 15:19:10 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: rtc: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the rtc class code to use the +correct field. + +Cc: Alessandro Zummo <a.zummo@towertech.it> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/rtc/rtc-sysfs.c | 46 +++++++++++++++++++++++----------------------- + 1 file changed, 23 insertions(+), 23 deletions(-) + +--- a/drivers/rtc/rtc-sysfs.c ++++ b/drivers/rtc/rtc-sysfs.c +@@ -25,15 +25,14 @@ + */ + + static ssize_t +-rtc_sysfs_show_name(struct device *dev, struct device_attribute *attr, +- char *buf) ++name_show(struct device *dev, struct device_attribute *attr, char *buf) + { + return sprintf(buf, "%s\n", to_rtc_device(dev)->name); + } ++static DEVICE_ATTR_RO(name); + + static ssize_t +-rtc_sysfs_show_date(struct device *dev, struct device_attribute *attr, +- char *buf) ++date_show(struct device *dev, struct device_attribute *attr, char *buf) + { + ssize_t retval; + struct rtc_time tm; +@@ -46,10 +45,10 @@ rtc_sysfs_show_date(struct device *dev, + + return retval; + } ++static DEVICE_ATTR_RO(date); + + static ssize_t +-rtc_sysfs_show_time(struct device *dev, struct device_attribute *attr, +- char *buf) ++time_show(struct device *dev, struct device_attribute *attr, char *buf) + { + ssize_t retval; + struct rtc_time tm; +@@ -62,10 +61,10 @@ rtc_sysfs_show_time(struct device *dev, + + return retval; + } ++static DEVICE_ATTR_RO(time); + + static ssize_t +-rtc_sysfs_show_since_epoch(struct device *dev, struct device_attribute *attr, +- char *buf) ++since_epoch_show(struct device *dev, struct device_attribute *attr, char *buf) + { + ssize_t retval; + struct rtc_time tm; +@@ -79,16 +78,16 @@ rtc_sysfs_show_since_epoch(struct device + + return retval; + } ++static DEVICE_ATTR_RO(since_epoch); + + static ssize_t +-rtc_sysfs_show_max_user_freq(struct device *dev, struct device_attribute *attr, +- char *buf) ++max_user_freq_show(struct device *dev, struct device_attribute *attr, char *buf) + { + return sprintf(buf, "%d\n", to_rtc_device(dev)->max_user_freq); + } + + static ssize_t +-rtc_sysfs_set_max_user_freq(struct device *dev, struct device_attribute *attr, ++max_user_freq_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t n) + { + struct rtc_device *rtc = to_rtc_device(dev); +@@ -101,6 +100,7 @@ rtc_sysfs_set_max_user_freq(struct devic + + return n; + } ++static DEVICE_ATTR_RW(max_user_freq); + + /** + * rtc_sysfs_show_hctosys - indicate if the given RTC set the system time +@@ -109,8 +109,7 @@ rtc_sysfs_set_max_user_freq(struct devic + * boot or resume event. + */ + static ssize_t +-rtc_sysfs_show_hctosys(struct device *dev, struct device_attribute *attr, +- char *buf) ++hctosys_show(struct device *dev, struct device_attribute *attr, char *buf) + { + #ifdef CONFIG_RTC_HCTOSYS_DEVICE + if (rtc_hctosys_ret == 0 && +@@ -121,17 +120,18 @@ rtc_sysfs_show_hctosys(struct device *de + #endif + return sprintf(buf, "0\n"); + } ++static DEVICE_ATTR_RO(hctosys); + +-static struct device_attribute rtc_attrs[] = { +- __ATTR(name, S_IRUGO, rtc_sysfs_show_name, NULL), +- __ATTR(date, S_IRUGO, rtc_sysfs_show_date, NULL), +- __ATTR(time, S_IRUGO, rtc_sysfs_show_time, NULL), +- __ATTR(since_epoch, S_IRUGO, rtc_sysfs_show_since_epoch, NULL), +- __ATTR(max_user_freq, S_IRUGO | S_IWUSR, rtc_sysfs_show_max_user_freq, +- rtc_sysfs_set_max_user_freq), +- __ATTR(hctosys, S_IRUGO, rtc_sysfs_show_hctosys, NULL), +- { }, ++static struct attribute *rtc_attrs[] = { ++ &dev_attr_name.attr, ++ &dev_attr_date.attr, ++ &dev_attr_time.attr, ++ &dev_attr_since_epoch.attr, ++ &dev_attr_max_user_freq.attr, ++ &dev_attr_hctosys.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(rtc); + + static ssize_t + rtc_sysfs_show_wakealarm(struct device *dev, struct device_attribute *attr, +@@ -261,5 +261,5 @@ void rtc_sysfs_del_device(struct rtc_dev + + void __init rtc_sysfs_init(struct class *rtc_class) + { +- rtc_class->dev_attrs = rtc_attrs; ++ rtc_class->dev_groups = rtc_groups; + } diff --git a/scsi-osd-convert-class-code-to-use-dev_groups.patch b/scsi-osd-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..f569b9a7080e1b --- /dev/null +++ b/scsi-osd-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,54 @@ +From foo@baz Tue Jul 9 15:35:52 PDT 2013 +Date: Tue, 09 Jul 2013 15:35:52 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: SCSI: OSD: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the scsi osd class code to use +the correct field. + +Cc: Boaz Harrosh <bharrosh@panasas.com> +Cc: Benny Halevy <bhalevy@tonian.com> +Cc: James E.J. Bottomley <JBottomley@parallels.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/scsi/osd/osd_uld.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +--- a/drivers/scsi/osd/osd_uld.c ++++ b/drivers/scsi/osd/osd_uld.c +@@ -107,6 +107,7 @@ static ssize_t osdname_show(struct devic + class_dev); + return sprintf(buf, "%s\n", ould->odi.osdname); + } ++static DEVICE_ATTR_RO(osdname); + + static ssize_t systemid_show(struct device *dev, struct device_attribute *attr, + char *buf) +@@ -117,17 +118,19 @@ static ssize_t systemid_show(struct devi + memcpy(buf, ould->odi.systemid, ould->odi.systemid_len); + return ould->odi.systemid_len; + } ++static DEVICE_ATTR_RO(systemid); + +-static struct device_attribute osd_uld_attrs[] = { +- __ATTR(osdname, S_IRUGO, osdname_show, NULL), +- __ATTR(systemid, S_IRUGO, systemid_show, NULL), +- __ATTR_NULL, ++static struct attribute *osd_uld_attrs[] = { ++ &dev_attr_osdname.attr, ++ &dev_attr_systemid.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(osd_uld); + + static struct class osd_uld_class = { + .owner = THIS_MODULE, + .name = "scsi_osd", +- .dev_attrs = osd_uld_attrs, ++ .dev_groups = osd_uld_groups, + }; + + /* diff --git a/scsi-sd-convert-class-code-to-use-dev_groups.patch b/scsi-sd-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..42effba73bc6d1 --- /dev/null +++ b/scsi-sd-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,314 @@ +From foo@baz Tue Jul 9 15:36:59 PDT 2013 +Date: Tue, 09 Jul 2013 15:36:59 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: SCSI: sd: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the scsi disk class code to use +the correct field. + +It required some functions to be moved around to place the show and +store functions next to each other, the old order seemed to make no +sense at all. + +Cc: James E.J. Bottomley <JBottomley@parallels.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/scsi/sd.c | 147 +++++++++++++++++++++++++++--------------------------- + 1 file changed, 74 insertions(+), 73 deletions(-) + +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -132,8 +132,8 @@ static const char *sd_cache_types[] = { + }; + + static ssize_t +-sd_store_cache_type(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t count) ++cache_type_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + int i, ct = -1, rcd, wce, sp; + struct scsi_disk *sdkp = to_scsi_disk(dev); +@@ -199,8 +199,18 @@ sd_store_cache_type(struct device *dev, + } + + static ssize_t +-sd_store_manage_start_stop(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t count) ++manage_start_stop_show(struct device *dev, struct device_attribute *attr, ++ char *buf) ++{ ++ struct scsi_disk *sdkp = to_scsi_disk(dev); ++ struct scsi_device *sdp = sdkp->device; ++ ++ return snprintf(buf, 20, "%u\n", sdp->manage_start_stop); ++} ++ ++static ssize_t ++manage_start_stop_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + struct scsi_device *sdp = sdkp->device; +@@ -212,10 +222,19 @@ sd_store_manage_start_stop(struct device + + return count; + } ++static DEVICE_ATTR_RW(manage_start_stop); ++ ++static ssize_t ++allow_restart_show(struct device *dev, struct device_attribute *attr, char *buf) ++{ ++ struct scsi_disk *sdkp = to_scsi_disk(dev); ++ ++ return snprintf(buf, 40, "%d\n", sdkp->device->allow_restart); ++} + + static ssize_t +-sd_store_allow_restart(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t count) ++allow_restart_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + struct scsi_device *sdp = sdkp->device; +@@ -230,47 +249,30 @@ sd_store_allow_restart(struct device *de + + return count; + } ++static DEVICE_ATTR_RW(allow_restart); + + static ssize_t +-sd_show_cache_type(struct device *dev, struct device_attribute *attr, +- char *buf) ++cache_type_show(struct device *dev, struct device_attribute *attr, char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + int ct = sdkp->RCD + 2*sdkp->WCE; + + return snprintf(buf, 40, "%s\n", sd_cache_types[ct]); + } ++static DEVICE_ATTR_RW(cache_type); + + static ssize_t +-sd_show_fua(struct device *dev, struct device_attribute *attr, char *buf) ++FUA_show(struct device *dev, struct device_attribute *attr, char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + + return snprintf(buf, 20, "%u\n", sdkp->DPOFUA); + } ++static DEVICE_ATTR_RO(FUA); + + static ssize_t +-sd_show_manage_start_stop(struct device *dev, struct device_attribute *attr, +- char *buf) +-{ +- struct scsi_disk *sdkp = to_scsi_disk(dev); +- struct scsi_device *sdp = sdkp->device; +- +- return snprintf(buf, 20, "%u\n", sdp->manage_start_stop); +-} +- +-static ssize_t +-sd_show_allow_restart(struct device *dev, struct device_attribute *attr, +- char *buf) +-{ +- struct scsi_disk *sdkp = to_scsi_disk(dev); +- +- return snprintf(buf, 40, "%d\n", sdkp->device->allow_restart); +-} +- +-static ssize_t +-sd_show_protection_type(struct device *dev, struct device_attribute *attr, +- char *buf) ++protection_type_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + +@@ -278,8 +280,8 @@ sd_show_protection_type(struct device *d + } + + static ssize_t +-sd_store_protection_type(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t count) ++protection_type_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + unsigned int val; +@@ -298,10 +300,11 @@ sd_store_protection_type(struct device * + + return count; + } ++static DEVICE_ATTR_RW(protection_type); + + static ssize_t +-sd_show_protection_mode(struct device *dev, struct device_attribute *attr, +- char *buf) ++protection_mode_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + struct scsi_device *sdp = sdkp->device; +@@ -320,24 +323,26 @@ sd_show_protection_mode(struct device *d + + return snprintf(buf, 20, "%s%u\n", dix ? "dix" : "dif", dif); + } ++static DEVICE_ATTR_RO(protection_mode); + + static ssize_t +-sd_show_app_tag_own(struct device *dev, struct device_attribute *attr, +- char *buf) ++app_tag_own_show(struct device *dev, struct device_attribute *attr, char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + + return snprintf(buf, 20, "%u\n", sdkp->ATO); + } ++static DEVICE_ATTR_RO(app_tag_own); + + static ssize_t +-sd_show_thin_provisioning(struct device *dev, struct device_attribute *attr, +- char *buf) ++thin_provisioning_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + + return snprintf(buf, 20, "%u\n", sdkp->lbpme); + } ++static DEVICE_ATTR_RO(thin_provisioning); + + static const char *lbp_mode[] = { + [SD_LBP_FULL] = "full", +@@ -349,8 +354,8 @@ static const char *lbp_mode[] = { + }; + + static ssize_t +-sd_show_provisioning_mode(struct device *dev, struct device_attribute *attr, +- char *buf) ++provisioning_mode_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + +@@ -358,8 +363,8 @@ sd_show_provisioning_mode(struct device + } + + static ssize_t +-sd_store_provisioning_mode(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t count) ++provisioning_mode_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + struct scsi_device *sdp = sdkp->device; +@@ -385,10 +390,11 @@ sd_store_provisioning_mode(struct device + + return count; + } ++static DEVICE_ATTR_RW(provisioning_mode); + + static ssize_t +-sd_show_max_medium_access_timeouts(struct device *dev, +- struct device_attribute *attr, char *buf) ++max_medium_access_timeouts_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + +@@ -396,9 +402,9 @@ sd_show_max_medium_access_timeouts(struc + } + + static ssize_t +-sd_store_max_medium_access_timeouts(struct device *dev, +- struct device_attribute *attr, +- const char *buf, size_t count) ++max_medium_access_timeouts_store(struct device *dev, ++ struct device_attribute *attr, const char *buf, ++ size_t count) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + int err; +@@ -410,10 +416,11 @@ sd_store_max_medium_access_timeouts(stru + + return err ? err : count; + } ++static DEVICE_ATTR_RW(max_medium_access_timeouts); + + static ssize_t +-sd_show_write_same_blocks(struct device *dev, struct device_attribute *attr, +- char *buf) ++max_write_same_blocks_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + +@@ -421,8 +428,8 @@ sd_show_write_same_blocks(struct device + } + + static ssize_t +-sd_store_write_same_blocks(struct device *dev, struct device_attribute *attr, +- const char *buf, size_t count) ++max_write_same_blocks_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + struct scsi_disk *sdkp = to_scsi_disk(dev); + struct scsi_device *sdp = sdkp->device; +@@ -451,35 +458,29 @@ sd_store_write_same_blocks(struct device + + return count; + } ++static DEVICE_ATTR_RW(max_write_same_blocks); + +-static struct device_attribute sd_disk_attrs[] = { +- __ATTR(cache_type, S_IRUGO|S_IWUSR, sd_show_cache_type, +- sd_store_cache_type), +- __ATTR(FUA, S_IRUGO, sd_show_fua, NULL), +- __ATTR(allow_restart, S_IRUGO|S_IWUSR, sd_show_allow_restart, +- sd_store_allow_restart), +- __ATTR(manage_start_stop, S_IRUGO|S_IWUSR, sd_show_manage_start_stop, +- sd_store_manage_start_stop), +- __ATTR(protection_type, S_IRUGO|S_IWUSR, sd_show_protection_type, +- sd_store_protection_type), +- __ATTR(protection_mode, S_IRUGO, sd_show_protection_mode, NULL), +- __ATTR(app_tag_own, S_IRUGO, sd_show_app_tag_own, NULL), +- __ATTR(thin_provisioning, S_IRUGO, sd_show_thin_provisioning, NULL), +- __ATTR(provisioning_mode, S_IRUGO|S_IWUSR, sd_show_provisioning_mode, +- sd_store_provisioning_mode), +- __ATTR(max_write_same_blocks, S_IRUGO|S_IWUSR, +- sd_show_write_same_blocks, sd_store_write_same_blocks), +- __ATTR(max_medium_access_timeouts, S_IRUGO|S_IWUSR, +- sd_show_max_medium_access_timeouts, +- sd_store_max_medium_access_timeouts), +- __ATTR_NULL, ++static struct attribute *sd_disk_attrs[] = { ++ &dev_attr_cache_type.attr, ++ &dev_attr_FUA.attr, ++ &dev_attr_allow_restart.attr, ++ &dev_attr_manage_start_stop.attr, ++ &dev_attr_protection_type.attr, ++ &dev_attr_protection_mode.attr, ++ &dev_attr_app_tag_own.attr, ++ &dev_attr_thin_provisioning.attr, ++ &dev_attr_provisioning_mode.attr, ++ &dev_attr_max_write_same_blocks.attr, ++ &dev_attr_max_medium_access_timeouts.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(sd_disk); + + static struct class sd_disk_class = { + .name = "scsi_disk", + .owner = THIS_MODULE, + .dev_release = scsi_disk_release, +- .dev_attrs = sd_disk_attrs, ++ .dev_groups = sd_disk_groups, + }; + + static const struct dev_pm_ops sd_pm_ops = { diff --git a/scsi-st-convert-class-code-to-use-dev_groups.patch b/scsi-st-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..bf3a01ed1b5e2e --- /dev/null +++ b/scsi-st-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,96 @@ +From foo@baz Tue Jul 9 15:38:50 PDT 2013 +Date: Tue, 09 Jul 2013 15:38:50 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: SCSI: st: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the scsi tape class code to use +the correct field. + +Cc: Kai Mäkisara <Kai.Makisara@kolumbus.fi> +Cc: James E.J. Bottomley <JBottomley@parallels.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/scsi/st.c | 25 +++++++++++++++---------- + 1 file changed, 15 insertions(+), 10 deletions(-) + +--- a/drivers/scsi/st.c ++++ b/drivers/scsi/st.c +@@ -82,7 +82,7 @@ static int try_rdio = 1; + static int try_wdio = 1; + + static struct class st_sysfs_class; +-static struct device_attribute st_dev_attrs[]; ++static const struct attribute_group *st_dev_groups[]; + + MODULE_AUTHOR("Kai Makisara"); + MODULE_DESCRIPTION("SCSI tape (st) driver"); +@@ -4274,7 +4274,7 @@ static void scsi_tape_release(struct kre + + static struct class st_sysfs_class = { + .name = "scsi_tape", +- .dev_attrs = st_dev_attrs, ++ .dev_groups = st_dev_groups, + }; + + static int __init init_st(void) +@@ -4408,6 +4408,7 @@ defined_show(struct device *dev, struct + l = snprintf(buf, PAGE_SIZE, "%d\n", STm->defined); + return l; + } ++static DEVICE_ATTR_RO(defined); + + static ssize_t + default_blksize_show(struct device *dev, struct device_attribute *attr, +@@ -4419,7 +4420,7 @@ default_blksize_show(struct device *dev, + l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_blksize); + return l; + } +- ++static DEVICE_ATTR_RO(default_blksize); + + static ssize_t + default_density_show(struct device *dev, struct device_attribute *attr, +@@ -4433,6 +4434,7 @@ default_density_show(struct device *dev, + l = snprintf(buf, PAGE_SIZE, fmt, STm->default_density); + return l; + } ++static DEVICE_ATTR_RO(default_density); + + static ssize_t + default_compression_show(struct device *dev, struct device_attribute *attr, +@@ -4444,6 +4446,7 @@ default_compression_show(struct device * + l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_compression - 1); + return l; + } ++static DEVICE_ATTR_RO(default_compression); + + static ssize_t + options_show(struct device *dev, struct device_attribute *attr, char *buf) +@@ -4472,15 +4475,17 @@ options_show(struct device *dev, struct + l = snprintf(buf, PAGE_SIZE, "0x%08x\n", options); + return l; + } ++static DEVICE_ATTR_RO(options); + +-static struct device_attribute st_dev_attrs[] = { +- __ATTR_RO(defined), +- __ATTR_RO(default_blksize), +- __ATTR_RO(default_density), +- __ATTR_RO(default_compression), +- __ATTR_RO(options), +- __ATTR_NULL, ++static struct attribute *st_dev_attrs[] = { ++ &dev_attr_defined.attr, ++ &dev_attr_default_blksize.attr, ++ &dev_attr_default_density.attr, ++ &dev_attr_default_compression.attr, ++ &dev_attr_options.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(st_dev); + + /* The following functions may be useful for a larger audience. */ + static int sgl_map_user_pages(struct st_buffer *STbp, @@ -1,54 +1,97 @@ # My specific stuff, at the top to make it easier to work stuff below. -devnode_gid.patch -0001-kdbus-interprocess-message-router.patch -dbus.patch -dev_removal.patch - - -time-don-t-inline-export_symbol-functions.patch -gregkh/gkh-version.patch - -##################################################################### -# Stuff to be merged for 2.6.37 -##################################################################### - -################################# -# Driver core patches for 2.6.37 -################################# - - -################################# -# TTY patches for 2.6.37 -################################# - - -################################# -# USB patches for 2.6.37 -################################# - - -################################# -# Staging patches for 2.6.37 -################################# - - -##################################################################### -# Stuff to be merged after 2.6.37 is out -##################################################################### - -############################################# -# Driver core patches for after 2.6.37 is out -############################################# - -##################################### -# TTY patches for after 2.6.37 is out -##################################### - -################################### -# USB stuff for after 2.6.37 is out -################################### - - -# staging stuff for next is now in the staging-next tree on git.kernel.org - +# driver core attribute cleanup work +sysfs.h-add-__attr_rw-macro.patch +sysfs.h-add-attribute_groups-macro.patch +sysfs.h-add-bin_attr-macro.patch +driver-core-add-device_attr_rw-and-device_attr_ro-macros.patch +sysfs-add-support-for-binary-attributes-in-groups.patch +driver-core-introduce-device_create_groups.patch +driver-core-add-default-groups-to-struct-class.patch + +# dev_groups to struct class work +misc-c2port-use-dev_bin_attrs-instead-of-hand-coding-it.patch +mips-convert-vpe_class-to-use-dev_groups.patch +bsr-convert-bsr_class-to-use-dev_groups.patch +tile-srom-convert-srom_class-to-use-dev_groups.patch +dma-convert-dma_devclass-to-use-dev_groups.patch +devfreq-convert-devfreq_class-to-use-dev_groups.patch +extcon-convert-extcon_class-to-use-dev_groups.patch +hid-roccat-convert-class-code-to-use-dev_groups.patch +isdn-convert-class-code-to-use-dev_groups.patch +leds-convert-class-code-to-use-dev_groups.patch +v4l2-convert-class-code-to-use-dev_groups.patch +c2port-convert-class-code-to-use-dev_groups.patch +enclosure-convert-class-code-to-use-dev_groups.patch +pci-convert-class-code-to-use-dev_groups.patch +x86-wmi-convert-class-code-to-use-dev_groups.patch +pps-convert-class-code-to-use-dev_groups.patch +ptp-convert-class-code-to-use-dev_groups.patch +regulator-convert-class-code-to-use-dev_groups.patch +rtc-convert-class-code-to-use-dev_groups.patch +uio-convert-class-code-to-use-dev_groups.patch +cuse-convert-class-code-to-use-dev_groups.patch +staging-comedi-convert-class-code-to-use-dev_groups.patch +backing-dev-convert-class-code-to-use-dev_groups.patch +scsi-osd-convert-class-code-to-use-dev_groups.patch +scsi-sd-convert-class-code-to-use-dev_groups.patch +scsi-st-convert-class-code-to-use-dev_groups.patch +video-backlight-convert-class-code-to-use-dev_groups.patch +video-backlight-lcd-convert-class-code-to-use-dev_groups.patch +video-output-convert-class-code-to-use-dev_groups.patch +net-core-convert-class-code-to-use-dev_groups.patch +net-ieee802154-convert-class-code-to-use-dev_groups.patch +net-wireless-convert-class-code-to-use-dev_groups.patch +net-rfkill-convert-class-code-to-use-dev_groups.patch + +c2port-convert-class-code-to-use-bin_attrs-in-groups.patch +hid-roccat-convert-class-code-to-use-bin_attrs-in-groups.patch + +driver-core-remove-dev_attrs-from-struct-class.patch +driver-core-remove-dev_bin_attrs-from-struct-class.patch + +# usb DEBUG cleanups +usb-ldusb-remove-custom-dbg_info-macro.patch +usb-legotower-remove-unneeded-tracing-macros.patch +usb-legousbtower-remove-custom-debug-macro.patch +usb-legotower-remove-custom-debug-macro-and-module-parameter.patch +usb-legotower-remove-direct-calls-to-printk.patch +usb-adutux-remove-unneeded-tracing-macros.patch +usb-adutux-remove-custom-debug-macro.patch +usb-adutux-remove-custom-debug-macro-and-module-parameter.patch +usb-adutux-remove-direct-calls-to-printk.patch +usb-misc-remove-config_usb_debug-from-makefile.patch + +usb-usbatm-remove-unused-udsl_assert-macro.patch +usb-usbatm-remove-unneeded-trace-printk-calls.patch +usb-usbatm-don-t-rely-on-config_usb_debug.patch +usb-usbatm-move-the-atm_dbg-call-to-use-dynamic-debug.patch +usb-usbatm-remove-config_usb_debug-dependancy.patch +usb-phy-remove-custom-dbg-macro.patch +usb-phy-remove-config_usb_debug-usage.patch +usb-gadget-fix-up-comment.patch +usb-isp1362-remove-unused-_bug_on-calls.patch +usb-isp1362-remove-unused-_warn_on-calls.patch +usb-isp1362-remove-_dbg-usage.patch +usb-isp1362-remove-config_usb_debug-dependency.patch +usb-isp116x-remove-dependency-on-config_usb_debug.patch +usb-sl811-remove-config_usb_debug-dependency.patch + +usb-remove-unneeded-idr.h-include.patch +usb-sl811-move-debug-files-from-proc-to-debugfs.patch +usb-isp1362-move-debug-files-from-proc-to-debugfs.patch + +0001-Simulate-fake-Fn-key-on-PS-2-keyboards-w-o-one-eg.-C.patch + + +#gregkh/gkh-version.patch + +driver-core-bus_type-add-dev_groups.patch +driver-core-bus_type-add-drv_groups.patch +driver-core-bus_type-add-bus_groups.patch + + +f1.patch +f2.patch +f3.patch +f4.patch diff --git a/staging-comedi-convert-class-code-to-use-dev_groups.patch b/staging-comedi-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..bbc4252592b8bf --- /dev/null +++ b/staging-comedi-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,134 @@ +From foo@baz Tue Jul 9 15:33:57 PDT 2013 +Date: Tue, 09 Jul 2013 15:33:57 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: staging: comedi: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the comedi class code to use the +correct field. + +Cc: Ian Abbott <abbotti@mev.co.uk> +Cc: H Hartley Sweeten <hsweeten@visionengravers.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/staging/comedi/comedi_fops.c | 39 +++++++++++++++++------------------ + 1 file changed, 20 insertions(+), 19 deletions(-) + +--- a/drivers/staging/comedi/comedi_fops.c ++++ b/drivers/staging/comedi/comedi_fops.c +@@ -262,7 +262,7 @@ static int resize_async_buffer(struct co + + /* sysfs attribute files */ + +-static ssize_t show_max_read_buffer_kb(struct device *csdev, ++static ssize_t max_read_buffer_kb_show(struct device *csdev, + struct device_attribute *attr, char *buf) + { + unsigned int minor = MINOR(csdev->devt); +@@ -283,7 +283,7 @@ static ssize_t show_max_read_buffer_kb(s + return snprintf(buf, PAGE_SIZE, "%i\n", size); + } + +-static ssize_t store_max_read_buffer_kb(struct device *csdev, ++static ssize_t max_read_buffer_kb_store(struct device *csdev, + struct device_attribute *attr, + const char *buf, size_t count) + { +@@ -314,8 +314,9 @@ static ssize_t store_max_read_buffer_kb( + + return err ? err : count; + } ++static DEVICE_ATTR_RW(max_read_buffer_kb); + +-static ssize_t show_read_buffer_kb(struct device *csdev, ++static ssize_t read_buffer_kb_show(struct device *csdev, + struct device_attribute *attr, char *buf) + { + unsigned int minor = MINOR(csdev->devt); +@@ -336,7 +337,7 @@ static ssize_t show_read_buffer_kb(struc + return snprintf(buf, PAGE_SIZE, "%i\n", size); + } + +-static ssize_t store_read_buffer_kb(struct device *csdev, ++static ssize_t read_buffer_kb_store(struct device *csdev, + struct device_attribute *attr, + const char *buf, size_t count) + { +@@ -367,8 +368,9 @@ static ssize_t store_read_buffer_kb(stru + + return err ? err : count; + } ++static DEVICE_ATTR_RW(read_buffer_kb); + +-static ssize_t show_max_write_buffer_kb(struct device *csdev, ++static ssize_t max_write_buffer_kb_show(struct device *csdev, + struct device_attribute *attr, + char *buf) + { +@@ -390,7 +392,7 @@ static ssize_t show_max_write_buffer_kb( + return snprintf(buf, PAGE_SIZE, "%i\n", size); + } + +-static ssize_t store_max_write_buffer_kb(struct device *csdev, ++static ssize_t max_write_buffer_kb_store(struct device *csdev, + struct device_attribute *attr, + const char *buf, size_t count) + { +@@ -421,8 +423,9 @@ static ssize_t store_max_write_buffer_kb + + return err ? err : count; + } ++static DEVICE_ATTR_RW(max_write_buffer_kb); + +-static ssize_t show_write_buffer_kb(struct device *csdev, ++static ssize_t write_buffer_kb_show(struct device *csdev, + struct device_attribute *attr, char *buf) + { + unsigned int minor = MINOR(csdev->devt); +@@ -443,7 +446,7 @@ static ssize_t show_write_buffer_kb(stru + return snprintf(buf, PAGE_SIZE, "%i\n", size); + } + +-static ssize_t store_write_buffer_kb(struct device *csdev, ++static ssize_t write_buffer_kb_store(struct device *csdev, + struct device_attribute *attr, + const char *buf, size_t count) + { +@@ -474,18 +477,16 @@ static ssize_t store_write_buffer_kb(str + + return err ? err : count; + } ++static DEVICE_ATTR_RW(write_buffer_kb); + +-static struct device_attribute comedi_dev_attrs[] = { +- __ATTR(max_read_buffer_kb, S_IRUGO | S_IWUSR, +- show_max_read_buffer_kb, store_max_read_buffer_kb), +- __ATTR(read_buffer_kb, S_IRUGO | S_IWUSR | S_IWGRP, +- show_read_buffer_kb, store_read_buffer_kb), +- __ATTR(max_write_buffer_kb, S_IRUGO | S_IWUSR, +- show_max_write_buffer_kb, store_max_write_buffer_kb), +- __ATTR(write_buffer_kb, S_IRUGO | S_IWUSR | S_IWGRP, +- show_write_buffer_kb, store_write_buffer_kb), +- __ATTR_NULL ++static struct attribute *comedi_dev_attrs[] = { ++ &dev_attr_max_read_buffer_kb.attr, ++ &dev_attr_read_buffer_kb.attr, ++ &dev_attr_max_write_buffer_kb.attr, ++ &dev_attr_write_buffer_kb.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(comedi_dev); + + static void comedi_set_subdevice_runflags(struct comedi_subdevice *s, + unsigned mask, unsigned bits) +@@ -2554,7 +2555,7 @@ static int __init comedi_init(void) + return PTR_ERR(comedi_class); + } + +- comedi_class->dev_attrs = comedi_dev_attrs; ++ comedi_class->dev_groups = comedi_dev_groups; + + /* XXX requires /proc interface */ + comedi_proc_init(); diff --git a/sysfs-add-support-for-binary-attributes-in-groups.patch b/sysfs-add-support-for-binary-attributes-in-groups.patch new file mode 100644 index 00000000000000..42521e6488bcd2 --- /dev/null +++ b/sysfs-add-support-for-binary-attributes-in-groups.patch @@ -0,0 +1,129 @@ +From foo@baz Wed Jul 10 12:02:20 PDT 2013 +Date: Wed, 10 Jul 2013 12:02:20 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: sysfs: add support for binary attributes in groups + +groups should be able to support binary attributes, just like it +supports "normal" attributes. This lets us only handle one type of +structure, groups, throughout the driver core and subsystems, making +binary attributes a "full fledged" part of the driver model, and not +something just "tacked on". + +Reported-by: Oliver Schinagl <oliver+list@schinagl.nl> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + fs/sysfs/group.c | 66 ++++++++++++++++++++++++++++++++++---------------- + include/linux/sysfs.h | 4 +-- + 2 files changed, 48 insertions(+), 22 deletions(-) + +--- a/fs/sysfs/group.c ++++ b/fs/sysfs/group.c +@@ -20,38 +20,64 @@ static void remove_files(struct sysfs_di + const struct attribute_group *grp) + { + struct attribute *const* attr; +- int i; ++ struct bin_attribute *const* bin_attr; + +- for (i = 0, attr = grp->attrs; *attr; i++, attr++) +- sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); ++ if (grp->attrs) ++ for (attr = grp->attrs; *attr; attr++) ++ sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); ++ if (grp->bin_attrs) ++ for (bin_attr = grp->bin_attrs; *bin_attr; bin_attr++) ++ sysfs_remove_bin_file(kobj, *bin_attr); + } + + static int create_files(struct sysfs_dirent *dir_sd, struct kobject *kobj, + const struct attribute_group *grp, int update) + { + struct attribute *const* attr; ++ struct bin_attribute *const* bin_attr; + int error = 0, i; + +- for (i = 0, attr = grp->attrs; *attr && !error; i++, attr++) { +- umode_t mode = 0; ++ if (grp->attrs) { ++ for (i = 0, attr = grp->attrs; *attr && !error; i++, attr++) { ++ umode_t mode = 0; + +- /* in update mode, we're changing the permissions or +- * visibility. Do this by first removing then +- * re-adding (if required) the file */ +- if (update) +- sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); +- if (grp->is_visible) { +- mode = grp->is_visible(kobj, *attr, i); +- if (!mode) +- continue; ++ /* ++ * In update mode, we're changing the permissions or ++ * visibility. Do this by first removing then ++ * re-adding (if required) the file. ++ */ ++ if (update) ++ sysfs_hash_and_remove(dir_sd, NULL, ++ (*attr)->name); ++ if (grp->is_visible) { ++ mode = grp->is_visible(kobj, *attr, i); ++ if (!mode) ++ continue; ++ } ++ error = sysfs_add_file_mode(dir_sd, *attr, ++ SYSFS_KOBJ_ATTR, ++ (*attr)->mode | mode); ++ if (unlikely(error)) ++ break; ++ } ++ if (error) { ++ remove_files(dir_sd, kobj, grp); ++ goto exit; ++ } ++ } ++ ++ if (grp->bin_attrs) { ++ for (bin_attr = grp->bin_attrs; *bin_attr; bin_attr++) { ++ if (update) ++ sysfs_remove_bin_file(kobj, *bin_attr); ++ error = sysfs_create_bin_file(kobj, *bin_attr); ++ if (error) ++ break; + } +- error = sysfs_add_file_mode(dir_sd, *attr, SYSFS_KOBJ_ATTR, +- (*attr)->mode | mode); +- if (unlikely(error)) +- break; ++ if (error) ++ remove_files(dir_sd, kobj, grp); + } +- if (error) +- remove_files(dir_sd, kobj, grp); ++exit: + return error; + } + +--- a/include/linux/sysfs.h ++++ b/include/linux/sysfs.h +@@ -21,6 +21,7 @@ + + struct kobject; + struct module; ++struct bin_attribute; + enum kobj_ns_type; + + struct attribute { +@@ -59,10 +60,9 @@ struct attribute_group { + umode_t (*is_visible)(struct kobject *, + struct attribute *, int); + struct attribute **attrs; ++ struct bin_attribute **bin_attrs; + }; + +- +- + /** + * Use these macros to make defining attributes easier. See include/linux/device.h + * for examples.. diff --git a/sysfs.h-add-__attr_rw-macro.patch b/sysfs.h-add-__attr_rw-macro.patch new file mode 100644 index 00000000000000..3666fb44937113 --- /dev/null +++ b/sysfs.h-add-__attr_rw-macro.patch @@ -0,0 +1,49 @@ +From foo@baz Mon Jul 8 12:30:29 PDT 2013 +Date: Mon, 08 Jul 2013 12:30:29 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: sysfs.h: add __ATTR_RW() macro + +A number of parts of the kernel created their own version of this, might +as well have the sysfs core provide it instead. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + include/linux/sysfs.h | 2 ++ + kernel/events/core.c | 2 -- + mm/backing-dev.c | 2 -- + 3 files changed, 2 insertions(+), 4 deletions(-) + +--- a/include/linux/sysfs.h ++++ b/include/linux/sysfs.h +@@ -79,6 +79,8 @@ struct attribute_group { + .show = _name##_show, \ + } + ++#define __ATTR_RW(_name) __ATTR(_name, 0644, _name##_show, _name##_store) ++ + #define __ATTR_NULL { .attr = { .name = NULL } } + + #ifdef CONFIG_DEBUG_LOCK_ALLOC +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -6212,8 +6212,6 @@ perf_event_mux_interval_ms_store(struct + return count; + } + +-#define __ATTR_RW(attr) __ATTR(attr, 0644, attr##_show, attr##_store) +- + static struct device_attribute pmu_dev_attrs[] = { + __ATTR_RO(type), + __ATTR_RW(perf_event_mux_interval_ms), +--- a/mm/backing-dev.c ++++ b/mm/backing-dev.c +@@ -232,8 +232,6 @@ static ssize_t stable_pages_required_sho + bdi_cap_stable_pages_required(bdi) ? 1 : 0); + } + +-#define __ATTR_RW(attr) __ATTR(attr, 0644, attr##_show, attr##_store) +- + static struct device_attribute bdi_dev_attrs[] = { + __ATTR_RW(read_ahead_kb), + __ATTR_RW(min_ratio), diff --git a/sysfs.h-add-attribute_groups-macro.patch b/sysfs.h-add-attribute_groups-macro.patch new file mode 100644 index 00000000000000..31816858e04505 --- /dev/null +++ b/sysfs.h-add-attribute_groups-macro.patch @@ -0,0 +1,33 @@ +From foo@baz Mon Jul 8 16:40:50 PDT 2013 +Date: Mon, 08 Jul 2013 16:40:50 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: sysfs.h: add ATTRIBUTE_GROUPS() macro + +To make it easier for driver subsystems to work with attribute groups, +create the ATTRIBUTE_GROUPS macro to remove some of the repetitive +typing for the most common use for attribute groups. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + include/linux/sysfs.h | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/include/linux/sysfs.h ++++ b/include/linux/sysfs.h +@@ -94,6 +94,15 @@ struct attribute_group { + #define __ATTR_IGNORE_LOCKDEP __ATTR + #endif + ++#define ATTRIBUTE_GROUPS(name) \ ++static const struct attribute_group name##_group = { \ ++ .attrs = name##_attrs, \ ++}; \ ++static const struct attribute_group *name##_groups[] = { \ ++ &name##_group, \ ++ NULL, \ ++} ++ + #define attr_name(_attr) (_attr).attr.name + + struct file; diff --git a/sysfs.h-add-bin_attr-macro.patch b/sysfs.h-add-bin_attr-macro.patch new file mode 100644 index 00000000000000..0b024198d00356 --- /dev/null +++ b/sysfs.h-add-bin_attr-macro.patch @@ -0,0 +1,32 @@ +From foo@baz Wed Jul 10 12:06:27 PDT 2013 +Date: Wed, 10 Jul 2013 12:06:27 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: sysfs.h: add BIN_ATTR macro + +This makes it easier to create static binary attributes, which is needed +in a number of drivers, instead of "open coding" them. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + include/linux/sysfs.h | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/include/linux/sysfs.h ++++ b/include/linux/sysfs.h +@@ -132,6 +132,15 @@ struct bin_attribute { + */ + #define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr) + ++/* macro to create static binary attributes easier */ ++#define BIN_ATTR(_name, _mode, _read, _write, _size) \ ++struct bin_attribute bin_attr_##_name = { \ ++ .attr = {.name = __stringify(_name), .mode = _mode }, \ ++ .read = _read, \ ++ .write = _write, \ ++ .size = _size, \ ++} ++ + struct sysfs_ops { + ssize_t (*show)(struct kobject *, struct attribute *,char *); + ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); diff --git a/tile-srom-convert-srom_class-to-use-dev_groups.patch b/tile-srom-convert-srom_class-to-use-dev_groups.patch new file mode 100644 index 00000000000000..f924a2e35d296f --- /dev/null +++ b/tile-srom-convert-srom_class-to-use-dev_groups.patch @@ -0,0 +1,77 @@ +From foo@baz Tue Jul 9 14:49:38 PDT 2013 +Date: Tue, 09 Jul 2013 14:49:38 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: tile: srom: convert srom_class to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the tile srom_class code to use +the correct field. + +Cc: Arnd Bergmann <arnd@arndb.de> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/char/tile-srom.c | 28 ++++++++++++++++------------ + 1 file changed, 16 insertions(+), 12 deletions(-) + +--- a/drivers/char/tile-srom.c ++++ b/drivers/char/tile-srom.c +@@ -279,33 +279,37 @@ loff_t srom_llseek(struct file *file, lo + return fixed_size_llseek(file, offset, origin, srom->total_size); + } + +-static ssize_t total_show(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t total_size_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct srom_dev *srom = dev_get_drvdata(dev); + return sprintf(buf, "%u\n", srom->total_size); + } ++static DEVICE_ATTR_RO(total_size); + +-static ssize_t sector_show(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t sector_size_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct srom_dev *srom = dev_get_drvdata(dev); + return sprintf(buf, "%u\n", srom->sector_size); + } ++static DEVICE_ATTR_RO(sector_size); + +-static ssize_t page_show(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t page_size_show(struct device *dev, ++ struct device_attribute *attr, char *buf) + { + struct srom_dev *srom = dev_get_drvdata(dev); + return sprintf(buf, "%u\n", srom->page_size); + } ++static DEVICE_ATTR_RO(page_size); + +-static struct device_attribute srom_dev_attrs[] = { +- __ATTR(total_size, S_IRUGO, total_show, NULL), +- __ATTR(sector_size, S_IRUGO, sector_show, NULL), +- __ATTR(page_size, S_IRUGO, page_show, NULL), +- __ATTR_NULL ++static struct attribute srom_dev_attrs[] = { ++ &dev_attr_total_size.attr, ++ &dev_attr_sector_size.attr, ++ &dev_attr_page_size.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(srom_dev); + + static char *srom_devnode(struct device *dev, umode_t *mode) + { +@@ -418,7 +422,7 @@ static int srom_init(void) + result = PTR_ERR(srom_class); + goto fail_cdev; + } +- srom_class->dev_attrs = srom_dev_attrs; ++ srom_class->dev_groups = srom_dev_groups; + srom_class->devnode = srom_devnode; + + /* Do per-partition initialization */ diff --git a/time-don-t-inline-export_symbol-functions.patch b/time-don-t-inline-export_symbol-functions.patch deleted file mode 100644 index b0dd9de32c6ad2..00000000000000 --- a/time-don-t-inline-export_symbol-functions.patch +++ /dev/null @@ -1,46 +0,0 @@ -From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -To: Thomas Gleixner <tglx@linutronix.de> -Subject: [PATCH] time: don't inline EXPORT_SYMBOL functions - -How is the compiler even handling exported functions that are marked -inline? Anyway, these shouldn't be inline because of that, so remove -that marking. - -Based on a larger patch by Mark Charlebois to get LLVM to build the -kernel. - - -Cc: Thomas Gleixner <tglx@linutronix.de> -Cc: Mark Charlebois <mcharleb@qualcomm.com> -Cc: Paul Gortmaker <paul.gortmaker@windriver.com> -Cc: Andrew Morton <akpm@linux-foundation.org> -Cc: hank <pyu@redhat.com> -Cc: John Stultz <john.stultz@linaro.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> - ---- - kernel/time.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/kernel/time.c b/kernel/time.c -index ba744cf..8d8bebd9 100644 ---- a/kernel/time.c -+++ b/kernel/time.c -@@ -232,7 +232,7 @@ EXPORT_SYMBOL(current_fs_time); - * Avoid unnecessary multiplications/divisions in the - * two most common HZ cases: - */ --inline unsigned int jiffies_to_msecs(const unsigned long j) -+unsigned int jiffies_to_msecs(const unsigned long j) - { - #if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ) - return (MSEC_PER_SEC / HZ) * j; -@@ -248,7 +248,7 @@ inline unsigned int jiffies_to_msecs(const unsigned long j) - } - EXPORT_SYMBOL(jiffies_to_msecs); - --inline unsigned int jiffies_to_usecs(const unsigned long j) -+unsigned int jiffies_to_usecs(const unsigned long j) - { - #if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ) - return (USEC_PER_SEC / HZ) * j; diff --git a/uio-convert-class-code-to-use-dev_groups.patch b/uio-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..5e49b44d55aee1 --- /dev/null +++ b/uio-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,71 @@ +From foo@baz Tue Jul 9 15:32:28 PDT 2013 +Date: Tue, 09 Jul 2013 15:32:28 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: UIO: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the uio class code to use the +correct field. + +Cc: Hans J. Koch <hjk@hansjkoch.de> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/uio/uio.c | 22 +++++++++++++--------- + 1 file changed, 13 insertions(+), 9 deletions(-) + +--- a/drivers/uio/uio.c ++++ b/drivers/uio/uio.c +@@ -224,38 +224,42 @@ static struct kobj_type portio_attr_type + .default_attrs = portio_attrs, + }; + +-static ssize_t show_name(struct device *dev, ++static ssize_t name_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct uio_device *idev = dev_get_drvdata(dev); + return sprintf(buf, "%s\n", idev->info->name); + } ++static DEVICE_ATTR_RO(name); + +-static ssize_t show_version(struct device *dev, ++static ssize_t version_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct uio_device *idev = dev_get_drvdata(dev); + return sprintf(buf, "%s\n", idev->info->version); + } ++static DEVICE_ATTR_RO(version); + +-static ssize_t show_event(struct device *dev, ++static ssize_t event_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct uio_device *idev = dev_get_drvdata(dev); + return sprintf(buf, "%u\n", (unsigned int)atomic_read(&idev->event)); + } ++static DEVICE_ATTR_RO(event); + +-static struct device_attribute uio_class_attributes[] = { +- __ATTR(name, S_IRUGO, show_name, NULL), +- __ATTR(version, S_IRUGO, show_version, NULL), +- __ATTR(event, S_IRUGO, show_event, NULL), +- {} ++static struct attribute *uio_attrs[] = { ++ &dev_attr_name.attr, ++ &dev_attr_version.attr, ++ &dev_attr_event.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(uio); + + /* UIO class infrastructure */ + static struct class uio_class = { + .name = "uio", +- .dev_attrs = uio_class_attributes, ++ .dev_groups = uio_groups, + }; + + /* diff --git a/usb-adutux-remove-custom-debug-macro-and-module-parameter.patch b/usb-adutux-remove-custom-debug-macro-and-module-parameter.patch new file mode 100644 index 00000000000000..5677c3185c92f4 --- /dev/null +++ b/usb-adutux-remove-custom-debug-macro-and-module-parameter.patch @@ -0,0 +1,125 @@ +From foo@baz Wed Jun 26 16:22:38 PDT 2013 +Date: Wed, 26 Jun 2013 16:22:38 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: linux-usb@vger.kernel.org +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: adutux: remove custom debug macro and module parameter + +Now that we don't use the dbg() macro, remove it, and the module +parameter. Also fix up the "dump_data" function to properly use the +dynamic debug core and the correct printk options, and don't call it +twice per function, as the data doesn't change from the beginning and +the end of the call. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/usb/misc/adutux.c | 50 ++++++++-------------------------------------- + 1 file changed, 9 insertions(+), 41 deletions(-) + +--- a/drivers/usb/misc/adutux.c ++++ b/drivers/usb/misc/adutux.c +@@ -27,30 +27,11 @@ + #include <linux/mutex.h> + #include <linux/uaccess.h> + +-#ifdef CONFIG_USB_DEBUG +-static int debug = 5; +-#else +-static int debug = 1; +-#endif +- +-/* Use our own dbg macro */ +-#undef dbg +-#define dbg(lvl, format, arg...) \ +-do { \ +- if (debug >= lvl) \ +- printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ +-} while (0) +- +- + /* Version Information */ + #define DRIVER_VERSION "v0.0.13" + #define DRIVER_AUTHOR "John Homppi" + #define DRIVER_DESC "adutux (see www.ontrak.net)" + +-/* Module parameters */ +-module_param(debug, int, S_IRUGO | S_IWUSR); +-MODULE_PARM_DESC(debug, "Debug enabled or not"); +- + /* Define these values to match your device */ + #define ADU_VENDOR_ID 0x0a07 + #define ADU_PRODUCT_ID 0x0064 +@@ -124,19 +105,11 @@ static DEFINE_MUTEX(adutux_mutex); + + static struct usb_driver adu_driver; + +-static void adu_debug_data(int level, const char *function, int size, +- const unsigned char *data) ++static inline void adu_debug_data(struct device *dev, const char *function, ++ int size, const unsigned char *data) + { +- int i; +- +- if (debug < level) +- return; +- +- printk(KERN_DEBUG "%s: %s - length = %d, data = ", +- __FILE__, function, size); +- for (i = 0; i < size; ++i) +- printk("%.2x ", data[i]); +- printk("\n"); ++ dev_dbg(dev, "%s - length = %d, data = %*ph\n", ++ function, size, size, data); + } + + /** +@@ -185,8 +158,8 @@ static void adu_interrupt_in_callback(st + struct adu_device *dev = urb->context; + int status = urb->status; + +- adu_debug_data(5, __func__, urb->actual_length, +- urb->transfer_buffer); ++ adu_debug_data(&dev->udev->dev, __func__, ++ urb->actual_length, urb->transfer_buffer); + + spin_lock(&dev->buflock); + +@@ -222,8 +195,6 @@ exit: + spin_unlock(&dev->buflock); + /* always wake up so we recover from errors */ + wake_up_interruptible(&dev->read_wait); +- adu_debug_data(5, __func__, urb->actual_length, +- urb->transfer_buffer); + } + + static void adu_interrupt_out_callback(struct urb *urb) +@@ -231,7 +202,8 @@ static void adu_interrupt_out_callback(s + struct adu_device *dev = urb->context; + int status = urb->status; + +- adu_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); ++ adu_debug_data(&dev->udev->dev, __func__, ++ urb->actual_length, urb->transfer_buffer); + + if (status != 0) { + if ((status != -ENOENT) && +@@ -240,17 +212,13 @@ static void adu_interrupt_out_callback(s + "%s :nonzero status received: %d\n", __func__, + status); + } +- goto exit; ++ return; + } + + spin_lock(&dev->buflock); + dev->out_urb_finished = 1; + wake_up(&dev->write_wait); + spin_unlock(&dev->buflock); +-exit: +- +- adu_debug_data(5, __func__, urb->actual_length, +- urb->transfer_buffer); + } + + static int adu_open(struct inode *inode, struct file *file) diff --git a/usb-adutux-remove-custom-debug-macro.patch b/usb-adutux-remove-custom-debug-macro.patch new file mode 100644 index 00000000000000..e8482b5b86b4ee --- /dev/null +++ b/usb-adutux-remove-custom-debug-macro.patch @@ -0,0 +1,283 @@ +From foo@baz Wed Jun 26 16:22:06 PDT 2013 +Date: Wed, 26 Jun 2013 16:22:06 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: linux-usb@vger.kernel.org +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: adutux: remove custom debug macro + +Don't use a custom debug macro for just one driver, instead rely on the +in-kernel dynamic debugging logic, which can handle this much better. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/usb/misc/adutux.c | 97 +++++++++++++++++++++++++++------------------- + 1 file changed, 58 insertions(+), 39 deletions(-) + +--- a/drivers/usb/misc/adutux.c ++++ b/drivers/usb/misc/adutux.c +@@ -147,10 +147,8 @@ static void adu_abort_transfers(struct a + { + unsigned long flags; + +- if (dev->udev == NULL) { +- dbg(1, " %s : udev is null", __func__); ++ if (dev->udev == NULL) + return; +- } + + /* shutdown transfer */ + +@@ -195,8 +193,9 @@ static void adu_interrupt_in_callback(st + if (status != 0) { + if ((status != -ENOENT) && (status != -ECONNRESET) && + (status != -ESHUTDOWN)) { +- dbg(1, " %s : nonzero status received: %d", +- __func__, status); ++ dev_dbg(&dev->udev->dev, ++ "%s : nonzero status received: %d\n", ++ __func__, status); + } + goto exit; + } +@@ -210,10 +209,11 @@ static void adu_interrupt_in_callback(st + dev->interrupt_in_buffer, urb->actual_length); + + dev->read_buffer_length += urb->actual_length; +- dbg(2, " %s reading %d ", __func__, +- urb->actual_length); ++ dev_dbg(&dev->udev->dev,"%s reading %d\n", __func__, ++ urb->actual_length); + } else { +- dbg(1, " %s : read_buffer overflow", __func__); ++ dev_dbg(&dev->udev->dev,"%s : read_buffer overflow\n", ++ __func__); + } + } + +@@ -236,8 +236,9 @@ static void adu_interrupt_out_callback(s + if (status != 0) { + if ((status != -ENOENT) && + (status != -ECONNRESET)) { +- dbg(1, " %s :nonzero status received: %d", +- __func__, status); ++ dev_dbg(&dev->udev->dev, ++ "%s :nonzero status received: %d\n", __func__, ++ status); + } + goto exit; + } +@@ -262,10 +263,8 @@ static int adu_open(struct inode *inode, + subminor = iminor(inode); + + retval = mutex_lock_interruptible(&adutux_mutex); +- if (retval) { +- dbg(2, "%s : mutex lock failed", __func__); ++ if (retval) + goto exit_no_lock; +- } + + interface = usb_find_interface(&adu_driver, subminor); + if (!interface) { +@@ -288,7 +287,8 @@ static int adu_open(struct inode *inode, + } + + ++dev->open_count; +- dbg(2, "%s : open count %d", __func__, dev->open_count); ++ dev_dbg(&dev->udev->dev, "%s: open count %d\n", __func__, ++ dev->open_count); + + /* save device in the file's private structure */ + file->private_data = dev; +@@ -325,7 +325,8 @@ static void adu_release_internal(struct + { + /* decrement our usage count for the device */ + --dev->open_count; +- dbg(2, " %s : open count %d", __func__, dev->open_count); ++ dev_dbg(&dev->udev->dev, "%s : open count %d\n", __func__, ++ dev->open_count); + if (dev->open_count <= 0) { + adu_abort_transfers(dev); + dev->open_count = 0; +@@ -338,14 +339,12 @@ static int adu_release(struct inode *ino + int retval = 0; + + if (file == NULL) { +- dbg(1, " %s : file is NULL", __func__); + retval = -ENODEV; + goto exit; + } + + dev = file->private_data; + if (dev == NULL) { +- dbg(1, " %s : object is NULL", __func__); + retval = -ENODEV; + goto exit; + } +@@ -353,7 +352,7 @@ static int adu_release(struct inode *ino + mutex_lock(&adutux_mutex); /* not interruptible */ + + if (dev->open_count <= 0) { +- dbg(1, " %s : device not opened", __func__); ++ dev_dbg(&dev->udev->dev, "%s : device not opened\n", __func__); + retval = -ENODEV; + goto unlock; + } +@@ -397,17 +396,19 @@ static ssize_t adu_read(struct file *fil + + /* verify that some data was requested */ + if (count == 0) { +- dbg(1, " %s : read request of 0 bytes", __func__); ++ dev_dbg(&dev->udev->dev, "%s : read request of 0 bytes\n", ++ __func__); + goto exit; + } + + timeout = COMMAND_TIMEOUT; +- dbg(2, " %s : about to start looping", __func__); ++ dev_dbg(&dev->udev->dev, "%s : about to start looping\n", __func__); + while (bytes_to_read) { + int data_in_secondary = dev->secondary_tail - dev->secondary_head; +- dbg(2, " %s : while, data_in_secondary=%d, status=%d", +- __func__, data_in_secondary, +- dev->interrupt_in_urb->status); ++ dev_dbg(&dev->udev->dev, ++ "%s : while, data_in_secondary=%d, status=%d\n", ++ __func__, data_in_secondary, ++ dev->interrupt_in_urb->status); + + if (data_in_secondary) { + /* drain secondary buffer */ +@@ -430,8 +431,9 @@ static ssize_t adu_read(struct file *fil + if (dev->read_buffer_length) { + /* we secure access to the primary */ + char *tmp; +- dbg(2, " %s : swap, read_buffer_length = %d", +- __func__, dev->read_buffer_length); ++ dev_dbg(&dev->udev->dev, ++ "%s : swap, read_buffer_length = %d\n", ++ __func__, dev->read_buffer_length); + tmp = dev->read_buffer_secondary; + dev->read_buffer_secondary = dev->read_buffer_primary; + dev->read_buffer_primary = tmp; +@@ -446,10 +448,14 @@ static ssize_t adu_read(struct file *fil + if (!dev->read_urb_finished) { + /* somebody is doing IO */ + spin_unlock_irqrestore(&dev->buflock, flags); +- dbg(2, " %s : submitted already", __func__); ++ dev_dbg(&dev->udev->dev, ++ "%s : submitted already\n", ++ __func__); + } else { + /* we must initiate input */ +- dbg(2, " %s : initiate input", __func__); ++ dev_dbg(&dev->udev->dev, ++ "%s : initiate input\n", ++ __func__); + dev->read_urb_finished = 0; + spin_unlock_irqrestore(&dev->buflock, flags); + +@@ -467,7 +473,9 @@ static ssize_t adu_read(struct file *fil + if (retval == -ENOMEM) { + retval = bytes_read ? bytes_read : -ENOMEM; + } +- dbg(2, " %s : submit failed", __func__); ++ dev_dbg(&dev->udev->dev, ++ "%s : submit failed\n", ++ __func__); + goto exit; + } + } +@@ -486,13 +494,16 @@ static ssize_t adu_read(struct file *fil + remove_wait_queue(&dev->read_wait, &wait); + + if (timeout <= 0) { +- dbg(2, " %s : timeout", __func__); ++ dev_dbg(&dev->udev->dev, ++ "%s : timeout\n", __func__); + retval = bytes_read ? bytes_read : -ETIMEDOUT; + goto exit; + } + + if (signal_pending(current)) { +- dbg(2, " %s : signal pending", __func__); ++ dev_dbg(&dev->udev->dev, ++ "%s : signal pending\n", ++ __func__); + retval = bytes_read ? bytes_read : -EINTR; + goto exit; + } +@@ -555,7 +566,8 @@ static ssize_t adu_write(struct file *fi + + /* verify that we actually have some data to write */ + if (count == 0) { +- dbg(1, " %s : write request of 0 bytes", __func__); ++ dev_dbg(&dev->udev->dev, "%s : write request of 0 bytes\n", ++ __func__); + goto exit; + } + +@@ -568,13 +580,15 @@ static ssize_t adu_write(struct file *fi + + mutex_unlock(&dev->mtx); + if (signal_pending(current)) { +- dbg(1, " %s : interrupted", __func__); ++ dev_dbg(&dev->udev->dev, "%s : interrupted\n", ++ __func__); + set_current_state(TASK_RUNNING); + retval = -EINTR; + goto exit_onqueue; + } + if (schedule_timeout(COMMAND_TIMEOUT) == 0) { +- dbg(1, "%s - command timed out.", __func__); ++ dev_dbg(&dev->udev->dev, ++ "%s - command timed out.\n", __func__); + retval = -ETIMEDOUT; + goto exit_onqueue; + } +@@ -585,18 +599,22 @@ static ssize_t adu_write(struct file *fi + goto exit_nolock; + } + +- dbg(4, " %s : in progress, count = %Zd", __func__, count); ++ dev_dbg(&dev->udev->dev, ++ "%s : in progress, count = %Zd\n", ++ __func__, count); + } else { + spin_unlock_irqrestore(&dev->buflock, flags); + set_current_state(TASK_RUNNING); + remove_wait_queue(&dev->write_wait, &waita); +- dbg(4, " %s : sending, count = %Zd", __func__, count); ++ dev_dbg(&dev->udev->dev, "%s : sending, count = %Zd\n", ++ __func__, count); + + /* write the data into interrupt_out_buffer from userspace */ + buffer_size = usb_endpoint_maxp(dev->interrupt_out_endpoint); + bytes_to_write = count > buffer_size ? buffer_size : count; +- dbg(4, " %s : buffer_size = %Zd, count = %Zd, bytes_to_write = %Zd", +- __func__, buffer_size, count, bytes_to_write); ++ dev_dbg(&dev->udev->dev, ++ "%s : buffer_size = %Zd, count = %Zd, bytes_to_write = %Zd\n", ++ __func__, buffer_size, count, bytes_to_write); + + if (copy_from_user(dev->interrupt_out_buffer, buffer, bytes_to_write) != 0) { + retval = -EFAULT; +@@ -779,7 +797,7 @@ static int adu_probe(struct usb_interfac + dev_err(&interface->dev, "Could not retrieve serial number\n"); + goto error; + } +- dbg(2, " %s : serial_number=%s", __func__, dev->serial_number); ++ dev_dbg(&interface->dev,"serial_number=%s", dev->serial_number); + + /* we can register the device now, as it is ready */ + usb_set_intfdata(interface, dev); +@@ -829,7 +847,8 @@ static void adu_disconnect(struct usb_in + usb_set_intfdata(interface, NULL); + + /* if the device is not opened, then we clean up right now */ +- dbg(2, " %s : open count %d", __func__, dev->open_count); ++ dev_dbg(&dev->udev->dev, "%s : open count %d\n", ++ __func__, dev->open_count); + if (!dev->open_count) + adu_delete(dev); + diff --git a/usb-adutux-remove-direct-calls-to-printk.patch b/usb-adutux-remove-direct-calls-to-printk.patch new file mode 100644 index 00000000000000..56463b6254d5cf --- /dev/null +++ b/usb-adutux-remove-direct-calls-to-printk.patch @@ -0,0 +1,56 @@ +From foo@baz Wed Jun 26 16:23:03 PDT 2013 +Date: Wed, 26 Jun 2013 16:23:03 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: linux-usb@vger.kernel.org +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: adutux: remove direct calls to printk() + +Use the pr_* calls instead, which are much more descriptive. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/usb/misc/adutux.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/usb/misc/adutux.c ++++ b/drivers/usb/misc/adutux.c +@@ -18,6 +18,8 @@ + * + */ + ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ++ + #include <linux/kernel.h> + #include <linux/errno.h> + #include <linux/init.h> +@@ -236,8 +238,8 @@ static int adu_open(struct inode *inode, + + interface = usb_find_interface(&adu_driver, subminor); + if (!interface) { +- printk(KERN_ERR "adutux: %s - error, can't find device for " +- "minor %d\n", __func__, subminor); ++ pr_err("%s - error, can't find device for minor %d\n", ++ __func__, subminor); + retval = -ENODEV; + goto exit_no_device; + } +@@ -357,8 +359,7 @@ static ssize_t adu_read(struct file *fil + /* verify that the device wasn't unplugged */ + if (dev->udev == NULL) { + retval = -ENODEV; +- printk(KERN_ERR "adutux: No device or device unplugged %d\n", +- retval); ++ pr_err("No device or device unplugged %d\n", retval); + goto exit; + } + +@@ -527,8 +528,7 @@ static ssize_t adu_write(struct file *fi + /* verify that the device wasn't unplugged */ + if (dev->udev == NULL) { + retval = -ENODEV; +- printk(KERN_ERR "adutux: No device or device unplugged %d\n", +- retval); ++ pr_err("No device or device unplugged %d\n", retval); + goto exit; + } + diff --git a/usb-adutux-remove-unneeded-tracing-macros.patch b/usb-adutux-remove-unneeded-tracing-macros.patch new file mode 100644 index 00000000000000..8b26214ac16e42 --- /dev/null +++ b/usb-adutux-remove-unneeded-tracing-macros.patch @@ -0,0 +1,211 @@ +From foo@baz Wed Jun 26 16:21:19 PDT 2013 +Date: Wed, 26 Jun 2013 16:21:19 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: linux-usb@vger.kernel.org +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: adutux: remove unneeded tracing macros + +Remove the unneeded tracing macros in this driver. The kernel has a +built-in trace function that can be used if this is really still needed. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/usb/misc/adutux.c | 41 +---------------------------------------- + 1 file changed, 1 insertion(+), 40 deletions(-) + +--- a/drivers/usb/misc/adutux.c ++++ b/drivers/usb/misc/adutux.c +@@ -147,11 +147,9 @@ static void adu_abort_transfers(struct a + { + unsigned long flags; + +- dbg(2, " %s : enter", __func__); +- + if (dev->udev == NULL) { + dbg(1, " %s : udev is null", __func__); +- goto exit; ++ return; + } + + /* shutdown transfer */ +@@ -170,15 +168,10 @@ static void adu_abort_transfers(struct a + usb_kill_urb(dev->interrupt_out_urb); + } else + spin_unlock_irqrestore(&dev->buflock, flags); +- +-exit: +- dbg(2, " %s : leave", __func__); + } + + static void adu_delete(struct adu_device *dev) + { +- dbg(2, "%s enter", __func__); +- + /* free data structures */ + usb_free_urb(dev->interrupt_in_urb); + usb_free_urb(dev->interrupt_out_urb); +@@ -187,8 +180,6 @@ static void adu_delete(struct adu_device + kfree(dev->interrupt_in_buffer); + kfree(dev->interrupt_out_buffer); + kfree(dev); +- +- dbg(2, "%s : leave", __func__); + } + + static void adu_interrupt_in_callback(struct urb *urb) +@@ -196,7 +187,6 @@ static void adu_interrupt_in_callback(st + struct adu_device *dev = urb->context; + int status = urb->status; + +- dbg(4, " %s : enter, status %d", __func__, status); + adu_debug_data(5, __func__, urb->actual_length, + urb->transfer_buffer); + +@@ -234,7 +224,6 @@ exit: + wake_up_interruptible(&dev->read_wait); + adu_debug_data(5, __func__, urb->actual_length, + urb->transfer_buffer); +- dbg(4, " %s : leave, status %d", __func__, status); + } + + static void adu_interrupt_out_callback(struct urb *urb) +@@ -242,7 +231,6 @@ static void adu_interrupt_out_callback(s + struct adu_device *dev = urb->context; + int status = urb->status; + +- dbg(4, " %s : enter, status %d", __func__, status); + adu_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); + + if (status != 0) { +@@ -262,7 +250,6 @@ exit: + + adu_debug_data(5, __func__, urb->actual_length, + urb->transfer_buffer); +- dbg(4, " %s : leave, status %d", __func__, status); + } + + static int adu_open(struct inode *inode, struct file *file) +@@ -272,8 +259,6 @@ static int adu_open(struct inode *inode, + int subminor; + int retval; + +- dbg(2, "%s : enter", __func__); +- + subminor = iminor(inode); + + retval = mutex_lock_interruptible(&adutux_mutex); +@@ -333,14 +318,11 @@ static int adu_open(struct inode *inode, + exit_no_device: + mutex_unlock(&adutux_mutex); + exit_no_lock: +- dbg(2, "%s : leave, return value %d ", __func__, retval); + return retval; + } + + static void adu_release_internal(struct adu_device *dev) + { +- dbg(2, " %s : enter", __func__); +- + /* decrement our usage count for the device */ + --dev->open_count; + dbg(2, " %s : open count %d", __func__, dev->open_count); +@@ -348,8 +330,6 @@ static void adu_release_internal(struct + adu_abort_transfers(dev); + dev->open_count = 0; + } +- +- dbg(2, " %s : leave", __func__); + } + + static int adu_release(struct inode *inode, struct file *file) +@@ -357,8 +337,6 @@ static int adu_release(struct inode *ino + struct adu_device *dev; + int retval = 0; + +- dbg(2, " %s : enter", __func__); +- + if (file == NULL) { + dbg(1, " %s : file is NULL", __func__); + retval = -ENODEV; +@@ -389,7 +367,6 @@ static int adu_release(struct inode *ino + unlock: + mutex_unlock(&adutux_mutex); + exit: +- dbg(2, " %s : leave, return value %d", __func__, retval); + return retval; + } + +@@ -406,11 +383,7 @@ static ssize_t adu_read(struct file *fil + unsigned long flags; + DECLARE_WAITQUEUE(wait, current); + +- dbg(2, " %s : enter, count = %Zd, file=%p", __func__, count, file); +- + dev = file->private_data; +- dbg(2, " %s : dev=%p", __func__, dev); +- + if (mutex_lock_interruptible(&dev->mtx)) + return -ERESTARTSYS; + +@@ -552,7 +525,6 @@ exit: + /* unlock the device */ + mutex_unlock(&dev->mtx); + +- dbg(2, " %s : leave, return value %d", __func__, retval); + return retval; + } + +@@ -567,8 +539,6 @@ static ssize_t adu_write(struct file *fi + unsigned long flags; + int retval; + +- dbg(2, " %s : enter, count = %Zd", __func__, count); +- + dev = file->private_data; + + retval = mutex_lock_interruptible(&dev->mtx); +@@ -665,7 +635,6 @@ static ssize_t adu_write(struct file *fi + exit: + mutex_unlock(&dev->mtx); + exit_nolock: +- dbg(2, " %s : leave, return value %d", __func__, retval); + return retval; + + exit_onqueue: +@@ -711,8 +680,6 @@ static int adu_probe(struct usb_interfac + int out_end_size; + int i; + +- dbg(2, " %s : enter", __func__); +- + if (udev == NULL) { + dev_err(&interface->dev, "udev is NULL.\n"); + goto exit; +@@ -833,8 +800,6 @@ static int adu_probe(struct usb_interfac + udev->descriptor.idProduct, dev->serial_number, + (dev->minor - ADU_MINOR_BASE)); + exit: +- dbg(2, " %s : leave, return value %p (dev)", __func__, dev); +- + return retval; + + error: +@@ -852,8 +817,6 @@ static void adu_disconnect(struct usb_in + struct adu_device *dev; + int minor; + +- dbg(2, " %s : enter", __func__); +- + dev = usb_get_intfdata(interface); + + mutex_lock(&dev->mtx); /* not interruptible */ +@@ -874,8 +837,6 @@ static void adu_disconnect(struct usb_in + + dev_info(&interface->dev, "ADU device adutux%d now disconnected\n", + (minor - ADU_MINOR_BASE)); +- +- dbg(2, " %s : leave", __func__); + } + + /* usb specific object needed to register this driver with the usb subsystem */ diff --git a/usb-gadget-fix-up-comment.patch b/usb-gadget-fix-up-comment.patch new file mode 100644 index 00000000000000..c5d42c0e7362de --- /dev/null +++ b/usb-gadget-fix-up-comment.patch @@ -0,0 +1,27 @@ +From foo@baz Fri Jun 28 11:11:19 PDT 2013 +Date: Fri, 28 Jun 2013 11:11:19 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: Felipe Balbi <balbi@ti.com> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: gadget: fix up comment + +This endif is for CONFIG_USB_GADGET_DEBUG_FILES, not CONFIG_USB_DEBUG, +so document it properly. + +Cc: Felipe Balbi <balbi@ti.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/usb/gadget/storage_common.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/gadget/storage_common.c ++++ b/drivers/usb/gadget/storage_common.c +@@ -172,7 +172,7 @@ MODULE_PARM_DESC(num_buffers, "Number of + */ + #define fsg_num_buffers CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS + +-#endif /* CONFIG_USB_DEBUG */ ++#endif /* CONFIG_USB_GADGET_DEBUG_FILES */ + + /* check if fsg_num_buffers is within a valid range */ + static inline int fsg_num_buffers_validate(void) diff --git a/usb-isp116x-remove-dependency-on-config_usb_debug.patch b/usb-isp116x-remove-dependency-on-config_usb_debug.patch new file mode 100644 index 00000000000000..6877cbfe4253d1 --- /dev/null +++ b/usb-isp116x-remove-dependency-on-config_usb_debug.patch @@ -0,0 +1,54 @@ +From foo@baz Fri Jun 28 11:19:44 PDT 2013 +Date: Fri, 28 Jun 2013 11:19:44 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: Olav Kongas <ok@artecdesign.ee> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: isp116x: remove dependency on CONFIG_USB_DEBUG + +Move all debugging messages in the driver to use the dynamic debug +subsystem, and not rely on CONFIG_USB_DEBUG to turn them on or off. + +This lets debugging be enabled without having to rebuild the driver, an +important thing for users that can not do it. + +It also removes the pointless IRQ_TEST() macro, as that was totally +useless and obviously never used. + +Cc: Olav Kongas <ok@artecdesign.ee> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/usb/host/isp116x.h | 13 +------------ + 1 file changed, 1 insertion(+), 12 deletions(-) + +--- a/drivers/usb/host/isp116x.h ++++ b/drivers/usb/host/isp116x.h +@@ -325,11 +325,7 @@ struct isp116x_ep { + + /*-------------------------------------------------------------------------*/ + +-#ifdef DEBUG +-#define DBG(stuff...) printk(KERN_DEBUG "116x: " stuff) +-#else +-#define DBG(stuff...) do{}while(0) +-#endif ++#define DBG(stuff...) pr_debug("116x: " stuff) + + #ifdef VERBOSE + # define VDBG DBG +@@ -358,15 +354,8 @@ struct isp116x_ep { + #define isp116x_check_platform_delay(h) 0 + #endif + +-#if defined(DEBUG) +-#define IRQ_TEST() BUG_ON(!irqs_disabled()) +-#else +-#define IRQ_TEST() do{}while(0) +-#endif +- + static inline void isp116x_write_addr(struct isp116x *isp116x, unsigned reg) + { +- IRQ_TEST(); + writew(reg & 0xff, isp116x->addr_reg); + isp116x_delay(isp116x, 300); + } diff --git a/usb-isp1362-move-debug-files-from-proc-to-debugfs.patch b/usb-isp1362-move-debug-files-from-proc-to-debugfs.patch new file mode 100644 index 00000000000000..ed2cece0f0e113 --- /dev/null +++ b/usb-isp1362-move-debug-files-from-proc-to-debugfs.patch @@ -0,0 +1,127 @@ +From foo@baz Tue Jul 2 12:17:06 PDT 2013 +Date: Tue, 02 Jul 2013 12:17:06 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: isp1362: move debug files from proc to debugfs + +Drivers should not be putting debug files in /proc/ that is what debugfs +is for, so move the isp1362 driver's debug file to debugfs. + +Cc: Felipe Balbi <balbi@ti.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/usb/host/isp1362-hcd.c | 45 ++++++++++------------------------------- + drivers/usb/host/isp1362.h | 2 - + 2 files changed, 12 insertions(+), 35 deletions(-) + +--- a/drivers/usb/host/isp1362-hcd.c ++++ b/drivers/usb/host/isp1362-hcd.c +@@ -78,6 +78,8 @@ + #include <linux/io.h> + #include <linux/bitmap.h> + #include <linux/prefetch.h> ++#include <linux/debugfs.h> ++#include <linux/seq_file.h> + + #include <asm/irq.h> + #include <asm/byteorder.h> +@@ -88,7 +90,6 @@ static int dbg_level; + module_param(dbg_level, int, 0644); + #else + module_param(dbg_level, int, 0); +-#define STUB_DEBUG_FILE + #endif + + #include "../core/usb.h" +@@ -1907,20 +1908,6 @@ static int isp1362_bus_resume(struct usb + + /*-------------------------------------------------------------------------*/ + +-#ifdef STUB_DEBUG_FILE +- +-static inline void create_debug_file(struct isp1362_hcd *isp1362_hcd) +-{ +-} +-static inline void remove_debug_file(struct isp1362_hcd *isp1362_hcd) +-{ +-} +- +-#else +- +-#include <linux/proc_fs.h> +-#include <linux/seq_file.h> +- + static void dump_irq(struct seq_file *s, char *label, u16 mask) + { + seq_printf(s, "%-15s %04x%s%s%s%s%s%s\n", label, mask, +@@ -2063,7 +2050,7 @@ static void dump_regs(struct seq_file *s + isp1362_read_reg16(isp1362_hcd, HCATLDTCTO)); + } + +-static int proc_isp1362_show(struct seq_file *s, void *unused) ++static int isp1362_show(struct seq_file *s, void *unused) + { + struct isp1362_hcd *isp1362_hcd = s->private; + struct isp1362_ep *ep; +@@ -2167,41 +2154,31 @@ static int proc_isp1362_show(struct seq_ + return 0; + } + +-static int proc_isp1362_open(struct inode *inode, struct file *file) ++static int isp1362_open(struct inode *inode, struct file *file) + { +- return single_open(file, proc_isp1362_show, PDE_DATA(inode)); ++ return single_open(file, isp1362_show, PDE_DATA(inode)); + } + +-static const struct file_operations proc_ops = { +- .open = proc_isp1362_open, ++static const struct file_operations debug_ops = { ++ .open = isp1362_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, + }; + + /* expect just one isp1362_hcd per system */ +-static const char proc_filename[] = "driver/isp1362"; +- + static void create_debug_file(struct isp1362_hcd *isp1362_hcd) + { +- struct proc_dir_entry *pde; +- +- pde = proc_create_data(proc_filename, 0, NULL, &proc_ops, isp1362_hcd); +- if (pde == NULL) { +- pr_warning("%s: Failed to create debug file '%s'\n", __func__, proc_filename); +- return; +- } +- isp1362_hcd->pde = pde; ++ isp1362_hcd->debug_file = debugfs_create_file("isp1362", S_IRUGO, ++ usb_debug_root, ++ isp1362_hcd, &debug_ops); + } + + static void remove_debug_file(struct isp1362_hcd *isp1362_hcd) + { +- if (isp1362_hcd->pde) +- remove_proc_entry(proc_filename, NULL); ++ debugfs_remove(isp1362_hcd->debug_file); + } + +-#endif +- + /*-------------------------------------------------------------------------*/ + + static void __isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd) +--- a/drivers/usb/host/isp1362.h ++++ b/drivers/usb/host/isp1362.h +@@ -480,7 +480,7 @@ struct isp1362_hcd { + + struct isp1362_platform_data *board; + +- struct proc_dir_entry *pde; ++ struct dentry *debug_file; + unsigned long stat1, stat2, stat4, stat8, stat16; + + /* HC registers */ diff --git a/usb-isp1362-remove-_dbg-usage.patch b/usb-isp1362-remove-_dbg-usage.patch new file mode 100644 index 00000000000000..ba87fd83f214fd --- /dev/null +++ b/usb-isp1362-remove-_dbg-usage.patch @@ -0,0 +1,142 @@ +From foo@baz Fri Jun 28 11:14:57 PDT 2013 +Date: Fri, 28 Jun 2013 11:14:57 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: Felipe Balbi <balbi@ti.com> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: isp1362: remove _DBG() usage + +If you want a debug call, just make it, so move to using the +already-there DBG() call. No need to make things more complex than they +really need to be. + +Cc: Felipe Balbi <balbi@ti.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/usb/host/isp1362-hcd.c | 30 +++++++++++++++--------------- + drivers/usb/host/isp1362.h | 6 ------ + 2 files changed, 15 insertions(+), 21 deletions(-) + +--- a/drivers/usb/host/isp1362-hcd.c ++++ b/drivers/usb/host/isp1362-hcd.c +@@ -1573,12 +1573,12 @@ static int isp1362_hub_control(struct us + DBG(0, "ClearHubFeature: "); + switch (wValue) { + case C_HUB_OVER_CURRENT: +- _DBG(0, "C_HUB_OVER_CURRENT\n"); ++ DBG(0, "C_HUB_OVER_CURRENT\n"); + spin_lock_irqsave(&isp1362_hcd->lock, flags); + isp1362_write_reg32(isp1362_hcd, HCRHSTATUS, RH_HS_OCIC); + spin_unlock_irqrestore(&isp1362_hcd->lock, flags); + case C_HUB_LOCAL_POWER: +- _DBG(0, "C_HUB_LOCAL_POWER\n"); ++ DBG(0, "C_HUB_LOCAL_POWER\n"); + break; + default: + goto error; +@@ -1589,7 +1589,7 @@ static int isp1362_hub_control(struct us + switch (wValue) { + case C_HUB_OVER_CURRENT: + case C_HUB_LOCAL_POWER: +- _DBG(0, "C_HUB_OVER_CURRENT or C_HUB_LOCAL_POWER\n"); ++ DBG(0, "C_HUB_OVER_CURRENT or C_HUB_LOCAL_POWER\n"); + break; + default: + goto error; +@@ -1620,36 +1620,36 @@ static int isp1362_hub_control(struct us + + switch (wValue) { + case USB_PORT_FEAT_ENABLE: +- _DBG(0, "USB_PORT_FEAT_ENABLE\n"); ++ DBG(0, "USB_PORT_FEAT_ENABLE\n"); + tmp = RH_PS_CCS; + break; + case USB_PORT_FEAT_C_ENABLE: +- _DBG(0, "USB_PORT_FEAT_C_ENABLE\n"); ++ DBG(0, "USB_PORT_FEAT_C_ENABLE\n"); + tmp = RH_PS_PESC; + break; + case USB_PORT_FEAT_SUSPEND: +- _DBG(0, "USB_PORT_FEAT_SUSPEND\n"); ++ DBG(0, "USB_PORT_FEAT_SUSPEND\n"); + tmp = RH_PS_POCI; + break; + case USB_PORT_FEAT_C_SUSPEND: +- _DBG(0, "USB_PORT_FEAT_C_SUSPEND\n"); ++ DBG(0, "USB_PORT_FEAT_C_SUSPEND\n"); + tmp = RH_PS_PSSC; + break; + case USB_PORT_FEAT_POWER: +- _DBG(0, "USB_PORT_FEAT_POWER\n"); ++ DBG(0, "USB_PORT_FEAT_POWER\n"); + tmp = RH_PS_LSDA; + + break; + case USB_PORT_FEAT_C_CONNECTION: +- _DBG(0, "USB_PORT_FEAT_C_CONNECTION\n"); ++ DBG(0, "USB_PORT_FEAT_C_CONNECTION\n"); + tmp = RH_PS_CSC; + break; + case USB_PORT_FEAT_C_OVER_CURRENT: +- _DBG(0, "USB_PORT_FEAT_C_OVER_CURRENT\n"); ++ DBG(0, "USB_PORT_FEAT_C_OVER_CURRENT\n"); + tmp = RH_PS_OCIC; + break; + case USB_PORT_FEAT_C_RESET: +- _DBG(0, "USB_PORT_FEAT_C_RESET\n"); ++ DBG(0, "USB_PORT_FEAT_C_RESET\n"); + tmp = RH_PS_PRSC; + break; + default: +@@ -1669,7 +1669,7 @@ static int isp1362_hub_control(struct us + wIndex--; + switch (wValue) { + case USB_PORT_FEAT_SUSPEND: +- _DBG(0, "USB_PORT_FEAT_SUSPEND\n"); ++ DBG(0, "USB_PORT_FEAT_SUSPEND\n"); + spin_lock_irqsave(&isp1362_hcd->lock, flags); + isp1362_write_reg32(isp1362_hcd, HCRHPORT1 + wIndex, RH_PS_PSS); + isp1362_hcd->rhport[wIndex] = +@@ -1677,7 +1677,7 @@ static int isp1362_hub_control(struct us + spin_unlock_irqrestore(&isp1362_hcd->lock, flags); + break; + case USB_PORT_FEAT_POWER: +- _DBG(0, "USB_PORT_FEAT_POWER\n"); ++ DBG(0, "USB_PORT_FEAT_POWER\n"); + spin_lock_irqsave(&isp1362_hcd->lock, flags); + isp1362_write_reg32(isp1362_hcd, HCRHPORT1 + wIndex, RH_PS_PPS); + isp1362_hcd->rhport[wIndex] = +@@ -1685,7 +1685,7 @@ static int isp1362_hub_control(struct us + spin_unlock_irqrestore(&isp1362_hcd->lock, flags); + break; + case USB_PORT_FEAT_RESET: +- _DBG(0, "USB_PORT_FEAT_RESET\n"); ++ DBG(0, "USB_PORT_FEAT_RESET\n"); + spin_lock_irqsave(&isp1362_hcd->lock, flags); + + t1 = jiffies + msecs_to_jiffies(USB_RESET_WIDTH); +@@ -1719,7 +1719,7 @@ static int isp1362_hub_control(struct us + default: + error: + /* "protocol stall" on error */ +- _DBG(0, "PROTOCOL STALL\n"); ++ DBG(0, "PROTOCOL STALL\n"); + retval = -EPIPE; + } + +--- a/drivers/usb/host/isp1362.h ++++ b/drivers/usb/host/isp1362.h +@@ -588,14 +588,8 @@ static inline struct usb_hcd *isp1362_hc + if (dbg_level > level) \ + pr_debug(fmt); \ + } while (0) +-#define _DBG(level, fmt...) \ +- do { \ +- if (dbg_level > level) \ +- printk(fmt); \ +- } while (0) + #else + #define DBG(fmt...) do {} while (0) +-#define _DBG DBG + #endif + + #ifdef VERBOSE diff --git a/usb-isp1362-remove-config_usb_debug-dependency.patch b/usb-isp1362-remove-config_usb_debug-dependency.patch new file mode 100644 index 00000000000000..2b3733b45382b2 --- /dev/null +++ b/usb-isp1362-remove-config_usb_debug-dependency.patch @@ -0,0 +1,98 @@ +From foo@baz Fri Jun 28 11:16:30 PDT 2013 +Date: Fri, 28 Jun 2013 11:16:30 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: Felipe Balbi <balbi@ti.com> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: isp1362: remove CONFIG_USB_DEBUG dependency + +Now that the debugging macros are cleaned up, just rely on the dynamic +debug code in the kernel to do the debug messages for the driver. + +This lets debugging be enabled without having to rebuild the driver, an +important thing for users that can not do it. + +Cc: Felipe Balbi <balbi@ti.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/usb/host/isp1362-hcd.c | 6 +----- + drivers/usb/host/isp1362.h | 16 ++++------------ + 2 files changed, 5 insertions(+), 17 deletions(-) + +--- a/drivers/usb/host/isp1362-hcd.c ++++ b/drivers/usb/host/isp1362-hcd.c +@@ -37,11 +37,7 @@ + * recovery time (MSCx = 0x7f8c) with a memory clock of 99.53 MHz. + */ + +-#ifdef CONFIG_USB_DEBUG +-# define ISP1362_DEBUG +-#else +-# undef ISP1362_DEBUG +-#endif ++#undef ISP1362_DEBUG + + /* + * The PXA255 UDC apparently doesn't handle GET_STATUS, GET_CONFIG and +--- a/drivers/usb/host/isp1362.h ++++ b/drivers/usb/host/isp1362.h +@@ -76,14 +76,14 @@ static inline void delayed_insw(unsigned + + #define ISP1362_REG_WRITE_OFFSET 0x80 + +-#ifdef ISP1362_DEBUG +-typedef const unsigned int isp1362_reg_t; +- + #define REG_WIDTH_16 0x000 + #define REG_WIDTH_32 0x100 + #define REG_WIDTH_MASK 0x100 + #define REG_NO_MASK 0x0ff + ++#ifdef ISP1362_DEBUG ++typedef const unsigned int isp1362_reg_t; ++ + #define REG_ACCESS_R 0x200 + #define REG_ACCESS_W 0x400 + #define REG_ACCESS_RW 0x600 +@@ -582,15 +582,11 @@ static inline struct usb_hcd *isp1362_hc + * ISP1362 HW Interface + */ + +-#ifdef ISP1362_DEBUG + #define DBG(level, fmt...) \ + do { \ + if (dbg_level > level) \ + pr_debug(fmt); \ + } while (0) +-#else +-#define DBG(fmt...) do {} while (0) +-#endif + + #ifdef VERBOSE + # define VDBG(fmt...) DBG(3, fmt) +@@ -833,7 +829,6 @@ static void isp1362_write_fifo(struct is + isp1362_write_reg32(d, r, __v & ~m); \ + } + +-#ifdef ISP1362_DEBUG + #define isp1362_show_reg(d, r) { \ + if ((ISP1362_REG_##r & REG_WIDTH_MASK) == REG_WIDTH_32) \ + DBG(0, "%-12s[%02x]: %08x\n", #r, \ +@@ -842,9 +837,6 @@ static void isp1362_write_fifo(struct is + DBG(0, "%-12s[%02x]: %04x\n", #r, \ + ISP1362_REG_NO(ISP1362_REG_##r), isp1362_read_reg16(d, r)); \ + } +-#else +-#define isp1362_show_reg(d, r) do {} while (0) +-#endif + + static void __attribute__((__unused__)) isp1362_show_regs(struct isp1362_hcd *isp1362_hcd) + { +@@ -967,7 +959,7 @@ static void __attribute__((unused)) dump + } + } + +-#if defined(ISP1362_DEBUG) && defined(PTD_TRACE) ++#if defined(PTD_TRACE) + + static void dump_ptd(struct ptd *ptd) + { diff --git a/usb-isp1362-remove-unused-_bug_on-calls.patch b/usb-isp1362-remove-unused-_bug_on-calls.patch new file mode 100644 index 00000000000000..c1d3e7fc8277d3 --- /dev/null +++ b/usb-isp1362-remove-unused-_bug_on-calls.patch @@ -0,0 +1,137 @@ +From foo@baz Fri Jun 28 11:12:12 PDT 2013 +Date: Fri, 28 Jun 2013 11:12:12 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: Felipe Balbi <balbi@ti.com> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: isp1362: remove unused _BUG_ON() calls + +We shouldn't ever panic in a driver, and these calls were never being +used, so just delete them, as obviously the driver is working properly +now (right?) + +Cc: Felipe Balbi <balbi@ti.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/usb/host/isp1362-hcd.c | 2 -- + drivers/usb/host/isp1362.h | 20 -------------------- + 2 files changed, 22 deletions(-) + +--- a/drivers/usb/host/isp1362-hcd.c ++++ b/drivers/usb/host/isp1362-hcd.c +@@ -350,8 +350,6 @@ static void isp1362_write_ptd(struct isp + struct ptd *ptd = &ep->ptd; + int len = PTD_GET_DIR(ptd) == PTD_DIR_IN ? 0 : ep->length; + +- _BUG_ON(ep->ptd_offset < 0); +- + prefetch(ptd); + isp1362_write_buffer(isp1362_hcd, ptd, ep->ptd_offset, PTD_HEADER_SIZE); + if (len) +--- a/drivers/usb/host/isp1362.h ++++ b/drivers/usb/host/isp1362.h +@@ -91,7 +91,6 @@ typedef const unsigned int isp1362_reg_t + + #define ISP1362_REG_NO(r) ((r) & REG_NO_MASK) + +-#define _BUG_ON(x) BUG_ON(x) + #define _WARN_ON(x) WARN_ON(x) + + #define ISP1362_REG(name, addr, width, rw) \ +@@ -102,7 +101,6 @@ static isp1362_reg_t ISP1362_REG_##name + #else + typedef const unsigned char isp1362_reg_t; + #define ISP1362_REG_NO(r) (r) +-#define _BUG_ON(x) do {} while (0) + #define _WARN_ON(x) do {} while (0) + + #define ISP1362_REG(name, addr, width, rw) \ +@@ -645,9 +643,7 @@ static inline struct usb_hcd *isp1362_hc + */ + static void isp1362_write_addr(struct isp1362_hcd *isp1362_hcd, isp1362_reg_t reg) + { +- /*_BUG_ON((reg & ISP1362_REG_WRITE_OFFSET) && !(reg & REG_ACCESS_W));*/ + REG_ACCESS_TEST(reg); +- _BUG_ON(!irqs_disabled()); + DUMMY_DELAY_ACCESS; + writew(ISP1362_REG_NO(reg), isp1362_hcd->addr_reg); + DUMMY_DELAY_ACCESS; +@@ -656,7 +652,6 @@ static void isp1362_write_addr(struct is + + static void isp1362_write_data16(struct isp1362_hcd *isp1362_hcd, u16 val) + { +- _BUG_ON(!irqs_disabled()); + DUMMY_DELAY_ACCESS; + writew(val, isp1362_hcd->data_reg); + } +@@ -665,7 +660,6 @@ static u16 isp1362_read_data16(struct is + { + u16 val; + +- _BUG_ON(!irqs_disabled()); + DUMMY_DELAY_ACCESS; + val = readw(isp1362_hcd->data_reg); + +@@ -674,7 +668,6 @@ static u16 isp1362_read_data16(struct is + + static void isp1362_write_data32(struct isp1362_hcd *isp1362_hcd, u32 val) + { +- _BUG_ON(!irqs_disabled()); + #if USE_32BIT + DUMMY_DELAY_ACCESS; + writel(val, isp1362_hcd->data_reg); +@@ -690,7 +683,6 @@ static u32 isp1362_read_data32(struct is + { + u32 val; + +- _BUG_ON(!irqs_disabled()); + #if USE_32BIT + DUMMY_DELAY_ACCESS; + val = readl(isp1362_hcd->data_reg); +@@ -713,8 +705,6 @@ static void isp1362_read_fifo(struct isp + if (!len) + return; + +- _BUG_ON(!irqs_disabled()); +- + RDBG("%s: Reading %d byte from fifo to mem @ %p\n", __func__, len, buf); + #if USE_32BIT + if (len >= 4) { +@@ -760,8 +750,6 @@ static void isp1362_write_fifo(struct is + return; + } + +- _BUG_ON(!irqs_disabled()); +- + RDBG("%s: Writing %d byte to fifo from memory @%p\n", __func__, len, buf); + #if USE_32BIT + if (len >= 4) { +@@ -923,10 +911,6 @@ static void __attribute__((__unused__)) + + static void isp1362_write_diraddr(struct isp1362_hcd *isp1362_hcd, u16 offset, u16 len) + { +- _BUG_ON(offset & 1); +- _BUG_ON(offset >= ISP1362_BUF_SIZE); +- _BUG_ON(len > ISP1362_BUF_SIZE); +- _BUG_ON(offset + len > ISP1362_BUF_SIZE); + len = (len + 1) & ~1; + + isp1362_clr_mask16(isp1362_hcd, HCDMACFG, HCDMACFG_CTR_ENABLE); +@@ -936,8 +920,6 @@ static void isp1362_write_diraddr(struct + + static void isp1362_read_buffer(struct isp1362_hcd *isp1362_hcd, void *buf, u16 offset, int len) + { +- _BUG_ON(offset & 1); +- + isp1362_write_diraddr(isp1362_hcd, offset, len); + + DBG(3, "%s: Reading %d byte from buffer @%04x to memory @ %p\n", +@@ -956,8 +938,6 @@ static void isp1362_read_buffer(struct i + + static void isp1362_write_buffer(struct isp1362_hcd *isp1362_hcd, void *buf, u16 offset, int len) + { +- _BUG_ON(offset & 1); +- + isp1362_write_diraddr(isp1362_hcd, offset, len); + + DBG(3, "%s: Writing %d byte to buffer @%04x from memory @ %p\n", diff --git a/usb-isp1362-remove-unused-_warn_on-calls.patch b/usb-isp1362-remove-unused-_warn_on-calls.patch new file mode 100644 index 00000000000000..dc110f20767024 --- /dev/null +++ b/usb-isp1362-remove-unused-_warn_on-calls.patch @@ -0,0 +1,67 @@ +From foo@baz Fri Jun 28 11:13:39 PDT 2013 +Date: Fri, 28 Jun 2013 11:13:39 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: Felipe Balbi <balbi@ti.com> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: isp1362: remove unused _WARN_ON() calls + +Like _BUG_ON(), _WARN_ON() wasn't ever being used, so just delete it, as +obviously things are working properly now (if not, we have bigger +problems...) + +Cc: Felipe Balbi <balbi@ti.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/usb/host/isp1362.h | 9 --------- + 1 file changed, 9 deletions(-) + +--- a/drivers/usb/host/isp1362.h ++++ b/drivers/usb/host/isp1362.h +@@ -91,8 +91,6 @@ typedef const unsigned int isp1362_reg_t + + #define ISP1362_REG_NO(r) ((r) & REG_NO_MASK) + +-#define _WARN_ON(x) WARN_ON(x) +- + #define ISP1362_REG(name, addr, width, rw) \ + static isp1362_reg_t ISP1362_REG_##name = ((addr) | (width) | (rw)) + +@@ -101,7 +99,6 @@ static isp1362_reg_t ISP1362_REG_##name + #else + typedef const unsigned char isp1362_reg_t; + #define ISP1362_REG_NO(r) (r) +-#define _WARN_ON(x) do {} while (0) + + #define ISP1362_REG(name, addr, width, rw) \ + static isp1362_reg_t ISP1362_REG_##name = addr +@@ -926,14 +923,11 @@ static void isp1362_read_buffer(struct i + __func__, len, offset, buf); + + isp1362_write_reg16(isp1362_hcd, HCuPINT, HCuPINT_EOT); +- _WARN_ON((isp1362_read_reg16(isp1362_hcd, HCuPINT) & HCuPINT_EOT)); + + isp1362_write_addr(isp1362_hcd, ISP1362_REG_HCDIRDATA); + + isp1362_read_fifo(isp1362_hcd, buf, len); +- _WARN_ON(!(isp1362_read_reg16(isp1362_hcd, HCuPINT) & HCuPINT_EOT)); + isp1362_write_reg16(isp1362_hcd, HCuPINT, HCuPINT_EOT); +- _WARN_ON((isp1362_read_reg16(isp1362_hcd, HCuPINT) & HCuPINT_EOT)); + } + + static void isp1362_write_buffer(struct isp1362_hcd *isp1362_hcd, void *buf, u16 offset, int len) +@@ -944,14 +938,11 @@ static void isp1362_write_buffer(struct + __func__, len, offset, buf); + + isp1362_write_reg16(isp1362_hcd, HCuPINT, HCuPINT_EOT); +- _WARN_ON((isp1362_read_reg16(isp1362_hcd, HCuPINT) & HCuPINT_EOT)); + + isp1362_write_addr(isp1362_hcd, ISP1362_REG_HCDIRDATA | ISP1362_REG_WRITE_OFFSET); + isp1362_write_fifo(isp1362_hcd, buf, len); + +- _WARN_ON(!(isp1362_read_reg16(isp1362_hcd, HCuPINT) & HCuPINT_EOT)); + isp1362_write_reg16(isp1362_hcd, HCuPINT, HCuPINT_EOT); +- _WARN_ON((isp1362_read_reg16(isp1362_hcd, HCuPINT) & HCuPINT_EOT)); + } + + static void __attribute__((unused)) dump_data(char *buf, int len) diff --git a/usb-ldusb-remove-custom-dbg_info-macro.patch b/usb-ldusb-remove-custom-dbg_info-macro.patch new file mode 100644 index 00000000000000..ebb53dde670bad --- /dev/null +++ b/usb-ldusb-remove-custom-dbg_info-macro.patch @@ -0,0 +1,86 @@ +From foo@baz Wed Jun 26 16:13:27 PDT 2013 +Date: Wed, 26 Jun 2013 16:13:27 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: linux-usb@vger.kernel.org +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: ldusb: remove custom dbg_info() macro + +We want to get rid of CONFIG_USB_DEBUG, so remove the reliance of the +ldusb driver on it. Don't use the custom macro, or a special module +parameter, instead, rely on the in-kernel dynamic debugging +infrastructure, which is much easier to use, and consistant across the +whole kernel. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/usb/misc/ldusb.c | 31 ++++++++++--------------------- + 1 file changed, 10 insertions(+), 21 deletions(-) + +--- a/drivers/usb/misc/ldusb.c ++++ b/drivers/usb/misc/ldusb.c +@@ -129,19 +129,6 @@ MODULE_DESCRIPTION("LD USB Driver"); + MODULE_LICENSE("GPL"); + MODULE_SUPPORTED_DEVICE("LD USB Devices"); + +-#ifdef CONFIG_USB_DEBUG +- static int debug = 1; +-#else +- static int debug = 0; +-#endif +- +-/* Use our own dbg macro */ +-#define dbg_info(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0) +- +-/* Module parameters */ +-module_param(debug, int, S_IRUGO | S_IWUSR); +-MODULE_PARM_DESC(debug, "Debug enabled or not"); +- + /* All interrupt in transfers are collected in a ring buffer to + * avoid racing conditions and get better performance of the driver. + */ +@@ -256,8 +243,9 @@ static void ld_usb_interrupt_in_callback + status == -ESHUTDOWN) { + goto exit; + } else { +- dbg_info(&dev->intf->dev, "%s: nonzero status received: %d\n", +- __func__, status); ++ dev_dbg(&dev->intf->dev, ++ "%s: nonzero status received: %d\n", __func__, ++ status); + spin_lock(&dev->rbsl); + goto resubmit; /* maybe we can recover */ + } +@@ -272,8 +260,8 @@ static void ld_usb_interrupt_in_callback + *actual_buffer = urb->actual_length; + memcpy(actual_buffer+1, dev->interrupt_in_buffer, urb->actual_length); + dev->ring_head = next_ring_head; +- dbg_info(&dev->intf->dev, "%s: received %d bytes\n", +- __func__, urb->actual_length); ++ dev_dbg(&dev->intf->dev, "%s: received %d bytes\n", ++ __func__, urb->actual_length); + } else { + dev_warn(&dev->intf->dev, + "Ring buffer overflow, %d bytes dropped\n", +@@ -310,9 +298,9 @@ static void ld_usb_interrupt_out_callbac + if (status && !(status == -ENOENT || + status == -ECONNRESET || + status == -ESHUTDOWN)) +- dbg_info(&dev->intf->dev, +- "%s - nonzero write interrupt status received: %d\n", +- __func__, status); ++ dev_dbg(&dev->intf->dev, ++ "%s - nonzero write interrupt status received: %d\n", ++ __func__, status); + + dev->interrupt_out_busy = 0; + wake_up_interruptible(&dev->write_wait); +@@ -585,7 +573,8 @@ static ssize_t ld_usb_write(struct file + bytes_to_write = min(count, write_buffer_size*dev->interrupt_out_endpoint_size); + if (bytes_to_write < count) + dev_warn(&dev->intf->dev, "Write buffer overflow, %zd bytes dropped\n",count-bytes_to_write); +- dbg_info(&dev->intf->dev, "%s: count = %zd, bytes_to_write = %zd\n", __func__, count, bytes_to_write); ++ dev_dbg(&dev->intf->dev, "%s: count = %zd, bytes_to_write = %zd\n", ++ __func__, count, bytes_to_write); + + if (copy_from_user(dev->interrupt_out_buffer, buffer, bytes_to_write)) { + retval = -EFAULT; diff --git a/usb-legotower-remove-custom-debug-macro-and-module-parameter.patch b/usb-legotower-remove-custom-debug-macro-and-module-parameter.patch new file mode 100644 index 00000000000000..b2ac3a9adb1445 --- /dev/null +++ b/usb-legotower-remove-custom-debug-macro-and-module-parameter.patch @@ -0,0 +1,114 @@ +From foo@baz Wed Jun 26 16:17:57 PDT 2013 +Date: Wed, 26 Jun 2013 16:17:57 -0700 +To: Greg KH <gregkh@linuxfoundation.org>, Juergen Stuber <starblue@users.sourceforge.net> +Cc: linux-usb@vger.kernel.org +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: legotower: remove custom debug macro and module parameter + +Now that we don't use the dbg() macro, remove it, and the module +parameter. Also fix up the "dump_data" function to properly use the +dynamic debug core and the correct printk options, and don't call it +twice per function, as the data doesn't change from the beginning and +the end of the call. + +Cc: Juergen Stuber <starblue@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + + +--- + drivers/usb/misc/legousbtower.c | 43 ++++++++-------------------------------- + 1 file changed, 9 insertions(+), 34 deletions(-) + +--- a/drivers/usb/misc/legousbtower.c ++++ b/drivers/usb/misc/legousbtower.c +@@ -87,28 +87,11 @@ + #include <linux/poll.h> + + +-#ifdef CONFIG_USB_DEBUG +- static int debug = 4; +-#else +- static int debug = 0; +-#endif +- +-/* Use our own dbg macro */ +-#undef dbg +-#define dbg(lvl, format, arg...) \ +-do { \ +- if (debug >= lvl) \ +- printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ +-} while (0) +- + /* Version Information */ + #define DRIVER_VERSION "v0.96" + #define DRIVER_AUTHOR "Juergen Stuber <starblue@sourceforge.net>" + #define DRIVER_DESC "LEGO USB Tower Driver" + +-/* Module parameters */ +-module_param(debug, int, S_IRUGO | S_IWUSR); +-MODULE_PARM_DESC(debug, "Debug enabled or not"); + + /* The defaults are chosen to work with the latest versions of leJOS and NQC. + */ +@@ -298,18 +281,12 @@ static struct usb_driver tower_driver = + /** + * lego_usb_tower_debug_data + */ +-static inline void lego_usb_tower_debug_data (int level, const char *function, int size, const unsigned char *data) ++static inline void lego_usb_tower_debug_data(struct device *dev, ++ const char *function, int size, ++ const unsigned char *data) + { +- int i; +- +- if (debug < level) +- return; +- +- printk (KERN_DEBUG "%s: %s - length = %d, data = ", __FILE__, function, size); +- for (i = 0; i < size; ++i) { +- printk ("%.2x ", data[i]); +- } +- printk ("\n"); ++ dev_dbg(dev, "%s - length = %d, data = %*ph\n", ++ function, size, size, data); + } + + +@@ -744,7 +721,8 @@ static void tower_interrupt_in_callback + int status = urb->status; + int retval; + +- lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); ++ lego_usb_tower_debug_data(&dev->udev->dev, __func__, ++ urb->actual_length, urb->transfer_buffer); + + if (status) { + if (status == -ENOENT || +@@ -788,8 +766,6 @@ resubmit: + exit: + dev->interrupt_in_done = 1; + wake_up_interruptible (&dev->read_wait); +- +- lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); + } + + +@@ -801,7 +777,8 @@ static void tower_interrupt_out_callback + struct lego_usb_tower *dev = urb->context; + int status = urb->status; + +- lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); ++ lego_usb_tower_debug_data(&dev->udev->dev, __func__, ++ urb->actual_length, urb->transfer_buffer); + + /* sync/async unlink faults aren't errors */ + if (status && !(status == -ENOENT || +@@ -814,8 +791,6 @@ static void tower_interrupt_out_callback + + dev->interrupt_out_busy = 0; + wake_up_interruptible(&dev->write_wait); +- +- lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); + } + + diff --git a/usb-legotower-remove-direct-calls-to-printk.patch b/usb-legotower-remove-direct-calls-to-printk.patch new file mode 100644 index 00000000000000..de03d6ee712f12 --- /dev/null +++ b/usb-legotower-remove-direct-calls-to-printk.patch @@ -0,0 +1,64 @@ +From foo@baz Wed Jun 26 16:19:44 PDT 2013 +Date: Wed, 26 Jun 2013 16:19:44 -0700 +To: Greg KH <gregkh@linuxfoundation.org>, Juergen Stuber <starblue@users.sourceforge.net> +Cc: linux-usb@vger.kernel.org +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: legotower: remove direct calls to printk() + +Use the pr_* calls instead, which are much more descriptive. + +Cc: Juergen Stuber <starblue@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/usb/misc/legousbtower.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +--- a/drivers/usb/misc/legousbtower.c ++++ b/drivers/usb/misc/legousbtower.c +@@ -75,6 +75,8 @@ + * - move reset into open to clean out spurious data + */ + ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ++ + #include <linux/kernel.h> + #include <linux/errno.h> + #include <linux/init.h> +@@ -325,8 +327,7 @@ static int tower_open (struct inode *ino + interface = usb_find_interface (&tower_driver, subminor); + + if (!interface) { +- printk(KERN_ERR "%s - error, can't find device for minor %d\n", +- __func__, subminor); ++ pr_err("error, can't find device for minor %d\n", subminor); + retval = -ENODEV; + goto exit; + } +@@ -563,7 +564,7 @@ static ssize_t tower_read (struct file * + /* verify that the device wasn't unplugged */ + if (dev->udev == NULL) { + retval = -ENODEV; +- printk(KERN_ERR "legousbtower: No device or device unplugged %d\n", retval); ++ pr_err("No device or device unplugged %d\n", retval); + goto unlock_exit; + } + +@@ -649,7 +650,7 @@ static ssize_t tower_write (struct file + /* verify that the device wasn't unplugged */ + if (dev->udev == NULL) { + retval = -ENODEV; +- printk(KERN_ERR "legousbtower: No device or device unplugged %d\n", retval); ++ pr_err("No device or device unplugged %d\n", retval); + goto unlock_exit; + } + +@@ -748,7 +749,8 @@ static void tower_interrupt_in_callback + dev_dbg(&dev->udev->dev, "%s: received %d bytes\n", + __func__, urb->actual_length); + } else { +- printk(KERN_WARNING "%s: read_buffer overflow, %d bytes dropped", __func__, urb->actual_length); ++ pr_warn("read_buffer overflow, %d bytes dropped\n", ++ urb->actual_length); + } + spin_unlock (&dev->read_buffer_lock); + } diff --git a/usb-legotower-remove-unneeded-tracing-macros.patch b/usb-legotower-remove-unneeded-tracing-macros.patch new file mode 100644 index 00000000000000..2a1566fa382755 --- /dev/null +++ b/usb-legotower-remove-unneeded-tracing-macros.patch @@ -0,0 +1,217 @@ +From foo@baz Wed Jun 26 16:15:10 PDT 2013 +Date: Wed, 26 Jun 2013 16:15:10 -0700 +To: Greg KH <gregkh@linuxfoundation.org>, Juergen Stuber <starblue@users.sourceforge.net> +Cc: linux-usb@vger.kernel.org +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: legotower: remove unneeded tracing macros + +Remove the unneeded tracing macros in this driver. The kernel has a +built-in trace function that can be used if this is really still needed. + + +Cc: Juergen Stuber <starblue@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/usb/misc/legousbtower.c | 42 ---------------------------------------- + 1 file changed, 1 insertion(+), 41 deletions(-) + +--- a/drivers/usb/misc/legousbtower.c ++++ b/drivers/usb/misc/legousbtower.c +@@ -318,8 +318,6 @@ static inline void lego_usb_tower_debug_ + */ + static inline void tower_delete (struct lego_usb_tower *dev) + { +- dbg(2, "%s: enter", __func__); +- + tower_abort_transfers (dev); + + /* free data structures */ +@@ -329,8 +327,6 @@ static inline void tower_delete (struct + kfree (dev->interrupt_in_buffer); + kfree (dev->interrupt_out_buffer); + kfree (dev); +- +- dbg(2, "%s: leave", __func__); + } + + +@@ -346,8 +342,6 @@ static int tower_open (struct inode *ino + struct tower_reset_reply reset_reply; + int result; + +- dbg(2, "%s: enter", __func__); +- + nonseekable_open(inode, file); + subminor = iminor(inode); + +@@ -435,8 +429,6 @@ unlock_exit: + mutex_unlock(&dev->lock); + + exit: +- dbg(2, "%s: leave, return value %d ", __func__, retval); +- + return retval; + } + +@@ -448,8 +440,6 @@ static int tower_release (struct inode * + struct lego_usb_tower *dev; + int retval = 0; + +- dbg(2, "%s: enter", __func__); +- + dev = file->private_data; + + if (dev == NULL) { +@@ -491,7 +481,6 @@ unlock_exit: + exit: + mutex_unlock(&open_disc_mutex); + exit_nolock: +- dbg(2, "%s: leave, return value %d", __func__, retval); + return retval; + } + +@@ -502,11 +491,9 @@ exit_nolock: + */ + static void tower_abort_transfers (struct lego_usb_tower *dev) + { +- dbg(2, "%s: enter", __func__); +- + if (dev == NULL) { + dbg(1, "%s: dev is null", __func__); +- goto exit; ++ return; + } + + /* shutdown transfer */ +@@ -518,9 +505,6 @@ static void tower_abort_transfers (struc + } + if (dev->interrupt_out_busy && dev->udev) + usb_kill_urb(dev->interrupt_out_urb); +- +-exit: +- dbg(2, "%s: leave", __func__); + } + + +@@ -553,8 +537,6 @@ static unsigned int tower_poll (struct f + struct lego_usb_tower *dev; + unsigned int mask = 0; + +- dbg(2, "%s: enter", __func__); +- + dev = file->private_data; + + if (!dev->udev) +@@ -571,8 +553,6 @@ static unsigned int tower_poll (struct f + mask |= POLLOUT | POLLWRNORM; + } + +- dbg(2, "%s: leave, mask = %d", __func__, mask); +- + return mask; + } + +@@ -597,8 +577,6 @@ static ssize_t tower_read (struct file * + int retval = 0; + unsigned long timeout = 0; + +- dbg(2, "%s: enter, count = %Zd", __func__, count); +- + dev = file->private_data; + + /* lock this object */ +@@ -672,7 +650,6 @@ unlock_exit: + mutex_unlock(&dev->lock); + + exit: +- dbg(2, "%s: leave, return value %d", __func__, retval); + return retval; + } + +@@ -686,8 +663,6 @@ static ssize_t tower_write (struct file + size_t bytes_to_write; + int retval = 0; + +- dbg(2, "%s: enter, count = %Zd", __func__, count); +- + dev = file->private_data; + + /* lock this object */ +@@ -757,8 +732,6 @@ unlock_exit: + mutex_unlock(&dev->lock); + + exit: +- dbg(2, "%s: leave, return value %d", __func__, retval); +- + return retval; + } + +@@ -772,8 +745,6 @@ static void tower_interrupt_in_callback + int status = urb->status; + int retval; + +- dbg(4, "%s: enter, status %d", __func__, status); +- + lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); + + if (status) { +@@ -817,7 +788,6 @@ exit: + wake_up_interruptible (&dev->read_wait); + + lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); +- dbg(4, "%s: leave, status %d", __func__, status); + } + + +@@ -829,7 +799,6 @@ static void tower_interrupt_out_callback + struct lego_usb_tower *dev = urb->context; + int status = urb->status; + +- dbg(4, "%s: enter, status %d", __func__, status); + lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); + + /* sync/async unlink faults aren't errors */ +@@ -844,7 +813,6 @@ static void tower_interrupt_out_callback + wake_up_interruptible(&dev->write_wait); + + lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); +- dbg(4, "%s: leave, status %d", __func__, status); + } + + +@@ -866,8 +834,6 @@ static int tower_probe (struct usb_inter + int retval = -ENOMEM; + int result; + +- dbg(2, "%s: enter", __func__); +- + /* allocate memory for our device state and initialize it */ + + dev = kmalloc (sizeof(struct lego_usb_tower), GFP_KERNEL); +@@ -993,8 +959,6 @@ static int tower_probe (struct usb_inter + + + exit: +- dbg(2, "%s: leave, return value 0x%.8lx (dev)", __func__, (long) dev); +- + return retval; + + error: +@@ -1013,8 +977,6 @@ static void tower_disconnect (struct usb + struct lego_usb_tower *dev; + int minor; + +- dbg(2, "%s: enter", __func__); +- + dev = usb_get_intfdata (interface); + mutex_lock(&open_disc_mutex); + usb_set_intfdata (interface, NULL); +@@ -1041,8 +1003,6 @@ static void tower_disconnect (struct usb + + dev_info(&interface->dev, "LEGO USB Tower #%d now disconnected\n", + (minor - LEGO_USB_TOWER_MINOR_BASE)); +- +- dbg(2, "%s: leave", __func__); + } + + module_usb_driver(tower_driver); diff --git a/usb-legousbtower-remove-custom-debug-macro.patch b/usb-legousbtower-remove-custom-debug-macro.patch new file mode 100644 index 00000000000000..20e64efbc0d07e --- /dev/null +++ b/usb-legousbtower-remove-custom-debug-macro.patch @@ -0,0 +1,110 @@ +From foo@baz Wed Jun 26 16:16:21 PDT 2013 +Date: Wed, 26 Jun 2013 16:16:21 -0700 +To: Greg KH <gregkh@linuxfoundation.org>, Juergen Stuber <starblue@users.sourceforge.net> +Cc: linux-usb@vger.kernel.org +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: legousbtower: remove custom debug macro + +Don't use a custom debug macro for just one driver, instead rely on the +in-kernel dynamic debugging logic, which can handle this much better. + +Cc: Juergen Stuber <starblue@users.sourceforge.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/usb/misc/legousbtower.c | 27 +++++++++++++++------------ + 1 file changed, 15 insertions(+), 12 deletions(-) + +--- a/drivers/usb/misc/legousbtower.c ++++ b/drivers/usb/misc/legousbtower.c +@@ -443,7 +443,6 @@ static int tower_release (struct inode * + dev = file->private_data; + + if (dev == NULL) { +- dbg(1, "%s: object is NULL", __func__); + retval = -ENODEV; + goto exit_nolock; + } +@@ -455,7 +454,8 @@ static int tower_release (struct inode * + } + + if (dev->open_count != 1) { +- dbg(1, "%s: device not opened exactly once", __func__); ++ dev_dbg(&dev->udev->dev, "%s: device not opened exactly once\n", ++ __func__); + retval = -ENODEV; + goto unlock_exit; + } +@@ -491,10 +491,8 @@ exit_nolock: + */ + static void tower_abort_transfers (struct lego_usb_tower *dev) + { +- if (dev == NULL) { +- dbg(1, "%s: dev is null", __func__); ++ if (dev == NULL) + return; +- } + + /* shutdown transfer */ + if (dev->interrupt_in_running) { +@@ -594,7 +592,7 @@ static ssize_t tower_read (struct file * + + /* verify that we actually have some data to read */ + if (count == 0) { +- dbg(1, "%s: read request of 0 bytes", __func__); ++ dev_dbg(&dev->udev->dev, "read request of 0 bytes\n"); + goto unlock_exit; + } + +@@ -680,7 +678,7 @@ static ssize_t tower_write (struct file + + /* verify that we actually have some data to write */ + if (count == 0) { +- dbg(1, "%s: write request of 0 bytes", __func__); ++ dev_dbg(&dev->udev->dev, "write request of 0 bytes\n"); + goto unlock_exit; + } + +@@ -698,7 +696,8 @@ static ssize_t tower_write (struct file + + /* write the data into interrupt_out_buffer from userspace */ + bytes_to_write = min_t(int, count, write_buffer_size); +- dbg(4, "%s: count = %Zd, bytes_to_write = %Zd", __func__, count, bytes_to_write); ++ dev_dbg(&dev->udev->dev, "%s: count = %Zd, bytes_to_write = %Zd\n", ++ __func__, count, bytes_to_write); + + if (copy_from_user (dev->interrupt_out_buffer, buffer, bytes_to_write)) { + retval = -EFAULT; +@@ -753,7 +752,9 @@ static void tower_interrupt_in_callback + status == -ESHUTDOWN) { + goto exit; + } else { +- dbg(1, "%s: nonzero status received: %d", __func__, status); ++ dev_dbg(&dev->udev->dev, ++ "%s: nonzero status received: %d\n", __func__, ++ status); + goto resubmit; /* maybe we can recover */ + } + } +@@ -766,7 +767,8 @@ static void tower_interrupt_in_callback + urb->actual_length); + dev->read_buffer_length += urb->actual_length; + dev->read_last_arrival = jiffies; +- dbg(3, "%s: received %d bytes", __func__, urb->actual_length); ++ dev_dbg(&dev->udev->dev, "%s: received %d bytes\n", ++ __func__, urb->actual_length); + } else { + printk(KERN_WARNING "%s: read_buffer overflow, %d bytes dropped", __func__, urb->actual_length); + } +@@ -805,8 +807,9 @@ static void tower_interrupt_out_callback + if (status && !(status == -ENOENT || + status == -ECONNRESET || + status == -ESHUTDOWN)) { +- dbg(1, "%s - nonzero write bulk status received: %d", +- __func__, status); ++ dev_dbg(&dev->udev->dev, ++ "%s: nonzero write bulk status received: %d\n", __func__, ++ status); + } + + dev->interrupt_out_busy = 0; diff --git a/usb-misc-remove-config_usb_debug-from-makefile.patch b/usb-misc-remove-config_usb_debug-from-makefile.patch new file mode 100644 index 00000000000000..9ad231911543d0 --- /dev/null +++ b/usb-misc-remove-config_usb_debug-from-makefile.patch @@ -0,0 +1,27 @@ +From foo@baz Wed Jun 26 16:23:51 PDT 2013 +Date: Wed, 26 Jun 2013 16:23:51 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: misc: remove CONFIG_USB_DEBUG from Makefile + +Now that no usb misc driver is looking for CONFIG_USB_DEBUG, or DEBUG, +don't enable it in the Makefile, as that's pointless. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/usb/misc/Makefile | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/usb/misc/Makefile ++++ b/drivers/usb/misc/Makefile +@@ -2,9 +2,6 @@ + # Makefile for the rest of the USB drivers + # (the ones that don't fit into any other categories) + # +- +-ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG +- + obj-$(CONFIG_USB_ADUTUX) += adutux.o + obj-$(CONFIG_USB_APPLEDISPLAY) += appledisplay.o + obj-$(CONFIG_USB_CYPRESS_CY7C63) += cypress_cy7c63.o diff --git a/usb-phy-remove-config_usb_debug-usage.patch b/usb-phy-remove-config_usb_debug-usage.patch new file mode 100644 index 00000000000000..e30581cbf501a5 --- /dev/null +++ b/usb-phy-remove-config_usb_debug-usage.patch @@ -0,0 +1,28 @@ +From foo@baz Fri Jun 28 11:10:15 PDT 2013 +Date: Fri, 28 Jun 2013 11:10:15 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: Felipe Balbi <balbi@ti.com> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: phy: remove CONFIG_USB_DEBUG usage + +Now that no USB phy driver is using CONFIG_USB_DEBUG, remove it from the +Makefile. + +Cc: Felipe Balbi <balbi@ti.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/usb/phy/Makefile | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/usb/phy/Makefile ++++ b/drivers/usb/phy/Makefile +@@ -1,9 +1,6 @@ + # + # Makefile for physical layer USB drivers + # +- +-ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG +- + obj-$(CONFIG_USB_PHY) += phy.o + obj-$(CONFIG_OF) += of.o + diff --git a/usb-phy-remove-custom-dbg-macro.patch b/usb-phy-remove-custom-dbg-macro.patch new file mode 100644 index 00000000000000..603d7e91af778c --- /dev/null +++ b/usb-phy-remove-custom-dbg-macro.patch @@ -0,0 +1,105 @@ +From foo@baz Fri Jun 28 11:08:22 PDT 2013 +Date: Fri, 28 Jun 2013 11:08:22 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: Felipe Balbi <balbi@ti.com> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: phy: remove custom DBG macro + +Use the in-kernel pr_debug() calls instead of trying to roll your own +DBG macro. This means the dynamic debugging calls now work here, and +there is no dependency on CONFIG_USB_DEBUG for the phy code anymore. + +Cc: Felipe Balbi <balbi@ti.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + +Note, this is against 3.10-rc7, odds are it will not apply to 3.11-rc1, +I'll refresh it when that is out and apply it then. + + drivers/usb/phy/phy-fsl-usb.c | 6 +++--- + drivers/usb/phy/phy-fsm-usb.h | 11 ++--------- + drivers/usb/phy/phy-isp1301-omap.c | 6 +----- + 3 files changed, 6 insertions(+), 17 deletions(-) + +--- a/drivers/usb/phy/phy-fsl-usb.c ++++ b/drivers/usb/phy/phy-fsl-usb.c +@@ -611,7 +611,7 @@ static int fsl_otg_set_peripheral(struct + otg_dev->fsm.b_bus_req = 1; + + /* start the gadget right away if the ID pin says Mini-B */ +- DBG("ID pin=%d\n", otg_dev->fsm.id); ++ pr_debug("ID pin=%d\n", otg_dev->fsm.id); + if (otg_dev->fsm.id == 1) { + fsl_otg_start_host(&otg_dev->fsm, 0); + otg_drv_vbus(&otg_dev->fsm, 0); +@@ -684,7 +684,7 @@ static int fsl_otg_start_hnp(struct usb_ + if (otg_dev != fsl_otg_dev) + return -ENODEV; + +- DBG("start_hnp...n"); ++ pr_debug("start_hnp...\n"); + + /* clear a_bus_req to enter a_suspend state */ + otg_dev->fsm.a_bus_req = 0; +@@ -941,7 +941,7 @@ int usb_otg_start(struct platform_device + p_otg->fsm.id = 0; + } + +- DBG("initial ID pin=%d\n", p_otg->fsm.id); ++ pr_debug("initial ID pin=%d\n", p_otg->fsm.id); + + /* enable OTG ID pin interrupt */ + temp = fsl_readl(&p_otg->dr_mem_map->otgsc); +--- a/drivers/usb/phy/phy-fsm-usb.h ++++ b/drivers/usb/phy/phy-fsm-usb.h +@@ -15,18 +15,11 @@ + * 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +-#undef DEBUG + #undef VERBOSE + +-#ifdef DEBUG +-#define DBG(fmt, args...) printk(KERN_DEBUG "[%s] " fmt , \ +- __func__, ## args) +-#else +-#define DBG(fmt, args...) do {} while (0) +-#endif +- + #ifdef VERBOSE +-#define VDBG DBG ++#define VDBG(fmt, args...) pr_debug("[%s] " fmt , \ ++ __func__, ## args) + #else + #define VDBG(stuff...) do {} while (0) + #endif +--- a/drivers/usb/phy/phy-isp1301-omap.c ++++ b/drivers/usb/phy/phy-isp1301-omap.c +@@ -40,9 +40,7 @@ + + #include <mach/usb.h> + +-#ifndef DEBUG +-#undef VERBOSE +-#endif ++#undef VERBOSE + + + #define DRIVER_VERSION "24 August 2004" +@@ -387,7 +385,6 @@ static void b_idle(struct isp1301 *isp, + static void + dump_regs(struct isp1301 *isp, const char *label) + { +-#ifdef DEBUG + u8 ctrl = isp1301_get_u8(isp, ISP1301_OTG_CONTROL_1); + u8 status = isp1301_get_u8(isp, ISP1301_OTG_STATUS); + u8 src = isp1301_get_u8(isp, ISP1301_INTERRUPT_SOURCE); +@@ -396,7 +393,6 @@ dump_regs(struct isp1301 *isp, const cha + omap_readl(OTG_CTRL), label, state_name(isp), + ctrl, status, src); + /* mode control and irq enables don't change much */ +-#endif + } + + /*-------------------------------------------------------------------------*/ diff --git a/usb-remove-unneeded-idr.h-include.patch b/usb-remove-unneeded-idr.h-include.patch new file mode 100644 index 00000000000000..4bfa7718e5cac9 --- /dev/null +++ b/usb-remove-unneeded-idr.h-include.patch @@ -0,0 +1,47 @@ +From foo@baz Tue Jul 2 12:19:50 PDT 2013 +Date: Tue, 02 Jul 2013 12:19:50 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: remove unneeded idr.h include + +None of these USB files need idr.h, so don't include it. + +Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> +Cc: Felipe Balbi <balbi@ti.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/usb/chipidea/core.c | 1 - + drivers/usb/core/endpoint.c | 1 - + drivers/usb/musb/musb_core.c | 1 - + 3 files changed, 3 deletions(-) + +--- a/drivers/usb/chipidea/core.c ++++ b/drivers/usb/chipidea/core.c +@@ -53,7 +53,6 @@ + #include <linux/dma-mapping.h> + #include <linux/platform_device.h> + #include <linux/module.h> +-#include <linux/idr.h> + #include <linux/interrupt.h> + #include <linux/io.h> + #include <linux/kernel.h> +--- a/drivers/usb/core/endpoint.c ++++ b/drivers/usb/core/endpoint.c +@@ -12,7 +12,6 @@ + #include <linux/kernel.h> + #include <linux/spinlock.h> + #include <linux/slab.h> +-#include <linux/idr.h> + #include <linux/usb.h> + #include "usb.h" + +--- a/drivers/usb/musb/musb_core.c ++++ b/drivers/usb/musb/musb_core.c +@@ -99,7 +99,6 @@ + #include <linux/prefetch.h> + #include <linux/platform_device.h> + #include <linux/io.h> +-#include <linux/idr.h> + #include <linux/dma-mapping.h> + + #include "musb_core.h" diff --git a/usb-sl811-move-debug-files-from-proc-to-debugfs.patch b/usb-sl811-move-debug-files-from-proc-to-debugfs.patch new file mode 100644 index 00000000000000..a18f57fd2a479f --- /dev/null +++ b/usb-sl811-move-debug-files-from-proc-to-debugfs.patch @@ -0,0 +1,120 @@ +From foo@baz Tue Jul 2 12:18:43 PDT 2013 +Date: Tue, 02 Jul 2013 12:18:43 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: sl811: move debug files from proc to debugfs + +Drivers should not be putting debug files in /proc/ that is what debugfs +is for, so move the sl811 driver's debug file to debugfs. + +Cc: Felipe Balbi <balbi@ti.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/usb/host/sl811-hcd.c | 38 +++++++++++--------------------------- + drivers/usb/host/sl811.h | 2 +- + 2 files changed, 12 insertions(+), 28 deletions(-) + +--- a/drivers/usb/host/sl811-hcd.c ++++ b/drivers/usb/host/sl811-hcd.c +@@ -48,6 +48,8 @@ + #include <linux/usb/hcd.h> + #include <linux/platform_device.h> + #include <linux/prefetch.h> ++#include <linux/debugfs.h> ++#include <linux/seq_file.h> + + #include <asm/io.h> + #include <asm/irq.h> +@@ -63,11 +65,6 @@ MODULE_ALIAS("platform:sl811-hcd"); + + #define DRIVER_VERSION "19 May 2005" + +- +-#ifndef DEBUG +-# define STUB_DEBUG_FILE +-#endif +- + /* for now, use only one transfer register bank */ + #undef USE_B + +@@ -1373,16 +1370,6 @@ sl811h_bus_resume(struct usb_hcd *hcd) + + /*-------------------------------------------------------------------------*/ + +-#ifdef STUB_DEBUG_FILE +- +-static inline void create_debug_file(struct sl811 *sl811) { } +-static inline void remove_debug_file(struct sl811 *sl811) { } +- +-#else +- +-#include <linux/proc_fs.h> +-#include <linux/seq_file.h> +- + static void dump_irq(struct seq_file *s, char *label, u8 mask) + { + seq_printf(s, "%s %02x%s%s%s%s%s%s\n", label, mask, +@@ -1394,7 +1381,7 @@ static void dump_irq(struct seq_file *s, + (mask & SL11H_INTMASK_DP) ? " dp" : ""); + } + +-static int proc_sl811h_show(struct seq_file *s, void *unused) ++static int sl811h_show(struct seq_file *s, void *unused) + { + struct sl811 *sl811 = s->private; + struct sl811h_ep *ep; +@@ -1505,34 +1492,31 @@ static int proc_sl811h_show(struct seq_f + return 0; + } + +-static int proc_sl811h_open(struct inode *inode, struct file *file) ++static int sl811h_open(struct inode *inode, struct file *file) + { +- return single_open(file, proc_sl811h_show, PDE_DATA(inode)); ++ return single_open(file, sl811h_show, inode->i_private); + } + +-static const struct file_operations proc_ops = { +- .open = proc_sl811h_open, ++static const struct file_operations debug_ops = { ++ .open = sl811h_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, + }; + + /* expect just one sl811 per system */ +-static const char proc_filename[] = "driver/sl811h"; +- + static void create_debug_file(struct sl811 *sl811) + { +- sl811->pde = proc_create_data(proc_filename, 0, NULL, &proc_ops, sl811); ++ sl811->debug_file = debugfs_create_file("sl811h", S_IRUGO, ++ usb_debug_root, sl811, ++ &debug_ops); + } + + static void remove_debug_file(struct sl811 *sl811) + { +- if (sl811->pde) +- remove_proc_entry(proc_filename, NULL); ++ debugfs_remove(sl811->debug_file); + } + +-#endif +- + /*-------------------------------------------------------------------------*/ + + static void +--- a/drivers/usb/host/sl811.h ++++ b/drivers/usb/host/sl811.h +@@ -122,7 +122,7 @@ struct sl811 { + void __iomem *addr_reg; + void __iomem *data_reg; + struct sl811_platform_data *board; +- struct proc_dir_entry *pde; ++ struct dentry *debug_file; + + unsigned long stat_insrmv; + unsigned long stat_wake; diff --git a/usb-sl811-remove-config_usb_debug-dependency.patch b/usb-sl811-remove-config_usb_debug-dependency.patch new file mode 100644 index 00000000000000..3da1ebf5f97738 --- /dev/null +++ b/usb-sl811-remove-config_usb_debug-dependency.patch @@ -0,0 +1,308 @@ +From foo@baz Fri Jun 28 11:21:28 PDT 2013 +Date: Fri, 28 Jun 2013 11:21:28 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: Felipe Balbi <balbi@ti.com> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: sl811: remove CONFIG_USB_DEBUG dependency + +This removes the dependency of the driver on CONFIG_USB_DEBUG and moves +it to us the dynamic debug subsystem instead. Bonus is the fact that we +can now properly determine the exact hardware that is spitting out the +messages. + +This lets debugging be enabled without having to rebuild the driver, an +important thing for users that can not do it. + +Cc: Felipe Balbi <balbi@ti.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/usb/host/sl811-hcd.c | 69 +++++++++++++++++++++++++------------------ + drivers/usb/host/sl811.h | 19 ----------- + 2 files changed, 42 insertions(+), 46 deletions(-) + +--- a/drivers/usb/host/sl811-hcd.c ++++ b/drivers/usb/host/sl811-hcd.c +@@ -100,7 +100,8 @@ static void port_power(struct sl811 *sl8 + + if (sl811->board && sl811->board->port_power) { + /* switch VBUS, at 500mA unless hub power budget gets set */ +- DBG("power %s\n", is_on ? "on" : "off"); ++ dev_dbg(hcd->self.controller, "power %s\n", ++ is_on ? "on" : "off"); + sl811->board->port_power(hcd->self.controller, is_on); + } + +@@ -282,7 +283,7 @@ static inline void sofirq_on(struct sl81 + { + if (sl811->irq_enable & SL11H_INTMASK_SOFINTR) + return; +- VDBG("sof irq on\n"); ++ dev_dbg(sl811_to_hcd(sl811)->self.controller, "sof irq on\n"); + sl811->irq_enable |= SL11H_INTMASK_SOFINTR; + } + +@@ -290,7 +291,7 @@ static inline void sofirq_off(struct sl8 + { + if (!(sl811->irq_enable & SL11H_INTMASK_SOFINTR)) + return; +- VDBG("sof irq off\n"); ++ dev_dbg(sl811_to_hcd(sl811)->self.controller, "sof irq off\n"); + sl811->irq_enable &= ~SL11H_INTMASK_SOFINTR; + } + +@@ -338,7 +339,8 @@ static struct sl811h_ep *start(struct sl + } + + if (unlikely(list_empty(&ep->hep->urb_list))) { +- DBG("empty %p queue?\n", ep); ++ dev_dbg(sl811_to_hcd(sl811)->self.controller, ++ "empty %p queue?\n", ep); + return NULL; + } + +@@ -391,7 +393,8 @@ static struct sl811h_ep *start(struct sl + status_packet(sl811, ep, urb, bank, control); + break; + default: +- DBG("bad ep%p pid %02x\n", ep, ep->nextpid); ++ dev_dbg(sl811_to_hcd(sl811)->self.controller, ++ "bad ep%p pid %02x\n", ep, ep->nextpid); + ep = NULL; + } + return ep; +@@ -447,7 +450,8 @@ static void finish_request( + } + + /* periodic deschedule */ +- DBG("deschedule qh%d/%p branch %d\n", ep->period, ep, ep->branch); ++ dev_dbg(sl811_to_hcd(sl811)->self.controller, ++ "deschedule qh%d/%p branch %d\n", ep->period, ep, ep->branch); + for (i = ep->branch; i < PERIODIC_SIZE; i += ep->period) { + struct sl811h_ep *temp; + struct sl811h_ep **prev = &sl811->periodic[i]; +@@ -593,7 +597,8 @@ static inline u8 checkdone(struct sl811 + ctl = sl811_read(sl811, SL811_EP_A(SL11H_HOSTCTLREG)); + if (ctl & SL11H_HCTLMASK_ARM) + sl811_write(sl811, SL811_EP_A(SL11H_HOSTCTLREG), 0); +- DBG("%s DONE_A: ctrl %02x sts %02x\n", ++ dev_dbg(sl811_to_hcd(sl811)->self.controller, ++ "%s DONE_A: ctrl %02x sts %02x\n", + (ctl & SL11H_HCTLMASK_ARM) ? "timeout" : "lost", + ctl, + sl811_read(sl811, SL811_EP_A(SL11H_PKTSTATREG))); +@@ -604,7 +609,8 @@ static inline u8 checkdone(struct sl811 + ctl = sl811_read(sl811, SL811_EP_B(SL11H_HOSTCTLREG)); + if (ctl & SL11H_HCTLMASK_ARM) + sl811_write(sl811, SL811_EP_B(SL11H_HOSTCTLREG), 0); +- DBG("%s DONE_B: ctrl %02x sts %02x\n", ++ dev_dbg(sl811_to_hcd(sl811)->self.controller, ++ "%s DONE_B: ctrl %02x sts %02x\n", + (ctl & SL11H_HCTLMASK_ARM) ? "timeout" : "lost", + ctl, + sl811_read(sl811, SL811_EP_B(SL11H_PKTSTATREG))); +@@ -665,7 +671,7 @@ retry: + * this one has nothing scheduled. + */ + if (sl811->next_periodic) { +- // ERR("overrun to slot %d\n", index); ++ // dev_err(hcd->self.controller, "overrun to slot %d\n", index); + sl811->stat_overrun++; + } + if (sl811->periodic[index]) +@@ -723,7 +729,7 @@ retry: + + } else if (irqstat & SL11H_INTMASK_RD) { + if (sl811->port1 & USB_PORT_STAT_SUSPEND) { +- DBG("wakeup\n"); ++ dev_dbg(hcd->self.controller, "wakeup\n"); + sl811->port1 |= USB_PORT_STAT_C_SUSPEND << 16; + sl811->stat_wake++; + } else +@@ -852,8 +858,9 @@ static int sl811h_urb_enqueue( + + if (ep->maxpacket > H_MAXPACKET) { + /* iso packets up to 240 bytes could work... */ +- DBG("dev %d ep%d maxpacket %d\n", +- udev->devnum, epnum, ep->maxpacket); ++ dev_dbg(hcd->self.controller, ++ "dev %d ep%d maxpacket %d\n", udev->devnum, ++ epnum, ep->maxpacket); + retval = -EINVAL; + kfree(ep); + goto fail; +@@ -917,7 +924,8 @@ static int sl811h_urb_enqueue( + * to share the faster parts of the tree without needing + * dummy/placeholder nodes + */ +- DBG("schedule qh%d/%p branch %d\n", ep->period, ep, ep->branch); ++ dev_dbg(hcd->self.controller, "schedule qh%d/%p branch %d\n", ++ ep->period, ep, ep->branch); + for (i = ep->branch; i < PERIODIC_SIZE; i += ep->period) { + struct sl811h_ep **prev = &sl811->periodic[i]; + struct sl811h_ep *here = *prev; +@@ -976,7 +984,8 @@ static int sl811h_urb_dequeue(struct usb + } else if (sl811->active_a == ep) { + if (time_before_eq(sl811->jiffies_a, jiffies)) { + /* happens a lot with lowspeed?? */ +- DBG("giveup on DONE_A: ctrl %02x sts %02x\n", ++ dev_dbg(hcd->self.controller, ++ "giveup on DONE_A: ctrl %02x sts %02x\n", + sl811_read(sl811, + SL811_EP_A(SL11H_HOSTCTLREG)), + sl811_read(sl811, +@@ -990,7 +999,8 @@ static int sl811h_urb_dequeue(struct usb + } else if (sl811->active_b == ep) { + if (time_before_eq(sl811->jiffies_a, jiffies)) { + /* happens a lot with lowspeed?? */ +- DBG("giveup on DONE_B: ctrl %02x sts %02x\n", ++ dev_dbg(hcd->self.controller, ++ "giveup on DONE_B: ctrl %02x sts %02x\n", + sl811_read(sl811, + SL811_EP_B(SL11H_HOSTCTLREG)), + sl811_read(sl811, +@@ -1008,7 +1018,8 @@ static int sl811h_urb_dequeue(struct usb + if (urb) + finish_request(sl811, ep, urb, 0); + else +- VDBG("dequeue, urb %p active %s; wait4irq\n", urb, ++ dev_dbg(sl811_to_hcd(sl811)->self.controller, ++ "dequeue, urb %p active %s; wait4irq\n", urb, + (sl811->active_a == ep) ? "A" : "B"); + } else + retval = -EINVAL; +@@ -1029,7 +1040,7 @@ sl811h_endpoint_disable(struct usb_hcd * + if (!list_empty(&hep->urb_list)) + msleep(3); + if (!list_empty(&hep->urb_list)) +- WARNING("ep %p not empty?\n", ep); ++ dev_warn(hcd->self.controller, "ep %p not empty?\n", ep); + + kfree(ep); + hep->hcpriv = NULL; +@@ -1132,7 +1143,7 @@ sl811h_timer(unsigned long _sl811) + + switch (signaling) { + case SL11H_CTL1MASK_SE0: +- DBG("end reset\n"); ++ dev_dbg(sl811_to_hcd(sl811)->self.controller, "end reset\n"); + sl811->port1 = (USB_PORT_STAT_C_RESET << 16) + | USB_PORT_STAT_POWER; + sl811->ctrl1 = 0; +@@ -1141,11 +1152,12 @@ sl811h_timer(unsigned long _sl811) + irqstat &= ~SL11H_INTMASK_RD; + break; + case SL11H_CTL1MASK_K: +- DBG("end resume\n"); ++ dev_dbg(sl811_to_hcd(sl811)->self.controller, "end resume\n"); + sl811->port1 &= ~USB_PORT_STAT_SUSPEND; + break; + default: +- DBG("odd timer signaling: %02x\n", signaling); ++ dev_dbg(sl811_to_hcd(sl811)->self.controller, ++ "odd timer signaling: %02x\n", signaling); + break; + } + sl811_write(sl811, SL11H_IRQ_STATUS, irqstat); +@@ -1243,7 +1255,7 @@ sl811h_hub_control( + break; + + /* 20 msec of resume/K signaling, other irqs blocked */ +- DBG("start resume...\n"); ++ dev_dbg(hcd->self.controller, "start resume...\n"); + sl811->irq_enable = 0; + sl811_write(sl811, SL11H_IRQ_ENABLE, + sl811->irq_enable); +@@ -1281,7 +1293,8 @@ sl811h_hub_control( + #ifndef VERBOSE + if (*(u16*)(buf+2)) /* only if wPortChange is interesting */ + #endif +- DBG("GetPortStatus %08x\n", sl811->port1); ++ dev_dbg(hcd->self.controller, "GetPortStatus %08x\n", ++ sl811->port1); + break; + case SetPortFeature: + if (wIndex != 1 || wLength != 0) +@@ -1293,7 +1306,7 @@ sl811h_hub_control( + if (!(sl811->port1 & USB_PORT_STAT_ENABLE)) + goto error; + +- DBG("suspend...\n"); ++ dev_dbg(hcd->self.controller,"suspend...\n"); + sl811->ctrl1 &= ~SL11H_CTL1MASK_SOF_ENA; + sl811_write(sl811, SL11H_CTLREG1, sl811->ctrl1); + break; +@@ -1338,7 +1351,7 @@ static int + sl811h_bus_suspend(struct usb_hcd *hcd) + { + // SOFs off +- DBG("%s\n", __func__); ++ dev_dbg(hcd->self.controller, "%s\n", __func__); + return 0; + } + +@@ -1346,7 +1359,7 @@ static int + sl811h_bus_resume(struct usb_hcd *hcd) + { + // SOFs on +- DBG("%s\n", __func__); ++ dev_dbg(hcd->self.controller, "%s\n", __func__); + return 0; + } + +@@ -1648,7 +1661,7 @@ sl811h_probe(struct platform_device *dev + + /* refuse to confuse usbcore */ + if (dev->dev.dma_mask) { +- DBG("no we won't dma\n"); ++ dev_dbg(&dev->dev, "no we won't dma\n"); + return -EINVAL; + } + +@@ -1716,7 +1729,7 @@ sl811h_probe(struct platform_device *dev + break; + default: + /* reject case 0, SL11S is less functional */ +- DBG("chiprev %02x\n", tmp); ++ dev_dbg(&dev->dev, "chiprev %02x\n", tmp); + retval = -ENXIO; + goto err6; + } +@@ -1747,7 +1760,7 @@ sl811h_probe(struct platform_device *dev + if (!ioaddr) + iounmap(addr_reg); + err2: +- DBG("init error, %d\n", retval); ++ dev_dbg(&dev->dev, "init error, %d\n", retval); + return retval; + } + +--- a/drivers/usb/host/sl811.h ++++ b/drivers/usb/host/sl811.h +@@ -242,25 +242,8 @@ sl811_read_buf(struct sl811 *sl811, int + + /*-------------------------------------------------------------------------*/ + +-#ifdef DEBUG +-#define DBG(stuff...) printk(KERN_DEBUG "sl811: " stuff) +-#else +-#define DBG(stuff...) do{}while(0) +-#endif +- +-#ifdef VERBOSE +-# define VDBG DBG +-#else +-# define VDBG(stuff...) do{}while(0) +-#endif +- + #ifdef PACKET_TRACE +-# define PACKET VDBG ++# define PACKET pr_debug("sl811: "stuff) + #else + # define PACKET(stuff...) do{}while(0) + #endif +- +-#define ERR(stuff...) printk(KERN_ERR "sl811: " stuff) +-#define WARNING(stuff...) printk(KERN_WARNING "sl811: " stuff) +-#define INFO(stuff...) printk(KERN_INFO "sl811: " stuff) +- diff --git a/usb-usbatm-don-t-rely-on-config_usb_debug.patch b/usb-usbatm-don-t-rely-on-config_usb_debug.patch new file mode 100644 index 00000000000000..dc6ff519a37a32 --- /dev/null +++ b/usb-usbatm-don-t-rely-on-config_usb_debug.patch @@ -0,0 +1,40 @@ +From foo@baz Fri Jun 28 11:03:03 PDT 2013 +Date: Fri, 28 Jun 2013 11:03:03 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: Duncan Sands <duncan.sands@free.fr> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: usbatm: don't rely on CONFIG_USB_DEBUG + +Enable the USB atm drivers to use the dynamic debugging subsystem, and +not rely on if CONFIG_USB_DEBUG is enabled or not for debugging +messages. This also provides a saner debug message, pointing out the +exact device the message is coming from. + +This also means the drivers do not have to be rebuilt to get debugging +messages, important for getting information from users who can not +rebuild their kernels. + +Cc: Duncan Sands <duncan.sands@free.fr> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/usb/atm/usbatm.h | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +--- a/drivers/usb/atm/usbatm.h ++++ b/drivers/usb/atm/usbatm.h +@@ -45,13 +45,8 @@ + dev_info(&(instance)->usb_intf->dev , format , ## arg) + #define usb_warn(instance, format, arg...) \ + dev_warn(&(instance)->usb_intf->dev , format , ## arg) +-#ifdef DEBUG + #define usb_dbg(instance, format, arg...) \ +- dev_printk(KERN_DEBUG , &(instance)->usb_intf->dev , format , ## arg) +-#else +-#define usb_dbg(instance, format, arg...) \ +- do {} while (0) +-#endif ++ dev_dbg(&(instance)->usb_intf->dev , format , ## arg) + + /* FIXME: move to dev_* once ATM is driver model aware */ + #define atm_printk(level, instance, format, arg...) \ diff --git a/usb-usbatm-move-the-atm_dbg-call-to-use-dynamic-debug.patch b/usb-usbatm-move-the-atm_dbg-call-to-use-dynamic-debug.patch new file mode 100644 index 00000000000000..e2b15aa5168699 --- /dev/null +++ b/usb-usbatm-move-the-atm_dbg-call-to-use-dynamic-debug.patch @@ -0,0 +1,46 @@ +From foo@baz Fri Jun 28 11:04:33 PDT 2013 +Date: Fri, 28 Jun 2013 11:04:33 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: Duncan Sands <duncan.sands@free.fr> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: usbatm: move the atm_dbg() call to use dynamic debug + +Move the atm_dbg() call to use the dynamic debug subsystem, and not rely +on CONFIG_USB_DEBUG for if things should be printed out or not. + +This also means the drivers do not have to be rebuilt to get debugging +messages, important for getting information from users who can not +rebuild their kernels. + +Cc: Duncan Sands <duncan.sands@free.fr> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/usb/atm/usbatm.h | 16 +++++----------- + 1 file changed, 5 insertions(+), 11 deletions(-) + +--- a/drivers/usb/atm/usbatm.h ++++ b/drivers/usb/atm/usbatm.h +@@ -59,18 +59,12 @@ + atm_printk(KERN_INFO, instance , format , ## arg) + #define atm_warn(instance, format, arg...) \ + atm_printk(KERN_WARNING, instance , format , ## arg) +-#ifdef DEBUG +-#define atm_dbg(instance, format, arg...) \ +- atm_printk(KERN_DEBUG, instance , format , ## arg) +-#define atm_rldbg(instance, format, arg...) \ ++#define atm_dbg(instance, format, arg...) \ ++ dynamic_pr_debug("ATM dev %d: " format , \ ++ (instance)->atm_dev->number , ## arg) ++#define atm_rldbg(instance, format, arg...) \ + if (printk_ratelimit()) \ +- atm_printk(KERN_DEBUG, instance , format , ## arg) +-#else +-#define atm_dbg(instance, format, arg...) \ +- do {} while (0) +-#define atm_rldbg(instance, format, arg...) \ +- do {} while (0) +-#endif ++ atm_dbg(instance , format , ## arg) + + + /* flags, set by mini-driver in bind() */ diff --git a/usb-usbatm-remove-config_usb_debug-dependancy.patch b/usb-usbatm-remove-config_usb_debug-dependancy.patch new file mode 100644 index 00000000000000..3d22ffa838db00 --- /dev/null +++ b/usb-usbatm-remove-config_usb_debug-dependancy.patch @@ -0,0 +1,63 @@ +From foo@baz Fri Jun 28 11:06:30 PDT 2013 +Date: Fri, 28 Jun 2013 11:06:30 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: Duncan Sands <duncan.sands@free.fr> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: usbatm: remove CONFIG_USB_DEBUG dependancy + +Now that no USB atm driver is relying on the CONFIG_USB_DEBUG option +(well, really the DEBUG option, thanks to some Makefile fun), remove it +from the Makefile. + +Also remove two last vestiges of DEBUG in the usbatm.c driver, moving +one to VERBOSE_DEBUG, which no one ever really cares about, and the +other to use the dynamic debug subsystem. + +Cc: Duncan Sands <duncan.sands@free.fr> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/usb/atm/Makefile | 3 --- + drivers/usb/atm/usbatm.c | 7 +++---- + 2 files changed, 3 insertions(+), 7 deletions(-) + +--- a/drivers/usb/atm/Makefile ++++ b/drivers/usb/atm/Makefile +@@ -1,9 +1,6 @@ + # + # Makefile for USB ATM/xDSL drivers + # +- +-ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG +- + obj-$(CONFIG_USB_CXACRU) += cxacru.o + obj-$(CONFIG_USB_SPEEDTOUCH) += speedtch.o + obj-$(CONFIG_USB_UEAGLEATM) += ueagle-atm.o +--- a/drivers/usb/atm/usbatm.c ++++ b/drivers/usb/atm/usbatm.c +@@ -661,7 +661,7 @@ static int usbatm_atm_send(struct atm_vc + + /* racy disconnection check - fine */ + if (!instance || instance->disconnected) { +-#ifdef DEBUG ++#ifdef VERBOSE_DEBUG + printk_ratelimited(KERN_DEBUG "%s: %s!\n", __func__, instance ? "disconnected" : "NULL instance"); + #endif + err = -ENODEV; +@@ -1120,14 +1120,13 @@ int usbatm_usb_probe(struct usb_interfac + instance->rx_channel.buf_size = num_packets * maxpacket; + instance->rx_channel.packet_size = maxpacket; + +-#ifdef DEBUG + for (i = 0; i < 2; i++) { + struct usbatm_channel *channel = i ? + &instance->tx_channel : &instance->rx_channel; + +- dev_dbg(dev, "%s: using %d byte buffer for %s channel 0x%p\n", __func__, channel->buf_size, i ? "tx" : "rx", channel); ++ dev_dbg(dev, "%s: using %d byte buffer for %s channel 0x%p\n", ++ __func__, channel->buf_size, i ? "tx" : "rx", channel); + } +-#endif + + /* initialize urbs */ + diff --git a/usb-usbatm-remove-unneeded-trace-printk-calls.patch b/usb-usbatm-remove-unneeded-trace-printk-calls.patch new file mode 100644 index 00000000000000..47744072df983c --- /dev/null +++ b/usb-usbatm-remove-unneeded-trace-printk-calls.patch @@ -0,0 +1,149 @@ +From foo@baz Fri Jun 28 11:02:03 PDT 2013 +Date: Fri, 28 Jun 2013 11:02:03 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: Duncan Sands <duncan.sands@free.fr> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: usbatm: remove unneeded trace printk calls + +We have an in-kernel trace subsystem, so use that instead of printk for +trying to figure out what functions are being called. + +Cc: Duncan Sands <duncan.sands@free.fr> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/usb/atm/usbatm.c | 34 ---------------------------------- + 1 file changed, 34 deletions(-) + +--- a/drivers/usb/atm/usbatm.c ++++ b/drivers/usb/atm/usbatm.c +@@ -311,8 +311,6 @@ static void usbatm_extract_one_cell(stru + int vci = ((source[1] & 0x0f) << 12) | (source[2] << 4) | (source[3] >> 4); + u8 pti = ((source[3] & 0xe) >> 1); + +- vdbg(&instance->usb_intf->dev, "%s: vpi %hd, vci %d, pti %d", __func__, vpi, vci, pti); +- + if ((vci != instance->cached_vci) || (vpi != instance->cached_vpi)) { + instance->cached_vpi = vpi; + instance->cached_vci = vci; +@@ -476,9 +474,6 @@ static unsigned int usbatm_write_cells(s + unsigned int bytes_written; + unsigned int stride = instance->tx_channel.stride; + +- vdbg(&instance->usb_intf->dev, "%s: skb->len=%d, avail_space=%u", +- __func__, skb->len, avail_space); +- + for (bytes_written = 0; bytes_written < avail_space && ctrl->len; + bytes_written += stride, target += stride) { + unsigned int data_len = min_t(unsigned int, skb->len, ATM_CELL_PAYLOAD); +@@ -639,7 +634,6 @@ static void usbatm_cancel_send(struct us + { + struct sk_buff *skb, *n; + +- atm_dbg(instance, "%s entered\n", __func__); + spin_lock_irq(&instance->sndqueue.lock); + skb_queue_walk_safe(&instance->sndqueue, skb, n) { + if (UDSL_SKB(skb)->atm.vcc == vcc) { +@@ -657,7 +651,6 @@ static void usbatm_cancel_send(struct us + usbatm_pop(vcc, skb); + } + tasklet_enable(&instance->tx_channel.tasklet); +- atm_dbg(instance, "%s done\n", __func__); + } + + static int usbatm_atm_send(struct atm_vcc *vcc, struct sk_buff *skb) +@@ -675,9 +668,6 @@ static int usbatm_atm_send(struct atm_vc + goto fail; + } + +- vdbg(&instance->usb_intf->dev, "%s called (skb 0x%p, len %u)", __func__, +- skb, skb->len); +- + if (vcc->qos.aal != ATM_AAL5) { + atm_rldbg(instance, "%s: unsupported ATM type %d!\n", __func__, vcc->qos.aal); + err = -EINVAL; +@@ -717,8 +707,6 @@ static void usbatm_destroy_instance(stru + { + struct usbatm_data *instance = container_of(kref, struct usbatm_data, refcount); + +- usb_dbg(instance, "%s\n", __func__); +- + tasklet_kill(&instance->rx_channel.tasklet); + tasklet_kill(&instance->tx_channel.tasklet); + usb_put_dev(instance->usb_dev); +@@ -727,15 +715,11 @@ static void usbatm_destroy_instance(stru + + static void usbatm_get_instance(struct usbatm_data *instance) + { +- usb_dbg(instance, "%s\n", __func__); +- + kref_get(&instance->refcount); + } + + static void usbatm_put_instance(struct usbatm_data *instance) + { +- usb_dbg(instance, "%s\n", __func__); +- + kref_put(&instance->refcount, usbatm_destroy_instance); + } + +@@ -751,7 +735,6 @@ static void usbatm_atm_dev_close(struct + if (!instance) + return; + +- usb_dbg(instance, "%s\n", __func__); + atm_dev->dev_data = NULL; /* catch bugs */ + usbatm_put_instance(instance); /* taken in usbatm_atm_init */ + } +@@ -807,8 +790,6 @@ static int usbatm_atm_open(struct atm_vc + if (!instance) + return -ENODEV; + +- atm_dbg(instance, "%s: vpi %hd, vci %d\n", __func__, vpi, vci); +- + /* only support AAL5 */ + if ((vcc->qos.aal != ATM_AAL5)) { + atm_warn(instance, "%s: unsupported ATM type %d!\n", __func__, vcc->qos.aal); +@@ -885,11 +866,6 @@ static void usbatm_atm_close(struct atm_ + if (!instance || !vcc_data) + return; + +- atm_dbg(instance, "%s entered\n", __func__); +- +- atm_dbg(instance, "%s: deallocating vcc 0x%p with vpi %d vci %d\n", +- __func__, vcc_data, vcc_data->vpi, vcc_data->vci); +- + usbatm_cancel_send(instance, vcc); + + mutex_lock(&instance->serialize); /* vs self, usbatm_atm_open, usbatm_usb_disconnect */ +@@ -916,8 +892,6 @@ static void usbatm_atm_close(struct atm_ + clear_bit(ATM_VF_ADDR, &vcc->flags); + + mutex_unlock(&instance->serialize); +- +- atm_dbg(instance, "%s successful\n", __func__); + } + + static int usbatm_atm_ioctl(struct atm_dev *atm_dev, unsigned int cmd, +@@ -1054,12 +1028,6 @@ int usbatm_usb_probe(struct usb_interfac + int i, length; + unsigned int maxpacket, num_packets; + +- dev_dbg(dev, "%s: trying driver %s with vendor=%04x, product=%04x, ifnum %2d\n", +- __func__, driver->driver_name, +- le16_to_cpu(usb_dev->descriptor.idVendor), +- le16_to_cpu(usb_dev->descriptor.idProduct), +- intf->altsetting->desc.bInterfaceNumber); +- + /* instance init */ + instance = kzalloc(sizeof(*instance) + sizeof(struct urb *) * (num_rcv_urbs + num_snd_urbs), GFP_KERNEL); + if (!instance) { +@@ -1258,8 +1226,6 @@ void usbatm_usb_disconnect(struct usb_in + struct usbatm_vcc_data *vcc_data; + int i; + +- dev_dbg(dev, "%s entered\n", __func__); +- + if (!instance) { + dev_dbg(dev, "%s: NULL instance!\n", __func__); + return; diff --git a/usb-usbatm-remove-unused-udsl_assert-macro.patch b/usb-usbatm-remove-unused-udsl_assert-macro.patch new file mode 100644 index 00000000000000..38b083e56f607f --- /dev/null +++ b/usb-usbatm-remove-unused-udsl_assert-macro.patch @@ -0,0 +1,85 @@ +From foo@baz Fri Jun 28 11:00:13 PDT 2013 +Date: Fri, 28 Jun 2013 11:00:13 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +Cc: Duncan Sands <duncan.sands@free.fr> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: usbatm: remove unused UDSL_ASSERT macro + +If this code isn't triggering this assert by now, it never will, so just +remove it, it's pointless. + +Cc: Duncan Sands <duncan.sands@free.fr> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + + +--- + drivers/usb/atm/usbatm.c | 8 -------- + drivers/usb/atm/usbatm.h | 12 ------------ + 2 files changed, 20 deletions(-) + +--- a/drivers/usb/atm/usbatm.c ++++ b/drivers/usb/atm/usbatm.c +@@ -344,7 +344,6 @@ static void usbatm_extract_one_cell(stru + __func__, sarb->len, vcc); + /* discard cells already received */ + skb_trim(sarb, 0); +- UDSL_ASSERT(instance, sarb->tail + ATM_CELL_PAYLOAD <= sarb->end); + } + + memcpy(skb_tail_pointer(sarb), source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); +@@ -437,8 +436,6 @@ static void usbatm_extract_cells(struct + unsigned char *cell_buf = instance->cell_buf; + unsigned int space_left = stride - buf_usage; + +- UDSL_ASSERT(instance, buf_usage <= stride); +- + if (avail_data >= space_left) { + /* add new data and process cell */ + memcpy(cell_buf + buf_usage, source, space_left); +@@ -481,7 +478,6 @@ static unsigned int usbatm_write_cells(s + + vdbg(&instance->usb_intf->dev, "%s: skb->len=%d, avail_space=%u", + __func__, skb->len, avail_space); +- UDSL_ASSERT(instance, !(avail_space % stride)); + + for (bytes_written = 0; bytes_written < avail_space && ctrl->len; + bytes_written += stride, target += stride) { +@@ -553,8 +549,6 @@ static void usbatm_rx_process(unsigned l + if (!urb->iso_frame_desc[i].status) { + unsigned int actual_length = urb->iso_frame_desc[i].actual_length; + +- UDSL_ASSERT(instance, actual_length <= packet_size); +- + if (!merge_length) + merge_start = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset; + merge_length += actual_length; +@@ -1176,8 +1170,6 @@ int usbatm_usb_probe(struct usb_interfac + struct urb *urb; + unsigned int iso_packets = usb_pipeisoc(channel->endpoint) ? channel->buf_size / channel->packet_size : 0; + +- UDSL_ASSERT(instance, !usb_pipeisoc(channel->endpoint) || usb_pipein(channel->endpoint)); +- + urb = usb_alloc_urb(iso_packets, GFP_KERNEL); + if (!urb) { + dev_err(dev, "%s: no memory for urb %d!\n", __func__, i); +--- a/drivers/usb/atm/usbatm.h ++++ b/drivers/usb/atm/usbatm.h +@@ -39,18 +39,6 @@ + #define VERBOSE_DEBUG + */ + +-#ifdef DEBUG +-#define UDSL_ASSERT(instance, x) BUG_ON(!(x)) +-#else +-#define UDSL_ASSERT(instance, x) \ +- do { \ +- if (!(x)) \ +- dev_warn(&(instance)->usb_intf->dev, \ +- "failed assertion '%s' at line %d", \ +- __stringify(x), __LINE__); \ +- } while (0) +-#endif +- + #define usb_err(instance, format, arg...) \ + dev_err(&(instance)->usb_intf->dev , format , ## arg) + #define usb_info(instance, format, arg...) \ diff --git a/v4l2-convert-class-code-to-use-dev_groups.patch b/v4l2-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..484c0de13af77f --- /dev/null +++ b/v4l2-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,92 @@ +From foo@baz Tue Jul 9 15:07:59 PDT 2013 +Date: Tue, 09 Jul 2013 15:08:00 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: v4l2: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the v4l2 class code to use the +correct field. + +Cc: Mauro Carvalho Chehab <mchehab@redhat.com> +Cc: Hans Verkuil <hans.verkuil@cisco.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/media/v4l2-core/v4l2-dev.c | 30 +++++++++++++++++------------- + 1 file changed, 17 insertions(+), 13 deletions(-) + +--- a/drivers/media/v4l2-core/v4l2-dev.c ++++ b/drivers/media/v4l2-core/v4l2-dev.c +@@ -38,24 +38,25 @@ + * sysfs stuff + */ + +-static ssize_t show_index(struct device *cd, +- struct device_attribute *attr, char *buf) ++static ssize_t index_show(struct device *cd, ++ struct device_attribute *attr, char *buf) + { + struct video_device *vdev = to_video_device(cd); + + return sprintf(buf, "%i\n", vdev->index); + } ++static DEVICE_ATTR_RO(index); + +-static ssize_t show_debug(struct device *cd, +- struct device_attribute *attr, char *buf) ++static ssize_t debug_show(struct device *cd, ++ struct device_attribute *attr, char *buf) + { + struct video_device *vdev = to_video_device(cd); + + return sprintf(buf, "%i\n", vdev->debug); + } + +-static ssize_t set_debug(struct device *cd, struct device_attribute *attr, +- const char *buf, size_t len) ++static ssize_t debug_store(struct device *cd, struct device_attribute *attr, ++ const char *buf, size_t len) + { + struct video_device *vdev = to_video_device(cd); + int res = 0; +@@ -68,21 +69,24 @@ static ssize_t set_debug(struct device * + vdev->debug = value; + return len; + } ++static DEVICE_ATTR_RW(debug); + +-static ssize_t show_name(struct device *cd, ++static ssize_t name_show(struct device *cd, + struct device_attribute *attr, char *buf) + { + struct video_device *vdev = to_video_device(cd); + + return sprintf(buf, "%.*s\n", (int)sizeof(vdev->name), vdev->name); + } ++static DEVICE_ATTR_RO(name); + +-static struct device_attribute video_device_attrs[] = { +- __ATTR(name, S_IRUGO, show_name, NULL), +- __ATTR(debug, 0644, show_debug, set_debug), +- __ATTR(index, S_IRUGO, show_index, NULL), +- __ATTR_NULL ++static struct attribute *video_device_attrs[] = { ++ &dev_attr_name.attr, ++ &dev_attr_debug.attr, ++ &dev_attr_index.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(video_device); + + /* + * Active devices +@@ -217,7 +221,7 @@ static void v4l2_device_release(struct d + + static struct class video_class = { + .name = VIDEO_NAME, +- .dev_attrs = video_device_attrs, ++ .dev_groups = video_device_groups, + }; + + struct video_device *video_devdata(struct file *file) diff --git a/video-backlight-convert-class-code-to-use-dev_groups.patch b/video-backlight-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..3f649fee2c02ae --- /dev/null +++ b/video-backlight-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,135 @@ +From foo@baz Tue Jul 9 15:39:32 PDT 2013 +Date: Tue, 09 Jul 2013 15:39:32 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: video: backlight: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the video backlight class code to +use the correct field. + +Cc: Richard Purdie <rpurdie@rpsys.net> +Cc: Jingoo Han <jg1.han@samsung.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/video/backlight/backlight.c | 44 +++++++++++++++++++----------------- + 1 file changed, 24 insertions(+), 20 deletions(-) + +--- a/drivers/video/backlight/backlight.c ++++ b/drivers/video/backlight/backlight.c +@@ -103,16 +103,16 @@ static void backlight_generate_event(str + sysfs_notify(&bd->dev.kobj, NULL, "actual_brightness"); + } + +-static ssize_t backlight_show_power(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t bl_power_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct backlight_device *bd = to_backlight_device(dev); + + return sprintf(buf, "%d\n", bd->props.power); + } + +-static ssize_t backlight_store_power(struct device *dev, +- struct device_attribute *attr, const char *buf, size_t count) ++static ssize_t bl_power_store(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) + { + int rc; + struct backlight_device *bd = to_backlight_device(dev); +@@ -136,8 +136,9 @@ static ssize_t backlight_store_power(str + + return rc; + } ++static DEVICE_ATTR_RW(bl_power); + +-static ssize_t backlight_show_brightness(struct device *dev, ++static ssize_t brightness_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct backlight_device *bd = to_backlight_device(dev); +@@ -145,7 +146,7 @@ static ssize_t backlight_show_brightness + return sprintf(buf, "%d\n", bd->props.brightness); + } + +-static ssize_t backlight_store_brightness(struct device *dev, ++static ssize_t brightness_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) + { + int rc; +@@ -175,24 +176,27 @@ static ssize_t backlight_store_brightnes + + return rc; + } ++static DEVICE_ATTR_RW(brightness); + +-static ssize_t backlight_show_type(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t type_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + struct backlight_device *bd = to_backlight_device(dev); + + return sprintf(buf, "%s\n", backlight_types[bd->props.type]); + } ++static DEVICE_ATTR_RO(type); + +-static ssize_t backlight_show_max_brightness(struct device *dev, ++static ssize_t max_brightness_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct backlight_device *bd = to_backlight_device(dev); + + return sprintf(buf, "%d\n", bd->props.max_brightness); + } ++static DEVICE_ATTR_RO(max_brightness); + +-static ssize_t backlight_show_actual_brightness(struct device *dev, ++static ssize_t actual_brightness_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + int rc = -ENXIO; +@@ -205,6 +209,7 @@ static ssize_t backlight_show_actual_bri + + return rc; + } ++static DEVICE_ATTR_RO(actual_brightness); + + static struct class *backlight_class; + +@@ -247,16 +252,15 @@ static void bl_device_release(struct dev + kfree(bd); + } + +-static struct device_attribute bl_device_attributes[] = { +- __ATTR(bl_power, 0644, backlight_show_power, backlight_store_power), +- __ATTR(brightness, 0644, backlight_show_brightness, +- backlight_store_brightness), +- __ATTR(actual_brightness, 0444, backlight_show_actual_brightness, +- NULL), +- __ATTR(max_brightness, 0444, backlight_show_max_brightness, NULL), +- __ATTR(type, 0444, backlight_show_type, NULL), +- __ATTR_NULL, ++static struct attribute *bl_device_attrs[] = { ++ &dev_attr_bl_power.attr, ++ &dev_attr_brightness.attr, ++ &dev_attr_actual_brightness.attr, ++ &dev_attr_max_brightness.attr, ++ &dev_attr_type.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(bl_device); + + /** + * backlight_force_update - tell the backlight subsystem that hardware state +@@ -493,7 +497,7 @@ static int __init backlight_class_init(v + return PTR_ERR(backlight_class); + } + +- backlight_class->dev_attrs = bl_device_attributes; ++ backlight_class->dev_groups = bl_device_groups; + backlight_class->pm = &backlight_class_dev_pm_ops; + return 0; + } diff --git a/video-backlight-lcd-convert-class-code-to-use-dev_groups.patch b/video-backlight-lcd-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..96a7bd0fa70e16 --- /dev/null +++ b/video-backlight-lcd-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,104 @@ +From foo@baz Tue Jul 9 15:40:31 PDT 2013 +Date: Tue, 09 Jul 2013 15:40:31 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: video: backlight: lcd: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the video backlight lcd class +code to use the correct field. + +Cc: Richard Purdie <rpurdie@rpsys.net> +Cc: Jingoo Han <jg1.han@samsung.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/video/backlight/lcd.c | 26 +++++++++++++++----------- + 1 file changed, 15 insertions(+), 11 deletions(-) + +--- a/drivers/video/backlight/lcd.c ++++ b/drivers/video/backlight/lcd.c +@@ -89,7 +89,7 @@ static inline void lcd_unregister_fb(str + } + #endif /* CONFIG_FB */ + +-static ssize_t lcd_show_power(struct device *dev, struct device_attribute *attr, ++static ssize_t lcd_power_show(struct device *dev, struct device_attribute *attr, + char *buf) + { + int rc; +@@ -105,7 +105,7 @@ static ssize_t lcd_show_power(struct dev + return rc; + } + +-static ssize_t lcd_store_power(struct device *dev, ++static ssize_t lcd_power_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) + { + int rc; +@@ -128,8 +128,9 @@ static ssize_t lcd_store_power(struct de + + return rc; + } ++static DEVICE_ATTR_RW(lcd_power); + +-static ssize_t lcd_show_contrast(struct device *dev, ++static ssize_t contrast_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + int rc = -ENXIO; +@@ -143,7 +144,7 @@ static ssize_t lcd_show_contrast(struct + return rc; + } + +-static ssize_t lcd_store_contrast(struct device *dev, ++static ssize_t contrast_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) + { + int rc; +@@ -166,14 +167,16 @@ static ssize_t lcd_store_contrast(struct + + return rc; + } ++static DEVICE_ATTR_RW(contrast); + +-static ssize_t lcd_show_max_contrast(struct device *dev, ++static ssize_t max_contrast_show(struct device *dev, + struct device_attribute *attr, char *buf) + { + struct lcd_device *ld = to_lcd_device(dev); + + return sprintf(buf, "%d\n", ld->props.max_contrast); + } ++static DEVICE_ATTR_RO(max_contrast); + + static struct class *lcd_class; + +@@ -183,12 +186,13 @@ static void lcd_device_release(struct de + kfree(ld); + } + +-static struct device_attribute lcd_device_attributes[] = { +- __ATTR(lcd_power, 0644, lcd_show_power, lcd_store_power), +- __ATTR(contrast, 0644, lcd_show_contrast, lcd_store_contrast), +- __ATTR(max_contrast, 0444, lcd_show_max_contrast, NULL), +- __ATTR_NULL, ++static struct attribute *lcd_device_attrs[] = { ++ &dev_attr_lcd_power.attr, ++ &dev_attr_contrast.attr, ++ &dev_attr_max_contrast.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(lcd_device); + + /** + * lcd_device_register - register a new object of lcd_device class. +@@ -344,7 +348,7 @@ static int __init lcd_class_init(void) + return PTR_ERR(lcd_class); + } + +- lcd_class->dev_attrs = lcd_device_attributes; ++ lcd_class->dev_groups = lcd_device_groups; + return 0; + } + diff --git a/video-output-convert-class-code-to-use-dev_groups.patch b/video-output-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..45756ed596e286 --- /dev/null +++ b/video-output-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,73 @@ +From foo@baz Tue Jul 9 16:16:53 PDT 2013 +Date: Tue, 09 Jul 2013 16:16:53 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: video: output: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the video output class code to +use the correct field. + +Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com> +Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/video/output.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +--- a/drivers/video/output.c ++++ b/drivers/video/output.c +@@ -32,8 +32,8 @@ MODULE_DESCRIPTION("Display Output Switc + MODULE_LICENSE("GPL"); + MODULE_AUTHOR("Luming Yu <luming.yu@intel.com>"); + +-static ssize_t video_output_show_state(struct device *dev, +- struct device_attribute *attr, char *buf) ++static ssize_t state_show(struct device *dev, struct device_attribute *attr, ++ char *buf) + { + ssize_t ret_size = 0; + struct output_device *od = to_output_device(dev); +@@ -42,9 +42,8 @@ static ssize_t video_output_show_state(s + return ret_size; + } + +-static ssize_t video_output_store_state(struct device *dev, +- struct device_attribute *attr, +- const char *buf,size_t count) ++static ssize_t state_store(struct device *dev, struct device_attribute *attr, ++ const char *buf,size_t count) + { + char *endp; + struct output_device *od = to_output_device(dev); +@@ -62,6 +61,7 @@ static ssize_t video_output_store_state( + } + return count; + } ++static DEVICE_ATTR_RW(state); + + static void video_output_release(struct device *dev) + { +@@ -69,16 +69,16 @@ static void video_output_release(struct + kfree(od); + } + +-static struct device_attribute video_output_attributes[] = { +- __ATTR(state, 0644, video_output_show_state, video_output_store_state), +- __ATTR_NULL, ++static struct attribute *video_output_attrs[] = { ++ &dev_attr_state.attr, ++ NULL, + }; +- ++ATTRIBUTE_GROUPS(video_output); + + static struct class video_output_class = { + .name = "video_output", + .dev_release = video_output_release, +- .dev_attrs = video_output_attributes, ++ .dev_groups = video_output_groups, + }; + + struct output_device *video_output_register(const char *name, diff --git a/x86-wmi-convert-class-code-to-use-dev_groups.patch b/x86-wmi-convert-class-code-to-use-dev_groups.patch new file mode 100644 index 00000000000000..80c4e125d2ab69 --- /dev/null +++ b/x86-wmi-convert-class-code-to-use-dev_groups.patch @@ -0,0 +1,45 @@ +From foo@baz Tue Jul 9 15:15:36 PDT 2013 +Date: Tue, 09 Jul 2013 15:15:36 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: x86: wmi: convert class code to use dev_groups + +The dev_attrs field of struct class is going away soon, dev_groups +should be used instead. This converts the wmi class code to use the +correct field. + +Cc: Matthew Garrett <matthew.garrett@nebula.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + drivers/platform/x86/wmi.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +--- a/drivers/platform/x86/wmi.c ++++ b/drivers/platform/x86/wmi.c +@@ -693,11 +693,13 @@ static ssize_t modalias_show(struct devi + + return sprintf(buf, "wmi:%s\n", guid_string); + } ++static DEVICE_ATTR_RO(modalias); + +-static struct device_attribute wmi_dev_attrs[] = { +- __ATTR_RO(modalias), +- __ATTR_NULL ++static struct attribute *wmi_attrs[] = { ++ &dev_attr_modalias.attr, ++ NULL, + }; ++ATTRIBUTE_GROUPS(wmi); + + static int wmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env) + { +@@ -732,7 +734,7 @@ static struct class wmi_class = { + .name = "wmi", + .dev_release = wmi_dev_free, + .dev_uevent = wmi_dev_uevent, +- .dev_attrs = wmi_dev_attrs, ++ .dev_groups = wmi_groups, + }; + + static int wmi_create_device(const struct guid_block *gblock, |