Re: [PATCH v5 2/5] USB: use genalloc for USB HCs with local memory
From: Fredrik Noring
Date: Tue May 21 2019 - 11:30:21 EST
Thanks Laurentiu!
> --- a/include/linux/usb/hcd.h
> +++ b/include/linux/usb/hcd.h
> @@ -216,6 +216,9 @@ struct usb_hcd {
> #define HC_IS_RUNNING(state) ((state) & __ACTIVE)
> #define HC_IS_SUSPENDED(state) ((state) & __SUSPEND)
>
> + /* allocator for HCs having local memory */
> + struct gen_pool *localmem_pool;
> +
I have tested patches 1, 2 and 5, and they seem to work. Nice! May I
suggest clarifying the NULL pointers? I think that may help someone
debugging or maintaining this in the future. Something like this:
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -385,6 +385,8 @@ struct ohci_hcd {
/*
* memory management for queue data structures
+ *
+ * @td_cache and @ed_cache are %NULL if &usb_hcd.localmem_pool is used.
*/
struct dma_pool *td_cache;
struct dma_pool *ed_cache;
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -211,7 +211,7 @@ struct usb_hcd {
#define HC_IS_RUNNING(state) ((state) & __ACTIVE)
#define HC_IS_SUSPENDED(state) ((state) & __SUSPEND)
- /* allocator for HCs having local memory */
+ /* allocator for HCs having local memory, or %NULL */
struct gen_pool *localmem_pool;
/* more shared queuing code would be good; it should support
Fredrik