device-dax: Adding match parameter to select which driver to match dax devices
PATCH v2 1/1 device-dax: Adding match parameter to select which driver to match dax devices
device_dax driver always match dax devices by default. The other drivers only match devices by dax_id. There is 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 <[email protected]>
---
Changes:
- v1->v2 fix build errors report by kernel test robot <[email protected]>
---
drivers/dax/device.c | 3 +++ drivers/dax/kmem.c | 4 ++++ 2 files changed, 7 insertions(+)
drivers/dax/device.c +3 -0
@@ -452,6 +452,7 @@ int dev_dax_probe(struct dev_dax *dev_dax) }EXPORT_SYMBOL_GPL (dev_dax_probe); +unsigned int dax_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 = dax_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 (dax_match, uint,0644 );MODULE_AUTHOR ("Intel Corporation" );MODULE_LICENSE ("GPL v2" );module_init (dax_init);
drivers/dax/kmem.c +4 -0
@@ -214,9 +214,11 @@ static void dev_dax_kmem_remove(struct dev_dax *dev_dax) }#endif /* CONFIG_MEMORY_HOTREMOVE */ +unsigned int kmem_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 = kmem_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 (kmem_match, uint,0644 );MODULE_AUTHOR ("Intel Corporation" );MODULE_LICENSE ("GPL v2" );module_init (dax_kmem_init);
Signature · 1 line
1.8.3.1