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
@@ -625,7 +625,7 @@ static void hid_close_report(struct hid_device *device)
|
||||
|
||||
static void hid_device_release(struct device *dev)
|
||||
{
|
||||
struct hid_device *hid = container_of(dev, struct hid_device, dev);
|
||||
struct hid_device *hid = to_hid_device(dev);
|
||||
|
||||
hid_close_report(hid);
|
||||
kfree(hid->dev_rdesc);
|
||||
@@ -1572,7 +1572,7 @@ read_report_descriptor(struct file *filp, struct kobject *kobj,
|
||||
char *buf, loff_t off, size_t count)
|
||||
{
|
||||
struct device *dev = container_of(kobj, struct device, kobj);
|
||||
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
|
||||
struct hid_device *hdev = to_hid_device(dev);
|
||||
|
||||
if (off >= hdev->rsize)
|
||||
return 0;
|
||||
@@ -1589,7 +1589,7 @@ static ssize_t
|
||||
show_country(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);
|
||||
|
||||
return sprintf(buf, "%02x\n", hdev->country & 0xff);
|
||||
}
|
||||
@@ -2140,7 +2140,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_device *hdev = container_of(dev, struct hid_device, dev);
|
||||
struct hid_device *hdev = to_hid_device(dev);
|
||||
|
||||
return hid_match_device(hdev, hdrv) != NULL;
|
||||
}
|
||||
@@ -2149,7 +2149,7 @@ static int hid_device_probe(struct device *dev)
|
||||
{
|
||||
struct hid_driver *hdrv = container_of(dev->driver,
|
||||
struct hid_driver, driver);
|
||||
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
|
||||
struct hid_device *hdev = to_hid_device(dev);
|
||||
const struct hid_device_id *id;
|
||||
int ret = 0;
|
||||
|
||||
@@ -2191,7 +2191,7 @@ unlock_driver_lock:
|
||||
|
||||
static int hid_device_remove(struct device *dev)
|
||||
{
|
||||
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
|
||||
struct hid_device *hdev = to_hid_device(dev);
|
||||
struct hid_driver *hdrv;
|
||||
int ret = 0;
|
||||
|
||||
@@ -2241,7 +2241,7 @@ ATTRIBUTE_GROUPS(hid_dev);
|
||||
|
||||
static int hid_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||
{
|
||||
struct hid_device *hdev = container_of(dev, struct hid_device, dev);
|
||||
struct hid_device *hdev = to_hid_device(dev);
|
||||
|
||||
if (add_uevent_var(env, "HID_ID=%04X:%08X:%08X",
|
||||
hdev->bus, hdev->vendor, hdev->product))
|
||||
|
||||
Reference in New Issue
Block a user