From: Zhenguo Yao <yaozhenguo1@gmail.com>
To: dan.j.williams@intel.com, vishal.l.verma@intel.com, dave.jiang@intel.com
Cc: nvdimm@lists.linux.dev, yaozhenguo@jd.com,
linux-kernel@vger.kernel.org, Zhenguo Yao <yaozhenguo1@gmail.com>
Subject: [PATCH v1] device-dax: Adding match parameter to select which driver to match dax devices
Date: Mon, 28 Feb 2022 17:49:38 +0800 [thread overview]
Message-ID: <20220228094938.32153-1-yaozhenguo1@gmail.com> (raw)
device_dax driver always match dax devices by default. The other
drivers only match devices by dax_id. There are situations which
need kmem drvier match all the dax device at boot time. So
adding a parameter to support this function.
Signed-off-by: Zhenguo Yao <yaozhenguo1@gmail.com>
---
drivers/dax/device.c | 3 +++
drivers/dax/kmem.c | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/drivers/dax/device.c b/drivers/dax/device.c
index dd8222a..a974cc1 100644
--- a/drivers/dax/device.c
+++ b/drivers/dax/device.c
@@ -452,6 +452,7 @@ int dev_dax_probe(struct dev_dax *dev_dax)
}
EXPORT_SYMBOL_GPL(dev_dax_probe);
+unsigned int match = 1;
static struct dax_device_driver device_dax_driver = {
.probe = dev_dax_probe,
/* all probe actions are unwound by devm, so .remove isn't necessary */
@@ -460,6 +461,7 @@ int dev_dax_probe(struct dev_dax *dev_dax)
static int __init dax_init(void)
{
+ device_dax_driver.match_always = match;
return dax_driver_register(&device_dax_driver);
}
@@ -468,6 +470,7 @@ static void __exit dax_exit(void)
dax_driver_unregister(&device_dax_driver);
}
+module_param(match, uint, 0644);
MODULE_AUTHOR("Intel Corporation");
MODULE_LICENSE("GPL v2");
module_init(dax_init);
diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c
index a376220..41ba713 100644
--- a/drivers/dax/kmem.c
+++ b/drivers/dax/kmem.c
@@ -214,9 +214,11 @@ static void dev_dax_kmem_remove(struct dev_dax *dev_dax)
}
#endif /* CONFIG_MEMORY_HOTREMOVE */
+unsigned int match;
static struct dax_device_driver device_dax_kmem_driver = {
.probe = dev_dax_kmem_probe,
.remove = dev_dax_kmem_remove,
+ .match_always = 0,
};
static int __init dax_kmem_init(void)
@@ -228,6 +230,7 @@ static int __init dax_kmem_init(void)
if (!kmem_name)
return -ENOMEM;
+ device_dax_kmem_driver.match_always = match;
rc = dax_driver_register(&device_dax_kmem_driver);
if (rc)
kfree_const(kmem_name);
@@ -241,6 +244,7 @@ static void __exit dax_kmem_exit(void)
kfree_const(kmem_name);
}
+module_param(match, uint, 0644);
MODULE_AUTHOR("Intel Corporation");
MODULE_LICENSE("GPL v2");
module_init(dax_kmem_init);
--
1.8.3.1
next reply other threads:[~2022-02-28 9:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-28 9:49 Zhenguo Yao [this message]
2022-02-28 17:36 ` [PATCH v1] device-dax: Adding match parameter to select which driver to match dax devices kernel test robot
2022-03-23 2:01 ` Dan Williams
2022-03-23 2:44 ` Zhenguo Yao
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=20220228094938.32153-1-yaozhenguo1@gmail.com \
--to=yaozhenguo1@gmail.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=vishal.l.verma@intel.com \
--cc=yaozhenguo@jd.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