mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-15 18:03:30 +00:00
kernel: leds-ws2812b: fix build with Linux >= 5.18
The return value of the .remove function pointer has changed from int to void with Linux 5.18. Use a precompiler macro to allow building the leds-ws2812b module with both, Linux 5.15 and Linux 6.1. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
d3e80e6e60
commit
a1c87e7c74
@ -17,6 +17,7 @@
|
|||||||
#include <linux/property.h>
|
#include <linux/property.h>
|
||||||
#include <linux/spi/spi.h>
|
#include <linux/spi/spi.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
|
#include <linux/version.h>
|
||||||
|
|
||||||
#define WS2812B_BYTES_PER_COLOR 3
|
#define WS2812B_BYTES_PER_COLOR 3
|
||||||
#define WS2812B_NUM_COLORS 3
|
#define WS2812B_NUM_COLORS 3
|
||||||
@ -191,7 +192,11 @@ ERR_UNREG_LEDS:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,18,0)
|
||||||
|
static void ws2812b_remove(struct spi_device *spi)
|
||||||
|
#else
|
||||||
static int ws2812b_remove(struct spi_device *spi)
|
static int ws2812b_remove(struct spi_device *spi)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
struct ws2812b_priv *priv = spi_get_drvdata(spi);
|
struct ws2812b_priv *priv = spi_get_drvdata(spi);
|
||||||
int cur_led;
|
int cur_led;
|
||||||
@ -201,7 +206,9 @@ static int ws2812b_remove(struct spi_device *spi)
|
|||||||
kfree(priv->data_buf);
|
kfree(priv->data_buf);
|
||||||
mutex_destroy(&priv->mutex);
|
mutex_destroy(&priv->mutex);
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
|
||||||
return 0;
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct spi_device_id ws2812b_spi_ids[] = {
|
static const struct spi_device_id ws2812b_spi_ids[] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user