Linux CXL
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Li Ming <ming.li@zohomail.com>
Cc: dave@stgolabs.net, 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@huawei.com,
	linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/3] cxl/core: Introduce a new helper resource_contains_addr()
Date: Tue, 8 Jul 2025 16:20:07 +0300	[thread overview]
Message-ID: <aG0bB2hrIZkq3Uv1@smile.fi.intel.com> (raw)
In-Reply-To: <20250708051536.92119-2-ming.li@zohomail.com>

On Tue, Jul 08, 2025 at 01:15:34PM +0800, Li Ming wrote:
> 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.

...

> +bool resource_contains_addr(const struct resource *res, const resource_size_t addr);

Right, the problem is that it collides with the resource namespace. Please, add a prefix.

bool cxl_resource_contains_addr(const struct resource *res, const resource_size_t addr);

...

> +bool resource_contains_addr(const struct resource *res, const resource_size_t addr)
> +{
> +	if (res->flags & IORESOURCE_MEM)

resource_type() ?

> +		return res->start <= addr && addr <= res->end;
> +
> +	return false;

I still think using DEFINE_RES_MEM() with resource_contains() is a better
approach.

> +}

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-07-08 13:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-08  5:15 [PATCH v3 0/3] Fix wrong dpa checking in PPR operation Li Ming
2025-07-08  5:15 ` [PATCH v3 1/3] cxl/core: Introduce a new helper resource_contains_addr() Li Ming
2025-07-08 13:20   ` Andy Shevchenko [this message]
2025-07-09  3:45     ` Li Ming
2025-07-09  1:24   ` Alison Schofield
2025-07-08  5:15 ` [PATCH v3 2/3] cxl/edac: Fix wrong dpa checking for PPR operation Li Ming
2025-07-08 23:11   ` Dave Jiang
2025-07-09  1:42   ` Alison Schofield
2025-07-09  7:13     ` Li Ming
2025-07-08  5:15 ` [PATCH v3 3/3] cxl/core: Using resource_contains_addr() to check address availability Li Ming
2025-07-08 23:11   ` Dave Jiang
2025-07-09  1:37   ` Alison Schofield

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=aG0bB2hrIZkq3Uv1@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --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=shiju.jose@huawei.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