Re: [RFC PATCH 02/10] usb: musb: switch over to devm_ioremap_resource()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, Feb 08, 2013 at 06:04:03PM +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 02/08/2013 04:02 PM, Felipe Balbi wrote:
> 
> > this will make sure that request_memory_region() will
> > be called and that we don't need to manually call
> > iounmap() on ->remove().
> 
> > Signed-off-by: Felipe Balbi <balbi@xxxxxx>
> > ---
> >  drivers/usb/musb/musb_core.c | 11 ++---------
> >  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> > diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
> > index a68ff27..48609ea 100644
> > --- a/drivers/usb/musb/musb_core.c
> > +++ b/drivers/usb/musb/musb_core.c
> > @@ -2014,7 +2014,6 @@ static int musb_probe(struct platform_device *pdev)
> >  {
> >  	struct device	*dev = &pdev->dev;
> >  	int		irq = platform_get_irq_byname(pdev, "mc");
> > -	int		status;
> >  	struct resource	*iomem;
> >  	void __iomem	*base;
> >  
> > @@ -2022,24 +2021,19 @@ static int musb_probe(struct platform_device *pdev)
> >  	if (!iomem || irq <= 0)
> >  		return -ENODEV;
> >  
> > -	base = ioremap(iomem->start, resource_size(iomem));
> > +	base = devm_ioremap_resource(dev, iomem);
> 
>    devm_ioremap_resource() is not in mainline yet, AFAIK. Maybe we should call

I'm not sending this patch for v3.9 anyway...

> devm_request_mem_region() in the glue layers instead? I'm preparing a patch that

better not since that's being deprecated.

> will only pass MUSB register subrange to the MUSB core from the glue layers

that'll be one nice patch to have.

> (have long promised it but musbhsdma.c part turned out to be not ready for prime
> time and I have to find a time to finish it).
> 
> >  	if (!base) {
> 
>    devm_ioremap_resource() returns error pointer, not NULL, AFAIR.
> 
> >  		dev_err(dev, "ioremap failed\n");
> 
>    devm_ioremap_resource() prints the error message itself.
> 
> >  		return -ENOMEM;
> 
>    You should pass up what devm_ioremap_resource() returned.

right, good point.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux