nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Dan Williams <dan.j.williams@intel.com>, linux-nvdimm@lists.01.org
Cc: linux-acpi@vger.kernel.org
Subject: Re: [PATCH 3/6] libnvdimm: add an api to cast a 'struct nd_region' to its 'struct device'
Date: Tue, 3 Apr 2018 08:31:12 -0700	[thread overview]
Message-ID: <2d2634b3-fcfd-c627-4f39-9a46a4bc1ff1@intel.com> (raw)
In-Reply-To: <152273077753.38372.6434283957266644623.stgit@dwillia2-desk3.amr.corp.intel.com>


On 4/2/2018 9:46 PM, Dan Williams wrote:
> For debug, it is useful for bus providers to be able to retrieve the
> 'struct device' associated with an nd_region instance that it
> registered. We already have to_nd_region() to perform the reverse cast
> operation, in fact its duplicate declaration can be removed from the
> private drivers/nvdimm/nd.h header.
>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>   drivers/nvdimm/nd.h          |    1 -
>   drivers/nvdimm/region_devs.c |    8 ++++++++
>   include/linux/libnvdimm.h    |    1 +
>   3 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h
> index 8d6375ee0fda..9dad5d737309 100644
> --- a/drivers/nvdimm/nd.h
> +++ b/drivers/nvdimm/nd.h
> @@ -341,7 +341,6 @@ static inline struct device *nd_dax_create(struct nd_region *nd_region)
>   }
>   #endif
>   
> -struct nd_region *to_nd_region(struct device *dev);
>   int nd_region_to_nstype(struct nd_region *nd_region);
>   int nd_region_register_namespaces(struct nd_region *nd_region, int *err);
>   u64 nd_region_interleave_set_cookie(struct nd_region *nd_region,
> diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
> index e6d01911e092..0af275c62bdf 100644
> --- a/drivers/nvdimm/region_devs.c
> +++ b/drivers/nvdimm/region_devs.c
> @@ -182,6 +182,14 @@ struct nd_region *to_nd_region(struct device *dev)
>   }
>   EXPORT_SYMBOL_GPL(to_nd_region);
>   
> +struct device *nd_region_dev(struct nd_region *nd_region)
> +{
> +	if (!nd_region)
> +		return NULL;
> +	return &nd_region->dev;
> +}
> +EXPORT_SYMBOL_GPL(nd_region_dev);
> +
>   struct nd_blk_region *to_nd_blk_region(struct device *dev)
>   {
>   	struct nd_region *nd_region = to_nd_region(dev);
> diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
> index ff855ed965fb..e0684a678a1b 100644
> --- a/include/linux/libnvdimm.h
> +++ b/include/linux/libnvdimm.h
> @@ -164,6 +164,7 @@ void nvdimm_bus_unregister(struct nvdimm_bus *nvdimm_bus);
>   struct nvdimm_bus *to_nvdimm_bus(struct device *dev);
>   struct nvdimm *to_nvdimm(struct device *dev);
>   struct nd_region *to_nd_region(struct device *dev);
> +struct device *nd_region_dev(struct nd_region *nd_region);
>   struct nd_blk_region *to_nd_blk_region(struct device *dev);
>   struct nvdimm_bus_descriptor *to_nd_desc(struct nvdimm_bus *nvdimm_bus);
>   struct device *to_nvdimm_bus_dev(struct nvdimm_bus *nvdimm_bus);
>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2018-04-03 15:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-03  4:46 [PATCH 0/6] nfit, address-range-scrub: rework and fixes Dan Williams
2018-04-03  4:46 ` [PATCH 1/6] nfit: fix region registration vs block-data-window ranges Dan Williams
2018-04-03 15:30   ` Dave Jiang
     [not found]   ` <152273076649.38372.8379231668189794225.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-04-06 20:05     ` Sasha Levin
2018-04-03  4:46 ` [PATCH 2/6] nfit, address-range-scrub: fix scrub in-progress reporting Dan Williams
2018-04-03 15:31   ` Dave Jiang
     [not found]   ` <152273077198.38372.11857145045474104173.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-04-06 20:05     ` Sasha Levin
2018-04-03  4:46 ` [PATCH 3/6] libnvdimm: add an api to cast a 'struct nd_region' to its 'struct device' Dan Williams
2018-04-03 15:31   ` Dave Jiang [this message]
2018-04-03  4:46 ` [PATCH 4/6] nfit, address-range-scrub: introduce nfit_spa->ars_state Dan Williams
2018-04-03 15:31   ` Dave Jiang
2018-04-03  4:46 ` [PATCH 5/6] nfit, address-range-scrub: rework and simplify ARS state machine Dan Williams
2018-04-03 15:29   ` Dave Jiang
2018-04-03 15:33     ` Dan Williams
2018-04-04 16:26   ` Kani, Toshi
2018-04-04 17:08     ` Dan Williams
2018-04-03  4:46 ` [PATCH 6/6] nfit, address-range-scrub: add module option to skip initial ars Dan Williams

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=2d2634b3-fcfd-c627-4f39-9a46a4bc1ff1@intel.com \
    --to=dave.jiang@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.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;
as well as URLs for NNTP newsgroup(s).