Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Geliang Tang and committed by
Jiri Kosina
ee79a8f8 d8ce9bf5

+76 -79
+7 -7
drivers/hid/hid-core.c
··· 625 625 626 626 static 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 630 hid_close_report(hid); 631 631 kfree(hid->dev_rdesc); ··· 1572 1572 char *buf, loff_t off, size_t count) 1573 1573 { 1574 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 1577 if (off >= hdev->rsize) 1578 1578 return 0; ··· 1589 1589 show_country(struct device *dev, struct device_attribute *attr, 1590 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 1594 return sprintf(buf, "%02x\n", hdev->country & 0xff); 1595 1595 } ··· 2140 2140 static int hid_bus_match(struct device *dev, struct device_driver *drv) 2141 2141 { 2142 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 2145 return hid_match_device(hdev, hdrv) != NULL; 2146 2146 } ··· 2149 2149 { 2150 2150 struct hid_driver *hdrv = container_of(dev->driver, 2151 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 2153 const struct hid_device_id *id; 2154 2154 int ret = 0; 2155 2155 ··· 2191 2191 2192 2192 static 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 2195 struct hid_driver *hdrv; 2196 2196 int ret = 0; 2197 2197 ··· 2241 2241 2242 2242 static 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 2246 if (add_uevent_var(env, "HID_ID=%04X:%08X:%08X", 2247 2247 hdev->bus, hdev->vendor, hdev->product))
+4 -4
drivers/hid/hid-cp2112.c
··· 807 807 struct device_attribute *attr, const char *buf, \ 808 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 811 struct cp2112_usb_config_report cfg; \ 812 812 int ret = cp2112_get_usb_config(hdev, &cfg); \ 813 813 if (ret) \ ··· 822 822 static ssize_t name##_show(struct device *kdev, \ 823 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 826 struct cp2112_usb_config_report cfg; \ 827 827 int ret = cp2112_get_usb_config(hdev, &cfg); \ 828 828 if (ret) \ ··· 887 887 struct device_attribute *kattr, const char *buf, 888 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 891 struct cp2112_pstring_attribute *attr = 892 892 container_of(kattr, struct cp2112_pstring_attribute, attr); 893 893 struct cp2112_string_report report; ··· 918 918 static ssize_t pstr_show(struct device *kdev, 919 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 922 struct cp2112_pstring_attribute *attr = 923 923 container_of(kattr, struct cp2112_pstring_attribute, attr); 924 924 struct cp2112_string_report report;
+3 -5
drivers/hid/hid-gt683r.c
··· 70 70 { 71 71 int i; 72 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 74 struct gt683r_led *led = hid_get_drvdata(hdev); 75 75 76 76 for (i = 0; i < GT683R_LED_COUNT; i++) { ··· 89 89 char *buf) 90 90 { 91 91 u8 sysfs_mode; 92 - struct hid_device *hdev = container_of(dev->parent, 93 - struct hid_device, dev); 92 + struct hid_device *hdev = to_hid_device(dev->parent); 94 93 struct gt683r_led *led = hid_get_drvdata(hdev); 95 94 96 95 if (led->mode == GT683R_LED_NORMAL) ··· 107 108 const char *buf, size_t count) 108 109 { 109 110 u8 sysfs_mode; 110 - struct hid_device *hdev = container_of(dev->parent, 111 - struct hid_device, dev); 111 + struct hid_device *hdev = to_hid_device(dev->parent); 112 112 struct gt683r_led *led = hid_get_drvdata(hdev); 113 113 114 114
+18 -18
drivers/hid/hid-lenovo.c
··· 220 220 struct device_attribute *attr, 221 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 224 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); 225 225 226 226 return snprintf(buf, PAGE_SIZE, "%u\n", cptkbd_data->fn_lock); ··· 231 231 const char *buf, 232 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 235 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); 236 236 int value; 237 237 ··· 250 250 struct device_attribute *attr, 251 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 254 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); 255 255 256 256 return snprintf(buf, PAGE_SIZE, "%u\n", ··· 262 262 const char *buf, 263 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 266 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); 267 267 int value; 268 268 ··· 387 387 struct device_attribute *attr, 388 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 391 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 392 392 393 393 return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->press_to_select); ··· 398 398 const char *buf, 399 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 402 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 403 403 int value; 404 404 ··· 417 417 struct device_attribute *attr, 418 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 421 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 422 422 423 423 return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->dragging); ··· 428 428 const char *buf, 429 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 432 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 433 433 int value; 434 434 ··· 447 447 struct device_attribute *attr, 448 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 451 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 452 452 453 453 return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->release_to_select); ··· 458 458 const char *buf, 459 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 462 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 463 463 int value; 464 464 ··· 477 477 struct device_attribute *attr, 478 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 481 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 482 482 483 483 return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->select_right); ··· 488 488 const char *buf, 489 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 492 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 493 493 int value; 494 494 ··· 507 507 struct device_attribute *attr, 508 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 511 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 512 512 513 513 return snprintf(buf, PAGE_SIZE, "%u\n", ··· 519 519 const char *buf, 520 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 523 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 524 524 int value; 525 525 ··· 536 536 struct device_attribute *attr, 537 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 540 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 541 541 542 542 return snprintf(buf, PAGE_SIZE, "%u\n", ··· 548 548 const char *buf, 549 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 552 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 553 553 int value; 554 554 ··· 609 609 struct led_classdev *led_cdev) 610 610 { 611 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 613 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 614 614 int led_nr = 0; 615 615 ··· 625 625 enum led_brightness value) 626 626 { 627 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 629 struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); 630 630 struct hid_report *report; 631 631 int led_nr = 0;
+2 -2
drivers/hid/hid-lg4ff.c
··· 1018 1018 enum led_brightness value) 1019 1019 { 1020 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 1022 struct lg_drv_data *drv_data = hid_get_drvdata(hid); 1023 1023 struct lg4ff_device_entry *entry; 1024 1024 int i, state = 0; ··· 1053 1053 static enum led_brightness lg4ff_led_get_brightness(struct led_classdev *led_cdev) 1054 1054 { 1055 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 1057 struct lg_drv_data *drv_data = hid_get_drvdata(hid); 1058 1058 struct lg4ff_device_entry *entry; 1059 1059 int i, value = 0;
+2 -2
drivers/hid/hid-multitouch.c
··· 272 272 struct device_attribute *attr, 273 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 276 struct mt_device *td = hid_get_drvdata(hdev); 277 277 278 278 return sprintf(buf, "%u\n", td->mtclass.quirks); ··· 282 282 struct device_attribute *attr, 283 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 286 struct mt_device *td = hid_get_drvdata(hdev); 287 287 288 288 unsigned long val;
+16 -16
drivers/hid/hid-ntrig.c
··· 173 173 struct device_attribute *attr, 174 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 177 struct ntrig_data *nd = hid_get_drvdata(hdev); 178 178 179 179 return sprintf(buf, "%d\n", nd->sensor_physical_width); ··· 185 185 struct device_attribute *attr, 186 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 189 struct ntrig_data *nd = hid_get_drvdata(hdev); 190 190 191 191 return sprintf(buf, "%d\n", nd->sensor_physical_height); ··· 197 197 struct device_attribute *attr, 198 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 201 struct ntrig_data *nd = hid_get_drvdata(hdev); 202 202 203 203 return sprintf(buf, "%d\n", nd->sensor_logical_width); ··· 209 209 struct device_attribute *attr, 210 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 213 struct ntrig_data *nd = hid_get_drvdata(hdev); 214 214 215 215 return sprintf(buf, "%d\n", nd->sensor_logical_height); ··· 221 221 struct device_attribute *attr, 222 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 225 struct ntrig_data *nd = hid_get_drvdata(hdev); 226 226 227 227 return sprintf(buf, "%d\n", nd->min_width * ··· 233 233 struct device_attribute *attr, 234 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 237 struct ntrig_data *nd = hid_get_drvdata(hdev); 238 238 239 239 unsigned long val; ··· 256 256 struct device_attribute *attr, 257 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 260 struct ntrig_data *nd = hid_get_drvdata(hdev); 261 261 262 262 return sprintf(buf, "%d\n", nd->min_height * ··· 268 268 struct device_attribute *attr, 269 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 272 struct ntrig_data *nd = hid_get_drvdata(hdev); 273 273 274 274 unsigned long val; ··· 292 292 struct device_attribute *attr, 293 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 296 struct ntrig_data *nd = hid_get_drvdata(hdev); 297 297 298 298 return sprintf(buf, "%d\n", nd->activate_slack); ··· 302 302 struct device_attribute *attr, 303 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 306 struct ntrig_data *nd = hid_get_drvdata(hdev); 307 307 308 308 unsigned long val; ··· 325 325 struct device_attribute *attr, 326 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 329 struct ntrig_data *nd = hid_get_drvdata(hdev); 330 330 331 331 return sprintf(buf, "%d\n", nd->activation_width * ··· 337 337 struct device_attribute *attr, 338 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 341 struct ntrig_data *nd = hid_get_drvdata(hdev); 342 342 343 343 unsigned long val; ··· 361 361 struct device_attribute *attr, 362 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 365 struct ntrig_data *nd = hid_get_drvdata(hdev); 366 366 367 367 return sprintf(buf, "%d\n", nd->activation_height * ··· 373 373 struct device_attribute *attr, 374 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 377 struct ntrig_data *nd = hid_get_drvdata(hdev); 378 378 379 379 unsigned long val; ··· 397 397 struct device_attribute *attr, 398 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 401 struct ntrig_data *nd = hid_get_drvdata(hdev); 402 402 403 403 return sprintf(buf, "%d\n", -nd->deactivate_slack); ··· 407 407 struct device_attribute *attr, 408 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 411 struct ntrig_data *nd = hid_get_drvdata(hdev); 412 412 413 413 unsigned long val;
+2 -2
drivers/hid/hid-picolcd_leds.c
··· 66 66 int i, state = 0; 67 67 68 68 dev = led_cdev->dev->parent; 69 - hdev = container_of(dev, struct hid_device, dev); 69 + hdev = to_hid_device(dev); 70 70 data = hid_get_drvdata(hdev); 71 71 if (!data) 72 72 return; ··· 93 93 int i, value = 0; 94 94 95 95 dev = led_cdev->dev->parent; 96 - hdev = container_of(dev, struct hid_device, dev); 96 + hdev = to_hid_device(dev); 97 97 data = hid_get_drvdata(hdev); 98 98 for (i = 0; i < 8; i++) 99 99 if (led_cdev == data->led[i]) {
+6 -6
drivers/hid/hid-prodikeys.c
··· 103 103 static ssize_t show_channel(struct device *dev, 104 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 107 struct pk_device *pk = hid_get_drvdata(hdev); 108 108 109 109 dbg_hid("pcmidi sysfs read channel=%u\n", pk->pm->midi_channel); ··· 116 116 static ssize_t store_channel(struct device *dev, 117 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 120 struct pk_device *pk = hid_get_drvdata(hdev); 121 121 122 122 unsigned channel = 0; ··· 140 140 static ssize_t show_sustain(struct device *dev, 141 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 144 struct pk_device *pk = hid_get_drvdata(hdev); 145 145 146 146 dbg_hid("pcmidi sysfs read sustain=%u\n", pk->pm->midi_sustain); ··· 153 153 static ssize_t store_sustain(struct device *dev, 154 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 157 struct pk_device *pk = hid_get_drvdata(hdev); 158 158 159 159 unsigned sustain = 0; ··· 179 179 static ssize_t show_octave(struct device *dev, 180 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 183 struct pk_device *pk = hid_get_drvdata(hdev); 184 184 185 185 dbg_hid("pcmidi sysfs read octave=%d\n", pk->pm->midi_octave); ··· 192 192 static ssize_t store_octave(struct device *dev, 193 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 196 struct pk_device *pk = hid_get_drvdata(hdev); 197 197 198 198 int octave = 0;
+3 -3
drivers/hid/hid-sony.c
··· 1549 1549 enum led_brightness value) 1550 1550 { 1551 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 1553 struct sony_sc *drv_data; 1554 1554 1555 1555 int n; ··· 1591 1591 static enum led_brightness sony_led_get_brightness(struct led_classdev *led) 1592 1592 { 1593 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 1595 struct sony_sc *drv_data; 1596 1596 1597 1597 int n; ··· 1614 1614 unsigned long *delay_off) 1615 1615 { 1616 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 1618 struct sony_sc *drv_data = hid_get_drvdata(hdev); 1619 1619 int n; 1620 1620 __u8 new_on, new_off;
+4 -4
drivers/hid/hid-steelseries.c
··· 141 141 enum led_brightness value) 142 142 { 143 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 145 struct steelseries_srws1_data *drv_data = hid_get_drvdata(hid); 146 146 147 147 if (!drv_data) { ··· 160 160 static enum led_brightness steelseries_srws1_led_all_get_brightness(struct led_classdev *led_cdev) 161 161 { 162 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 164 struct steelseries_srws1_data *drv_data; 165 165 166 166 drv_data = hid_get_drvdata(hid); ··· 177 177 enum led_brightness value) 178 178 { 179 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 181 struct steelseries_srws1_data *drv_data = hid_get_drvdata(hid); 182 182 int i, state = 0; 183 183 ··· 205 205 static enum led_brightness steelseries_srws1_led_get_brightness(struct led_classdev *led_cdev) 206 206 { 207 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 209 struct steelseries_srws1_data *drv_data; 210 210 int i, value = 0; 211 211
+1 -2
drivers/hid/hid-wiimote.h
··· 256 256 WIIPROTO_REQ_MAX 257 257 }; 258 258 259 - #define dev_to_wii(pdev) hid_get_drvdata(container_of(pdev, struct hid_device, \ 260 - dev)) 259 + #define dev_to_wii(pdev) hid_get_drvdata(to_hid_device(pdev)) 261 260 262 261 void __wiimote_schedule(struct wiimote_data *wdata); 263 262
+8 -8
drivers/hid/wacom_sys.c
··· 686 686 static ssize_t wacom_led_select_store(struct device *dev, int set_id, 687 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 690 struct wacom *wacom = hid_get_drvdata(hdev); 691 691 unsigned int id; 692 692 int err; ··· 714 714 static ssize_t wacom_led##SET_ID##_select_show(struct device *dev, \ 715 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 718 struct wacom *wacom = hid_get_drvdata(hdev); \ 719 719 return scnprintf(buf, PAGE_SIZE, "%d\n", \ 720 720 wacom->led.select[SET_ID]); \ ··· 750 750 static ssize_t wacom_##name##_luminance_store(struct device *dev, \ 751 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 754 struct wacom *wacom = hid_get_drvdata(hdev); \ 755 755 \ 756 756 return wacom_luminance_store(wacom, &wacom->led.field, \ ··· 773 773 static ssize_t wacom_button_image_store(struct device *dev, int button_id, 774 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 777 struct wacom *wacom = hid_get_drvdata(hdev); 778 778 int err; 779 779 unsigned len; ··· 1097 1097 struct device_attribute 1098 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 1101 struct wacom *wacom = hid_get_drvdata(hdev); 1102 1102 1103 1103 return snprintf(buf, PAGE_SIZE, "%i\n", wacom->wacom_wac.bt_high_speed); ··· 1107 1107 struct device_attribute *attr, 1108 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 1111 struct wacom *wacom = hid_get_drvdata(hdev); 1112 1112 u8 new_speed; 1113 1113 ··· 1131 1131 char *buf, int index) 1132 1132 { 1133 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 1135 struct wacom *wacom = hid_get_drvdata(hdev); 1136 1136 u8 mode; 1137 1137 ··· 1242 1242 { 1243 1243 unsigned char selector = 0; 1244 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 1246 struct wacom *wacom = hid_get_drvdata(hdev); 1247 1247 int err; 1248 1248