From: Magnus Damm <magnus.damm@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Magnus Damm <magnus.damm@gmail.com>,
gregkh@suse.de, akpm@linux-foundation.org
Subject: [PATCH 01/04] resource: add resource_size()
Date: Wed, 09 Jul 2008 20:54:36 +0900 [thread overview]
Message-ID: <20080709115436.14144.47963.sendpatchset@rx1.opensource.se> (raw)
In-Reply-To: <20080709115428.14144.7121.sendpatchset@rx1.opensource.se>
Avoid one-off errors by introducing a resource_size() function.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
---
include/linux/ioport.h | 4 ++++
kernel/resource.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
--- 0001/include/linux/ioport.h
+++ work/include/linux/ioport.h 2008-07-09 12:59:04.000000000 +0900
@@ -113,6 +113,10 @@ extern int allocate_resource(struct reso
int adjust_resource(struct resource *res, resource_size_t start,
resource_size_t size);
resource_size_t resource_alignment(struct resource *res);
+static inline resource_size_t resource_size(struct resource *res)
+{
+ return res->end - res->start + 1;
+}
/* Convenience shorthand with allocation */
#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
--- 0001/kernel/resource.c
+++ work/kernel/resource.c 2008-07-09 12:59:41.000000000 +0900
@@ -490,7 +490,7 @@ resource_size_t resource_alignment(struc
{
switch (res->flags & (IORESOURCE_SIZEALIGN | IORESOURCE_STARTALIGN)) {
case IORESOURCE_SIZEALIGN:
- return res->end - res->start + 1;
+ return resource_size(res);
case IORESOURCE_STARTALIGN:
return res->start;
default:
next prev parent reply other threads:[~2008-07-09 11:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-09 11:54 [PATCH 00/04] resource: type and size patches Magnus Damm
2008-07-09 11:54 ` Magnus Damm [this message]
2008-07-09 11:54 ` [PATCH 02/04] resource: add resource_type() and IORESOURCE_TYPE_BITS Magnus Damm
2008-07-09 11:54 ` [PATCH 03/04] resource: use new resource type changes Magnus Damm
2008-07-09 12:11 ` Josh Boyer
2008-07-11 19:18 ` Andrew Morton
2008-07-09 11:55 ` [PATCH 04/04] resource: add new IORESOURCE_CLK type Magnus Damm
2008-07-11 19:18 ` Andrew Morton
2008-07-15 8:19 ` Magnus Damm
2008-07-17 23:20 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080709115436.14144.47963.sendpatchset@rx1.opensource.se \
--to=magnus.damm@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox