lkml.org 
[lkml]   [2022]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 6/7] pwm: lpss: Add devm_pwm_lpss_probe() stub
On Thu, Nov 17, 2022 at 01:08:05PM +0200, Andy Shevchenko wrote:
> In case the PWM LPSS module is not provided, allow users to be
> compiled with the help of the devm_pwm_lpss_probe() stub.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Thierry Reding <thierry.reding@gmail.com>
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> ---
> include/linux/platform_data/x86/pwm-lpss.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/include/linux/platform_data/x86/pwm-lpss.h b/include/linux/platform_data/x86/pwm-lpss.h
> index c852fe24fe2a..6ef21b8baec7 100644
> --- a/include/linux/platform_data/x86/pwm-lpss.h
> +++ b/include/linux/platform_data/x86/pwm-lpss.h
> @@ -4,6 +4,8 @@
> #ifndef __PLATFORM_DATA_X86_PWM_LPSS_H
> #define __PLATFORM_DATA_X86_PWM_LPSS_H
>
> +#include <linux/err.h>
> +#include <linux/kconfig.h>
> #include <linux/types.h>
>
> struct device;
> @@ -27,7 +29,16 @@ struct pwm_lpss_boardinfo {
> bool other_devices_aml_touches_pwm_regs;
> };
>
> +#if IS_REACHABLE(CONFIG_PWM_LPSS)
> struct pwm_lpss_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base,
> const struct pwm_lpss_boardinfo *info);
> +#else
> +static inline
> +struct pwm_lpss_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base,
> + const struct pwm_lpss_boardinfo *info)
> +{
> + return ERR_PTR(-ENODEV);
> +}
> +#endif /* CONFIG_PWM_LPSS */

Hmm, this is actually never used, because if
!IS_REACHABLE(CONFIG_PWM_LPSS), the only caller (that is added in patch
7) has:

if (!IS_REACHABLE(CONFIG_PWM_LPSS))
return 0;

before devm_pwm_lpss_probe() is called.

Not sure if it's safe to just drop this patch. The return value is
neither -ENOSYS (which I would expect for a stub function like that) nor
-EINVAL (which for reasons unknown to me is used in the stub for
pwmchip_add()).

I would have a better feeling with -ENOSYS in your stub, but I don't
feel really strong here.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2022-11-22 17:49    [W:0.095 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site