[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dac48dcd-c676-4161-e38b-11bbcf8d2a8f@nxp.com>
Date: Tue, 21 May 2019 11:08:14 +0000
From: Laurentiu Tudor <laurentiu.tudor@....com>
To: Christoph Hellwig <hch@....de>
CC: "stern@...land.harvard.edu" <stern@...land.harvard.edu>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"marex@...x.de" <marex@...x.de>, Leo Li <leoyang.li@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"robin.murphy@....com" <robin.murphy@....com>,
"noring@...rew.org" <noring@...rew.org>,
"JuergenUrban@....de" <JuergenUrban@....de>
Subject: Re: [PATCH v4 2/3] usb: host: ohci-sm501: init genalloc for local
memory
On 21.05.2019 13:39, Christoph Hellwig wrote:
> On Thu, May 16, 2019 at 02:47:20PM +0300, laurentiu.tudor@....com wrote:
>> + hcd->localmem_pool = devm_gen_pool_create(dev, PAGE_SHIFT,
>> + dev_to_node(dev),
>> + "ohci-sm501");
>> + if (IS_ERR(hcd->localmem_pool)) {
>> + retval = PTR_ERR(hcd->localmem_pool);
>> + goto err5;
>> + }
>> +
>> + local_mem = devm_ioremap(dev, mem->start, resource_size(mem));
>> + if (!local_mem) {
>> + retval = -ENOMEM;
>> + goto err5;
>> + }
>> +
>> + retval = gen_pool_add_virt(hcd->localmem_pool,
>> + (unsigned long)local_mem,
>> + mem->start - mem->parent->start,
>> + resource_size(mem),
>> + dev_to_node(dev));
>
> I wonder if having a helper for these operations would be useful,
> explaining what we do here. That is create a pool for a resource,
> where the virtual address is the ioremap of said resource. We
> could also make that a managed API so that you can get rid of the
> cleanup path.
This is close to what I've already prepared in the next spin. It's a new
usb hcd api so it's not as abstract as your idea. I think we can discuss
on it after I'll send it.
---
Best Regards, Laurentiu
Powered by blists - more mailing lists