mbox series

[v1,0/7] xhci: mem: Short cleanup series

Message ID 20230206161049.13972-1-andriy.shevchenko@linux.intel.com
Headers show
Series xhci: mem: Short cleanup series | expand

Message

Andy Shevchenko Feb. 6, 2023, 4:10 p.m. UTC
Clean up xhci-mem.c a bit using latest and greatest Linux kernel
features.

Andy Shevchenko (7):
  xhci: mem: Carefully calculate size for memory allocations
  xhci: mem: Use __GFP_ZERO instead of explicit memset() call
  xhci: mem: Get rid of redundant 'else'
  xhci: mem: Drop useless return:s
  xhci: mem: Use while (i--) pattern to clean up
  xhci: mem: Replace explicit castings with appropriate specifiers
  xhci: mem: Join string literals back

 drivers/usb/host/xhci-mem.c | 85 +++++++++++++++----------------------
 1 file changed, 35 insertions(+), 50 deletions(-)

Comments

Andy Shevchenko Feb. 7, 2023, 10:49 p.m. UTC | #1
On Tue, Feb 07, 2023 at 05:11:23PM +0200, Mathias Nyman wrote:
> On 6.2.2023 18.10, Andy Shevchenko wrote:
> > Use __GFP_ZERO instead of explicit memset() call in
> > xhci_alloc_stream_ctx().

...

> > +	mem_flags |= __GFP_ZERO;
> 
> How about calling dma_pool_zalloc() instead of setting __GFP_ZERO flag?
> Memory returned by dma_alloc_coherent() should already be zeroed if I remember correctly

That will work too.