linux-mips
[Top] [All Lists]

Re: [PATCH 0/2] Fix resource size miscalculations

To: Jiri Kosina <trivial@kernel.org>
Subject: Re: [PATCH 0/2] Fix resource size miscalculations
From: Joe Perches <joe@perches.com>
Date: Thu, 24 Mar 2011 15:49:05 -0700
Cc: linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, linux-fbdev@vger.kernel.org
In-reply-to: <cover.1300909445.git.joe@perches.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <cover.1300909445.git.joe@perches.com>
Sender: linux-mips-bounce@linux-mips.org
On Wed, 2011-03-23 at 12:55 -0700, Joe Perches wrote:
> Use resource_size a few places

Perhaps this relatively common error is too common.
It seems to be poor style.  A possible better style for
struct resource uses could be inline function(s) like:

static inline void __iomem *resource_ioremap(struct resource *r)
{
        return ioremap(r->start, resource_size(r));
}

and maybe

static inline struct resource *
resource_request_region(struct resource *r, const char *name)
{
        return __request_region(&ioport_resource, r->start, resource_size(r), 
name, 0);
}



<Prev in Thread] Current Thread [Next in Thread>