All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Dave Jiang <dave.jiang@intel.com>, <linux-cxl@vger.kernel.org>
Cc: <alison.schofield@intel.com>
Subject: Re: [NDCTL PATCH v4 2/3] cxl: Enumerate major/minor of FWCTL char device
Date: Wed, 9 Apr 2025 16:39:25 -0700	[thread overview]
Message-ID: <67f7052dd5353_71fe29498@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <20250218230116.2689627-3-dave.jiang@intel.com>

Dave Jiang wrote:
> Add major/minor discovery for the FWCTL character device that is associated
> with supprting CXL Features under the cxl_memdev. Add libcxl API functions
> to retrieve the major and minor of the FWCTL character device.
> 
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
[..]
> diff --git a/cxl/lib/private.h b/cxl/lib/private.h
> index b6cd910e9335..676bf1573487 100644
> --- a/cxl/lib/private.h
> +++ b/cxl/lib/private.h
> @@ -37,6 +37,7 @@ enum cxl_fwl_loading {
>  struct cxl_endpoint;
>  struct cxl_memdev {
>  	int id, major, minor;
> +	int fwctl_major, fwctl_minor;

Unlike daxctl_dev_get_{major,minor}() which need a valid daxctl_dev,
there is no guarantee that a memdev has a fwctl capability. So I would
prefer that the helper functions are:

int cxl_fwctl_get_major(const struct cxl_fwctl *)
int cxl_fwctl_get_minor(const struct cxl_fwctl *)
struct cxl_fwctl *cxl_memdev_get_fwctl(struct cxl_memdev *)

...where obtaining that 'struct cxl_fwctl' gives you a chance to return
NULL and prevent non-sensical cxl_memdev_get_fwctl_major() against a
memdev that does not have an active fwctl portal.

It also lets you build other cxl_fwctl helper functionality around that
object.

  parent reply	other threads:[~2025-04-09 23:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-18 22:59 [NDCTL PATCH v4 0/3] ndctl: Add support and test for CXL Features support Dave Jiang
2025-02-18 22:59 ` [NDCTL PATCH v4 1/3] cxl: Add cxl_bus_get_by_provider() Dave Jiang
2025-04-09  0:42   ` Alison Schofield
2025-02-18 22:59 ` [NDCTL PATCH v4 2/3] cxl: Enumerate major/minor of FWCTL char device Dave Jiang
2025-04-09 19:56   ` Alison Schofield
2025-04-09 22:40     ` Dave Jiang
2025-04-09 23:39   ` Dan Williams [this message]
2025-02-18 22:59 ` [NDCTL PATCH v4 3/3] cxl/test: Add test for cxl features device Dave Jiang
2025-04-09 20:40   ` Alison Schofield
2025-04-09 23:10     ` Dave Jiang
2025-04-10  1:05     ` Dave Jiang

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=67f7052dd5353_71fe29498@dwillia2-xfh.jf.intel.com.notmuch \
    --to=dan.j.williams@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=linux-cxl@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 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.