[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BD79186B4FD85F4B8E60E381CAEE190901EE5C9C@mi8nycmail19.Mi8.com>
Date: Mon, 23 Nov 2009 17:04:03 -0500
From: "H Hartley Sweeten" <hartleys@...ionengravers.com>
To: "Ingo Oeser" <ioe-lkml@...eria.de>
Cc: <linux-kernel@...r.kernel.org>
Subject: RE: drivers/dma/mv_xor.c: use resource_size()
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists