summaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorGeliang Tang <geliangtang@163.com>2015-12-27 10:25:22 +0100
committerJiri Kosina <jkosina@suse.cz>2015-12-28 13:41:50 +0100
commitba91a96718d17160890e161f702db6e60747248a (patch)
tree6af58c2933d66bbcf4bdb40445ccbe68d2029c95 /drivers/hid
parentHID: use to_hid_device() (diff)
downloadlinux-ba91a96718d17160890e161f702db6e60747248a.tar.xz
linux-ba91a96718d17160890e161f702db6e60747248a.zip
HID: add a new helper to_hid_driver()
Add a new helper to_hid_driver() and use it in hid-core.c. Signed-off-by: Geliang Tang <geliangtang@163.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-core.c7
1 files changed, 3 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 {
static ssize_t store_new_id(struct device_driver *drv, const char *buf,
size_t count)
{
- struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver);
+ struct hid_driver *hdrv = to_hid_driver(drv);
struct hid_dynid *dynid;
__u32 bus, vendor, product;
unsigned long driver_data = 0;
@@ -2139,7 +2139,7 @@ static const struct hid_device_id *hid_match_device(struct hid_device *hdev,
static int hid_bus_match(struct device *dev, struct device_driver *drv)
{
- struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver);
+ struct hid_driver *hdrv = to_hid_driver(drv);
struct hid_device *hdev = to_hid_device(dev);
return hid_match_device(hdev, hdrv) != NULL;
@@ -2147,8 +2147,7 @@ static int hid_bus_match(struct device *dev, struct device_driver *drv)
static int hid_device_probe(struct device *dev)
{
- struct hid_driver *hdrv = container_of(dev->driver,
- struct hid_driver, driver);
+ struct hid_driver *hdrv = to_hid_driver(dev->driver);
struct hid_device *hdev = to_hid_device(dev);
const struct hid_device_id *id;
int ret = 0;