Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755340AbbLKLfj (ORCPT ); Fri, 11 Dec 2015 06:35:39 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:42189 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754759AbbLKL0Q (ORCPT ); Fri, 11 Dec 2015 06:26:16 -0500 X-AuditID: cbfee61b-f793c6d00000236c-b5-566ab2d6e6d4 From: Robert Baldyga To: balbi@ti.com Cc: gregkh@linuxfoundation.org, andrzej.p@samsung.com, m.szyprowski@samsung.com, b.zolnierkie@samsung.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Robert Baldyga Subject: [PATCH v3 15/36] usb: gadget: composite: handle get_alt() automatically Date: Fri, 11 Dec 2015 12:24:54 +0100 Message-id: <1449833115-24065-16-git-send-email-r.baldyga@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1449833115-24065-1-git-send-email-r.baldyga@samsung.com> References: <1449833115-24065-1-git-send-email-r.baldyga@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOLMWRmVeSWpSXmKPExsVy+t9jQd1rm7LCDFb2qVnMetnOYrFxxnpW i4P36y2aF69ns7i8aw6bxaJlrcwWa4/cZbd4cHgnuwOHx/65a9g9+rasYvQ4fmM7k8fnTXIB LFFcNimpOZllqUX6dglcGdNnT2IueMNesefvHcYGxo1sXYycHBICJhLHlhyAssUkLtxbD2Rz cQgJzGKU2LJsMTuE85NR4uyNjYwgVWwCOhJbvk8As0UEBCTWv7gEVsQscI5R4uGdNrCEsECA xIYZH9lBbBYBVYldkw6C2bwCbhIzv1xmhVgnJ3Hy2GQwmxMoPvnkJWYQW0jAVeLN63WMExh5 FzAyrGKUSC1ILihOSs81ykst1ytOzC0uzUvXS87P3cQIDq5n0jsYD+9yP8QowMGoxMO7gCMr TIg1say4MvcQowQHs5II768NQCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8+y5FhgkJpCeWpGan phakFsFkmTg4pRoYd+312D5tevSBHNEKB4V3R69onMxk/37j3GXdI7MUpW69+NjjJnu/a+ps Ufvc3n1LVs/j1DN/Kmmnq71UcHeIu783o3rene7tm980qFT9U9ZeJvIvd0UD24vLYUpPN/Gy zo+uY9iTJm96U2WtcY2E9Zc0val74p6IXRH/6WnwKGWVK+NSz636SizFGYmGWsxFxYkA/InA 7yoCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1219 Lines: 35 As now we store current altsetting number for each interface, we can handle USB_REQ_GET_INTERFACE automatically. Signed-off-by: Robert Baldyga --- drivers/usb/gadget/composite.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 48af787..d78e63f 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -2078,7 +2078,13 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) if (!f) break; /* lots of interfaces only need altsetting zero... */ - value = f->get_alt ? f->get_alt(f, w_index) : 0; + if (usb_function_is_new_api(f)) { + value = usb_interface_id_to_index(f, intf); + if (value >= 0) + value = f->descs->intfs[value]->cur_altset; + } else { + value = f->get_alt ? f->get_alt(f, w_index) : 0; + } if (value < 0) break; *((u8 *)req->buf) = value; -- 1.9.1 -- 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/