diff mbox

[v2] /dev/dax: fix Kconfig dependency build breakage

Message ID 20160912161507.24311-1-ross.zwisler@linux.intel.com (mailing list archive)
State Accepted
Commit 4e65e9381c7a
Headers show

Commit Message

Ross Zwisler Sept. 12, 2016, 4:15 p.m. UTC
The function dax_pmem_probe() in drivers/dax/pmem.c is compiled under the
CONFIG_DEV_DAX_PMEM tri-state config option.  This config option currently
only depends on CONFIG_NVDIMM_DAX, a bool, which means that the following
configuration is possible:

CONFIG_LIBNVDIMM=m
...
CONFIG_NVDIMM_DAX=y
CONFIG_DEV_DAX=y
CONFIG_DEV_DAX_PMEM=y

With this config LIBNVDIMM is compiled as a module with NVDIMM_DAX=y just
meaning that we will compile drivers/nvdimm/dax_devs.c into that module.
However, dax_pmem_probe() depends on several symbols defined in
drivers/nvdimm/dax_devs.c, which results in the following build errors:

drivers/built-in.o: In function `dax_pmem_probe':
linux/drivers/dax/pmem.c:70: undefined reference to `to_nd_dax'
linux/drivers/dax/pmem.c:74: undefined reference to
`nvdimm_namespace_common_probe'
linux/drivers/dax/pmem.c:80: undefined reference to `devm_nsio_enable'
linux/drivers/dax/pmem.c:81: undefined reference to `nvdimm_setup_pfn'
linux/drivers/dax/pmem.c:84: undefined reference to `devm_nsio_disable'
linux/drivers/dax/pmem.c:122: undefined reference to `to_nd_region'
drivers/built-in.o: In function `dax_pmem_init':
linux/drivers/dax/pmem.c:147: undefined reference to `__nd_driver_register'

Fix this by making NVDIMM_DAX a tristate.  DEV_DAX_PMEM depends on
NVDIMM_DAX which depends on LIBNVDIMM.  Since they are all now tristates,
if LIBNVDIMM is built as a kernel module DEV_DAX_PMEM will be as well.
This prevents dax_devs.c from being built as a built-in while its
dependencies are in the libnvdimm.ko module.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Suggested-by: Dan Williams <dan.j.williams@intel.com>
---

Change from v1:
 - Made NVDIMM_DAX a tristate instead of adding an extra dependency. (djbw)

---
 drivers/nvdimm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dan Williams Sept. 13, 2016, 12:33 a.m. UTC | #1
On Mon, Sep 12, 2016 at 9:15 AM, Ross Zwisler
<ross.zwisler@linux.intel.com> wrote:
> The function dax_pmem_probe() in drivers/dax/pmem.c is compiled under the
> CONFIG_DEV_DAX_PMEM tri-state config option.  This config option currently
> only depends on CONFIG_NVDIMM_DAX, a bool, which means that the following
> configuration is possible:
>
> CONFIG_LIBNVDIMM=m
> ...
> CONFIG_NVDIMM_DAX=y
> CONFIG_DEV_DAX=y
> CONFIG_DEV_DAX_PMEM=y
>
> With this config LIBNVDIMM is compiled as a module with NVDIMM_DAX=y just
> meaning that we will compile drivers/nvdimm/dax_devs.c into that module.
> However, dax_pmem_probe() depends on several symbols defined in
> drivers/nvdimm/dax_devs.c, which results in the following build errors:
>
> drivers/built-in.o: In function `dax_pmem_probe':
> linux/drivers/dax/pmem.c:70: undefined reference to `to_nd_dax'
> linux/drivers/dax/pmem.c:74: undefined reference to
> `nvdimm_namespace_common_probe'
> linux/drivers/dax/pmem.c:80: undefined reference to `devm_nsio_enable'
> linux/drivers/dax/pmem.c:81: undefined reference to `nvdimm_setup_pfn'
> linux/drivers/dax/pmem.c:84: undefined reference to `devm_nsio_disable'
> linux/drivers/dax/pmem.c:122: undefined reference to `to_nd_region'
> drivers/built-in.o: In function `dax_pmem_init':
> linux/drivers/dax/pmem.c:147: undefined reference to `__nd_driver_register'
>
> Fix this by making NVDIMM_DAX a tristate.  DEV_DAX_PMEM depends on
> NVDIMM_DAX which depends on LIBNVDIMM.  Since they are all now tristates,
> if LIBNVDIMM is built as a kernel module DEV_DAX_PMEM will be as well.
> This prevents dax_devs.c from being built as a built-in while its
> dependencies are in the libnvdimm.ko module.
>
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> Suggested-by: Dan Williams <dan.j.williams@intel.com>
> ---
>
> Change from v1:
>  - Made NVDIMM_DAX a tristate instead of adding an extra dependency. (djbw)

Thanks, applied.
diff mbox

Patch

diff --git a/drivers/nvdimm/Kconfig b/drivers/nvdimm/Kconfig
index 124c243..8b2b740 100644
--- a/drivers/nvdimm/Kconfig
+++ b/drivers/nvdimm/Kconfig
@@ -89,7 +89,7 @@  config NVDIMM_PFN
 	  Select Y if unsure
 
 config NVDIMM_DAX
-	bool "NVDIMM DAX: Raw access to persistent memory"
+	tristate "NVDIMM DAX: Raw access to persistent memory"
 	default LIBNVDIMM
 	depends on NVDIMM_PFN
 	help