On Thu, Mar 23, 2017 at 01:56:35PM +0100, Greg Kroah-Hartman wrote: > On Fri, Mar 17, 2017 at 11:35:29AM +0100, Johan Hovold wrote: > > Many USB drivers iterate over the available endpoints to find required > > endpoints of a specific type and direction. Typically the endpoints are > > required for proper function and a missing endpoint should abort probe. > > > > To facilitate code reuse, this series adds a helper to retrieve common > > endpoints (bulk or interrupt, in or out) and four wrappers to find a > > single endpoint (which should cover the vast majority of drivers). > > > > This typically saves about 10-15 lines of code per driver, so even if > > this series result in a net gain in terms of lines due to the helpers > > being added to core, there will be further reductions when applied to > > other subsystems. > > > > Note that the helpers are marked as __must_check to serve as a reminder > > to always verify that all expected endpoints are indeed present. > > > > Also note that some drivers have implemented their endpoint look-up > > loops in such a way that they have picked the last endpoint descriptor > > of the specified type should more than one such descriptor exist. To > > avoid any regressions, the second patch therefore adds corresponding > > helpers to lookup endpoints by searching the endpoint descriptors in > > reverse order. In almost all cases, I expect it would be safe to simply > > pick the first matching descriptor instead (i.e. there is only one > > endpoint descriptor per type). > > > > Note that this series applies on top of Greg's usb-linus branch which > > has a few fixes for the iowarrior and USBTMC drivers. > > I applied this to my usb-next branch, which is probably why a few didn't > apply properly. Let's get usb-linus merged with Linus, and then merged > together on Monday and then can you resend those remaining two? Sounds good. I was hoping you'd have merged back the fixes before applying this series, but I'll just resend the two patches with conflicts later as you suggest. [ I notice now that I confused the iowarrior and lvtest fixes; the former are already in Linus's tree. ] Thanks, Johan -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html