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>
This commit is contained in:

committed by
Jiri Kosina

parent
d8ce9bf555
commit
ee79a8f840
@@ -686,7 +686,7 @@ out:
|
||||
static ssize_t wacom_led_select_store(struct device *dev, int set_id,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
|
||||
struct hid_device *hdev = to_hid_device(dev);
|
||||
struct wacom *wacom = hid_get_drvdata(hdev);
|
||||
unsigned int id;
|
||||
int err;
|
||||
@@ -714,7 +714,7 @@ static ssize_t wacom_led##SET_ID##_select_store(struct device *dev, \
|
||||
static ssize_t wacom_led##SET_ID##_select_show(struct device *dev, \
|
||||
struct device_attribute *attr, char *buf) \
|
||||
{ \
|
||||
struct hid_device *hdev = container_of(dev, struct hid_device, dev);\
|
||||
struct hid_device *hdev = to_hid_device(dev);\
|
||||
struct wacom *wacom = hid_get_drvdata(hdev); \
|
||||
return scnprintf(buf, PAGE_SIZE, "%d\n", \
|
||||
wacom->led.select[SET_ID]); \
|
||||
@@ -750,7 +750,7 @@ static ssize_t wacom_luminance_store(struct wacom *wacom, u8 *dest,
|
||||
static ssize_t wacom_##name##_luminance_store(struct device *dev, \
|
||||
struct device_attribute *attr, const char *buf, size_t count) \
|
||||
{ \
|
||||
struct hid_device *hdev = container_of(dev, struct hid_device, dev);\
|
||||
struct hid_device *hdev = to_hid_device(dev);\
|
||||
struct wacom *wacom = hid_get_drvdata(hdev); \
|
||||
\
|
||||
return wacom_luminance_store(wacom, &wacom->led.field, \
|
||||
@@ -773,7 +773,7 @@ DEVICE_LUMINANCE_ATTR(buttons, img_lum);
|
||||
static ssize_t wacom_button_image_store(struct device *dev, int button_id,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
|
||||
struct hid_device *hdev = to_hid_device(dev);
|
||||
struct wacom *wacom = hid_get_drvdata(hdev);
|
||||
int err;
|
||||
unsigned len;
|
||||
@@ -1097,7 +1097,7 @@ static ssize_t wacom_show_speed(struct device *dev,
|
||||
struct device_attribute
|
||||
*attr, char *buf)
|
||||
{
|
||||
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
|
||||
struct hid_device *hdev = to_hid_device(dev);
|
||||
struct wacom *wacom = hid_get_drvdata(hdev);
|
||||
|
||||
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,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
|
||||
struct hid_device *hdev = to_hid_device(dev);
|
||||
struct wacom *wacom = hid_get_drvdata(hdev);
|
||||
u8 new_speed;
|
||||
|
||||
@@ -1131,7 +1131,7 @@ static ssize_t wacom_show_remote_mode(struct kobject *kobj,
|
||||
char *buf, int index)
|
||||
{
|
||||
struct device *dev = container_of(kobj->parent, struct device, kobj);
|
||||
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
|
||||
struct hid_device *hdev = to_hid_device(dev);
|
||||
struct wacom *wacom = hid_get_drvdata(hdev);
|
||||
u8 mode;
|
||||
|
||||
@@ -1242,7 +1242,7 @@ static ssize_t wacom_store_unpair_remote(struct kobject *kobj,
|
||||
{
|
||||
unsigned char selector = 0;
|
||||
struct device *dev = container_of(kobj->parent, struct device, kobj);
|
||||
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
|
||||
struct hid_device *hdev = to_hid_device(dev);
|
||||
struct wacom *wacom = hid_get_drvdata(hdev);
|
||||
int err;
|
||||
|
||||
|
Reference in New Issue
Block a user