Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

drivers/dma/mv_xor.c: use resource_size()

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


hartleys at visionengravers

Nov 23, 2009, 10:02 AM

Post #1 of 4 (106 views)
Permalink
drivers/dma/mv_xor.c: use resource_size()

Use resource_size() for devm_ioremap.

Signed-off-by: H Hartley Sweeten <hsweeten [at] visionengravers>

---

diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 466ab10..ec280ff 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1311,7 +1311,7 @@ static int mv_xor_shared_probe(struct platform_device *pdev)
return -ENODEV;

msp->xor_base = devm_ioremap(&pdev->dev, res->start,
- res->end - res->start + 1);
+ resource_size(res));
if (!msp->xor_base)
return -EBUSY;

@@ -1320,7 +1320,7 @@ static int mv_xor_shared_probe(struct platform_device *pdev)
return -ENODEV;

msp->xor_high_base = devm_ioremap(&pdev->dev, res->start,
- res->end - res->start + 1);
+ resource_size(res));
if (!msp->xor_high_base)
return -EBUSY;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


ioe-lkml at rameria

Nov 23, 2009, 1:34 PM

Post #2 of 4 (102 views)
Permalink
Re: drivers/dma/mv_xor.c: use resource_size() [In reply to]

Hi,

On Monday 23 November 2009, H Hartley Sweeten wrote:
> Use resource_size() for devm_ioremap.

This pattern foo = do_with_res(res->start, resource_size(res)) seem to happen quite often.
What about creating inline functions like

foo = do_with_full_res(res)

?

That would save some code and make it obviously correct.

Best Regards

Ingo Oeser
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


hartleys at visionengravers

Nov 23, 2009, 2:04 PM

Post #3 of 4 (108 views)
Permalink
RE: drivers/dma/mv_xor.c: use resource_size() [In reply to]

On Monday, November 23, 2009 2:35 PM, Ingo Oeser wrote:
> On Monday 23 November 2009, H Hartley Sweeten wrote:
>> Use resource_size() for devm_ioremap.
>
> This pattern foo = do_with_res(res->start, resource_size(res)) seem to happen quite often.
> What about creating inline functions like
>
> foo = do_with_full_res(res)
>
> ?
>
> That would save some code and make it obviously correct.
>

I thought about that also. Just not sure what header(s) they would go in.

The most obvious ones I can see are:


static inline struct resource * request_mem_resource(struct resource *res, const char *name)
{
return request_mem_region(res->start, resource_size(res), name);
}

static void release_mem_resource(struct resource *res)
{
release_mem_region(res->start, resource_size(res));
}

static void __iomem * ioremap_resource(struct resource *res)
{
return ioremap(res->start, resource_size(res));
}


There are probably others (devm_request_region, etc.).

They could also be #define macros. Not sure which is better.

Regards,
Hartley
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


dan.j.williams at intel

Nov 23, 2009, 4:30 PM

Post #4 of 4 (101 views)
Permalink
Re: drivers/dma/mv_xor.c: use resource_size() [In reply to]

On Mon, Nov 23, 2009 at 11:02 AM, H Hartley Sweeten
<hartleys [at] visionengravers> wrote:
> Use resource_size() for devm_ioremap.
>
> Signed-off-by: H Hartley Sweeten <hsweeten [at] visionengravers>
>
> ---

Hi,

I just happened to see this. Please cc me on any patches that touch
drivers/dma/. In general scripts/get_maintainer.pl is your friend.

Thanks,
Dan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.