diff options
author | Geliang Tang <geliangtang@163.com> | 2015-12-27 04:25:24 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2015-12-28 07:41:51 -0500 |
commit | 2cf83833fc9cff04c50e402260b724b3f001d737 (patch) | |
tree | 6e0d76a5c4ab8d408665bacd2699cb9cd304aefb | |
parent | d98ba98c4fbff91abb37eef628ccce0c218b4185 (diff) |
HID: use kobj_to_dev()
Use kobj_to_dev() instead of open-coding it.
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/hid-core.c | 2 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-arvo.c | 6 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-common.c | 6 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-isku.c | 6 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-kone.c | 12 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-koneplus.c | 12 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-kovaplus.c | 12 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-lua.c | 4 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-pyra.c | 15 | ||||
-rw-r--r-- | drivers/hid/wacom_sys.c | 4 |
10 files changed, 28 insertions, 51 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 9d75205a511e..e847fb7f5d5d 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1571,7 +1571,7 @@ read_report_descriptor(struct file *filp, struct kobject *kobj, | |||
1571 | struct bin_attribute *attr, | 1571 | struct bin_attribute *attr, |
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 = kobj_to_dev(kobj); |
1575 | struct hid_device *hdev = to_hid_device(dev); | 1575 | struct hid_device *hdev = to_hid_device(dev); |
1576 | 1576 | ||
1577 | if (off >= hdev->rsize) | 1577 | if (off >= hdev->rsize) |
diff --git a/drivers/hid/hid-roccat-arvo.c b/drivers/hid/hid-roccat-arvo.c index 1948208fe038..329c5d1270f9 100644 --- a/drivers/hid/hid-roccat-arvo.c +++ b/drivers/hid/hid-roccat-arvo.c | |||
@@ -191,8 +191,7 @@ static ssize_t arvo_sysfs_write(struct file *fp, | |||
191 | struct kobject *kobj, void const *buf, | 191 | struct kobject *kobj, void const *buf, |
192 | loff_t off, size_t count, size_t real_size, uint command) | 192 | loff_t off, size_t count, size_t real_size, uint command) |
193 | { | 193 | { |
194 | struct device *dev = | 194 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
195 | container_of(kobj, struct device, kobj)->parent->parent; | ||
196 | struct arvo_device *arvo = hid_get_drvdata(dev_get_drvdata(dev)); | 195 | struct arvo_device *arvo = hid_get_drvdata(dev_get_drvdata(dev)); |
197 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 196 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
198 | int retval; | 197 | int retval; |
@@ -211,8 +210,7 @@ static ssize_t arvo_sysfs_read(struct file *fp, | |||
211 | struct kobject *kobj, void *buf, loff_t off, | 210 | struct kobject *kobj, void *buf, loff_t off, |
212 | size_t count, size_t real_size, uint command) | 211 | size_t count, size_t real_size, uint command) |
213 | { | 212 | { |
214 | struct device *dev = | 213 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
215 | container_of(kobj, struct device, kobj)->parent->parent; | ||
216 | struct arvo_device *arvo = hid_get_drvdata(dev_get_drvdata(dev)); | 214 | struct arvo_device *arvo = hid_get_drvdata(dev_get_drvdata(dev)); |
217 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 215 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
218 | int retval; | 216 | int retval; |
diff --git a/drivers/hid/hid-roccat-common.c b/drivers/hid/hid-roccat-common.c index 02e28e9f4ea7..8155ac5fede2 100644 --- a/drivers/hid/hid-roccat-common.c +++ b/drivers/hid/hid-roccat-common.c | |||
@@ -134,8 +134,7 @@ ssize_t roccat_common2_sysfs_read(struct file *fp, struct kobject *kobj, | |||
134 | char *buf, loff_t off, size_t count, | 134 | char *buf, loff_t off, size_t count, |
135 | size_t real_size, uint command) | 135 | size_t real_size, uint command) |
136 | { | 136 | { |
137 | struct device *dev = | 137 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
138 | container_of(kobj, struct device, kobj)->parent->parent; | ||
139 | struct roccat_common2_device *roccat_dev = hid_get_drvdata(dev_get_drvdata(dev)); | 138 | struct roccat_common2_device *roccat_dev = hid_get_drvdata(dev_get_drvdata(dev)); |
140 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 139 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
141 | int retval; | 140 | int retval; |
@@ -158,8 +157,7 @@ ssize_t roccat_common2_sysfs_write(struct file *fp, struct kobject *kobj, | |||
158 | void const *buf, loff_t off, size_t count, | 157 | void const *buf, loff_t off, size_t count, |
159 | size_t real_size, uint command) | 158 | size_t real_size, uint command) |
160 | { | 159 | { |
161 | struct device *dev = | 160 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
162 | container_of(kobj, struct device, kobj)->parent->parent; | ||
163 | struct roccat_common2_device *roccat_dev = hid_get_drvdata(dev_get_drvdata(dev)); | 161 | struct roccat_common2_device *roccat_dev = hid_get_drvdata(dev_get_drvdata(dev)); |
164 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 162 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
165 | int retval; | 163 | int retval; |
diff --git a/drivers/hid/hid-roccat-isku.c b/drivers/hid/hid-roccat-isku.c index bc62ed91e451..02db537f8f3e 100644 --- a/drivers/hid/hid-roccat-isku.c +++ b/drivers/hid/hid-roccat-isku.c | |||
@@ -121,8 +121,7 @@ static ssize_t isku_sysfs_read(struct file *fp, struct kobject *kobj, | |||
121 | char *buf, loff_t off, size_t count, | 121 | char *buf, loff_t off, size_t count, |
122 | size_t real_size, uint command) | 122 | size_t real_size, uint command) |
123 | { | 123 | { |
124 | struct device *dev = | 124 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
125 | container_of(kobj, struct device, kobj)->parent->parent; | ||
126 | struct isku_device *isku = hid_get_drvdata(dev_get_drvdata(dev)); | 125 | struct isku_device *isku = hid_get_drvdata(dev_get_drvdata(dev)); |
127 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 126 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
128 | int retval; | 127 | int retval; |
@@ -144,8 +143,7 @@ static ssize_t isku_sysfs_write(struct file *fp, struct kobject *kobj, | |||
144 | void const *buf, loff_t off, size_t count, | 143 | void const *buf, loff_t off, size_t count, |
145 | size_t real_size, uint command) | 144 | size_t real_size, uint command) |
146 | { | 145 | { |
147 | struct device *dev = | 146 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
148 | container_of(kobj, struct device, kobj)->parent->parent; | ||
149 | struct isku_device *isku = hid_get_drvdata(dev_get_drvdata(dev)); | 147 | struct isku_device *isku = hid_get_drvdata(dev_get_drvdata(dev)); |
150 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 148 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
151 | int retval; | 149 | int retval; |
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c index c29265055ac1..bf4675a27396 100644 --- a/drivers/hid/hid-roccat-kone.c +++ b/drivers/hid/hid-roccat-kone.c | |||
@@ -269,8 +269,7 @@ static int kone_get_firmware_version(struct usb_device *usb_dev, int *result) | |||
269 | static ssize_t kone_sysfs_read_settings(struct file *fp, struct kobject *kobj, | 269 | static ssize_t kone_sysfs_read_settings(struct file *fp, struct kobject *kobj, |
270 | struct bin_attribute *attr, char *buf, | 270 | struct bin_attribute *attr, char *buf, |
271 | loff_t off, size_t count) { | 271 | loff_t off, size_t count) { |
272 | struct device *dev = | 272 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
273 | container_of(kobj, struct device, kobj)->parent->parent; | ||
274 | struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); | 273 | struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); |
275 | 274 | ||
276 | if (off >= sizeof(struct kone_settings)) | 275 | if (off >= sizeof(struct kone_settings)) |
@@ -294,8 +293,7 @@ static ssize_t kone_sysfs_read_settings(struct file *fp, struct kobject *kobj, | |||
294 | static ssize_t kone_sysfs_write_settings(struct file *fp, struct kobject *kobj, | 293 | static ssize_t kone_sysfs_write_settings(struct file *fp, struct kobject *kobj, |
295 | struct bin_attribute *attr, char *buf, | 294 | struct bin_attribute *attr, char *buf, |
296 | loff_t off, size_t count) { | 295 | loff_t off, size_t count) { |
297 | struct device *dev = | 296 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
298 | container_of(kobj, struct device, kobj)->parent->parent; | ||
299 | struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); | 297 | struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); |
300 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 298 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
301 | int retval = 0, difference, old_profile; | 299 | int retval = 0, difference, old_profile; |
@@ -332,8 +330,7 @@ static BIN_ATTR(settings, 0660, kone_sysfs_read_settings, | |||
332 | static ssize_t kone_sysfs_read_profilex(struct file *fp, | 330 | static ssize_t kone_sysfs_read_profilex(struct file *fp, |
333 | struct kobject *kobj, struct bin_attribute *attr, | 331 | struct kobject *kobj, struct bin_attribute *attr, |
334 | char *buf, loff_t off, size_t count) { | 332 | char *buf, loff_t off, size_t count) { |
335 | struct device *dev = | 333 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
336 | container_of(kobj, struct device, kobj)->parent->parent; | ||
337 | struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); | 334 | struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); |
338 | 335 | ||
339 | if (off >= sizeof(struct kone_profile)) | 336 | if (off >= sizeof(struct kone_profile)) |
@@ -353,8 +350,7 @@ static ssize_t kone_sysfs_read_profilex(struct file *fp, | |||
353 | static ssize_t kone_sysfs_write_profilex(struct file *fp, | 350 | static ssize_t kone_sysfs_write_profilex(struct file *fp, |
354 | struct kobject *kobj, struct bin_attribute *attr, | 351 | struct kobject *kobj, struct bin_attribute *attr, |
355 | char *buf, loff_t off, size_t count) { | 352 | char *buf, loff_t off, size_t count) { |
356 | struct device *dev = | 353 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
357 | container_of(kobj, struct device, kobj)->parent->parent; | ||
358 | struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); | 354 | struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); |
359 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 355 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
360 | struct kone_profile *profile; | 356 | struct kone_profile *profile; |
diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c index 5e99fcdc71b9..09e8fc72aa1d 100644 --- a/drivers/hid/hid-roccat-koneplus.c +++ b/drivers/hid/hid-roccat-koneplus.c | |||
@@ -87,8 +87,7 @@ static ssize_t koneplus_sysfs_read(struct file *fp, struct kobject *kobj, | |||
87 | char *buf, loff_t off, size_t count, | 87 | char *buf, loff_t off, size_t count, |
88 | size_t real_size, uint command) | 88 | size_t real_size, uint command) |
89 | { | 89 | { |
90 | struct device *dev = | 90 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
91 | container_of(kobj, struct device, kobj)->parent->parent; | ||
92 | struct koneplus_device *koneplus = hid_get_drvdata(dev_get_drvdata(dev)); | 91 | struct koneplus_device *koneplus = hid_get_drvdata(dev_get_drvdata(dev)); |
93 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 92 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
94 | int retval; | 93 | int retval; |
@@ -113,8 +112,7 @@ static ssize_t koneplus_sysfs_write(struct file *fp, struct kobject *kobj, | |||
113 | void const *buf, loff_t off, size_t count, | 112 | void const *buf, loff_t off, size_t count, |
114 | size_t real_size, uint command) | 113 | size_t real_size, uint command) |
115 | { | 114 | { |
116 | struct device *dev = | 115 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
117 | container_of(kobj, struct device, kobj)->parent->parent; | ||
118 | struct koneplus_device *koneplus = hid_get_drvdata(dev_get_drvdata(dev)); | 116 | struct koneplus_device *koneplus = hid_get_drvdata(dev_get_drvdata(dev)); |
119 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 117 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
120 | int retval; | 118 | int retval; |
@@ -193,8 +191,7 @@ static ssize_t koneplus_sysfs_read_profilex_settings(struct file *fp, | |||
193 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | 191 | struct kobject *kobj, struct bin_attribute *attr, char *buf, |
194 | loff_t off, size_t count) | 192 | loff_t off, size_t count) |
195 | { | 193 | { |
196 | struct device *dev = | 194 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
197 | container_of(kobj, struct device, kobj)->parent->parent; | ||
198 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 195 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
199 | ssize_t retval; | 196 | ssize_t retval; |
200 | 197 | ||
@@ -212,8 +209,7 @@ static ssize_t koneplus_sysfs_read_profilex_buttons(struct file *fp, | |||
212 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | 209 | struct kobject *kobj, struct bin_attribute *attr, char *buf, |
213 | loff_t off, size_t count) | 210 | loff_t off, size_t count) |
214 | { | 211 | { |
215 | struct device *dev = | 212 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
216 | container_of(kobj, struct device, kobj)->parent->parent; | ||
217 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 213 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
218 | ssize_t retval; | 214 | ssize_t retval; |
219 | 215 | ||
diff --git a/drivers/hid/hid-roccat-kovaplus.c b/drivers/hid/hid-roccat-kovaplus.c index 966047711fbf..43617fb28b87 100644 --- a/drivers/hid/hid-roccat-kovaplus.c +++ b/drivers/hid/hid-roccat-kovaplus.c | |||
@@ -128,8 +128,7 @@ static ssize_t kovaplus_sysfs_read(struct file *fp, struct kobject *kobj, | |||
128 | char *buf, loff_t off, size_t count, | 128 | char *buf, loff_t off, size_t count, |
129 | size_t real_size, uint command) | 129 | size_t real_size, uint command) |
130 | { | 130 | { |
131 | struct device *dev = | 131 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
132 | container_of(kobj, struct device, kobj)->parent->parent; | ||
133 | struct kovaplus_device *kovaplus = hid_get_drvdata(dev_get_drvdata(dev)); | 132 | struct kovaplus_device *kovaplus = hid_get_drvdata(dev_get_drvdata(dev)); |
134 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 133 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
135 | int retval; | 134 | int retval; |
@@ -154,8 +153,7 @@ static ssize_t kovaplus_sysfs_write(struct file *fp, struct kobject *kobj, | |||
154 | void const *buf, loff_t off, size_t count, | 153 | void const *buf, loff_t off, size_t count, |
155 | size_t real_size, uint command) | 154 | size_t real_size, uint command) |
156 | { | 155 | { |
157 | struct device *dev = | 156 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
158 | container_of(kobj, struct device, kobj)->parent->parent; | ||
159 | struct kovaplus_device *kovaplus = hid_get_drvdata(dev_get_drvdata(dev)); | 157 | struct kovaplus_device *kovaplus = hid_get_drvdata(dev_get_drvdata(dev)); |
160 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 158 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
161 | int retval; | 159 | int retval; |
@@ -221,8 +219,7 @@ static ssize_t kovaplus_sysfs_read_profilex_settings(struct file *fp, | |||
221 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | 219 | struct kobject *kobj, struct bin_attribute *attr, char *buf, |
222 | loff_t off, size_t count) | 220 | loff_t off, size_t count) |
223 | { | 221 | { |
224 | struct device *dev = | 222 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
225 | container_of(kobj, struct device, kobj)->parent->parent; | ||
226 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 223 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
227 | ssize_t retval; | 224 | ssize_t retval; |
228 | 225 | ||
@@ -240,8 +237,7 @@ static ssize_t kovaplus_sysfs_read_profilex_buttons(struct file *fp, | |||
240 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | 237 | struct kobject *kobj, struct bin_attribute *attr, char *buf, |
241 | loff_t off, size_t count) | 238 | loff_t off, size_t count) |
242 | { | 239 | { |
243 | struct device *dev = | 240 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
244 | container_of(kobj, struct device, kobj)->parent->parent; | ||
245 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 241 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
246 | ssize_t retval; | 242 | ssize_t retval; |
247 | 243 | ||
diff --git a/drivers/hid/hid-roccat-lua.c b/drivers/hid/hid-roccat-lua.c index 65e2e76bf2fe..ac1a7313e259 100644 --- a/drivers/hid/hid-roccat-lua.c +++ b/drivers/hid/hid-roccat-lua.c | |||
@@ -30,7 +30,7 @@ static ssize_t lua_sysfs_read(struct file *fp, struct kobject *kobj, | |||
30 | char *buf, loff_t off, size_t count, | 30 | char *buf, loff_t off, size_t count, |
31 | size_t real_size, uint command) | 31 | size_t real_size, uint command) |
32 | { | 32 | { |
33 | struct device *dev = container_of(kobj, struct device, kobj); | 33 | struct device *dev = kobj_to_dev(kobj); |
34 | struct lua_device *lua = hid_get_drvdata(dev_get_drvdata(dev)); | 34 | struct lua_device *lua = hid_get_drvdata(dev_get_drvdata(dev)); |
35 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 35 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
36 | int retval; | 36 | int retval; |
@@ -52,7 +52,7 @@ static ssize_t lua_sysfs_write(struct file *fp, struct kobject *kobj, | |||
52 | void const *buf, loff_t off, size_t count, | 52 | void const *buf, loff_t off, size_t count, |
53 | size_t real_size, uint command) | 53 | size_t real_size, uint command) |
54 | { | 54 | { |
55 | struct device *dev = container_of(kobj, struct device, kobj); | 55 | struct device *dev = kobj_to_dev(kobj); |
56 | struct lua_device *lua = hid_get_drvdata(dev_get_drvdata(dev)); | 56 | struct lua_device *lua = hid_get_drvdata(dev_get_drvdata(dev)); |
57 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 57 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
58 | int retval; | 58 | int retval; |
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c index 47d7e74231e5..b30aa7b82bf8 100644 --- a/drivers/hid/hid-roccat-pyra.c +++ b/drivers/hid/hid-roccat-pyra.c | |||
@@ -90,8 +90,7 @@ static ssize_t pyra_sysfs_read(struct file *fp, struct kobject *kobj, | |||
90 | char *buf, loff_t off, size_t count, | 90 | char *buf, loff_t off, size_t count, |
91 | size_t real_size, uint command) | 91 | size_t real_size, uint command) |
92 | { | 92 | { |
93 | struct device *dev = | 93 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
94 | container_of(kobj, struct device, kobj)->parent->parent; | ||
95 | struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); | 94 | struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); |
96 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 95 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
97 | int retval; | 96 | int retval; |
@@ -116,8 +115,7 @@ static ssize_t pyra_sysfs_write(struct file *fp, struct kobject *kobj, | |||
116 | void const *buf, loff_t off, size_t count, | 115 | void const *buf, loff_t off, size_t count, |
117 | size_t real_size, uint command) | 116 | size_t real_size, uint command) |
118 | { | 117 | { |
119 | struct device *dev = | 118 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
120 | container_of(kobj, struct device, kobj)->parent->parent; | ||
121 | struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); | 119 | struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); |
122 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 120 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
123 | int retval; | 121 | int retval; |
@@ -191,8 +189,7 @@ static ssize_t pyra_sysfs_read_profilex_settings(struct file *fp, | |||
191 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | 189 | struct kobject *kobj, struct bin_attribute *attr, char *buf, |
192 | loff_t off, size_t count) | 190 | loff_t off, size_t count) |
193 | { | 191 | { |
194 | struct device *dev = | 192 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
195 | container_of(kobj, struct device, kobj)->parent->parent; | ||
196 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 193 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
197 | ssize_t retval; | 194 | ssize_t retval; |
198 | 195 | ||
@@ -210,8 +207,7 @@ static ssize_t pyra_sysfs_read_profilex_buttons(struct file *fp, | |||
210 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | 207 | struct kobject *kobj, struct bin_attribute *attr, char *buf, |
211 | loff_t off, size_t count) | 208 | loff_t off, size_t count) |
212 | { | 209 | { |
213 | struct device *dev = | 210 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
214 | container_of(kobj, struct device, kobj)->parent->parent; | ||
215 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 211 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
216 | ssize_t retval; | 212 | ssize_t retval; |
217 | 213 | ||
@@ -248,8 +244,7 @@ static ssize_t pyra_sysfs_write_settings(struct file *fp, | |||
248 | struct kobject *kobj, struct bin_attribute *attr, char *buf, | 244 | struct kobject *kobj, struct bin_attribute *attr, char *buf, |
249 | loff_t off, size_t count) | 245 | loff_t off, size_t count) |
250 | { | 246 | { |
251 | struct device *dev = | 247 | struct device *dev = kobj_to_dev(kobj)->parent->parent; |
252 | container_of(kobj, struct device, kobj)->parent->parent; | ||
253 | struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); | 248 | struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); |
254 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 249 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
255 | int retval = 0; | 250 | int retval = 0; |
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 4b7feb3022c1..a90de9b5d489 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
@@ -1130,7 +1130,7 @@ static ssize_t wacom_show_remote_mode(struct kobject *kobj, | |||
1130 | struct kobj_attribute *kattr, | 1130 | struct kobj_attribute *kattr, |
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 = kobj_to_dev(kobj->parent); |
1134 | struct hid_device *hdev = to_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; |
@@ -1241,7 +1241,7 @@ static ssize_t wacom_store_unpair_remote(struct kobject *kobj, | |||
1241 | const char *buf, size_t count) | 1241 | const char *buf, size_t count) |
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 = kobj_to_dev(kobj->parent); |
1245 | struct hid_device *hdev = to_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; |