* [PATCH 1/2] libnvdimm: move ->module to struct nvdimm_bus_descriptor
@ 2016-07-22 3:25 Dan Williams
2016-07-22 3:25 ` [PATCH 2/2] nfit, tools/testing/nvdimm/: unify shutdown paths Dan Williams
[not found] ` <146915794457.7201.5023729229431647060.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
0 siblings, 2 replies; 4+ messages in thread
From: Dan Williams @ 2016-07-22 3:25 UTC (permalink / raw)
To: linux-nvdimm; +Cc: linux-acpi, vishal.l.verma
Let the provider module be explicitly passed in rather than implicitly
assumed by the module that calls nvdimm_bus_register(). This is in
preparation for unifying the nfit and nfit_test driver teardown paths.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
drivers/acpi/nfit.c | 1 +
drivers/nvdimm/bus.c | 2 +-
drivers/nvdimm/core.c | 7 +++----
drivers/nvdimm/e820.c | 1 +
drivers/nvdimm/nd-core.h | 1 -
include/linux/libnvdimm.h | 7 +++----
tools/testing/nvdimm/test/nfit.c | 1 +
7 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
index fb80f32db525..e7eb3b6f1514 100644
--- a/drivers/acpi/nfit.c
+++ b/drivers/acpi/nfit.c
@@ -2417,6 +2417,7 @@ void acpi_nfit_desc_init(struct acpi_nfit_desc *acpi_desc, struct device *dev)
acpi_desc->blk_do_io = acpi_nfit_blk_region_do_io;
nd_desc = &acpi_desc->nd_desc;
nd_desc->provider_name = "ACPI.NFIT";
+ nd_desc->module = THIS_MODULE;
nd_desc->ndctl = acpi_nfit_ctl;
nd_desc->flush_probe = acpi_nfit_flush_probe;
nd_desc->clear_to_send = acpi_nfit_clear_to_send;
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index 1cc7880320fe..275dd5c0a301 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -73,7 +73,7 @@ static struct module *to_bus_provider(struct device *dev)
if (is_nd_pmem(dev) || is_nd_blk(dev)) {
struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev);
- return nvdimm_bus->module;
+ return nvdimm_bus->nd_desc->module;
}
return NULL;
}
diff --git a/drivers/nvdimm/core.c b/drivers/nvdimm/core.c
index 757e0cf028bf..e8528756f54f 100644
--- a/drivers/nvdimm/core.c
+++ b/drivers/nvdimm/core.c
@@ -447,8 +447,8 @@ struct attribute_group nvdimm_bus_attribute_group = {
};
EXPORT_SYMBOL_GPL(nvdimm_bus_attribute_group);
-struct nvdimm_bus *__nvdimm_bus_register(struct device *parent,
- struct nvdimm_bus_descriptor *nd_desc, struct module *module)
+struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
+ struct nvdimm_bus_descriptor *nd_desc)
{
struct nvdimm_bus *nvdimm_bus;
int rc;
@@ -467,7 +467,6 @@ struct nvdimm_bus *__nvdimm_bus_register(struct device *parent,
return NULL;
}
nvdimm_bus->nd_desc = nd_desc;
- nvdimm_bus->module = module;
nvdimm_bus->dev.parent = parent;
nvdimm_bus->dev.release = nvdimm_bus_release;
nvdimm_bus->dev.groups = nd_desc->attr_groups;
@@ -491,7 +490,7 @@ struct nvdimm_bus *__nvdimm_bus_register(struct device *parent,
put_device(&nvdimm_bus->dev);
return NULL;
}
-EXPORT_SYMBOL_GPL(__nvdimm_bus_register);
+EXPORT_SYMBOL_GPL(nvdimm_bus_register);
static void set_badblock(struct badblocks *bb, sector_t s, int num)
{
diff --git a/drivers/nvdimm/e820.c b/drivers/nvdimm/e820.c
index 95825b38559a..11ea90120542 100644
--- a/drivers/nvdimm/e820.c
+++ b/drivers/nvdimm/e820.c
@@ -47,6 +47,7 @@ static int e820_pmem_probe(struct platform_device *pdev)
nd_desc.attr_groups = e820_pmem_attribute_groups;
nd_desc.provider_name = "e820";
+ nd_desc.module = THIS_MODULE;
nvdimm_bus = nvdimm_bus_register(dev, &nd_desc);
if (!nvdimm_bus)
goto err;
diff --git a/drivers/nvdimm/nd-core.h b/drivers/nvdimm/nd-core.h
index 6e961f7f43e7..38ce6bbbc170 100644
--- a/drivers/nvdimm/nd-core.h
+++ b/drivers/nvdimm/nd-core.h
@@ -26,7 +26,6 @@ extern int nvdimm_major;
struct nvdimm_bus {
struct nvdimm_bus_descriptor *nd_desc;
wait_queue_head_t probe_wait;
- struct module *module;
struct list_head list;
struct device dev;
int id, probe_active;
diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
index d37fda6dd64c..2ab869dece4a 100644
--- a/include/linux/libnvdimm.h
+++ b/include/linux/libnvdimm.h
@@ -70,6 +70,7 @@ struct nd_mapping {
struct nvdimm_bus_descriptor {
const struct attribute_group **attr_groups;
unsigned long cmd_mask;
+ struct module *module;
char *provider_name;
ndctl_fn ndctl;
int (*flush_probe)(struct nvdimm_bus_descriptor *nd_desc);
@@ -128,10 +129,8 @@ static inline struct nd_blk_region_desc *to_blk_region_desc(
}
int nvdimm_bus_add_poison(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length);
-struct nvdimm_bus *__nvdimm_bus_register(struct device *parent,
- struct nvdimm_bus_descriptor *nfit_desc, struct module *module);
-#define nvdimm_bus_register(parent, desc) \
- __nvdimm_bus_register(parent, desc, THIS_MODULE)
+struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
+ struct nvdimm_bus_descriptor *nfit_desc);
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);
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
index 78cba1e3b1da..642713f15723 100644
--- a/tools/testing/nvdimm/test/nfit.c
+++ b/tools/testing/nvdimm/test/nfit.c
@@ -1463,6 +1463,7 @@ static int nfit_test_probe(struct platform_device *pdev)
acpi_desc->blk_do_io = nfit_test_blk_do_io;
nd_desc = &acpi_desc->nd_desc;
nd_desc->provider_name = NULL;
+ nd_desc->module = THIS_MODULE;
nd_desc->ndctl = nfit_test_ctl;
acpi_desc->nvdimm_bus = nvdimm_bus_register(&pdev->dev, nd_desc);
if (!acpi_desc->nvdimm_bus)
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] nfit, tools/testing/nvdimm/: unify shutdown paths
2016-07-22 3:25 [PATCH 1/2] libnvdimm: move ->module to struct nvdimm_bus_descriptor Dan Williams
@ 2016-07-22 3:25 ` Dan Williams
2016-07-22 12:41 ` joeyli
[not found] ` <146915794457.7201.5023729229431647060.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
1 sibling, 1 reply; 4+ messages in thread
From: Dan Williams @ 2016-07-22 3:25 UTC (permalink / raw)
To: linux-nvdimm; +Cc: vishal.l.verma, linux-acpi
While testing the new on-demand ARS patches we discovered that
differences between the nfit_test and normal nfit driver shutdown paths
can leak resources. Unify the shutdown paths to trigger via a devm_
callback when the acpi_desc->dev is unbound from its driver.
Reported-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
drivers/acpi/nfit.c | 36 ++++++++++++++++++++++--------------
tools/testing/nvdimm/test/nfit.c | 16 ++--------------
2 files changed, 24 insertions(+), 28 deletions(-)
diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
index e7eb3b6f1514..be7c2fde16e7 100644
--- a/drivers/acpi/nfit.c
+++ b/drivers/acpi/nfit.c
@@ -2291,6 +2291,16 @@ static int acpi_nfit_check_deletions(struct acpi_nfit_desc *acpi_desc,
return 0;
}
+static void acpi_nfit_destruct(void *data)
+{
+ struct acpi_nfit_desc *acpi_desc = data;
+
+ acpi_desc->cancel = 1;
+ flush_workqueue(nfit_wq);
+ nvdimm_bus_unregister(acpi_desc->nvdimm_bus);
+ acpi_desc->nvdimm_bus = NULL;
+}
+
int acpi_nfit_init(struct acpi_nfit_desc *acpi_desc, void *data, acpi_size sz)
{
struct device *dev = acpi_desc->dev;
@@ -2298,6 +2308,17 @@ int acpi_nfit_init(struct acpi_nfit_desc *acpi_desc, void *data, acpi_size sz)
const void *end;
int rc;
+ if (!acpi_desc->nvdimm_bus) {
+ acpi_desc->nvdimm_bus = nvdimm_bus_register(dev,
+ &acpi_desc->nd_desc);
+ if (!acpi_desc->nvdimm_bus)
+ return -ENOMEM;
+ rc = devm_add_action_or_reset(dev, acpi_nfit_destruct,
+ acpi_desc);
+ if (rc)
+ return rc;
+ }
+
mutex_lock(&acpi_desc->init_mutex);
INIT_LIST_HEAD(&prev.spas);
@@ -2456,9 +2477,6 @@ static int acpi_nfit_add(struct acpi_device *adev)
if (!acpi_desc)
return -ENOMEM;
acpi_nfit_desc_init(acpi_desc, &adev->dev);
- acpi_desc->nvdimm_bus = nvdimm_bus_register(dev, &acpi_desc->nd_desc);
- if (!acpi_desc->nvdimm_bus)
- return -ENOMEM;
/* Save the acpi header for exporting the revision via sysfs */
acpi_desc->acpi_header = *tbl;
@@ -2480,19 +2498,12 @@ static int acpi_nfit_add(struct acpi_device *adev)
rc = acpi_nfit_init(acpi_desc, (void *) tbl
+ sizeof(struct acpi_table_nfit),
sz - sizeof(struct acpi_table_nfit));
-
- if (rc)
- nvdimm_bus_unregister(acpi_desc->nvdimm_bus);
return rc;
}
static int acpi_nfit_remove(struct acpi_device *adev)
{
- struct acpi_nfit_desc *acpi_desc = dev_get_drvdata(&adev->dev);
-
- acpi_desc->cancel = 1;
- flush_workqueue(nfit_wq);
- nvdimm_bus_unregister(acpi_desc->nvdimm_bus);
+ /* see acpi_nfit_destruct */
return 0;
}
@@ -2519,9 +2530,6 @@ static void acpi_nfit_notify(struct acpi_device *adev, u32 event)
if (!acpi_desc)
goto out_unlock;
acpi_nfit_desc_init(acpi_desc, &adev->dev);
- acpi_desc->nvdimm_bus = nvdimm_bus_register(dev, &acpi_desc->nd_desc);
- if (!acpi_desc->nvdimm_bus)
- goto out_unlock;
} else {
/*
* Finish previous registration before considering new
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
index 642713f15723..5404efa578a3 100644
--- a/tools/testing/nvdimm/test/nfit.c
+++ b/tools/testing/nvdimm/test/nfit.c
@@ -1465,16 +1465,11 @@ static int nfit_test_probe(struct platform_device *pdev)
nd_desc->provider_name = NULL;
nd_desc->module = THIS_MODULE;
nd_desc->ndctl = nfit_test_ctl;
- acpi_desc->nvdimm_bus = nvdimm_bus_register(&pdev->dev, nd_desc);
- if (!acpi_desc->nvdimm_bus)
- return -ENXIO;
rc = acpi_nfit_init(acpi_desc, nfit_test->nfit_buf,
nfit_test->nfit_size);
- if (rc) {
- nvdimm_bus_unregister(acpi_desc->nvdimm_bus);
+ if (rc)
return rc;
- }
if (nfit_test->setup != nfit_test0_setup)
return 0;
@@ -1484,21 +1479,14 @@ static int nfit_test_probe(struct platform_device *pdev)
rc = acpi_nfit_init(acpi_desc, nfit_test->nfit_buf,
nfit_test->nfit_size);
- if (rc) {
- nvdimm_bus_unregister(acpi_desc->nvdimm_bus);
+ if (rc)
return rc;
- }
return 0;
}
static int nfit_test_remove(struct platform_device *pdev)
{
- struct nfit_test *nfit_test = to_nfit_test(&pdev->dev);
- struct acpi_nfit_desc *acpi_desc = &nfit_test->acpi_desc;
-
- nvdimm_bus_unregister(acpi_desc->nvdimm_bus);
-
return 0;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] nfit, tools/testing/nvdimm/: unify shutdown paths
2016-07-22 3:25 ` [PATCH 2/2] nfit, tools/testing/nvdimm/: unify shutdown paths Dan Williams
@ 2016-07-22 12:41 ` joeyli
0 siblings, 0 replies; 4+ messages in thread
From: joeyli @ 2016-07-22 12:41 UTC (permalink / raw)
To: Dan Williams; +Cc: linux-nvdimm, vishal.l.verma, linux-acpi
Hi Dan,
On Thu, Jul 21, 2016 at 08:25:50PM -0700, Dan Williams wrote:
> While testing the new on-demand ARS patches we discovered that
> differences between the nfit_test and normal nfit driver shutdown paths
> can leak resources. Unify the shutdown paths to trigger via a devm_
> callback when the acpi_desc->dev is unbound from its driver.
>
> Reported-by: Vishal Verma <vishal.l.verma@intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Lee, Chun-Yi <jlee@suse.com>
Thanks a lot!
Joey Lee
> ---
> drivers/acpi/nfit.c | 36 ++++++++++++++++++++++--------------
> tools/testing/nvdimm/test/nfit.c | 16 ++--------------
> 2 files changed, 24 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
> index e7eb3b6f1514..be7c2fde16e7 100644
> --- a/drivers/acpi/nfit.c
> +++ b/drivers/acpi/nfit.c
> @@ -2291,6 +2291,16 @@ static int acpi_nfit_check_deletions(struct acpi_nfit_desc *acpi_desc,
> return 0;
> }
>
> +static void acpi_nfit_destruct(void *data)
> +{
> + struct acpi_nfit_desc *acpi_desc = data;
> +
> + acpi_desc->cancel = 1;
> + flush_workqueue(nfit_wq);
> + nvdimm_bus_unregister(acpi_desc->nvdimm_bus);
> + acpi_desc->nvdimm_bus = NULL;
> +}
> +
> int acpi_nfit_init(struct acpi_nfit_desc *acpi_desc, void *data, acpi_size sz)
> {
> struct device *dev = acpi_desc->dev;
> @@ -2298,6 +2308,17 @@ int acpi_nfit_init(struct acpi_nfit_desc *acpi_desc, void *data, acpi_size sz)
> const void *end;
> int rc;
>
> + if (!acpi_desc->nvdimm_bus) {
> + acpi_desc->nvdimm_bus = nvdimm_bus_register(dev,
> + &acpi_desc->nd_desc);
> + if (!acpi_desc->nvdimm_bus)
> + return -ENOMEM;
> + rc = devm_add_action_or_reset(dev, acpi_nfit_destruct,
> + acpi_desc);
> + if (rc)
> + return rc;
> + }
> +
> mutex_lock(&acpi_desc->init_mutex);
>
> INIT_LIST_HEAD(&prev.spas);
> @@ -2456,9 +2477,6 @@ static int acpi_nfit_add(struct acpi_device *adev)
> if (!acpi_desc)
> return -ENOMEM;
> acpi_nfit_desc_init(acpi_desc, &adev->dev);
> - acpi_desc->nvdimm_bus = nvdimm_bus_register(dev, &acpi_desc->nd_desc);
> - if (!acpi_desc->nvdimm_bus)
> - return -ENOMEM;
>
> /* Save the acpi header for exporting the revision via sysfs */
> acpi_desc->acpi_header = *tbl;
> @@ -2480,19 +2498,12 @@ static int acpi_nfit_add(struct acpi_device *adev)
> rc = acpi_nfit_init(acpi_desc, (void *) tbl
> + sizeof(struct acpi_table_nfit),
> sz - sizeof(struct acpi_table_nfit));
> -
> - if (rc)
> - nvdimm_bus_unregister(acpi_desc->nvdimm_bus);
> return rc;
> }
>
> static int acpi_nfit_remove(struct acpi_device *adev)
> {
> - struct acpi_nfit_desc *acpi_desc = dev_get_drvdata(&adev->dev);
> -
> - acpi_desc->cancel = 1;
> - flush_workqueue(nfit_wq);
> - nvdimm_bus_unregister(acpi_desc->nvdimm_bus);
> + /* see acpi_nfit_destruct */
> return 0;
> }
>
> @@ -2519,9 +2530,6 @@ static void acpi_nfit_notify(struct acpi_device *adev, u32 event)
> if (!acpi_desc)
> goto out_unlock;
> acpi_nfit_desc_init(acpi_desc, &adev->dev);
> - acpi_desc->nvdimm_bus = nvdimm_bus_register(dev, &acpi_desc->nd_desc);
> - if (!acpi_desc->nvdimm_bus)
> - goto out_unlock;
> } else {
> /*
> * Finish previous registration before considering new
> diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
> index 642713f15723..5404efa578a3 100644
> --- a/tools/testing/nvdimm/test/nfit.c
> +++ b/tools/testing/nvdimm/test/nfit.c
> @@ -1465,16 +1465,11 @@ static int nfit_test_probe(struct platform_device *pdev)
> nd_desc->provider_name = NULL;
> nd_desc->module = THIS_MODULE;
> nd_desc->ndctl = nfit_test_ctl;
> - acpi_desc->nvdimm_bus = nvdimm_bus_register(&pdev->dev, nd_desc);
> - if (!acpi_desc->nvdimm_bus)
> - return -ENXIO;
>
> rc = acpi_nfit_init(acpi_desc, nfit_test->nfit_buf,
> nfit_test->nfit_size);
> - if (rc) {
> - nvdimm_bus_unregister(acpi_desc->nvdimm_bus);
> + if (rc)
> return rc;
> - }
>
> if (nfit_test->setup != nfit_test0_setup)
> return 0;
> @@ -1484,21 +1479,14 @@ static int nfit_test_probe(struct platform_device *pdev)
>
> rc = acpi_nfit_init(acpi_desc, nfit_test->nfit_buf,
> nfit_test->nfit_size);
> - if (rc) {
> - nvdimm_bus_unregister(acpi_desc->nvdimm_bus);
> + if (rc)
> return rc;
> - }
>
> return 0;
> }
>
> static int nfit_test_remove(struct platform_device *pdev)
> {
> - struct nfit_test *nfit_test = to_nfit_test(&pdev->dev);
> - struct acpi_nfit_desc *acpi_desc = &nfit_test->acpi_desc;
> -
> - nvdimm_bus_unregister(acpi_desc->nvdimm_bus);
> -
> return 0;
> }
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <146915794457.7201.5023729229431647060.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 1/2] libnvdimm: move ->module to struct nvdimm_bus_descriptor
[not found] ` <146915794457.7201.5023729229431647060.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2016-07-22 10:23 ` joeyli
0 siblings, 0 replies; 4+ messages in thread
From: joeyli @ 2016-07-22 10:23 UTC (permalink / raw)
To: Dan Williams
Cc: linux-acpi-u79uwXL29TY76Z2rM5mHXA,
linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw
On Thu, Jul 21, 2016 at 08:25:44PM -0700, Dan Williams wrote:
> Let the provider module be explicitly passed in rather than implicitly
> assumed by the module that calls nvdimm_bus_register(). This is in
> preparation for unifying the nfit and nfit_test driver teardown paths.
>
> Signed-off-by: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Lee, Chun-Yi <jlee-IBi9RG/b67k@public.gmane.org>
Regards
Joey Lee
> ---
> drivers/acpi/nfit.c | 1 +
> drivers/nvdimm/bus.c | 2 +-
> drivers/nvdimm/core.c | 7 +++----
> drivers/nvdimm/e820.c | 1 +
> drivers/nvdimm/nd-core.h | 1 -
> include/linux/libnvdimm.h | 7 +++----
> tools/testing/nvdimm/test/nfit.c | 1 +
> 7 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
> index fb80f32db525..e7eb3b6f1514 100644
> --- a/drivers/acpi/nfit.c
> +++ b/drivers/acpi/nfit.c
> @@ -2417,6 +2417,7 @@ void acpi_nfit_desc_init(struct acpi_nfit_desc *acpi_desc, struct device *dev)
> acpi_desc->blk_do_io = acpi_nfit_blk_region_do_io;
> nd_desc = &acpi_desc->nd_desc;
> nd_desc->provider_name = "ACPI.NFIT";
> + nd_desc->module = THIS_MODULE;
> nd_desc->ndctl = acpi_nfit_ctl;
> nd_desc->flush_probe = acpi_nfit_flush_probe;
> nd_desc->clear_to_send = acpi_nfit_clear_to_send;
> diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
> index 1cc7880320fe..275dd5c0a301 100644
> --- a/drivers/nvdimm/bus.c
> +++ b/drivers/nvdimm/bus.c
> @@ -73,7 +73,7 @@ static struct module *to_bus_provider(struct device *dev)
> if (is_nd_pmem(dev) || is_nd_blk(dev)) {
> struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev);
>
> - return nvdimm_bus->module;
> + return nvdimm_bus->nd_desc->module;
> }
> return NULL;
> }
> diff --git a/drivers/nvdimm/core.c b/drivers/nvdimm/core.c
> index 757e0cf028bf..e8528756f54f 100644
> --- a/drivers/nvdimm/core.c
> +++ b/drivers/nvdimm/core.c
> @@ -447,8 +447,8 @@ struct attribute_group nvdimm_bus_attribute_group = {
> };
> EXPORT_SYMBOL_GPL(nvdimm_bus_attribute_group);
>
> -struct nvdimm_bus *__nvdimm_bus_register(struct device *parent,
> - struct nvdimm_bus_descriptor *nd_desc, struct module *module)
> +struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
> + struct nvdimm_bus_descriptor *nd_desc)
> {
> struct nvdimm_bus *nvdimm_bus;
> int rc;
> @@ -467,7 +467,6 @@ struct nvdimm_bus *__nvdimm_bus_register(struct device *parent,
> return NULL;
> }
> nvdimm_bus->nd_desc = nd_desc;
> - nvdimm_bus->module = module;
> nvdimm_bus->dev.parent = parent;
> nvdimm_bus->dev.release = nvdimm_bus_release;
> nvdimm_bus->dev.groups = nd_desc->attr_groups;
> @@ -491,7 +490,7 @@ struct nvdimm_bus *__nvdimm_bus_register(struct device *parent,
> put_device(&nvdimm_bus->dev);
> return NULL;
> }
> -EXPORT_SYMBOL_GPL(__nvdimm_bus_register);
> +EXPORT_SYMBOL_GPL(nvdimm_bus_register);
>
> static void set_badblock(struct badblocks *bb, sector_t s, int num)
> {
> diff --git a/drivers/nvdimm/e820.c b/drivers/nvdimm/e820.c
> index 95825b38559a..11ea90120542 100644
> --- a/drivers/nvdimm/e820.c
> +++ b/drivers/nvdimm/e820.c
> @@ -47,6 +47,7 @@ static int e820_pmem_probe(struct platform_device *pdev)
>
> nd_desc.attr_groups = e820_pmem_attribute_groups;
> nd_desc.provider_name = "e820";
> + nd_desc.module = THIS_MODULE;
> nvdimm_bus = nvdimm_bus_register(dev, &nd_desc);
> if (!nvdimm_bus)
> goto err;
> diff --git a/drivers/nvdimm/nd-core.h b/drivers/nvdimm/nd-core.h
> index 6e961f7f43e7..38ce6bbbc170 100644
> --- a/drivers/nvdimm/nd-core.h
> +++ b/drivers/nvdimm/nd-core.h
> @@ -26,7 +26,6 @@ extern int nvdimm_major;
> struct nvdimm_bus {
> struct nvdimm_bus_descriptor *nd_desc;
> wait_queue_head_t probe_wait;
> - struct module *module;
> struct list_head list;
> struct device dev;
> int id, probe_active;
> diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
> index d37fda6dd64c..2ab869dece4a 100644
> --- a/include/linux/libnvdimm.h
> +++ b/include/linux/libnvdimm.h
> @@ -70,6 +70,7 @@ struct nd_mapping {
> struct nvdimm_bus_descriptor {
> const struct attribute_group **attr_groups;
> unsigned long cmd_mask;
> + struct module *module;
> char *provider_name;
> ndctl_fn ndctl;
> int (*flush_probe)(struct nvdimm_bus_descriptor *nd_desc);
> @@ -128,10 +129,8 @@ static inline struct nd_blk_region_desc *to_blk_region_desc(
> }
>
> int nvdimm_bus_add_poison(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length);
> -struct nvdimm_bus *__nvdimm_bus_register(struct device *parent,
> - struct nvdimm_bus_descriptor *nfit_desc, struct module *module);
> -#define nvdimm_bus_register(parent, desc) \
> - __nvdimm_bus_register(parent, desc, THIS_MODULE)
> +struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
> + struct nvdimm_bus_descriptor *nfit_desc);
> 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);
> diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
> index 78cba1e3b1da..642713f15723 100644
> --- a/tools/testing/nvdimm/test/nfit.c
> +++ b/tools/testing/nvdimm/test/nfit.c
> @@ -1463,6 +1463,7 @@ static int nfit_test_probe(struct platform_device *pdev)
> acpi_desc->blk_do_io = nfit_test_blk_do_io;
> nd_desc = &acpi_desc->nd_desc;
> nd_desc->provider_name = NULL;
> + nd_desc->module = THIS_MODULE;
> nd_desc->ndctl = nfit_test_ctl;
> acpi_desc->nvdimm_bus = nvdimm_bus_register(&pdev->dev, nd_desc);
> if (!acpi_desc->nvdimm_bus)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-22 12:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-22 3:25 [PATCH 1/2] libnvdimm: move ->module to struct nvdimm_bus_descriptor Dan Williams
2016-07-22 3:25 ` [PATCH 2/2] nfit, tools/testing/nvdimm/: unify shutdown paths Dan Williams
2016-07-22 12:41 ` joeyli
[not found] ` <146915794457.7201.5023729229431647060.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-07-22 10:23 ` [PATCH 1/2] libnvdimm: move ->module to struct nvdimm_bus_descriptor joeyli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox