Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1297463

[PATCH 1/4] USB: core, devio: use to_usb_device

From Geliang Tang <geliangtang@163.com>
Newsgroups linux.kernel
Subject [PATCH 1/4] USB: core, devio: use to_usb_device
Date 2015-12-23 14:30 +0100
Message-ID <qIREl-1LV-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Use to_usb_device() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 drivers/usb/core/devio.c | 2 +-
 drivers/usb/core/usb.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 59e7a33..c47d36a 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -848,7 +848,7 @@ static struct usb_device *usbdev_lookup_by_devt(dev_t devt)
 			      (void *) (unsigned long) devt, match_devt);
 	if (!dev)
 		return NULL;
-	return container_of(dev, struct usb_device, dev);
+	return to_usb_device(dev);
 }
 
 /*
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 77e4c9b..f25de6c 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -241,7 +241,7 @@ static int __each_dev(struct device *dev, void *data)
 	if (!is_usb_device(dev))
 		return 0;
 
-	return arg->fn(container_of(dev, struct usb_device, dev), arg->data);
+	return arg->fn(to_usb_device(dev), arg->data);
 }
 
 /**
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/4] USB: core, devio: use to_usb_device Geliang Tang <geliangtang@163.com> - 2015-12-23 14:30 +0100
  [PATCH 4/4] HID: usbhid: use to_usb_device Geliang Tang <geliangtang@163.com> - 2015-12-23 14:30 +0100
    Re: [PATCH 4/4] HID: usbhid: use to_usb_device Jiri Kosina <jikos@kernel.org> - 2015-12-28 13:20 +0100
  [PATCH 2/4] USB: core, wusbcore: use bus_to_hcd Geliang Tang <geliangtang@163.com> - 2015-12-23 14:30 +0100
  [PATCH 3/4] USB: host: use to_platform_device Geliang Tang <geliangtang@163.com> - 2015-12-23 14:40 +0100

csiph-web