[B] [PATCH 1/1] mfd: intel-lpss: Use MODULE_SOFTDEP() instead of implicit request

Kai-Heng Feng kai.heng.feng at canonical.com
Wed Jun 8 03:06:02 UTC 2022


From: Andy Shevchenko <andriy.shevchenko at linux.intel.com>

BugLink: https://bugs.launchpad.net/bugs/1973167

There is no need to handle optional module request in the driver
when user space tools has that feature for ages.

Replace custom code by MODULE_SOFTDEP() macro to let user space know
that we would like to have the DMA driver loaded first, if any.

Signed-off-by: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
Signed-off-by: Lee Jones <lee.jones at linaro.org>
(backported from commit 569fac74627cc332a2097a7a4bfdc654b8e7f273)
Signed-off-by: Kai-Heng Feng <kai.heng.feng at canonical.com>
---
 drivers/mfd/intel-lpss.c | 29 ++++++++---------------------
 1 file changed, 8 insertions(+), 21 deletions(-)

diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
index ac89d2751c854..6d440cdcebdec 100644
--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -142,17 +142,6 @@ static const struct dmi_system_id mtrr_large_wc_region[] = {
 	{ }
 };
 
-static int intel_lpss_request_dma_module(const char *name)
-{
-	static bool intel_lpss_dma_requested;
-
-	if (intel_lpss_dma_requested)
-		return 0;
-
-	intel_lpss_dma_requested = true;
-	return request_module("%s", name);
-}
-
 static void intel_lpss_cache_ltr(struct intel_lpss *lpss)
 {
 	lpss->active_ltr = readl(lpss->priv + LPSS_PRIV_ACTIVELTR);
@@ -447,16 +436,6 @@ int intel_lpss_probe(struct device *dev,
 		dev_warn(dev, "Failed to create debugfs entries\n");
 
 	if (intel_lpss_has_idma(lpss)) {
-		/*
-		 * Ensure the DMA driver is loaded before the host
-		 * controller device appears, so that the host controller
-		 * driver can request its DMA channels as early as
-		 * possible.
-		 *
-		 * If the DMA module is not there that's OK as well.
-		 */
-		intel_lpss_request_dma_module(LPSS_IDMA64_DRIVER_NAME);
-
 		ret = mfd_add_devices(dev, lpss->devid, &intel_lpss_idma64_cell,
 				      1, info->mem, info->irq, NULL);
 		if (ret)
@@ -568,3 +547,11 @@ MODULE_AUTHOR("Heikki Krogerus <heikki.krogerus at linux.intel.com>");
 MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula at linux.intel.com>");
 MODULE_DESCRIPTION("Intel LPSS core driver");
 MODULE_LICENSE("GPL v2");
+/*
+ * Ensure the DMA driver is loaded before the host controller device appears,
+ * so that the host controller driver can request its DMA channels as early
+ * as possible.
+ *
+ * If the DMA module is not there that's OK as well.
+ */
+MODULE_SOFTDEP("pre: platform:" LPSS_IDMA64_DRIVER_NAME);
-- 
2.36.1




More information about the kernel-team mailing list