aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeliang Tang <geliangtang@163.com>2015-12-27 04:25:21 -0500
committerJiri Kosina <jkosina@suse.cz>2015-12-28 07:41:44 -0500
commitee79a8f840a45d331bc33e55cbcc89bba417671c (patch)
tree9dc3d0fd485715c63999d0aaf339c2a7d26dce3f
parentd8ce9bf5551bfea431893bdd0a943f24a5170828 (diff)
HID: use to_hid_device()
Use to_hid_device() instead of container_of(). Signed-off-by: Geliang Tang <geliangtang@163.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-core.c14
-rw-r--r--drivers/hid/hid-cp2112.c8
-rw-r--r--drivers/hid/hid-gt683r.c8
-rw-r--r--drivers/hid/hid-lenovo.c36
-rw-r--r--drivers/hid/hid-lg4ff.c4
-rw-r--r--drivers/hid/hid-multitouch.c4
-rw-r--r--drivers/hid/hid-ntrig.c32
-rw-r--r--drivers/hid/hid-picolcd_leds.c4
-rw-r--r--drivers/hid/hid-prodikeys.c12
-rw-r--r--drivers/hid/hid-sony.c6
-rw-r--r--drivers/hid/hid-steelseries.c8
-rw-r--r--drivers/hid/hid-wiimote.h3
-rw-r--r--drivers/hid/wacom_sys.c16
13 files changed, 76 insertions, 79 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 190260c52adc..a6e24e00a37b 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -625,7 +625,7 @@ static void hid_close_report(struct hid_device *device)
625 625
626static void hid_device_release(struct device *dev) 626static void hid_device_release(struct device *dev)
627{ 627{
628 struct hid_device *hid = container_of(dev, struct hid_device, dev); 628 struct hid_device *hid = to_hid_device(dev);
629 629
630 hid_close_report(hid); 630 hid_close_report(hid);
631 kfree(hid->dev_rdesc); 631 kfree(hid->dev_rdesc);
@@ -1572,7 +1572,7 @@ read_report_descriptor(struct file *filp, struct kobject *kobj,
1572 char *buf, loff_t off, size_t count) 1572 char *buf, loff_t off, size_t count)
1573{ 1573{
1574 struct device *dev = container_of(kobj, struct device, kobj); 1574 struct device *dev = container_of(kobj, struct device, kobj);
1575 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1575 struct hid_device *hdev = to_hid_device(dev);
1576 1576
1577 if (off >= hdev->rsize) 1577 if (off >= hdev->rsize)
1578 return 0; 1578 return 0;
@@ -1589,7 +1589,7 @@ static ssize_t
1589show_country(struct device *dev, struct device_attribute *attr, 1589show_country(struct device *dev, struct device_attribute *attr,
1590 char *buf) 1590 char *buf)
1591{ 1591{
1592 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1592 struct hid_device *hdev = to_hid_device(dev);
1593 1593
1594 return sprintf(buf, "%02x\n", hdev->country & 0xff); 1594 return sprintf(buf, "%02x\n", hdev->country & 0xff);
1595} 1595}
@@ -2140,7 +2140,7 @@ static const struct hid_device_id *hid_match_device(struct hid_device *hdev,
2140static int hid_bus_match(struct device *dev, struct device_driver *drv) 2140static int hid_bus_match(struct device *dev, struct device_driver *drv)
2141{ 2141{
2142 struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); 2142 struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver);
2143 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 2143 struct hid_device *hdev = to_hid_device(dev);
2144 2144
2145 return hid_match_device(hdev, hdrv) != NULL; 2145 return hid_match_device(hdev, hdrv) != NULL;
2146} 2146}
@@ -2149,7 +2149,7 @@ static int hid_device_probe(struct device *dev)
2149{ 2149{
2150 struct hid_driver *hdrv = container_of(dev->driver, 2150 struct hid_driver *hdrv = container_of(dev->driver,
2151 struct hid_driver, driver); 2151 struct hid_driver, driver);
2152 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 2152 struct hid_device *hdev = to_hid_device(dev);
2153 const struct hid_device_id *id; 2153 const struct hid_device_id *id;
2154 int ret = 0; 2154 int ret = 0;
2155 2155
@@ -2191,7 +2191,7 @@ unlock_driver_lock:
2191 2191
2192static int hid_device_remove(struct device *dev) 2192static int hid_device_remove(struct device *dev)
2193{ 2193{
2194 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 2194 struct hid_device *hdev = to_hid_device(dev);
2195 struct hid_driver *hdrv; 2195 struct hid_driver *hdrv;
2196 int ret = 0; 2196 int ret = 0;
2197 2197
@@ -2241,7 +2241,7 @@ ATTRIBUTE_GROUPS(hid_dev);
2241 2241
2242static int hid_uevent(struct device *dev, struct kobj_uevent_env *env) 2242static int hid_uevent(struct device *dev, struct kobj_uevent_env *env)
2243{ 2243{
2244 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 2244 struct hid_device *hdev = to_hid_device(dev);
2245 2245
2246 if (add_uevent_var(env, "HID_ID=%04X:%08X:%08X", 2246 if (add_uevent_var(env, "HID_ID=%04X:%08X:%08X",
2247 hdev->bus, hdev->vendor, hdev->product)) 2247 hdev->bus, hdev->vendor, hdev->product))
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
index 7afc3fcc122c..7c38bfa05fac 100644
--- a/drivers/hid/hid-cp2112.c
+++ b/drivers/hid/hid-cp2112.c
@@ -807,7 +807,7 @@ static ssize_t name##_store(struct device *kdev, \
807 struct device_attribute *attr, const char *buf, \ 807 struct device_attribute *attr, const char *buf, \
808 size_t count) \ 808 size_t count) \
809{ \ 809{ \
810 struct hid_device *hdev = container_of(kdev, struct hid_device, dev); \ 810 struct hid_device *hdev = to_hid_device(kdev); \
811 struct cp2112_usb_config_report cfg; \ 811 struct cp2112_usb_config_report cfg; \
812 int ret = cp2112_get_usb_config(hdev, &cfg); \ 812 int ret = cp2112_get_usb_config(hdev, &cfg); \
813 if (ret) \ 813 if (ret) \
@@ -822,7 +822,7 @@ static ssize_t name##_store(struct device *kdev, \
822static ssize_t name##_show(struct device *kdev, \ 822static ssize_t name##_show(struct device *kdev, \
823 struct device_attribute *attr, char *buf) \ 823 struct device_attribute *attr, char *buf) \
824{ \ 824{ \
825 struct hid_device *hdev = container_of(kdev, struct hid_device, dev); \ 825 struct hid_device *hdev = to_hid_device(kdev); \
826 struct cp2112_usb_config_report cfg; \ 826 struct cp2112_usb_config_report cfg; \
827 int ret = cp2112_get_usb_config(hdev, &cfg); \ 827 int ret = cp2112_get_usb_config(hdev, &cfg); \
828 if (ret) \ 828 if (ret) \
@@ -887,7 +887,7 @@ static ssize_t pstr_store(struct device *kdev,
887 struct device_attribute *kattr, const char *buf, 887 struct device_attribute *kattr, const char *buf,
888 size_t count) 888 size_t count)
889{ 889{
890 struct hid_device *hdev = container_of(kdev, struct hid_device, dev); 890 struct hid_device *hdev = to_hid_device(kdev);
891 struct cp2112_pstring_attribute *attr = 891 struct cp2112_pstring_attribute *attr =
892 container_of(kattr, struct cp2112_pstring_attribute, attr); 892 container_of(kattr, struct cp2112_pstring_attribute, attr);
893 struct cp2112_string_report report; 893 struct cp2112_string_report report;
@@ -918,7 +918,7 @@ static ssize_t pstr_store(struct device *kdev,
918static ssize_t pstr_show(struct device *kdev, 918static ssize_t pstr_show(struct device *kdev,
919 struct device_attribute *kattr, char *buf) 919 struct device_attribute *kattr, char *buf)
920{ 920{
921 struct hid_device *hdev = container_of(kdev, struct hid_device, dev); 921 struct hid_device *hdev = to_hid_device(kdev);
922 struct cp2112_pstring_attribute *attr = 922 struct cp2112_pstring_attribute *attr =
923 container_of(kattr, struct cp2112_pstring_attribute, attr); 923 container_of(kattr, struct cp2112_pstring_attribute, attr);
924 struct cp2112_string_report report; 924 struct cp2112_string_report report;
diff --git a/drivers/hid/hid-gt683r.c b/drivers/hid/hid-gt683r.c
index 0d6f135e266c..a298fbd8db6b 100644
--- a/drivers/hid/hid-gt683r.c
+++ b/drivers/hid/hid-gt683r.c
@@ -70,7 +70,7 @@ static void gt683r_brightness_set(struct led_classdev *led_cdev,
70{ 70{
71 int i; 71 int i;
72 struct device *dev = led_cdev->dev->parent; 72 struct device *dev = led_cdev->dev->parent;
73 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 73 struct hid_device *hdev = to_hid_device(dev);
74 struct gt683r_led *led = hid_get_drvdata(hdev); 74 struct gt683r_led *led = hid_get_drvdata(hdev);
75 75
76 for (i = 0; i < GT683R_LED_COUNT; i++) { 76 for (i = 0; i < GT683R_LED_COUNT; i++) {
@@ -89,8 +89,7 @@ static ssize_t mode_show(struct device *dev,
89 char *buf) 89 char *buf)
90{ 90{
91 u8 sysfs_mode; 91 u8 sysfs_mode;
92 struct hid_device *hdev = container_of(dev->parent, 92 struct hid_device *hdev = to_hid_device(dev->parent);
93 struct hid_device, dev);
94 struct gt683r_led *led = hid_get_drvdata(hdev); 93 struct gt683r_led *led = hid_get_drvdata(hdev);
95 94
96 if (led->mode == GT683R_LED_NORMAL) 95 if (led->mode == GT683R_LED_NORMAL)
@@ -108,8 +107,7 @@ static ssize_t mode_store(struct device *dev,
108 const char *buf, size_t count) 107 const char *buf, size_t count)
109{ 108{
110 u8 sysfs_mode; 109 u8 sysfs_mode;
111 struct hid_device *hdev = container_of(dev->parent, 110 struct hid_device *hdev = to_hid_device(dev->parent);
112 struct hid_device, dev);
113 struct gt683r_led *led = hid_get_drvdata(hdev); 111 struct gt683r_led *led = hid_get_drvdata(hdev);
114 112
115 113
diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index 8979f1fd5208..0125e356bd8d 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -220,7 +220,7 @@ static ssize_t attr_fn_lock_show_cptkbd(struct device *dev,
220 struct device_attribute *attr, 220 struct device_attribute *attr,
221 char *buf) 221 char *buf)
222{ 222{
223 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 223 struct hid_device *hdev = to_hid_device(dev);
224 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); 224 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev);
225 225
226 return snprintf(buf, PAGE_SIZE, "%u\n", cptkbd_data->fn_lock); 226 return snprintf(buf, PAGE_SIZE, "%u\n", cptkbd_data->fn_lock);
@@ -231,7 +231,7 @@ static ssize_t attr_fn_lock_store_cptkbd(struct device *dev,
231 const char *buf, 231 const char *buf,
232 size_t count) 232 size_t count)
233{ 233{
234 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 234 struct hid_device *hdev = to_hid_device(dev);
235 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); 235 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev);
236 int value; 236 int value;
237 237
@@ -250,7 +250,7 @@ static ssize_t attr_sensitivity_show_cptkbd(struct device *dev,
250 struct device_attribute *attr, 250 struct device_attribute *attr,
251 char *buf) 251 char *buf)
252{ 252{
253 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 253 struct hid_device *hdev = to_hid_device(dev);
254 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); 254 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev);
255 255
256 return snprintf(buf, PAGE_SIZE, "%u\n", 256 return snprintf(buf, PAGE_SIZE, "%u\n",
@@ -262,7 +262,7 @@ static ssize_t attr_sensitivity_store_cptkbd(struct device *dev,
262 const char *buf, 262 const char *buf,
263 size_t count) 263 size_t count)
264{ 264{
265 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 265 struct hid_device *hdev = to_hid_device(dev);
266 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); 266 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev);
267 int value; 267 int value;
268 268
@@ -387,7 +387,7 @@ static ssize_t attr_press_to_select_show_tpkbd(struct device *dev,
387 struct device_attribute *attr, 387 struct device_attribute *attr,
388 char *buf) 388 char *buf)
389{ 389{
390 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 390 struct hid_device *hdev = to_hid_device(dev);
391 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 391 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev);
392 392
393 return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->press_to_select); 393 return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->press_to_select);
@@ -398,7 +398,7 @@ static ssize_t attr_press_to_select_store_tpkbd(struct device *dev,
398 const char *buf, 398 const char *buf,
399 size_t count) 399 size_t count)
400{ 400{
401 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 401 struct hid_device *hdev = to_hid_device(dev);
402 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 402 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev);
403 int value; 403 int value;
404 404
@@ -417,7 +417,7 @@ static ssize_t attr_dragging_show_tpkbd(struct device *dev,
417 struct device_attribute *attr, 417 struct device_attribute *attr,
418 char *buf) 418 char *buf)
419{ 419{
420 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 420 struct hid_device *hdev = to_hid_device(dev);
421 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 421 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev);
422 422
423 return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->dragging); 423 return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->dragging);
@@ -428,7 +428,7 @@ static ssize_t attr_dragging_store_tpkbd(struct device *dev,
428 const char *buf, 428 const char *buf,
429 size_t count) 429 size_t count)
430{ 430{
431 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 431 struct hid_device *hdev = to_hid_device(dev);
432 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 432 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev);
433 int value; 433 int value;
434 434
@@ -447,7 +447,7 @@ static ssize_t attr_release_to_select_show_tpkbd(struct device *dev,
447 struct device_attribute *attr, 447 struct device_attribute *attr,
448 char *buf) 448 char *buf)
449{ 449{
450 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 450 struct hid_device *hdev = to_hid_device(dev);
451 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 451 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev);
452 452
453 return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->release_to_select); 453 return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->release_to_select);
@@ -458,7 +458,7 @@ static ssize_t attr_release_to_select_store_tpkbd(struct device *dev,
458 const char *buf, 458 const char *buf,
459 size_t count) 459 size_t count)
460{ 460{
461 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 461 struct hid_device *hdev = to_hid_device(dev);
462 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 462 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev);
463 int value; 463 int value;
464 464
@@ -477,7 +477,7 @@ static ssize_t attr_select_right_show_tpkbd(struct device *dev,
477 struct device_attribute *attr, 477 struct device_attribute *attr,
478 char *buf) 478 char *buf)
479{ 479{
480 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 480 struct hid_device *hdev = to_hid_device(dev);
481 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 481 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev);
482 482
483 return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->select_right); 483 return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->select_right);
@@ -488,7 +488,7 @@ static ssize_t attr_select_right_store_tpkbd(struct device *dev,
488 const char *buf, 488 const char *buf,
489 size_t count) 489 size_t count)
490{ 490{
491 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 491 struct hid_device *hdev = to_hid_device(dev);
492 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 492 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev);
493 int value; 493 int value;
494 494
@@ -507,7 +507,7 @@ static ssize_t attr_sensitivity_show_tpkbd(struct device *dev,
507 struct device_attribute *attr, 507 struct device_attribute *attr,
508 char *buf) 508 char *buf)
509{ 509{
510 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 510 struct hid_device *hdev = to_hid_device(dev);
511 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 511 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev);
512 512
513 return snprintf(buf, PAGE_SIZE, "%u\n", 513 return snprintf(buf, PAGE_SIZE, "%u\n",
@@ -519,7 +519,7 @@ static ssize_t attr_sensitivity_store_tpkbd(struct device *dev,
519 const char *buf, 519 const char *buf,
520 size_t count) 520 size_t count)
521{ 521{
522 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 522 struct hid_device *hdev = to_hid_device(dev);
523 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 523 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev);
524 int value; 524 int value;
525 525
@@ -536,7 +536,7 @@ static ssize_t attr_press_speed_show_tpkbd(struct device *dev,
536 struct device_attribute *attr, 536 struct device_attribute *attr,
537 char *buf) 537 char *buf)
538{ 538{
539 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 539 struct hid_device *hdev = to_hid_device(dev);
540 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 540 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev);
541 541
542 return snprintf(buf, PAGE_SIZE, "%u\n", 542 return snprintf(buf, PAGE_SIZE, "%u\n",
@@ -548,7 +548,7 @@ static ssize_t attr_press_speed_store_tpkbd(struct device *dev,
548 const char *buf, 548 const char *buf,
549 size_t count) 549 size_t count)
550{ 550{
551 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 551 struct hid_device *hdev = to_hid_device(dev);
552 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 552 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev);
553 int value; 553 int value;
554 554
@@ -609,7 +609,7 @@ static enum led_brightness lenovo_led_brightness_get_tpkbd(
609 struct led_classdev *led_cdev) 609 struct led_classdev *led_cdev)
610{ 610{
611 struct device *dev = led_cdev->dev->parent; 611 struct device *dev = led_cdev->dev->parent;
612 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 612 struct hid_device *hdev = to_hid_device(dev);
613 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 613 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev);
614 int led_nr = 0; 614 int led_nr = 0;
615 615
@@ -625,7 +625,7 @@ static void lenovo_led_brightness_set_tpkbd(struct led_classdev *led_cdev,
625 enum led_brightness value) 625 enum led_brightness value)
626{ 626{
627 struct device *dev = led_cdev->dev->parent; 627 struct device *dev = led_cdev->dev->parent;
628 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 628 struct hid_device *hdev = to_hid_device(dev);
629 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 629 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev);
630 struct hid_report *report; 630 struct hid_report *report;
631 int led_nr = 0; 631 int led_nr = 0;
diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index 3e160ff5f218..af3a8ec8a746 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -1018,7 +1018,7 @@ static void lg4ff_led_set_brightness(struct led_classdev *led_cdev,
1018 enum led_brightness value) 1018 enum led_brightness value)
1019{ 1019{
1020 struct device *dev = led_cdev->dev->parent; 1020 struct device *dev = led_cdev->dev->parent;
1021 struct hid_device *hid = container_of(dev, struct hid_device, dev); 1021 struct hid_device *hid = to_hid_device(dev);
1022 struct lg_drv_data *drv_data = hid_get_drvdata(hid); 1022 struct lg_drv_data *drv_data = hid_get_drvdata(hid);
1023 struct lg4ff_device_entry *entry; 1023 struct lg4ff_device_entry *entry;
1024 int i, state = 0; 1024 int i, state = 0;
@@ -1053,7 +1053,7 @@ static void lg4ff_led_set_brightness(struct led_classdev *led_cdev,
1053static enum led_brightness lg4ff_led_get_brightness(struct led_classdev *led_cdev) 1053static enum led_brightness lg4ff_led_get_brightness(struct led_classdev *led_cdev)
1054{ 1054{
1055 struct device *dev = led_cdev->dev->parent; 1055 struct device *dev = led_cdev->dev->parent;
1056 struct hid_device *hid = container_of(dev, struct hid_device, dev); 1056 struct hid_device *hid = to_hid_device(dev);
1057 struct lg_drv_data *drv_data = hid_get_drvdata(hid); 1057 struct lg_drv_data *drv_data = hid_get_drvdata(hid);
1058 struct lg4ff_device_entry *entry; 1058 struct lg4ff_device_entry *entry;
1059 int i, value = 0; 1059 int i, value = 0;
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 3d664d01305e..96cf7512c338 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -272,7 +272,7 @@ static ssize_t mt_show_quirks(struct device *dev,
272 struct device_attribute *attr, 272 struct device_attribute *attr,
273 char *buf) 273 char *buf)
274{ 274{
275 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 275 struct hid_device *hdev = to_hid_device(dev);
276 struct mt_device *td = hid_get_drvdata(hdev); 276 struct mt_device *td = hid_get_drvdata(hdev);
277 277
278 return sprintf(buf, "%u\n", td->mtclass.quirks); 278 return sprintf(buf, "%u\n", td->mtclass.quirks);
@@ -282,7 +282,7 @@ static ssize_t mt_set_quirks(struct device *dev,
282 struct device_attribute *attr, 282 struct device_attribute *attr,
283 const char *buf, size_t count) 283 const char *buf, size_t count)
284{ 284{
285 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 285 struct hid_device *hdev = to_hid_device(dev);
286 struct mt_device *td = hid_get_drvdata(hdev); 286 struct mt_device *td = hid_get_drvdata(hdev);
287 287
288 unsigned long val; 288 unsigned long val;
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 756d1ef9bd99..1b0084d4af2e 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -173,7 +173,7 @@ static ssize_t show_phys_width(struct device *dev,
173 struct device_attribute *attr, 173 struct device_attribute *attr,
174 char *buf) 174 char *buf)
175{ 175{
176 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 176 struct hid_device *hdev = to_hid_device(dev);
177 struct ntrig_data *nd = hid_get_drvdata(hdev); 177 struct ntrig_data *nd = hid_get_drvdata(hdev);
178 178
179 return sprintf(buf, "%d\n", nd->sensor_physical_width); 179 return sprintf(buf, "%d\n", nd->sensor_physical_width);
@@ -185,7 +185,7 @@ static ssize_t show_phys_height(struct device *dev,
185 struct device_attribute *attr, 185 struct device_attribute *attr,
186 char *buf) 186 char *buf)
187{ 187{
188 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 188 struct hid_device *hdev = to_hid_device(dev);
189 struct ntrig_data *nd = hid_get_drvdata(hdev); 189 struct ntrig_data *nd = hid_get_drvdata(hdev);
190 190
191 return sprintf(buf, "%d\n", nd->sensor_physical_height); 191 return sprintf(buf, "%d\n", nd->sensor_physical_height);
@@ -197,7 +197,7 @@ static ssize_t show_log_width(struct device *dev,
197 struct device_attribute *attr, 197 struct device_attribute *attr,
198 char *buf) 198 char *buf)
199{ 199{
200 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 200 struct hid_device *hdev = to_hid_device(dev);
201 struct ntrig_data *nd = hid_get_drvdata(hdev); 201 struct ntrig_data *nd = hid_get_drvdata(hdev);
202 202
203 return sprintf(buf, "%d\n", nd->sensor_logical_width); 203 return sprintf(buf, "%d\n", nd->sensor_logical_width);
@@ -209,7 +209,7 @@ static ssize_t show_log_height(struct device *dev,
209 struct device_attribute *attr, 209 struct device_attribute *attr,
210 char *buf) 210 char *buf)
211{ 211{
212 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 212 struct hid_device *hdev = to_hid_device(dev);
213 struct ntrig_data *nd = hid_get_drvdata(hdev); 213 struct ntrig_data *nd = hid_get_drvdata(hdev);
214 214
215 return sprintf(buf, "%d\n", nd->sensor_logical_height); 215 return sprintf(buf, "%d\n", nd->sensor_logical_height);
@@ -221,7 +221,7 @@ static ssize_t show_min_width(struct device *dev,
221 struct device_attribute *attr, 221 struct device_attribute *attr,
222 char *buf) 222 char *buf)
223{ 223{
224 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 224 struct hid_device *hdev = to_hid_device(dev);
225 struct ntrig_data *nd = hid_get_drvdata(hdev); 225 struct ntrig_data *nd = hid_get_drvdata(hdev);
226 226
227 return sprintf(buf, "%d\n", nd->min_width * 227 return sprintf(buf, "%d\n", nd->min_width *
@@ -233,7 +233,7 @@ static ssize_t set_min_width(struct device *dev,
233 struct device_attribute *attr, 233 struct device_attribute *attr,
234 const char *buf, size_t count) 234 const char *buf, size_t count)
235{ 235{
236 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 236 struct hid_device *hdev = to_hid_device(dev);
237 struct ntrig_data *nd = hid_get_drvdata(hdev); 237 struct ntrig_data *nd = hid_get_drvdata(hdev);
238 238
239 unsigned long val; 239 unsigned long val;
@@ -256,7 +256,7 @@ static ssize_t show_min_height(struct device *dev,
256 struct device_attribute *attr, 256 struct device_attribute *attr,
257 char *buf) 257 char *buf)
258{ 258{
259 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 259 struct hid_device *hdev = to_hid_device(dev);
260 struct ntrig_data *nd = hid_get_drvdata(hdev); 260 struct ntrig_data *nd = hid_get_drvdata(hdev);
261 261
262 return sprintf(buf, "%d\n", nd->min_height * 262 return sprintf(buf, "%d\n", nd->min_height *
@@ -268,7 +268,7 @@ static ssize_t set_min_height(struct device *dev,
268 struct device_attribute *attr, 268 struct device_attribute *attr,
269 const char *buf, size_t count) 269 const char *buf, size_t count)
270{ 270{
271 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 271 struct hid_device *hdev = to_hid_device(dev);
272 struct ntrig_data *nd = hid_get_drvdata(hdev); 272 struct ntrig_data *nd = hid_get_drvdata(hdev);
273 273
274 unsigned long val; 274 unsigned long val;
@@ -292,7 +292,7 @@ static ssize_t show_activate_slack(struct device *dev,
292 struct device_attribute *attr, 292 struct device_attribute *attr,
293 char *buf) 293 char *buf)
294{ 294{
295 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 295 struct hid_device *hdev = to_hid_device(dev);
296 struct ntrig_data *nd = hid_get_drvdata(hdev); 296 struct ntrig_data *nd = hid_get_drvdata(hdev);
297 297
298 return sprintf(buf, "%d\n", nd->activate_slack); 298 return sprintf(buf, "%d\n", nd->activate_slack);
@@ -302,7 +302,7 @@ static ssize_t set_activate_slack(struct device *dev,
302 struct device_attribute *attr, 302 struct device_attribute *attr,
303 const char *buf, size_t count) 303 const char *buf, size_t count)
304{ 304{
305 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 305 struct hid_device *hdev = to_hid_device(dev);
306 struct ntrig_data *nd = hid_get_drvdata(hdev); 306 struct ntrig_data *nd = hid_get_drvdata(hdev);
307 307
308 unsigned long val; 308 unsigned long val;
@@ -325,7 +325,7 @@ static ssize_t show_activation_width(struct device *dev,
325 struct device_attribute *attr, 325 struct device_attribute *attr,
326 char *buf) 326 char *buf)
327{ 327{
328 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 328 struct hid_device *hdev = to_hid_device(dev);
329 struct ntrig_data *nd = hid_get_drvdata(hdev); 329 struct ntrig_data *nd = hid_get_drvdata(hdev);
330 330
331 return sprintf(buf, "%d\n", nd->activation_width * 331 return sprintf(buf, "%d\n", nd->activation_width *
@@ -337,7 +337,7 @@ static ssize_t set_activation_width(struct device *dev,
337 struct device_attribute *attr, 337 struct device_attribute *attr,
338 const char *buf, size_t count) 338 const char *buf, size_t count)
339{ 339{
340 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 340 struct hid_device *hdev = to_hid_device(dev);
341 struct ntrig_data *nd = hid_get_drvdata(hdev); 341 struct ntrig_data *nd = hid_get_drvdata(hdev);
342 342
343 unsigned long val; 343 unsigned long val;
@@ -361,7 +361,7 @@ static ssize_t show_activation_height(struct device *dev,
361 struct device_attribute *attr, 361 struct device_attribute *attr,
362 char *buf) 362 char *buf)
363{ 363{
364 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 364 struct hid_device *hdev = to_hid_device(dev);
365 struct ntrig_data *nd = hid_get_drvdata(hdev); 365 struct ntrig_data *nd = hid_get_drvdata(hdev);
366 366
367 return sprintf(buf, "%d\n", nd->activation_height * 367 return sprintf(buf, "%d\n", nd->activation_height *
@@ -373,7 +373,7 @@ static ssize_t set_activation_height(struct device *dev,
373 struct device_attribute *attr, 373 struct device_attribute *attr,
374 const char *buf, size_t count) 374 const char *buf, size_t count)
375{ 375{
376 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 376 struct hid_device *hdev = to_hid_device(dev);
377 struct ntrig_data *nd = hid_get_drvdata(hdev); 377 struct ntrig_data *nd = hid_get_drvdata(hdev);
378 378
379 unsigned long val; 379 unsigned long val;
@@ -397,7 +397,7 @@ static ssize_t show_deactivate_slack(struct device *dev,
397 struct device_attribute *attr, 397 struct device_attribute *attr,
398 char *buf) 398 char *buf)
399{ 399{
400 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 400 struct hid_device *hdev = to_hid_device(dev);
401 struct ntrig_data *nd = hid_get_drvdata(hdev); 401 struct ntrig_data *nd = hid_get_drvdata(hdev);
402 402
403 return sprintf(buf, "%d\n", -nd->deactivate_slack); 403 return sprintf(buf, "%d\n", -nd->deactivate_slack);
@@ -407,7 +407,7 @@ static ssize_t set_deactivate_slack(struct device *dev,
407 struct device_attribute *attr, 407 struct device_attribute *attr,
408 const char *buf, size_t count) 408 const char *buf, size_t count)
409{ 409{
410 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 410 struct hid_device *hdev = to_hid_device(dev);
411 struct ntrig_data *nd = hid_get_drvdata(hdev); 411 struct ntrig_data *nd = hid_get_drvdata(hdev);
412 412
413 unsigned long val; 413 unsigned long val;
diff --git a/drivers/hid/hid-picolcd_leds.c b/drivers/hid/hid-picolcd_leds.c
index e994f9c29012..a802b4f49c7b 100644
--- a/drivers/hid/hid-picolcd_leds.c
+++ b/drivers/hid/hid-picolcd_leds.c
@@ -66,7 +66,7 @@ static void picolcd_led_set_brightness(struct led_classdev *led_cdev,
66 int i, state = 0; 66 int i, state = 0;
67 67
68 dev = led_cdev->dev->parent; 68 dev = led_cdev->dev->parent;
69 hdev = container_of(dev, struct hid_device, dev); 69 hdev = to_hid_device(dev);
70 data = hid_get_drvdata(hdev); 70 data = hid_get_drvdata(hdev);
71 if (!data) 71 if (!data)
72 return; 72 return;
@@ -93,7 +93,7 @@ static enum led_brightness picolcd_led_get_brightness(struct led_classdev *led_c
93 int i, value = 0; 93 int i, value = 0;
94 94
95 dev = led_cdev->dev->parent; 95 dev = led_cdev->dev->parent;
96 hdev = container_of(dev, struct hid_device, dev); 96 hdev = to_hid_device(dev);
97 data = hid_get_drvdata(hdev); 97 data = hid_get_drvdata(hdev);
98 for (i = 0; i < 8; i++) 98 for (i = 0; i < 8; i++)
99 if (led_cdev == data->led[i]) { 99 if (led_cdev == data->led[i]) {
diff --git a/drivers/hid/hid-prodikeys.c b/drivers/hid/hid-prodikeys.c
index 3a207c0ac0e3..f095bf8a3aa9 100644
--- a/drivers/hid/hid-prodikeys.c
+++ b/drivers/hid/hid-prodikeys.c
@@ -103,7 +103,7 @@ MODULE_PARM_DESC(enable, "Enable for the PC-MIDI virtual audio driver");
103static ssize_t show_channel(struct device *dev, 103static ssize_t show_channel(struct device *dev,
104 struct device_attribute *attr, char *buf) 104 struct device_attribute *attr, char *buf)
105{ 105{
106 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 106 struct hid_device *hdev = to_hid_device(dev);
107 struct pk_device *pk = hid_get_drvdata(hdev); 107 struct pk_device *pk = hid_get_drvdata(hdev);
108 108
109 dbg_hid("pcmidi sysfs read channel=%u\n", pk->pm->midi_channel); 109 dbg_hid("pcmidi sysfs read channel=%u\n", pk->pm->midi_channel);
@@ -116,7 +116,7 @@ static ssize_t show_channel(struct device *dev,
116static ssize_t store_channel(struct device *dev, 116static ssize_t store_channel(struct device *dev,
117 struct device_attribute *attr, const char *buf, size_t count) 117 struct device_attribute *attr, const char *buf, size_t count)
118{ 118{
119 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 119 struct hid_device *hdev = to_hid_device(dev);
120 struct pk_device *pk = hid_get_drvdata(hdev); 120 struct pk_device *pk = hid_get_drvdata(hdev);
121 121
122 unsigned channel = 0; 122 unsigned channel = 0;
@@ -140,7 +140,7 @@ static struct device_attribute *sysfs_device_attr_channel = {
140static ssize_t show_sustain(struct device *dev, 140static ssize_t show_sustain(struct device *dev,
141 struct device_attribute *attr, char *buf) 141 struct device_attribute *attr, char *buf)
142{ 142{
143 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 143 struct hid_device *hdev = to_hid_device(dev);
144 struct pk_device *pk = hid_get_drvdata(hdev); 144 struct pk_device *pk = hid_get_drvdata(hdev);
145 145
146 dbg_hid("pcmidi sysfs read sustain=%u\n", pk->pm->midi_sustain); 146 dbg_hid("pcmidi sysfs read sustain=%u\n", pk->pm->midi_sustain);
@@ -153,7 +153,7 @@ static ssize_t show_sustain(struct device *dev,
153static ssize_t store_sustain(struct device *dev, 153static ssize_t store_sustain(struct device *dev,
154 struct device_attribute *attr, const char *buf, size_t count) 154 struct device_attribute *attr, const char *buf, size_t count)
155{ 155{
156 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 156 struct hid_device *hdev = to_hid_device(dev);
157 struct pk_device *pk = hid_get_drvdata(hdev); 157 struct pk_device *pk = hid_get_drvdata(hdev);
158 158
159 unsigned sustain = 0; 159 unsigned sustain = 0;
@@ -179,7 +179,7 @@ static struct device_attribute *sysfs_device_attr_sustain = {
179static ssize_t show_octave(struct device *dev, 179static ssize_t show_octave(struct device *dev,
180 struct device_attribute *attr, char *buf) 180 struct device_attribute *attr, char *buf)
181{ 181{
182 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 182 struct hid_device *hdev = to_hid_device(dev);
183 struct pk_device *pk = hid_get_drvdata(hdev); 183 struct pk_device *pk = hid_get_drvdata(hdev);
184 184
185 dbg_hid("pcmidi sysfs read octave=%d\n", pk->pm->midi_octave); 185 dbg_hid("pcmidi sysfs read octave=%d\n", pk->pm->midi_octave);
@@ -192,7 +192,7 @@ static ssize_t show_octave(struct device *dev,
192static ssize_t store_octave(struct device *dev, 192static ssize_t store_octave(struct device *dev,
193 struct device_attribute *attr, const char *buf, size_t count) 193 struct device_attribute *attr, const char *buf, size_t count)
194{ 194{
195 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 195 struct hid_device *hdev = to_hid_device(dev);
196 struct pk_device *pk = hid_get_drvdata(hdev); 196 struct pk_device *pk = hid_get_drvdata(hdev);
197 197
198 int octave = 0; 198 int octave = 0;
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 774cd2210566..9bbf5a725139 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1549,7 +1549,7 @@ static void sony_led_set_brightness(struct led_classdev *led,
1549 enum led_brightness value) 1549 enum led_brightness value)
1550{ 1550{
1551 struct device *dev = led->dev->parent; 1551 struct device *dev = led->dev->parent;
1552 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1552 struct hid_device *hdev = to_hid_device(dev);
1553 struct sony_sc *drv_data; 1553 struct sony_sc *drv_data;
1554 1554
1555 int n; 1555 int n;
@@ -1591,7 +1591,7 @@ static void sony_led_set_brightness(struct led_classdev *led,
1591static enum led_brightness sony_led_get_brightness(struct led_classdev *led) 1591static enum led_brightness sony_led_get_brightness(struct led_classdev *led)
1592{ 1592{
1593 struct device *dev = led->dev->parent; 1593 struct device *dev = led->dev->parent;
1594 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1594 struct hid_device *hdev = to_hid_device(dev);
1595 struct sony_sc *drv_data; 1595 struct sony_sc *drv_data;
1596 1596
1597 int n; 1597 int n;
@@ -1614,7 +1614,7 @@ static int sony_led_blink_set(struct led_classdev *led, unsigned long *delay_on,
1614 unsigned long *delay_off) 1614 unsigned long *delay_off)
1615{ 1615{
1616 struct device *dev = led->dev->parent; 1616 struct device *dev = led->dev->parent;
1617 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1617 struct hid_device *hdev = to_hid_device(dev);
1618 struct sony_sc *drv_data = hid_get_drvdata(hdev); 1618 struct sony_sc *drv_data = hid_get_drvdata(hdev);
1619 int n; 1619 int n;
1620 __u8 new_on, new_off; 1620 __u8 new_on, new_off;
diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c
index 3edd4ac36494..ec18768b124a 100644
--- a/drivers/hid/hid-steelseries.c
+++ b/drivers/hid/hid-steelseries.c
@@ -141,7 +141,7 @@ static void steelseries_srws1_led_all_set_brightness(struct led_classdev *led_cd
141 enum led_brightness value) 141 enum led_brightness value)
142{ 142{
143 struct device *dev = led_cdev->dev->parent; 143 struct device *dev = led_cdev->dev->parent;
144 struct hid_device *hid = container_of(dev, struct hid_device, dev); 144 struct hid_device *hid = to_hid_device(dev);
145 struct steelseries_srws1_data *drv_data = hid_get_drvdata(hid); 145 struct steelseries_srws1_data *drv_data = hid_get_drvdata(hid);
146 146
147 if (!drv_data) { 147 if (!drv_data) {
@@ -160,7 +160,7 @@ static void steelseries_srws1_led_all_set_brightness(struct led_classdev *led_cd
160static enum led_brightness steelseries_srws1_led_all_get_brightness(struct led_classdev *led_cdev) 160static enum led_brightness steelseries_srws1_led_all_get_brightness(struct led_classdev *led_cdev)
161{ 161{
162 struct device *dev = led_cdev->dev->parent; 162 struct device *dev = led_cdev->dev->parent;
163 struct hid_device *hid = container_of(dev, struct hid_device, dev); 163 struct hid_device *hid = to_hid_device(dev);
164 struct steelseries_srws1_data *drv_data; 164 struct steelseries_srws1_data *drv_data;
165 165
166 drv_data = hid_get_drvdata(hid); 166 drv_data = hid_get_drvdata(hid);
@@ -177,7 +177,7 @@ static void steelseries_srws1_led_set_brightness(struct led_classdev *led_cdev,
177 enum led_brightness value) 177 enum led_brightness value)
178{ 178{
179 struct device *dev = led_cdev->dev->parent; 179 struct device *dev = led_cdev->dev->parent;
180 struct hid_device *hid = container_of(dev, struct hid_device, dev); 180 struct hid_device *hid = to_hid_device(dev);
181 struct steelseries_srws1_data *drv_data = hid_get_drvdata(hid); 181 struct steelseries_srws1_data *drv_data = hid_get_drvdata(hid);
182 int i, state = 0; 182 int i, state = 0;
183 183
@@ -205,7 +205,7 @@ static void steelseries_srws1_led_set_brightness(struct led_classdev *led_cdev,
205static enum led_brightness steelseries_srws1_led_get_brightness(struct led_classdev *led_cdev) 205static enum led_brightness steelseries_srws1_led_get_brightness(struct led_classdev *led_cdev)
206{ 206{
207 struct device *dev = led_cdev->dev->parent; 207 struct device *dev = led_cdev->dev->parent;
208 struct hid_device *hid = container_of(dev, struct hid_device, dev); 208 struct hid_device *hid = to_hid_device(dev);
209 struct steelseries_srws1_data *drv_data; 209 struct steelseries_srws1_data *drv_data;
210 int i, value = 0; 210 int i, value = 0;
211 211
diff --git a/drivers/hid/hid-wiimote.h b/drivers/hid/hid-wiimote.h
index 875694d43e4d..510ca77fe14e 100644
--- a/drivers/hid/hid-wiimote.h
+++ b/drivers/hid/hid-wiimote.h
@@ -256,8 +256,7 @@ enum wiiproto_reqs {
256 WIIPROTO_REQ_MAX 256 WIIPROTO_REQ_MAX
257}; 257};
258 258
259#define dev_to_wii(pdev) hid_get_drvdata(container_of(pdev, struct hid_device, \ 259#define dev_to_wii(pdev) hid_get_drvdata(to_hid_device(pdev))
260 dev))
261 260
262void __wiimote_schedule(struct wiimote_data *wdata); 261void __wiimote_schedule(struct wiimote_data *wdata);
263 262
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index e06af5b9f59e..4b7feb3022c1 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -686,7 +686,7 @@ out:
686static ssize_t wacom_led_select_store(struct device *dev, int set_id, 686static ssize_t wacom_led_select_store(struct device *dev, int set_id,
687 const char *buf, size_t count) 687 const char *buf, size_t count)
688{ 688{
689 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 689 struct hid_device *hdev = to_hid_device(dev);
690 struct wacom *wacom = hid_get_drvdata(hdev); 690 struct wacom *wacom = hid_get_drvdata(hdev);
691 unsigned int id; 691 unsigned int id;
692 int err; 692 int err;
@@ -714,7 +714,7 @@ static ssize_t wacom_led##SET_ID##_select_store(struct device *dev, \
714static ssize_t wacom_led##SET_ID##_select_show(struct device *dev, \ 714static ssize_t wacom_led##SET_ID##_select_show(struct device *dev, \
715 struct device_attribute *attr, char *buf) \ 715 struct device_attribute *attr, char *buf) \
716{ \ 716{ \
717 struct hid_device *hdev = container_of(dev, struct hid_device, dev);\ 717 struct hid_device *hdev = to_hid_device(dev);\
718 struct wacom *wacom = hid_get_drvdata(hdev); \ 718 struct wacom *wacom = hid_get_drvdata(hdev); \
719 return scnprintf(buf, PAGE_SIZE, "%d\n", \ 719 return scnprintf(buf, PAGE_SIZE, "%d\n", \
720 wacom->led.select[SET_ID]); \ 720 wacom->led.select[SET_ID]); \
@@ -750,7 +750,7 @@ static ssize_t wacom_luminance_store(struct wacom *wacom, u8 *dest,
750static ssize_t wacom_##name##_luminance_store(struct device *dev, \ 750static ssize_t wacom_##name##_luminance_store(struct device *dev, \
751 struct device_attribute *attr, const char *buf, size_t count) \ 751 struct device_attribute *attr, const char *buf, size_t count) \
752{ \ 752{ \
753 struct hid_device *hdev = container_of(dev, struct hid_device, dev);\ 753 struct hid_device *hdev = to_hid_device(dev);\
754 struct wacom *wacom = hid_get_drvdata(hdev); \ 754 struct wacom *wacom = hid_get_drvdata(hdev); \
755 \ 755 \
756 return wacom_luminance_store(wacom, &wacom->led.field, \ 756 return wacom_luminance_store(wacom, &wacom->led.field, \
@@ -773,7 +773,7 @@ DEVICE_LUMINANCE_ATTR(buttons, img_lum);
773static ssize_t wacom_button_image_store(struct device *dev, int button_id, 773static ssize_t wacom_button_image_store(struct device *dev, int button_id,
774 const char *buf, size_t count) 774 const char *buf, size_t count)
775{ 775{
776 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 776 struct hid_device *hdev = to_hid_device(dev);
777 struct wacom *wacom = hid_get_drvdata(hdev); 777 struct wacom *wacom = hid_get_drvdata(hdev);
778 int err; 778 int err;
779 unsigned len; 779 unsigned len;
@@ -1097,7 +1097,7 @@ static ssize_t wacom_show_speed(struct device *dev,
1097 struct device_attribute 1097 struct device_attribute
1098 *attr, char *buf) 1098 *attr, char *buf)
1099{ 1099{
1100 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1100 struct hid_device *hdev = to_hid_device(dev);
1101 struct wacom *wacom = hid_get_drvdata(hdev); 1101 struct wacom *wacom = hid_get_drvdata(hdev);
1102 1102
1103 return snprintf(buf, PAGE_SIZE, "%i\n", wacom->wacom_wac.bt_high_speed); 1103 return snprintf(buf, PAGE_SIZE, "%i\n", wacom->wacom_wac.bt_high_speed);
@@ -1107,7 +1107,7 @@ static ssize_t wacom_store_speed(struct device *dev,
1107 struct device_attribute *attr, 1107 struct device_attribute *attr,
1108 const char *buf, size_t count) 1108 const char *buf, size_t count)
1109{ 1109{
1110 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1110 struct hid_device *hdev = to_hid_device(dev);
1111 struct wacom *wacom = hid_get_drvdata(hdev); 1111 struct wacom *wacom = hid_get_drvdata(hdev);
1112 u8 new_speed; 1112 u8 new_speed;
1113 1113
@@ -1131,7 +1131,7 @@ static ssize_t wacom_show_remote_mode(struct kobject *kobj,
1131 char *buf, int index) 1131 char *buf, int index)
1132{ 1132{
1133 struct device *dev = container_of(kobj->parent, struct device, kobj); 1133 struct device *dev = container_of(kobj->parent, struct device, kobj);
1134 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1134 struct hid_device *hdev = to_hid_device(dev);
1135 struct wacom *wacom = hid_get_drvdata(hdev); 1135 struct wacom *wacom = hid_get_drvdata(hdev);
1136 u8 mode; 1136 u8 mode;
1137 1137
@@ -1242,7 +1242,7 @@ static ssize_t wacom_store_unpair_remote(struct kobject *kobj,
1242{ 1242{
1243 unsigned char selector = 0; 1243 unsigned char selector = 0;
1244 struct device *dev = container_of(kobj->parent, struct device, kobj); 1244 struct device *dev = container_of(kobj->parent, struct device, kobj);
1245 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1245 struct hid_device *hdev = to_hid_device(dev);
1246 struct wacom *wacom = hid_get_drvdata(hdev); 1246 struct wacom *wacom = hid_get_drvdata(hdev);
1247 int err; 1247 int err;
1248 1248