usb: dwc2: gadget: pick smallest acceptable fifo
authorMian Yousaf Kaukab <yousaf.kaukab@intel.com>
Fri, 9 Jan 2015 12:39:04 +0000 (13:39 +0100)
committerFelipe Balbi <balbi@ti.com>
Mon, 12 Jan 2015 21:34:32 +0000 (15:34 -0600)
commitca4c55ad89edb54b1eb04fe2d4c6915c9f8d69b9
tree50283d5ce9bde4d878b4493f88ad4d250304df4a
parent8a20fa457eb5a8d247fd82d4bd3c04225fd2f253
usb: dwc2: gadget: pick smallest acceptable fifo

Current algorithm picks the first fifo which is equal to or greater
than the required size. This can result in bigger fifos assigned to
endpoints with smaller maxps. Change the algorithm to pick the
smallest fifo which is greater than or equal to the required size.

Moreover, only use signed variables when required.

Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc2/gadget.c