X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=drivers%2Fpwm%2Fcore.c;h=a0860b30bd931760480ca6800d539d08d6433478;hb=e265eb3a30543a237b2ebc4e0422ac82e55b07e4;hp=799c4fb4cc2faeba3770f8e743798f23c3ff5563;hpb=69efb3439ccf2ce72e01edde05d2c63d624e251e;p=karo-tx-linux.git diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 799c4fb4cc2f..a0860b30bd93 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -765,6 +765,7 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id) unsigned int best = 0; struct pwm_lookup *p, *chosen = NULL; unsigned int match; + int err; /* look up via DT first */ if (IS_ENABLED(CONFIG_OF) && dev && dev->of_node) @@ -825,6 +826,19 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id) return ERR_PTR(-ENODEV); chip = pwmchip_find_by_name(chosen->provider); + + /* + * If the lookup entry specifies a module, load the module and retry + * the PWM chip lookup. This can be used to work around driver load + * ordering issues if driver's can't be made to properly support the + * deferred probe mechanism. + */ + if (!chip && chosen->module) { + err = request_module(chosen->module); + if (err == 0) + chip = pwmchip_find_by_name(chosen->provider); + } + if (!chip) return ERR_PTR(-EPROBE_DEFER);