Deleted Added
full compact
usb_util.c (302408) usb_util.c (305733)
1/* $FreeBSD: stable/11/sys/dev/usb/usb_util.c 246616 2013-02-10 10:56:13Z hselasky $ */
1/* $FreeBSD: stable/11/sys/dev/usb/usb_util.c 305733 2016-09-12 10:14:30Z hselasky $ */
2/*-
3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.

--- 83 unchanged lines hidden (view full) ---

93 (iface->idesc == NULL) ||
94 (iface->idesc->iInterface == 0)) {
95 err = USB_ERR_INVAL;
96 } else {
97 err = 0;
98 }
99
100 /* Protect scratch area */
2/*-
3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.

--- 83 unchanged lines hidden (view full) ---

93 (iface->idesc == NULL) ||
94 (iface->idesc->iInterface == 0)) {
95 err = USB_ERR_INVAL;
96 } else {
97 err = 0;
98 }
99
100 /* Protect scratch area */
101 do_unlock = usbd_enum_lock(udev);
101 do_unlock = usbd_ctrl_lock(udev);
102
103 temp_p = (char *)udev->scratch.data;
104
105 if (err == 0) {
106 /* try to get the interface string ! */
107 err = usbd_req_get_string_any(udev, NULL, temp_p,
108 sizeof(udev->scratch.data),
109 iface->idesc->iInterface);
110 }
111 if (err != 0) {
112 /* use default description */
113 usb_devinfo(udev, temp_p,
114 sizeof(udev->scratch.data));
115 }
116
117 if (do_unlock)
102
103 temp_p = (char *)udev->scratch.data;
104
105 if (err == 0) {
106 /* try to get the interface string ! */
107 err = usbd_req_get_string_any(udev, NULL, temp_p,
108 sizeof(udev->scratch.data),
109 iface->idesc->iInterface);
110 }
111 if (err != 0) {
112 /* use default description */
113 usb_devinfo(udev, temp_p,
114 sizeof(udev->scratch.data));
115 }
116
117 if (do_unlock)
118 usbd_enum_unlock(udev);
118 usbd_ctrl_unlock(udev);
119
120 device_set_desc_copy(dev, temp_p);
121 device_printf(dev, "<%s> on %s\n", temp_p,
122 device_get_nameunit(udev->bus->bdev));
123}
124
125/*------------------------------------------------------------------------*
126 * usb_pause_mtx - factored out code

--- 97 unchanged lines hidden ---
119
120 device_set_desc_copy(dev, temp_p);
121 device_printf(dev, "<%s> on %s\n", temp_p,
122 device_get_nameunit(udev->bus->bdev));
123}
124
125/*------------------------------------------------------------------------*
126 * usb_pause_mtx - factored out code

--- 97 unchanged lines hidden ---