[PATCH] ath79: fix MikroTik CPLD driver build error on kernel 6.1

Jonas Gorski jonas.gorski at gmail.com
Sun Sep 10 03:41:11 PDT 2023


Hi,

On Sat, 9 Sept 2023 at 04:44, Shiji Yang <yangshiji66 at outlook.com> wrote:
>
> From: Shiji Yang <yangshiji66 at qq.com>
>
> Since kernel 5.18, the return type in device remove function has
> changed from 'int' to 'void'.
>
> Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
> ---
>  target/linux/ath79/files/drivers/mfd/rb4xx-cpld.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/target/linux/ath79/files/drivers/mfd/rb4xx-cpld.c b/target/linux/ath79/files/drivers/mfd/rb4xx-cpld.c
> index da18424c63..f10ddef9e2 100644
> --- a/target/linux/ath79/files/drivers/mfd/rb4xx-cpld.c
> +++ b/target/linux/ath79/files/drivers/mfd/rb4xx-cpld.c
> @@ -22,6 +22,7 @@
>  #include <linux/spi/spi.h>
>  #include <linux/module.h>
>  #include <linux/of_platform.h>
> +#include <linux/version.h>
>
>  #include <mfd/rb4xx-cpld.h>
>
> @@ -151,9 +152,14 @@ static int rb4xx_cpld_probe(struct spi_device *spi)
>                                     NULL, 0, NULL);
>  }
>
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,18,0)
> +static void rb4xx_cpld_remove(struct spi_device *spi)
> +{
> +#else
>  static int rb4xx_cpld_remove(struct spi_device *spi)
>  {
>         return 0;
> +#endif

I'm pretty sure having a remove callback is optional, so why not just
delete it since it doesn't do anything anyway?

If we ever need one, we can just add one again.

Best Regards,
Jonas



More information about the openwrt-devel mailing list