diff options
| -rw-r--r-- | drivers/hid/hid-core.c | 7 | ||||
| -rw-r--r-- | include/linux/hid.h | 3 |
2 files changed, 6 insertions, 4 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index a6e24e00a37b..9d75205a511e 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
| @@ -2077,7 +2077,7 @@ struct hid_dynid { | |||
| 2077 | static ssize_t store_new_id(struct device_driver *drv, const char *buf, | 2077 | static ssize_t store_new_id(struct device_driver *drv, const char *buf, |
| 2078 | size_t count) | 2078 | size_t count) |
| 2079 | { | 2079 | { |
| 2080 | struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); | 2080 | struct hid_driver *hdrv = to_hid_driver(drv); |
| 2081 | struct hid_dynid *dynid; | 2081 | struct hid_dynid *dynid; |
| 2082 | __u32 bus, vendor, product; | 2082 | __u32 bus, vendor, product; |
| 2083 | unsigned long driver_data = 0; | 2083 | unsigned long driver_data = 0; |
| @@ -2139,7 +2139,7 @@ static const struct hid_device_id *hid_match_device(struct hid_device *hdev, | |||
| 2139 | 2139 | ||
| 2140 | static int hid_bus_match(struct device *dev, struct device_driver *drv) | 2140 | static 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 = to_hid_driver(drv); |
| 2143 | struct hid_device *hdev = to_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; |
| @@ -2147,8 +2147,7 @@ static int hid_bus_match(struct device *dev, struct device_driver *drv) | |||
| 2147 | 2147 | ||
| 2148 | static int hid_device_probe(struct device *dev) | 2148 | static int hid_device_probe(struct device *dev) |
| 2149 | { | 2149 | { |
| 2150 | struct hid_driver *hdrv = container_of(dev->driver, | 2150 | struct hid_driver *hdrv = to_hid_driver(dev->driver); |
| 2151 | struct hid_driver, driver); | ||
| 2152 | struct hid_device *hdev = to_hid_device(dev); | 2151 | struct hid_device *hdev = to_hid_device(dev); |
| 2153 | const struct hid_device_id *id; | 2152 | const struct hid_device_id *id; |
| 2154 | int ret = 0; | 2153 | int ret = 0; |
diff --git a/include/linux/hid.h b/include/linux/hid.h index 1472026367ed..75b66eccc692 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
| @@ -717,6 +717,9 @@ struct hid_driver { | |||
| 717 | struct device_driver driver; | 717 | struct device_driver driver; |
| 718 | }; | 718 | }; |
| 719 | 719 | ||
| 720 | #define to_hid_driver(pdrv) \ | ||
| 721 | container_of(pdrv, struct hid_driver, driver) | ||
| 722 | |||
| 720 | /** | 723 | /** |
| 721 | * hid_ll_driver - low level driver callbacks | 724 | * hid_ll_driver - low level driver callbacks |
| 722 | * @start: called on probe to start the device | 725 | * @start: called on probe to start the device |
