Sometimes a broken card-detect is not a general issue affecting all
boards, but only a given board. Allow setting broken_cd for such boards
via a device parameter.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
v1 -> v2:
  - replace Kconfig option with device parameter (Marco, Sascha)
---
 drivers/mci/mci-core.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 5f4457bab3df..26b524007609 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1919,7 +1919,7 @@ int mci_register(struct mci_host *host)
 {
        struct mci *mci;
        struct device_d *hw_dev;
-       struct param_d *param_probe;
+       struct param_d *param_probe, *param_broken_cd;
        int ret;
 
        mci = xzalloc(sizeof(*mci));
@@ -1973,6 +1973,15 @@ int mci_register(struct mci_host *host)
                goto err_unregister;
        }
 
+       param_broken_cd = dev_add_param_bool(&mci->dev, "broken_cd",
+                                            NULL, NULL, &host->broken_cd, mci);
+
+       if (IS_ERR(param_broken_cd) && PTR_ERR(param_broken_cd) != -ENOSYS) {
+               ret = PTR_ERR(param_broken_cd);
+               dev_dbg(&mci->dev, "Failed to add 'broken_cd' parameter to the 
MCI device\n");
+               goto err_unregister;
+       }
+
        if (IS_ENABLED(CONFIG_MCI_INFO))
                mci->dev.info = mci_info;
 
-- 
2.30.2


Reply via email to