Messages in this thread |  | | Subject | RE: drivers/dma/mv_xor.c: use resource_size() | | Date | Mon, 23 Nov 2009 17:04:03 -0500 | | From | "H Hartley Sweeten" <> |
| |
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
|  |