浏览代码

usb: core: introduce a new usb_get_std_status() helper

This new helper is a simple wrapper around usb_get_status(). This
patch is in preparation to adding support for fetching PTM_STATUS
types. No functional changes.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Felipe Balbi 7 年之前
父节点
当前提交
d9e1e1484a
共有 5 个文件被更改,包括 19 次插入12 次删除
  1. 2 2
      drivers/staging/wlan-ng/hfa384x_usb.c
  2. 2 2
      drivers/usb/core/driver.c
  3. 4 4
      drivers/usb/core/hub.c
  4. 4 4
      drivers/usb/misc/usbtest.c
  5. 7 0
      include/linux/usb.h

+ 2 - 2
drivers/staging/wlan-ng/hfa384x_usb.c

@@ -2460,7 +2460,7 @@ int hfa384x_drvr_start(struct hfa384x *hw)
 	 * ok
 	 * ok
 	 */
 	 */
 	result =
 	result =
-	    usb_get_status(hw->usb, USB_RECIP_ENDPOINT, hw->endp_in, &status);
+	    usb_get_std_status(hw->usb, USB_RECIP_ENDPOINT, hw->endp_in, &status);
 	if (result < 0) {
 	if (result < 0) {
 		netdev_err(hw->wlandev->netdev, "Cannot get bulk in endpoint status.\n");
 		netdev_err(hw->wlandev->netdev, "Cannot get bulk in endpoint status.\n");
 		goto done;
 		goto done;
@@ -2469,7 +2469,7 @@ int hfa384x_drvr_start(struct hfa384x *hw)
 		netdev_err(hw->wlandev->netdev, "Failed to reset bulk in endpoint.\n");
 		netdev_err(hw->wlandev->netdev, "Failed to reset bulk in endpoint.\n");
 
 
 	result =
 	result =
-	    usb_get_status(hw->usb, USB_RECIP_ENDPOINT, hw->endp_out, &status);
+	    usb_get_std_status(hw->usb, USB_RECIP_ENDPOINT, hw->endp_out, &status);
 	if (result < 0) {
 	if (result < 0) {
 		netdev_err(hw->wlandev->netdev, "Cannot get bulk out endpoint status.\n");
 		netdev_err(hw->wlandev->netdev, "Cannot get bulk out endpoint status.\n");
 		goto done;
 		goto done;

+ 2 - 2
drivers/usb/core/driver.c

@@ -1340,8 +1340,8 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
 			int err;
 			int err;
 			u16 devstat;
 			u16 devstat;
 
 
-			err = usb_get_status(udev, USB_RECIP_DEVICE, 0,
-					     &devstat);
+			err = usb_get_std_status(udev, USB_RECIP_DEVICE, 0,
+						 &devstat);
 			if (err) {
 			if (err) {
 				dev_err(&udev->dev,
 				dev_err(&udev->dev,
 					"Failed to suspend device, error %d\n",
 					"Failed to suspend device, error %d\n",

+ 4 - 4
drivers/usb/core/hub.c

@@ -1482,7 +1482,7 @@ static int hub_configure(struct usb_hub *hub,
 	/* power budgeting mostly matters with bus-powered hubs,
 	/* power budgeting mostly matters with bus-powered hubs,
 	 * and battery-powered root hubs (may provide just 8 mA).
 	 * and battery-powered root hubs (may provide just 8 mA).
 	 */
 	 */
-	ret = usb_get_status(hdev, USB_RECIP_DEVICE, 0, &hubstatus);
+	ret = usb_get_std_status(hdev, USB_RECIP_DEVICE, 0, &hubstatus);
 	if (ret) {
 	if (ret) {
 		message = "can't get hub status";
 		message = "can't get hub status";
 		goto fail;
 		goto fail;
@@ -3279,7 +3279,7 @@ static int finish_port_resume(struct usb_device *udev)
 	 */
 	 */
 	if (status == 0) {
 	if (status == 0) {
 		devstatus = 0;
 		devstatus = 0;
-		status = usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus);
+		status = usb_get_std_status(udev, USB_RECIP_DEVICE, 0, &devstatus);
 
 
 		/* If a normal resume failed, try doing a reset-resume */
 		/* If a normal resume failed, try doing a reset-resume */
 		if (status && !udev->reset_resume && udev->persist_enabled) {
 		if (status && !udev->reset_resume && udev->persist_enabled) {
@@ -3303,7 +3303,7 @@ static int finish_port_resume(struct usb_device *udev)
 			if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP))
 			if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP))
 				status = usb_disable_remote_wakeup(udev);
 				status = usb_disable_remote_wakeup(udev);
 		} else {
 		} else {
-			status = usb_get_status(udev, USB_RECIP_INTERFACE, 0,
+			status = usb_get_std_status(udev, USB_RECIP_INTERFACE, 0,
 					&devstatus);
 					&devstatus);
 			if (!status && devstatus & (USB_INTRF_STAT_FUNC_RW_CAP
 			if (!status && devstatus & (USB_INTRF_STAT_FUNC_RW_CAP
 					| USB_INTRF_STAT_FUNC_RW))
 					| USB_INTRF_STAT_FUNC_RW))
@@ -4866,7 +4866,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
 				&& udev->bus_mA <= unit_load) {
 				&& udev->bus_mA <= unit_load) {
 			u16	devstat;
 			u16	devstat;
 
 
-			status = usb_get_status(udev, USB_RECIP_DEVICE, 0,
+			status = usb_get_std_status(udev, USB_RECIP_DEVICE, 0,
 					&devstat);
 					&devstat);
 			if (status) {
 			if (status) {
 				dev_dbg(&udev->dev, "get status %d ?\n", status);
 				dev_dbg(&udev->dev, "get status %d ?\n", status);

+ 4 - 4
drivers/usb/misc/usbtest.c

@@ -1016,7 +1016,7 @@ static int ch9_postconfig(struct usbtest_dev *dev)
 	/* FIXME fetch strings from at least the device descriptor */
 	/* FIXME fetch strings from at least the device descriptor */
 
 
 	/* [9.4.5] get_status always works */
 	/* [9.4.5] get_status always works */
-	retval = usb_get_status(udev, USB_RECIP_DEVICE, 0, dev->buf);
+	retval = usb_get_std_status(udev, USB_RECIP_DEVICE, 0, dev->buf);
 	if (retval) {
 	if (retval) {
 		dev_err(&iface->dev, "get dev status --> %d\n", retval);
 		dev_err(&iface->dev, "get dev status --> %d\n", retval);
 		return retval;
 		return retval;
@@ -1026,7 +1026,7 @@ static int ch9_postconfig(struct usbtest_dev *dev)
 	 * the device's remote wakeup feature ... if we can, test that here
 	 * the device's remote wakeup feature ... if we can, test that here
 	 */
 	 */
 
 
-	retval = usb_get_status(udev, USB_RECIP_INTERFACE,
+	retval = usb_get_std_status(udev, USB_RECIP_INTERFACE,
 			iface->altsetting[0].desc.bInterfaceNumber, dev->buf);
 			iface->altsetting[0].desc.bInterfaceNumber, dev->buf);
 	if (retval) {
 	if (retval) {
 		dev_err(&iface->dev, "get interface status --> %d\n", retval);
 		dev_err(&iface->dev, "get interface status --> %d\n", retval);
@@ -1615,7 +1615,7 @@ static int verify_not_halted(struct usbtest_dev *tdev, int ep, struct urb *urb)
 	u16	status;
 	u16	status;
 
 
 	/* shouldn't look or act halted */
 	/* shouldn't look or act halted */
-	retval = usb_get_status(urb->dev, USB_RECIP_ENDPOINT, ep, &status);
+	retval = usb_get_std_status(urb->dev, USB_RECIP_ENDPOINT, ep, &status);
 	if (retval < 0) {
 	if (retval < 0) {
 		ERROR(tdev, "ep %02x couldn't get no-halt status, %d\n",
 		ERROR(tdev, "ep %02x couldn't get no-halt status, %d\n",
 				ep, retval);
 				ep, retval);
@@ -1637,7 +1637,7 @@ static int verify_halted(struct usbtest_dev *tdev, int ep, struct urb *urb)
 	u16	status;
 	u16	status;
 
 
 	/* should look and act halted */
 	/* should look and act halted */
-	retval = usb_get_status(urb->dev, USB_RECIP_ENDPOINT, ep, &status);
+	retval = usb_get_std_status(urb->dev, USB_RECIP_ENDPOINT, ep, &status);
 	if (retval < 0) {
 	if (retval < 0) {
 		ERROR(tdev, "ep %02x couldn't get halt status, %d\n",
 		ERROR(tdev, "ep %02x couldn't get halt status, %d\n",
 				ep, retval);
 				ep, retval);

+ 7 - 0
include/linux/usb.h

@@ -1767,6 +1767,13 @@ extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype,
 	unsigned char descindex, void *buf, int size);
 	unsigned char descindex, void *buf, int size);
 extern int usb_get_status(struct usb_device *dev,
 extern int usb_get_status(struct usb_device *dev,
 	int recip, int target, void *data);
 	int recip, int target, void *data);
+
+static inline int usb_get_std_status(struct usb_device *dev,
+	int recip, int target, void *data)
+{
+	return usb_get_status(dev, recip, target, data);
+}
+
 extern int usb_string(struct usb_device *dev, int index,
 extern int usb_string(struct usb_device *dev, int index,
 	char *buf, size_t size);
 	char *buf, size_t size);