aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2023-04-20 11:09:38 +0200
committerÁlvaro Fernández Rojas <noltari@gmail.com>2023-04-23 12:19:02 +0200
commit7f285b9c1df2b2332832df33bee9a12c0532cee6 (patch)
treebb8d6548edb784855c8ea4d376fb02a922545243
parentf6f4db6e4d156d9d0dacc9d19d4355dc284d6483 (diff)
downloadupstream-7f285b9c1df2b2332832df33bee9a12c0532cee6.tar.gz
upstream-7f285b9c1df2b2332832df33bee9a12c0532cee6.tar.bz2
upstream-7f285b9c1df2b2332832df33bee9a12c0532cee6.zip
bmips: leds-sercomm-msp430: improve driver
- Add missing module functions. - Fix infinite pattern trigger by converting negative values to 0. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
-rw-r--r--target/linux/bmips/files/drivers/leds/leds-sercomm-msp430.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/target/linux/bmips/files/drivers/leds/leds-sercomm-msp430.c b/target/linux/bmips/files/drivers/leds/leds-sercomm-msp430.c
index 5409142989..d3167de053 100644
--- a/target/linux/bmips/files/drivers/leds/leds-sercomm-msp430.c
+++ b/target/linux/bmips/files/drivers/leds/leds-sercomm-msp430.c
@@ -212,6 +212,10 @@ static int msp430_pattern_set(struct led_classdev *led_cdev,
delay0 = msp430_blink_delay(pattern[0].delta_t);
delay1 = msp430_blink_delay(pattern[1].delta_t);
+ /* Infinite pattern */
+ if (repeat < 0)
+ repeat = 0;
+
/* Pulse: <off> <delay> <max> <delay> */
if (delay0 == delay1 &&
pattern[0].brightness == LED_OFF &&
@@ -354,14 +358,15 @@ static int msp430_leds_probe(struct spi_device *spi)
static const struct of_device_id msp430_leds_of_match[] = {
{ .compatible = "sercomm,msp430-leds", },
- { },
+ { /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, msp430_leds_of_match);
static const struct spi_device_id msp430_leds_id_table[] = {
{ "msp430-leds", 0 },
- { }
+ { /* sentinel */ }
};
+MODULE_DEVICE_TABLE(spi, msp430_leds_id_table);
static struct spi_driver msp430_leds_driver = {
.driver = {
@@ -371,7 +376,6 @@ static struct spi_driver msp430_leds_driver = {
.id_table = msp430_leds_id_table,
.probe = msp430_leds_probe,
};
-
module_spi_driver(msp430_leds_driver);
MODULE_AUTHOR("Álvaro Fernández Rojas <noltari@gmail.com>");