From: Shiju Jose <shiju.jose@huawei.com>
To: Li Ming <ming.li@zohomail.com>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"andriy.shevchenko@linux.intel.com"
<andriy.shevchenko@linux.intel.com>,
"bhelgaas@google.com" <bhelgaas@google.com>,
"ilpo.jarvinen@linux.intel.com" <ilpo.jarvinen@linux.intel.com>,
"dave@stgolabs.net" <dave@stgolabs.net>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
"dave.jiang@intel.com" <dave.jiang@intel.com>,
"alison.schofield@intel.com" <alison.schofield@intel.com>,
"vishal.l.verma@intel.com" <vishal.l.verma@intel.com>,
"ira.weiny@intel.com" <ira.weiny@intel.com>,
"dan.j.williams@intel.com" <dan.j.williams@intel.com>
Cc: "linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v2 1/3] resource: Introduce a new helper resource_contains_addr()
Date: Thu, 3 Jul 2025 09:52:47 +0000 [thread overview]
Message-ID: <95a899051e5c46aca70aa0b0016c0f90@huawei.com> (raw)
In-Reply-To: <20250702072008.468371-1-ming.li@zohomail.com>
>-----Original Message-----
>From: Li Ming <ming.li@zohomail.com>
>Sent: 02 July 2025 08:20
>To: akpm@linux-foundation.org; andriy.shevchenko@linux.intel.com;
>bhelgaas@google.com; ilpo.jarvinen@linux.intel.com; dave@stgolabs.net;
>Jonathan Cameron <jonathan.cameron@huawei.com>; dave.jiang@intel.com;
>alison.schofield@intel.com; vishal.l.verma@intel.com; ira.weiny@intel.com;
>dan.j.williams@intel.com; Shiju Jose <shiju.jose@huawei.com>
>Cc: linux-cxl@vger.kernel.org; linux-kernel@vger.kernel.org; Li Ming
><ming.li@zohomail.com>
>Subject: [PATCH v2 1/3] resource: Introduce a new helper
>resource_contains_addr()
>
>In CXL subsystem, many functions need to check an address availability by
>checking if the resource range contains the address. Providing a new helper
>function resource_contains_addr() to check if the resource range contains the
>input address.
>
>Suggested-by: Alison Schofield <alison.schofield@intel.com>
>Signed-off-by: Li Ming <ming.li@zohomail.com>
Tested-by: Shiju Jose <shiju.jose@huawei.com>
>---
>v2:
>* Implement a general helper resource_contains_addr(). (Alison)
>
>base-commit: 0a46f60a9fe16f5596b6b4b3ee1a483ea7854136 cxl/fixes
>---
> include/linux/ioport.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
>diff --git a/include/linux/ioport.h b/include/linux/ioport.h index
>e8b2d6aa4013..75f5e9ccd549 100644
>--- a/include/linux/ioport.h
>+++ b/include/linux/ioport.h
>@@ -308,6 +308,14 @@ static inline bool resource_contains(const struct
>resource *r1, const struct res
> return r1->start <= r2->start && r1->end >= r2->end; }
>
>+/* True if res contains addr */
>+static inline bool resource_contains_addr(const struct resource *res,
>+const resource_size_t addr) {
>+ if (res->flags & IORESOURCE_UNSET)
>+ return false;
>+ return res->start <= addr && addr <= res->end; }
>+
> /* True if any part of r1 overlaps r2 */ static inline bool
>resource_overlaps(const struct resource *r1, const struct resource *r2) {
>--
>2.34.1
prev parent reply other threads:[~2025-07-03 9:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-02 7:20 [PATCH v2 1/3] resource: Introduce a new helper resource_contains_addr() Li Ming
2025-07-02 7:20 ` [PATCH v2 2/3] cxl/edac: Fix wrong dpa checking for PPR operation Li Ming
2025-07-02 8:24 ` Andy Shevchenko
2025-07-02 19:38 ` Alison Schofield
2025-07-03 9:57 ` Li Ming
2025-07-03 9:52 ` Shiju Jose
2025-07-02 7:20 ` [PATCH v2 3/3] cxl/core: Using resource_contains_addr() to check address availability Li Ming
2025-07-02 8:16 ` [PATCH v2 1/3] resource: Introduce a new helper resource_contains_addr() Andy Shevchenko
2025-07-02 8:18 ` Andy Shevchenko
2025-07-02 19:16 ` Alison Schofield
2025-07-03 9:31 ` Andy Shevchenko
2025-07-07 4:19 ` Li Ming
2025-07-02 8:21 ` Andy Shevchenko
2025-07-03 5:33 ` Li Ming
2025-07-03 9:52 ` Shiju Jose [this message]
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=95a899051e5c46aca70aa0b0016c0f90@huawei.com \
--to=shiju.jose@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=alison.schofield@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.li@zohomail.com \
--cc=vishal.l.verma@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox