From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
linux-kernel@vger.kernel.org
Cc: Peter Tyser <ptyser@xes-inc.com>, Lee Jones <lee@kernel.org>
Subject: [PATCH v1 1/2] resource: Introduce resource_rebase() helper
Date: Wed, 3 Sep 2025 10:12:28 +0200 [thread overview]
Message-ID: <20250903081414.1972179-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20250903081414.1972179-1-andriy.shevchenko@linux.intel.com>
Introduce a helper to add an offset to the resource. This is helpful
in the cases when, for example) the resource has statically defined
the start and end fields, but the base of it is yet to be defined,
usually dynamically at run-time.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
include/linux/ioport.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index e8b2d6aa4013..159e74284d0b 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -290,6 +290,12 @@ static inline resource_size_t resource_size(const struct resource *res)
{
return res->end - res->start + 1;
}
+
+static inline void resource_rebase(struct resource *res, resource_size_t start)
+{
+ resource_set_range(res, start + res->start, resource_size(res));
+}
+
static inline unsigned long resource_type(const struct resource *res)
{
return res->flags & IORESOURCE_TYPE_BITS;
--
2.50.1
next prev parent reply other threads:[~2025-09-03 8:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 8:12 [PATCH v1 0/2] mfd: lpc_ich: Simplify GPIO resource handling Andy Shevchenko
2025-09-03 8:12 ` Andy Shevchenko [this message]
2025-09-03 12:29 ` [PATCH v1 1/2] resource: Introduce resource_rebase() helper Ilpo Järvinen
2025-09-03 15:20 ` Andy Shevchenko
2025-09-03 8:12 ` [PATCH v1 2/2] mfd: lpc_ich: Convert to use resource_rebase() Andy Shevchenko
2025-09-03 10:45 ` Andy Shevchenko
2025-09-03 12:19 ` Ilpo Järvinen
2025-09-04 8:08 ` [PATCH v1 0/2] mfd: lpc_ich: Simplify GPIO resource handling Andy Shevchenko
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=20250903081414.1972179-2-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ptyser@xes-inc.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.