From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751608AbXCJG4e (ORCPT ); Sat, 10 Mar 2007 01:56:34 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752201AbXCJG4d (ORCPT ); Sat, 10 Mar 2007 01:56:33 -0500 Received: from cantor2.suse.de ([195.135.220.15]:43212 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751608AbXCJG4a (ORCPT ); Sat, 10 Mar 2007 01:56:30 -0500 Date: Fri, 9 Mar 2007 22:54:43 -0800 From: Greg KH To: Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, Andrew Morton Subject: Re: [PATCH] Use attribute groups in struct device_type Message-ID: <20070310065443.GA20302@suse.de> References: <200703100137.35203.dtor@insightbb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200703100137.35203.dtor@insightbb.com> User-Agent: Mutt/1.5.13 (2006-08-11) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 10, 2007 at 01:37:34AM -0500, Dmitry Torokhov wrote: > Greg, > > Please consider applying the patch below. It switches struct device_type > to using attribute groups which os more flexible. I am using it in my > input class_device -> device conversion (which is 99% done btw). Argh, I never sent you my version of that, did I? Very sorry about that, I was working on fixing up the device namespace issue first, which isn't done yet :( Anyway, my patch that did that is below, feel free to use it or not if you want. > I looked through -mm and the latest git and there does not seem to be > any users of struct device_type yet... Yes, the input patch below uses it and I have a block-device patch from Kay in my tree that Andrew doesn't pull from (as it's usually really messed up and I know to hide this kind of breakage from him...) thanks, greg k-h -------------------- >>From kay.sievers@vrfy.org Wed Sep 13 22:59:01 2006 Date: Wed, 13 Sep 2006 16:11:35 +0200 From: Kay Sievers To: Greg KH Subject: Driver core: convert input core to use struct device From: Kay Sievers Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. Signed-off-by: Kay Sievers Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-input.c | 2 drivers/hwmon/hdaps.c | 2 drivers/input/evdev.c | 12 -- drivers/input/input.c | 110 ++++++++++++---------- drivers/input/joydev.c | 12 -- drivers/input/joystick/a3d.c | 2 drivers/input/joystick/adi.c | 2 drivers/input/joystick/cobra.c | 2 drivers/input/joystick/gf2k.c | 2 drivers/input/joystick/grip.c | 2 drivers/input/joystick/grip_mp.c | 2 drivers/input/joystick/guillemot.c | 2 drivers/input/joystick/iforce/iforce-main.c | 4 drivers/input/joystick/magellan.c | 2 drivers/input/joystick/sidewinder.c | 2 drivers/input/joystick/spaceball.c | 2 drivers/input/joystick/spaceorb.c | 2 drivers/input/joystick/stinger.c | 2 drivers/input/joystick/tmdc.c | 2 drivers/input/joystick/twidjoy.c | 2 drivers/input/joystick/warrior.c | 2 drivers/input/keyboard/atkbd.c | 2 drivers/input/keyboard/corgikbd.c | 2 drivers/input/keyboard/lkkbd.c | 2 drivers/input/keyboard/newtonkbd.c | 2 drivers/input/keyboard/spitzkbd.c | 2 drivers/input/keyboard/sunkbd.c | 2 drivers/input/keyboard/xtkbd.c | 2 drivers/input/misc/pcspkr.c | 2 drivers/input/misc/wistron_btns.c | 2 drivers/input/mouse/psmouse-base.c | 2 drivers/input/mouse/sermouse.c | 2 drivers/input/mouse/vsxxxaa.c | 2 drivers/input/mousedev.c | 24 +--- drivers/input/touchscreen/ads7846.c | 2 drivers/input/touchscreen/corgi_ts.c | 2 drivers/input/touchscreen/elo.c | 2 drivers/input/touchscreen/h3600_ts_input.c | 2 drivers/input/touchscreen/penmount.c | 2 drivers/input/tsdev.c | 12 -- drivers/media/dvb/dvb-usb/dvb-usb-remote.c | 2 drivers/media/video/bt8xx/bttv-input.c | 2 drivers/media/video/cx88/cx88-input.c | 2 drivers/media/video/saa7134/saa7134-input.c | 2 drivers/media/video/usbvideo/konicawc.c | 2 drivers/media/video/usbvideo/quickcam_messenger.c | 2 drivers/usb/input/acecad.c | 2 drivers/usb/input/aiptek.c | 2 drivers/usb/input/appletouch.c | 2 drivers/usb/input/ati_remote.c | 2 drivers/usb/input/ati_remote2.c | 2 drivers/usb/input/gtco.c | 2 drivers/usb/input/itmtouch.c | 2 drivers/usb/input/kbtab.c | 2 drivers/usb/input/keyspan_remote.c | 2 drivers/usb/input/mtouchusb.c | 2 drivers/usb/input/powermate.c | 2 drivers/usb/input/touchkitusb.c | 2 drivers/usb/input/usbkbd.c | 2 drivers/usb/input/usbmouse.c | 2 drivers/usb/input/usbtouchscreen.c | 2 drivers/usb/input/wacom_sys.c | 2 drivers/usb/input/xpad.c | 2 drivers/usb/input/yealink.c | 2 include/linux/input.h | 8 - net/bluetooth/hidp/core.c | 2 66 files changed, 146 insertions(+), 154 deletions(-) --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -896,7 +896,7 @@ int hidinput_connect(struct hid_device * input_dev->id.vendor = hid->vendor; input_dev->id.product = hid->product; input_dev->id.version = hid->version; - input_dev->cdev.dev = hid->dev; + input_dev->d.parent = hid->dev; hidinput->input = input_dev; list_add_tail(&hidinput->list, &hid->inputs); } --- a/drivers/hwmon/hdaps.c +++ b/drivers/hwmon/hdaps.c @@ -572,7 +572,7 @@ static int __init hdaps_init(void) /* initialize the input class */ hdaps_idev->name = "hdaps"; - hdaps_idev->cdev.dev = &pdev->dev; + hdaps_idev->d.parent = &pdev->dev; hdaps_idev->evbit[0] = BIT(EV_ABS); input_set_abs_params(hdaps_idev, ABS_X, -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -620,7 +620,6 @@ static struct input_handle *evdev_connec const struct input_device_id *id) { struct evdev *evdev; - struct class_device *cdev; int minor; for (minor = 0; minor < EVDEV_MINORS && evdev_table[minor]; minor++); @@ -645,13 +644,9 @@ static struct input_handle *evdev_connec evdev_table[minor] = evdev; - cdev = class_device_create(&input_class, &dev->cdev, + device_create(&input_class, &dev->d, MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + minor), - dev->cdev.dev, evdev->name); - - /* temporary symlink to keep userspace happy */ - sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, - evdev->name); + evdev->name); return &evdev->handle; } @@ -661,8 +656,7 @@ static void evdev_disconnect(struct inpu struct evdev *evdev = handle->private; struct evdev_list *list; - sysfs_remove_link(&input_class.subsys.kset.kobj, evdev->name); - class_device_destroy(&input_class, + device_destroy(&input_class, MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor)); evdev->exist = 0; --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -430,7 +430,7 @@ static void input_seq_print_bitmap(struc static int input_devices_seq_show(struct seq_file *seq, void *v) { struct input_dev *dev = container_of(v, struct input_dev, node); - const char *path = kobject_get_path(&dev->cdev.kobj, GFP_KERNEL); + const char *path = kobject_get_path(&dev->d.kobj, GFP_KERNEL); struct input_handle *handle; seq_printf(seq, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n", @@ -585,14 +585,16 @@ static inline void input_proc_exit(void) #endif #define INPUT_DEV_STRING_ATTR_SHOW(name) \ -static ssize_t input_dev_show_##name(struct class_device *dev, char *buf) \ +static ssize_t input_dev_show_##name(struct device *dev, \ + struct device_attribute *attr, \ + char *buf) \ { \ struct input_dev *input_dev = to_input_dev(dev); \ \ return scnprintf(buf, PAGE_SIZE, "%s\n", \ input_dev->name ? input_dev->name : ""); \ } \ -static CLASS_DEVICE_ATTR(name, S_IRUGO, input_dev_show_##name, NULL); +static DEVICE_ATTR(name, S_IRUGO, input_dev_show_##name, NULL); INPUT_DEV_STRING_ATTR_SHOW(name); INPUT_DEV_STRING_ATTR_SHOW(phys); @@ -646,7 +648,9 @@ static int input_print_modalias(char *bu return len; } -static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf) +static ssize_t input_dev_show_modalias(struct device *dev, + struct device_attribute *attr, + char *buf) { struct input_dev *id = to_input_dev(dev); ssize_t len; @@ -655,13 +659,13 @@ static ssize_t input_dev_show_modalias(s return min_t(int, len, PAGE_SIZE); } -static CLASS_DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL); +static DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL); static struct attribute *input_dev_attrs[] = { - &class_device_attr_name.attr, - &class_device_attr_phys.attr, - &class_device_attr_uniq.attr, - &class_device_attr_modalias.attr, + &dev_attr_name.attr, + &dev_attr_phys.attr, + &dev_attr_uniq.attr, + &dev_attr_modalias.attr, NULL }; @@ -670,12 +674,14 @@ static struct attribute_group input_dev_ }; #define INPUT_DEV_ID_ATTR(name) \ -static ssize_t input_dev_show_id_##name(struct class_device *dev, char *buf) \ +static ssize_t input_dev_show_id_##name(struct device *dev, \ + struct device_attribute *attr, \ + char *buf) \ { \ struct input_dev *input_dev = to_input_dev(dev); \ return scnprintf(buf, PAGE_SIZE, "%04x\n", input_dev->id.name); \ } \ -static CLASS_DEVICE_ATTR(name, S_IRUGO, input_dev_show_id_##name, NULL); +static DEVICE_ATTR(name, S_IRUGO, input_dev_show_id_##name, NULL); INPUT_DEV_ID_ATTR(bustype); INPUT_DEV_ID_ATTR(vendor); @@ -683,10 +689,10 @@ INPUT_DEV_ID_ATTR(product); INPUT_DEV_ID_ATTR(version); static struct attribute *input_dev_id_attrs[] = { - &class_device_attr_bustype.attr, - &class_device_attr_vendor.attr, - &class_device_attr_product.attr, - &class_device_attr_version.attr, + &dev_attr_bustype.attr, + &dev_attr_vendor.attr, + &dev_attr_product.attr, + &dev_attr_version.attr, NULL }; @@ -716,14 +722,16 @@ static int input_print_bitmap(char *buf, } #define INPUT_DEV_CAP_ATTR(ev, bm) \ -static ssize_t input_dev_show_cap_##bm(struct class_device *dev, char *buf) \ +static ssize_t input_dev_show_cap_##bm(struct device *dev, \ + struct device_attribute *attr, \ + char *buf) \ { \ struct input_dev *input_dev = to_input_dev(dev); \ int len = input_print_bitmap(buf, PAGE_SIZE, \ input_dev->bm##bit, ev##_MAX, 1); \ return min_t(int, len, PAGE_SIZE); \ } \ -static CLASS_DEVICE_ATTR(bm, S_IRUGO, input_dev_show_cap_##bm, NULL); +static DEVICE_ATTR(bm, S_IRUGO, input_dev_show_cap_##bm, NULL); INPUT_DEV_CAP_ATTR(EV, ev); INPUT_DEV_CAP_ATTR(KEY, key); @@ -736,15 +744,15 @@ INPUT_DEV_CAP_ATTR(FF, ff); INPUT_DEV_CAP_ATTR(SW, sw); static struct attribute *input_dev_caps_attrs[] = { - &class_device_attr_ev.attr, - &class_device_attr_key.attr, - &class_device_attr_rel.attr, - &class_device_attr_abs.attr, - &class_device_attr_msc.attr, - &class_device_attr_led.attr, - &class_device_attr_snd.attr, - &class_device_attr_ff.attr, - &class_device_attr_sw.attr, + &dev_attr_ev.attr, + &dev_attr_key.attr, + &dev_attr_rel.attr, + &dev_attr_abs.attr, + &dev_attr_msc.attr, + &dev_attr_led.attr, + &dev_attr_snd.attr, + &dev_attr_ff.attr, + &dev_attr_sw.attr, NULL }; @@ -753,9 +761,9 @@ static struct attribute_group input_dev_ .attrs = input_dev_caps_attrs, }; -static void input_dev_release(struct class_device *class_dev) +static void input_dev_release(struct device *d) { - struct input_dev *dev = to_input_dev(class_dev); + struct input_dev *dev = to_input_dev(d); input_ff_destroy(dev); kfree(dev); @@ -842,16 +850,23 @@ static int input_add_uevent_modalias_var return err; \ } while (0) -static int input_dev_uevent(struct class_device *cdev, char **envp, +static int input_dev_uevent(struct device *d, char **envp, int num_envp, char *buffer, int buffer_size) { - struct input_dev *dev = to_input_dev(cdev); + struct input_dev *dev; int i = 0; int len = 0; + /* input is a single class, this is only valid for input_dev's */ + if (strncmp("input", kobject_name(&d->kobj), 5) != 0) + return 0; + + dev = to_input_dev(d); + INPUT_ADD_HOTPLUG_VAR("PRODUCT=%x/%x/%x/%x", dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version); + if (dev->name) INPUT_ADD_HOTPLUG_VAR("NAME=\"%s\"", dev->name); if (dev->phys) @@ -885,8 +900,8 @@ static int input_dev_uevent(struct class struct class input_class = { .name = "input", - .release = input_dev_release, - .uevent = input_dev_uevent, + .dev_release = input_dev_release, + .dev_uevent = input_dev_uevent, }; EXPORT_SYMBOL_GPL(input_class); @@ -905,8 +920,8 @@ struct input_dev *input_allocate_device( dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL); if (dev) { - dev->cdev.class = &input_class; - class_device_initialize(&dev->cdev); + device_initialize(&dev->d); + dev->d.class = &input_class; mutex_init(&dev->mutex); INIT_LIST_HEAD(&dev->h_list); INIT_LIST_HEAD(&dev->node); @@ -971,26 +986,27 @@ int input_register_device(struct input_d list_add_tail(&dev->node, &input_dev_list); - snprintf(dev->cdev.class_id, sizeof(dev->cdev.class_id), + dev->d.class = &input_class; + snprintf(dev->d.bus_id, sizeof(dev->d.bus_id), "input%ld", (unsigned long) atomic_inc_return(&input_no) - 1); - error = class_device_add(&dev->cdev); + error = device_add(&dev->d); if (error) return error; - error = sysfs_create_group(&dev->cdev.kobj, &input_dev_attr_group); + error = sysfs_create_group(&dev->d.kobj, &input_dev_attr_group); if (error) goto fail1; - error = sysfs_create_group(&dev->cdev.kobj, &input_dev_id_attr_group); + error = sysfs_create_group(&dev->d.kobj, &input_dev_id_attr_group); if (error) goto fail2; - error = sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group); + error = sysfs_create_group(&dev->d.kobj, &input_dev_caps_attr_group); if (error) goto fail3; - path = kobject_get_path(&dev->cdev.kobj, GFP_KERNEL); + path = kobject_get_path(&dev->d.kobj, GFP_KERNEL); printk(KERN_INFO "input: %s as %s\n", dev->name ? dev->name : "Unspecified device", path ? path : "N/A"); kfree(path); @@ -1008,9 +1024,9 @@ int input_register_device(struct input_d return 0; - fail3: sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); - fail2: sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group); - fail1: class_device_del(&dev->cdev); + fail3: sysfs_remove_group(&dev->d.kobj, &input_dev_id_attr_group); + fail2: sysfs_remove_group(&dev->d.kobj, &input_dev_attr_group); + fail1: device_del(&dev->d); return error; } EXPORT_SYMBOL(input_register_device); @@ -1036,11 +1052,11 @@ void input_unregister_device(struct inpu list_del_init(&dev->node); - sysfs_remove_group(&dev->cdev.kobj, &input_dev_caps_attr_group); - sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); - sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group); + sysfs_remove_group(&dev->d.kobj, &input_dev_caps_attr_group); + sysfs_remove_group(&dev->d.kobj, &input_dev_id_attr_group); + sysfs_remove_group(&dev->d.kobj, &input_dev_attr_group); - class_device_unregister(&dev->cdev); + device_unregister(&dev->d); input_wakeup_procfs_readers(); } --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c @@ -469,7 +469,6 @@ static struct input_handle *joydev_conne const struct input_device_id *id) { struct joydev *joydev; - struct class_device *cdev; int i, j, t, minor; for (minor = 0; minor < JOYDEV_MINORS && joydev_table[minor]; minor++); @@ -534,13 +533,9 @@ static struct input_handle *joydev_conne joydev_table[minor] = joydev; - cdev = class_device_create(&input_class, &dev->cdev, + device_create(&input_class, &dev->d, MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + minor), - dev->cdev.dev, joydev->name); - - /* temporary symlink to keep userspace happy */ - sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, - joydev->name); + joydev->name); return &joydev->handle; } @@ -550,8 +545,7 @@ static void joydev_disconnect(struct inp struct joydev *joydev = handle->private; struct joydev_list *list; - sysfs_remove_link(&input_class.subsys.kset.kobj, joydev->name); - class_device_destroy(&input_class, MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor)); + device_destroy(&input_class, MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor)); joydev->exist = 0; if (joydev->open) { --- a/drivers/input/joystick/a3d.c +++ b/drivers/input/joystick/a3d.c @@ -314,7 +314,7 @@ static int a3d_connect(struct gameport * input_dev->id.vendor = GAMEPORT_ID_VENDOR_MADCATZ; input_dev->id.product = a3d->mode; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &gameport->dev; + input_dev->d.parent = &gameport->dev; input_dev->private = a3d; input_dev->open = a3d_open; input_dev->close = a3d_close; --- a/drivers/input/joystick/adi.c +++ b/drivers/input/joystick/adi.c @@ -424,7 +424,7 @@ static int adi_init_input(struct adi *ad input_dev->id.vendor = GAMEPORT_ID_VENDOR_LOGITECH; input_dev->id.product = adi->id; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &port->gameport->dev; + input_dev->d.parent = &port->gameport->dev; input_dev->private = port; input_dev->open = adi_open; --- a/drivers/input/joystick/cobra.c +++ b/drivers/input/joystick/cobra.c @@ -211,7 +211,7 @@ static int cobra_connect(struct gameport input_dev->id.vendor = GAMEPORT_ID_VENDOR_CREATIVE; input_dev->id.product = 0x0008; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &gameport->dev; + input_dev->d.parent = &gameport->dev; input_dev->private = cobra; input_dev->open = cobra_open; --- a/drivers/input/joystick/gf2k.c +++ b/drivers/input/joystick/gf2k.c @@ -308,7 +308,7 @@ static int gf2k_connect(struct gameport input_dev->id.vendor = GAMEPORT_ID_VENDOR_GENIUS; input_dev->id.product = gf2k->id; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &gameport->dev; + input_dev->d.parent = &gameport->dev; input_dev->private = gf2k; input_dev->open = gf2k_open; --- a/drivers/input/joystick/grip.c +++ b/drivers/input/joystick/grip.c @@ -363,7 +363,7 @@ static int grip_connect(struct gameport input_dev->id.vendor = GAMEPORT_ID_VENDOR_GRAVIS; input_dev->id.product = grip->mode[i]; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &gameport->dev; + input_dev->d.parent = &gameport->dev; input_dev->private = grip; input_dev->open = grip_open; --- a/drivers/input/joystick/grip_mp.c +++ b/drivers/input/joystick/grip_mp.c @@ -599,7 +599,7 @@ static int register_slot(int slot, struc input_dev->id.vendor = GAMEPORT_ID_VENDOR_GRAVIS; input_dev->id.product = 0x0100 + port->mode; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &grip->gameport->dev; + input_dev->d.parent = &grip->gameport->dev; input_dev->private = grip; input_dev->open = grip_open; --- a/drivers/input/joystick/guillemot.c +++ b/drivers/input/joystick/guillemot.c @@ -231,7 +231,7 @@ static int guillemot_connect(struct game input_dev->id.vendor = GAMEPORT_ID_VENDOR_GUILLEMOT; input_dev->id.product = guillemot_type[i].id; input_dev->id.version = (int)data[14] << 8 | data[15]; - input_dev->cdev.dev = &gameport->dev; + input_dev->d.parent = &gameport->dev; input_dev->private = guillemot; input_dev->open = guillemot_open; --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c @@ -287,13 +287,13 @@ int iforce_init_device(struct iforce *if #ifdef CONFIG_JOYSTICK_IFORCE_USB case IFORCE_USB: input_dev->id.bustype = BUS_USB; - input_dev->cdev.dev = &iforce->usbdev->dev; + input_dev->d.parent = &iforce->usbdev->dev; break; #endif #ifdef CONFIG_JOYSTICK_IFORCE_232 case IFORCE_232: input_dev->id.bustype = BUS_RS232; - input_dev->cdev.dev = &iforce->serio->dev; + input_dev->d.parent = &iforce->serio->dev; break; #endif } --- a/drivers/input/joystick/magellan.c +++ b/drivers/input/joystick/magellan.c @@ -168,7 +168,7 @@ static int magellan_connect(struct serio input_dev->id.vendor = SERIO_MAGELLAN; input_dev->id.product = 0x0001; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &serio->dev; + input_dev->d.parent = &serio->dev; input_dev->private = magellan; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); --- a/drivers/input/joystick/sidewinder.c +++ b/drivers/input/joystick/sidewinder.c @@ -751,7 +751,7 @@ static int sw_connect(struct gameport *g input_dev->id.vendor = GAMEPORT_ID_VENDOR_MICROSOFT; input_dev->id.product = sw->type; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &gameport->dev; + input_dev->d.parent = &gameport->dev; input_dev->private = sw; input_dev->open = sw_open; --- a/drivers/input/joystick/spaceball.c +++ b/drivers/input/joystick/spaceball.c @@ -226,7 +226,7 @@ static int spaceball_connect(struct seri input_dev->id.vendor = SERIO_SPACEBALL; input_dev->id.product = id; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &serio->dev; + input_dev->d.parent = &serio->dev; input_dev->private = spaceball; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); --- a/drivers/input/joystick/spaceorb.c +++ b/drivers/input/joystick/spaceorb.c @@ -183,7 +183,7 @@ static int spaceorb_connect(struct serio input_dev->id.vendor = SERIO_SPACEORB; input_dev->id.product = 0x0001; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &serio->dev; + input_dev->d.parent = &serio->dev; input_dev->private = spaceorb; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); --- a/drivers/input/joystick/stinger.c +++ b/drivers/input/joystick/stinger.c @@ -154,7 +154,7 @@ static int stinger_connect(struct serio input_dev->id.vendor = SERIO_STINGER; input_dev->id.product = 0x0001; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &serio->dev; + input_dev->d.parent = &serio->dev; input_dev->private = stinger; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); --- a/drivers/input/joystick/tmdc.c +++ b/drivers/input/joystick/tmdc.c @@ -326,7 +326,7 @@ static int tmdc_setup_port(struct tmdc * input_dev->id.vendor = GAMEPORT_ID_VENDOR_THRUSTMASTER; input_dev->id.product = model->id; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &tmdc->gameport->dev; + input_dev->d.parent = &tmdc->gameport->dev; input_dev->private = tmdc; input_dev->open = tmdc_open; --- a/drivers/input/joystick/twidjoy.c +++ b/drivers/input/joystick/twidjoy.c @@ -205,7 +205,7 @@ static int twidjoy_connect(struct serio input_dev->id.vendor = SERIO_TWIDJOY; input_dev->id.product = 0x0001; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &serio->dev; + input_dev->d.parent = &serio->dev; input_dev->private = twidjoy; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); --- a/drivers/input/joystick/warrior.c +++ b/drivers/input/joystick/warrior.c @@ -160,7 +160,7 @@ static int warrior_connect(struct serio input_dev->id.vendor = SERIO_WARRIOR; input_dev->id.product = 0x0001; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &serio->dev; + input_dev->d.parent = &serio->dev; input_dev->private = warrior; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS); --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c @@ -884,7 +884,7 @@ static void atkbd_set_device_attrs(struc input_dev->id.version = atkbd->id; input_dev->event = atkbd_event; input_dev->private = atkbd; - input_dev->cdev.dev = &atkbd->ps2dev.serio->dev; + input_dev->d.parent = &atkbd->ps2dev.serio->dev; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_MSC); --- a/drivers/input/keyboard/corgikbd.c +++ b/drivers/input/keyboard/corgikbd.c @@ -323,7 +323,7 @@ static int __init corgikbd_probe(struct input_dev->id.vendor = 0x0001; input_dev->id.product = 0x0001; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &pdev->dev; + input_dev->d.parent = &pdev->dev; input_dev->private = corgikbd; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW); --- a/drivers/input/keyboard/lkkbd.c +++ b/drivers/input/keyboard/lkkbd.c @@ -666,7 +666,7 @@ lkkbd_connect (struct serio *serio, stru input_dev->id.vendor = SERIO_LKKBD; input_dev->id.product = 0; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &serio->dev; + input_dev->d.parent = &serio->dev; input_dev->event = lkkbd_event; input_dev->private = lk; --- a/drivers/input/keyboard/newtonkbd.c +++ b/drivers/input/keyboard/newtonkbd.c @@ -104,7 +104,7 @@ static int nkbd_connect(struct serio *se input_dev->id.vendor = SERIO_NEWTON; input_dev->id.product = 0x0001; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &serio->dev; + input_dev->d.parent = &serio->dev; input_dev->private = nkbd; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); --- a/drivers/input/keyboard/spitzkbd.c +++ b/drivers/input/keyboard/spitzkbd.c @@ -375,7 +375,7 @@ static int __init spitzkbd_probe(struct input_dev->private = spitzkbd; input_dev->name = "Spitz Keyboard"; input_dev->phys = spitzkbd->phys; - input_dev->cdev.dev = &dev->dev; + input_dev->d.parent = &dev->dev; input_dev->id.bustype = BUS_HOST; input_dev->id.vendor = 0x0001; --- a/drivers/input/keyboard/sunkbd.c +++ b/drivers/input/keyboard/sunkbd.c @@ -271,7 +271,7 @@ static int sunkbd_connect(struct serio * input_dev->id.vendor = SERIO_SUNKBD; input_dev->id.product = sunkbd->type; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &serio->dev; + input_dev->d.parent = &serio->dev; input_dev->private = sunkbd; input_dev->event = sunkbd_event; --- a/drivers/input/keyboard/xtkbd.c +++ b/drivers/input/keyboard/xtkbd.c @@ -108,7 +108,7 @@ static int xtkbd_connect(struct serio *s input_dev->id.vendor = 0x0001; input_dev->id.product = 0x0001; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &serio->dev; + input_dev->d.parent = &serio->dev; input_dev->private = xtkbd; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); --- a/drivers/input/misc/pcspkr.c +++ b/drivers/input/misc/pcspkr.c @@ -78,7 +78,7 @@ static int __devinit pcspkr_probe(struct pcspkr_dev->id.vendor = 0x001f; pcspkr_dev->id.product = 0x0001; pcspkr_dev->id.version = 0x0100; - pcspkr_dev->cdev.dev = &dev->dev; + pcspkr_dev->d.parent = &dev->dev; pcspkr_dev->evbit[0] = BIT(EV_SND); pcspkr_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c @@ -473,7 +473,7 @@ static int __devinit setup_input_dev(voi input_dev->name = "Wistron laptop buttons"; input_dev->phys = "wistron/input0"; input_dev->id.bustype = BUS_HOST; - input_dev->cdev.dev = &wistron_device->dev; + input_dev->d.parent = &wistron_device->dev; for (key = keymap; key->type != KE_END; key++) { if (key->type == KE_KEY) { --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -1063,7 +1063,7 @@ static int psmouse_switch_protocol(struc struct input_dev *input_dev = psmouse->dev; input_dev->private = psmouse; - input_dev->cdev.dev = &psmouse->ps2dev.serio->dev; + input_dev->d.parent = &psmouse->ps2dev.serio->dev; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); --- a/drivers/input/mouse/sermouse.c +++ b/drivers/input/mouse/sermouse.c @@ -258,7 +258,7 @@ static int sermouse_connect(struct serio input_dev->id.vendor = sermouse->type; input_dev->id.product = c; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &serio->dev; + input_dev->d.parent = &serio->dev; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT); --- a/drivers/input/mouse/vsxxxaa.c +++ b/drivers/input/mouse/vsxxxaa.c @@ -508,7 +508,7 @@ vsxxxaa_connect (struct serio *serio, st input_dev->name = mouse->name; input_dev->phys = mouse->phys; input_dev->id.bustype = BUS_RS232; - input_dev->cdev.dev = &serio->dev; + input_dev->d.parent = &serio->dev; input_dev->private = mouse; set_bit (EV_KEY, input_dev->evbit); /* We have buttons */ --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c @@ -628,7 +628,6 @@ static struct input_handle *mousedev_con const struct input_device_id *id) { struct mousedev *mousedev; - struct class_device *cdev; int minor = 0; for (minor = 0; minor < MOUSEDEV_MINORS && mousedev_table[minor]; minor++); @@ -656,13 +655,9 @@ static struct input_handle *mousedev_con mousedev_table[minor] = mousedev; - cdev = class_device_create(&input_class, &dev->cdev, + device_create(&input_class, &dev->d, MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + minor), - dev->cdev.dev, mousedev->name); - - /* temporary symlink to keep userspace happy */ - sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, - mousedev->name); + mousedev->name); return &mousedev->handle; } @@ -672,8 +667,7 @@ static void mousedev_disconnect(struct i struct mousedev *mousedev = handle->private; struct mousedev_list *list; - sysfs_remove_link(&input_class.subsys.kset.kobj, mousedev->name); - class_device_destroy(&input_class, + device_destroy(&input_class, MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor)); mousedev->exist = 0; @@ -738,7 +732,7 @@ static int psaux_registered; static int __init mousedev_init(void) { - struct class_device *cdev; + struct device *dev; int error; error = input_register_handler(&mousedev_handler); @@ -752,11 +746,11 @@ static int __init mousedev_init(void) mousedev_mix.exist = 1; mousedev_mix.minor = MOUSEDEV_MIX; - cdev = class_device_create(&input_class, NULL, - MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), NULL, "mice"); - if (IS_ERR(cdev)) { + dev = device_create(&input_class, NULL, + MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX), "mice"); + if (IS_ERR(dev)) { input_unregister_handler(&mousedev_handler); - return PTR_ERR(cdev); + return PTR_ERR(dev); } #ifdef CONFIG_INPUT_MOUSEDEV_PSAUX @@ -779,7 +773,7 @@ static void __exit mousedev_exit(void) if (psaux_registered) misc_deregister(&psaux_mouse); #endif - class_device_destroy(&input_class, + device_destroy(&input_class, MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + MOUSEDEV_MIX)); input_unregister_handler(&mousedev_handler); } --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -897,7 +897,7 @@ static int __devinit ads7846_probe(struc input_dev->name = "ADS784x Touchscreen"; input_dev->phys = ts->phys; - input_dev->cdev.dev = &spi->dev; + input_dev->d.parent = &spi->dev; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); --- a/drivers/input/touchscreen/corgi_ts.c +++ b/drivers/input/touchscreen/corgi_ts.c @@ -300,7 +300,7 @@ static int __init corgits_probe(struct p input_dev->id.vendor = 0x0001; input_dev->id.product = 0x0002; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &pdev->dev; + input_dev->d.parent = &pdev->dev; input_dev->private = corgi_ts; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); --- a/drivers/input/touchscreen/elo.c +++ b/drivers/input/touchscreen/elo.c @@ -319,7 +319,7 @@ static int elo_connect(struct serio *ser input_dev->id.vendor = SERIO_ELO; input_dev->id.product = elo->id; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &serio->dev; + input_dev->d.parent = &serio->dev; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); --- a/drivers/input/touchscreen/h3600_ts_input.c +++ b/drivers/input/touchscreen/h3600_ts_input.c @@ -367,7 +367,7 @@ static int h3600ts_connect(struct serio input_dev->id.vendor = SERIO_H3600; input_dev->id.product = 0x0666; /* FIXME !!! We can ask the hardware */ input_dev->id.version = 0x0100; - input_dev->cdev.dev = &serio->dev; + input_dev->d.parent = &serio->dev; input_dev->private = ts; input_dev->event = h3600ts_event; --- a/drivers/input/touchscreen/penmount.c +++ b/drivers/input/touchscreen/penmount.c @@ -112,7 +112,7 @@ static int pm_connect(struct serio *seri input_dev->id.vendor = SERIO_PENMOUNT; input_dev->id.product = 0; input_dev->id.version = 0x0100; - input_dev->cdev.dev = &serio->dev; + input_dev->d.parent = &serio->dev; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); --- a/drivers/input/tsdev.c +++ b/drivers/input/tsdev.c @@ -375,7 +375,6 @@ static struct input_handle *tsdev_connec const struct input_device_id *id) { struct tsdev *tsdev; - struct class_device *cdev; int minor, delta; for (minor = 0; minor < TSDEV_MINORS / 2 && tsdev_table[minor]; minor++); @@ -415,13 +414,9 @@ static struct input_handle *tsdev_connec tsdev_table[minor] = tsdev; - cdev = class_device_create(&input_class, &dev->cdev, + device_create(&input_class, &dev->d, MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor), - dev->cdev.dev, tsdev->name); - - /* temporary symlink to keep userspace happy */ - sysfs_create_link(&input_class.subsys.kset.kobj, &cdev->kobj, - tsdev->name); + tsdev->name); return &tsdev->handle; } @@ -431,8 +426,7 @@ static void tsdev_disconnect(struct inpu struct tsdev *tsdev = handle->private; struct tsdev_list *list; - sysfs_remove_link(&input_class.subsys.kset.kobj, tsdev->name); - class_device_destroy(&input_class, + device_destroy(&input_class, MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor)); tsdev->exist = 0; --- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c @@ -112,7 +112,7 @@ int dvb_usb_remote_init(struct dvb_usb_d input_dev->name = "IR-receiver inside an USB DVB receiver"; input_dev->phys = d->rc_phys; usb_to_input_id(d->udev, &input_dev->id); - input_dev->cdev.dev = &d->udev->dev; + input_dev->d.parent = &d->udev->dev; /* set the bits for the keys */ deb_rc("key map size: %d\n", d->props.rc_key_map_size); --- a/drivers/media/video/bt8xx/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c @@ -313,7 +313,7 @@ int bttv_input_init(struct bttv *btv) input_dev->id.vendor = btv->c.pci->vendor; input_dev->id.product = btv->c.pci->device; } - input_dev->cdev.dev = &btv->c.pci->dev; + input_dev->d.parent = &btv->c.pci->dev; btv->remote = ir; bttv_ir_start(btv, ir); --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -328,7 +328,7 @@ int cx88_ir_init(struct cx88_core *core, input_dev->id.vendor = pci->vendor; input_dev->id.product = pci->device; } - input_dev->cdev.dev = &pci->dev; + input_dev->d.parent = &pci->dev; /* record handles to ourself */ ir->core = core; core->ir = ir; --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -373,7 +373,7 @@ int saa7134_input_init1(struct saa7134_d input_dev->id.vendor = dev->pci->vendor; input_dev->id.product = dev->pci->device; } - input_dev->cdev.dev = &dev->pci->dev; + input_dev->d.parent = &dev->pci->dev; dev->remote = ir; saa7134_ir_start(dev, ir); --- a/drivers/media/video/usbvideo/konicawc.c +++ b/drivers/media/video/usbvideo/konicawc.c @@ -236,7 +236,7 @@ static void konicawc_register_input(stru input_dev->name = "Konicawc snapshot button"; input_dev->phys = cam->input_physname; usb_to_input_id(dev, &input_dev->id); - input_dev->cdev.dev = &dev->dev; + input_dev->d.parent = &dev->dev; input_dev->evbit[0] = BIT(EV_KEY); input_dev->keybit[LONG(BTN_0)] = BIT(BTN_0); --- a/drivers/media/video/usbvideo/quickcam_messenger.c +++ b/drivers/media/video/usbvideo/quickcam_messenger.c @@ -100,7 +100,7 @@ static void qcm_register_input(struct qc input_dev->name = "QCM button"; input_dev->phys = cam->input_physname; usb_to_input_id(dev, &input_dev->id); - input_dev->cdev.dev = &dev->dev; + input_dev->d.parent = &dev->dev; input_dev->evbit[0] = BIT(EV_KEY); input_dev->keybit[LONG(BTN_0)] = BIT(BTN_0); --- a/drivers/usb/input/acecad.c +++ b/drivers/usb/input/acecad.c @@ -178,7 +178,7 @@ static int usb_acecad_probe(struct usb_i input_dev->name = acecad->name; input_dev->phys = acecad->phys; usb_to_input_id(dev, &input_dev->id); - input_dev->cdev.dev = &intf->dev; + input_dev->d.parent = &intf->dev; input_dev->private = acecad; input_dev->open = usb_acecad_open; --- a/drivers/usb/input/aiptek.c +++ b/drivers/usb/input/aiptek.c @@ -2043,7 +2043,7 @@ aiptek_probe(struct usb_interface *intf, inputdev->name = "Aiptek"; inputdev->phys = aiptek->features.usbPath; usb_to_input_id(usbdev, &inputdev->id); - inputdev->cdev.dev = &intf->dev; + inputdev->d.parent = &intf->dev; inputdev->private = aiptek; inputdev->open = aiptek_open; inputdev->close = aiptek_close; --- a/drivers/usb/input/appletouch.c +++ b/drivers/usb/input/appletouch.c @@ -589,7 +589,7 @@ static int atp_probe(struct usb_interfac input_dev->name = "appletouch"; input_dev->phys = dev->phys; usb_to_input_id(dev->udev, &input_dev->id); - input_dev->cdev.dev = &iface->dev; + input_dev->d.parent = &iface->dev; input_dev->private = dev; input_dev->open = atp_open; --- a/drivers/usb/input/ati_remote.c +++ b/drivers/usb/input/ati_remote.c @@ -661,7 +661,7 @@ static void ati_remote_input_init(struct idev->phys = ati_remote->phys; usb_to_input_id(ati_remote->udev, &idev->id); - idev->cdev.dev = &ati_remote->udev->dev; + idev->d.parent = &ati_remote->udev->dev; } static int ati_remote_initialize(struct ati_remote *ati_remote) --- a/drivers/usb/input/ati_remote2.c +++ b/drivers/usb/input/ati_remote2.c @@ -330,7 +330,7 @@ static int ati_remote2_input_init(struct idev->phys = ar2->phys; usb_to_input_id(ar2->udev, &idev->id); - idev->cdev.dev = &ar2->udev->dev; + idev->d.parent = &ar2->udev->dev; i = input_register_device(idev); if (i) --- a/drivers/usb/input/gtco.c +++ b/drivers/usb/input/gtco.c @@ -1007,7 +1007,7 @@ static int gtco_probe(struct usb_interfa /* Set input device required ID information */ usb_to_input_id(device->usbdev, &device->inputdevice->id); - inputdev->cdev.dev = &usbinterface->dev; + inputdev->d.parent = &usbinterface->dev; /* Setup the URB, it will be posted later on open of input device */ endpoint = &usbinterface->altsetting[0].endpoint[0].desc; --- a/drivers/usb/input/itmtouch.c +++ b/drivers/usb/input/itmtouch.c @@ -186,7 +186,7 @@ static int itmtouch_probe(struct usb_int input_dev->name = itmtouch->name; input_dev->phys = itmtouch->phys; usb_to_input_id(udev, &input_dev->id); - input_dev->cdev.dev = &intf->dev; + input_dev->d.parent = &intf->dev; input_dev->private = itmtouch; input_dev->open = itmtouch_open; --- a/drivers/usb/input/kbtab.c +++ b/drivers/usb/input/kbtab.c @@ -145,7 +145,7 @@ static int kbtab_probe(struct usb_interf input_dev->name = "KB Gear Tablet"; input_dev->phys = kbtab->phys; usb_to_input_id(dev, &input_dev->id); - input_dev->cdev.dev = &intf->dev; + input_dev->d.parent = &intf->dev; input_dev->private = kbtab; input_dev->open = kbtab_open; --- a/drivers/usb/input/keyspan_remote.c +++ b/drivers/usb/input/keyspan_remote.c @@ -495,7 +495,7 @@ static int keyspan_probe(struct usb_inte input_dev->name = remote->name; input_dev->phys = remote->phys; usb_to_input_id(udev, &input_dev->id); - input_dev->cdev.dev = &interface->dev; + input_dev->d.parent = &interface->dev; input_dev->evbit[0] = BIT(EV_KEY); /* We will only report KEY events. */ for (i = 0; i < ARRAY_SIZE(keyspan_key_table); i++) --- a/drivers/usb/input/mtouchusb.c +++ b/drivers/usb/input/mtouchusb.c @@ -233,7 +233,7 @@ static int mtouchusb_probe(struct usb_in input_dev->name = mtouch->name; input_dev->phys = mtouch->phys; usb_to_input_id(udev, &input_dev->id); - input_dev->cdev.dev = &intf->dev; + input_dev->d.parent = &intf->dev; input_dev->private = mtouch; input_dev->open = mtouchusb_open; --- a/drivers/usb/input/powermate.c +++ b/drivers/usb/input/powermate.c @@ -359,7 +359,7 @@ static int powermate_probe(struct usb_in input_dev->phys = pm->phys; usb_to_input_id(udev, &input_dev->id); - input_dev->cdev.dev = &intf->dev; + input_dev->d.parent = &intf->dev; input_dev->private = pm; input_dev->event = powermate_input_event; --- a/drivers/usb/input/touchkitusb.c +++ b/drivers/usb/input/touchkitusb.c @@ -314,7 +314,7 @@ static int touchkit_probe(struct usb_int input_dev->name = touchkit->name; input_dev->phys = touchkit->phys; usb_to_input_id(udev, &input_dev->id); - input_dev->cdev.dev = &intf->dev; + input_dev->d.parent = &intf->dev; input_dev->private = touchkit; input_dev->open = touchkit_open; input_dev->close = touchkit_close; --- a/drivers/usb/input/usbkbd.c +++ b/drivers/usb/input/usbkbd.c @@ -273,7 +273,7 @@ static int usb_kbd_probe(struct usb_inte input_dev->name = kbd->name; input_dev->phys = kbd->phys; usb_to_input_id(dev, &input_dev->id); - input_dev->cdev.dev = &iface->dev; + input_dev->d.parent = &iface->dev; input_dev->private = kbd; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP); --- a/drivers/usb/input/usbmouse.c +++ b/drivers/usb/input/usbmouse.c @@ -170,7 +170,7 @@ static int usb_mouse_probe(struct usb_in input_dev->name = mouse->name; input_dev->phys = mouse->phys; usb_to_input_id(dev, &input_dev->id); - input_dev->cdev.dev = &intf->dev; + input_dev->d.parent = &intf->dev; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); --- a/drivers/usb/input/usbtouchscreen.c +++ b/drivers/usb/input/usbtouchscreen.c @@ -740,7 +740,7 @@ static int usbtouch_probe(struct usb_int input_dev->name = usbtouch->name; input_dev->phys = usbtouch->phys; usb_to_input_id(udev, &input_dev->id); - input_dev->cdev.dev = &intf->dev; + input_dev->d.parent = &intf->dev; input_dev->private = usbtouch; input_dev->open = usbtouch_open; input_dev->close = usbtouch_close; --- a/drivers/usb/input/wacom_sys.c +++ b/drivers/usb/input/wacom_sys.c @@ -229,7 +229,7 @@ static int wacom_probe(struct usb_interf wacom->wacom_wac = wacom_wac; usb_to_input_id(dev, &input_dev->id); - input_dev->cdev.dev = &intf->dev; + input_dev->d.parent = &intf->dev; input_dev->private = wacom; input_dev->open = wacom_open; input_dev->close = wacom_close; --- a/drivers/usb/input/xpad.c +++ b/drivers/usb/input/xpad.c @@ -344,7 +344,7 @@ static int xpad_probe(struct usb_interfa input_dev->name = xpad_device[i].name; input_dev->phys = xpad->phys; usb_to_input_id(udev, &input_dev->id); - input_dev->cdev.dev = &intf->dev; + input_dev->d.parent = &intf->dev; input_dev->private = xpad; input_dev->open = xpad_open; input_dev->close = xpad_close; --- a/drivers/usb/input/yealink.c +++ b/drivers/usb/input/yealink.c @@ -937,7 +937,7 @@ static int usb_probe(struct usb_interfac input_dev->name = nfo->name; input_dev->phys = yld->phys; usb_to_input_id(udev, &input_dev->id); - input_dev->cdev.dev = &intf->dev; + input_dev->d.parent = &intf->dev; input_dev->private = yld; input_dev->open = input_open; --- a/include/linux/input.h +++ b/include/linux/input.h @@ -995,12 +995,12 @@ struct input_dev { struct mutex mutex; /* serializes open and close operations */ unsigned int users; - struct class_device cdev; + struct device d; struct list_head h_list; struct list_head node; }; -#define to_input_dev(d) container_of(d, struct input_dev, cdev) +#define to_input_dev(dev) container_of(dev, struct input_dev, d) /* * Verify that we are in sync with input_device_id mod_devicetable.h #defines @@ -1113,12 +1113,12 @@ void input_free_device(struct input_dev static inline struct input_dev *input_get_device(struct input_dev *dev) { - return to_input_dev(class_device_get(&dev->cdev)); + return to_input_dev(get_device(&dev->d)); } static inline void input_put_device(struct input_dev *dev) { - class_device_put(&dev->cdev); + put_device(&dev->d); } int input_register_device(struct input_dev *); --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -663,7 +663,7 @@ static inline void hidp_setup_input(stru input->relbit[0] |= BIT(REL_WHEEL); } - input->cdev.dev = hidp_get_device(session); + input->d.parent = hidp_get_device(session); input->event = hidp_input_event;