Commit c77b8855 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

USB: appledisplay: refactor endpoint retrieval

Use the new endpoint helpers to lookup the required interrupt-in
endpoint.

Note that the default retval was never used.
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e53e0342
...@@ -212,28 +212,21 @@ static int appledisplay_probe(struct usb_interface *iface, ...@@ -212,28 +212,21 @@ static int appledisplay_probe(struct usb_interface *iface,
struct backlight_properties props; struct backlight_properties props;
struct appledisplay *pdata; struct appledisplay *pdata;
struct usb_device *udev = interface_to_usbdev(iface); struct usb_device *udev = interface_to_usbdev(iface);
struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint; struct usb_endpoint_descriptor *endpoint;
int int_in_endpointAddr = 0; int int_in_endpointAddr = 0;
int i, retval = -ENOMEM, brightness; int retval, brightness;
char bl_name[20]; char bl_name[20];
/* set up the endpoint information */ /* set up the endpoint information */
/* use only the first interrupt-in endpoint */ /* use only the first interrupt-in endpoint */
iface_desc = iface->cur_altsetting; retval = usb_find_int_in_endpoint(iface->cur_altsetting, &endpoint);
for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) { if (retval) {
endpoint = &iface_desc->endpoint[i].desc;
if (!int_in_endpointAddr && usb_endpoint_is_int_in(endpoint)) {
/* we found an interrupt in endpoint */
int_in_endpointAddr = endpoint->bEndpointAddress;
break;
}
}
if (!int_in_endpointAddr) {
dev_err(&iface->dev, "Could not find int-in endpoint\n"); dev_err(&iface->dev, "Could not find int-in endpoint\n");
return -EIO; return retval;
} }
int_in_endpointAddr = endpoint->bEndpointAddress;
/* allocate memory for our device state and initialize it */ /* allocate memory for our device state and initialize it */
pdata = kzalloc(sizeof(struct appledisplay), GFP_KERNEL); pdata = kzalloc(sizeof(struct appledisplay), GFP_KERNEL);
if (!pdata) { if (!pdata) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment