diff --git a/MAINTAINERS b/MAINTAINERS index fecb85901aad..597ece49f365 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14245,3 +14245,8 @@ AMLOGIC LEDRING DRIVER M: Renjun Xu F: drivers/amlogic/ledring/aml-is31fl32xx.c F: drivers/amlogic/ledring/aml-pca9557.c + +AMLOGIC LEDRING DRIVER IOCTL +M: Renjun Xu +F: drivers/amlogic/ledring/aml-is31fl32xx.c +F: drivers/amlogic/ledring/aml-pca9557.c diff --git a/drivers/amlogic/ledring/aml-is31fl32xx.c b/drivers/amlogic/ledring/aml-is31fl32xx.c index 6da1224e8c71..e84aec5b786f 100644 --- a/drivers/amlogic/ledring/aml-is31fl32xx.c +++ b/drivers/amlogic/ledring/aml-is31fl32xx.c @@ -685,6 +685,7 @@ static void setup_timer_task(void) static const struct file_operations is31fl32xx_fops = { .owner = THIS_MODULE, .compat_ioctl = is31fl32xx_ioctl, + .unlocked_ioctl = is31fl32xx_ioctl, }; static int is31fl32xx_probe(struct i2c_client *client, @@ -694,7 +695,8 @@ static int is31fl32xx_probe(struct i2c_client *client, const struct of_device_id *of_dev_id; struct device *dev = &client->dev; struct is31fl32xx_priv *priv; - int count; + int count, i; + int try_times = 0; int ret = 0; pr_info("%s\n",__func__); @@ -725,11 +727,14 @@ static int is31fl32xx_probe(struct i2c_client *client, priv->client = client; priv->cdef = cdef; i2c_set_clientdata(client, priv); - - ret = is31fl32xx_init_regs(priv); - if (ret) - goto err1; - + for (i = 0; i < 3; i++) { + ret = is31fl32xx_init_regs(priv); + if (ret) { + if (++try_times >= 3) + goto err1; + } else + break; + } ret = is31fl32xx_parse_dt(dev, priv); if (ret) goto err1; diff --git a/drivers/amlogic/ledring/aml-pca9557.c b/drivers/amlogic/ledring/aml-pca9557.c index d014adc6469c..8f3ac270a056 100644 --- a/drivers/amlogic/ledring/aml-pca9557.c +++ b/drivers/amlogic/ledring/aml-pca9557.c @@ -437,6 +437,7 @@ static const struct file_operations led_fops = { .owner = THIS_MODULE, .read = leds_read, .compat_ioctl = leds_ioctl, + .unlocked_ioctl = leds_ioctl, }; static int ledring_parse_child_dt(const struct device *dev, int *mode) @@ -493,7 +494,8 @@ static int ledring_parse_child_dt(const struct device *dev, int *mode) static int ledring_probe(struct i2c_client *client, const struct i2c_device_id *i2c_id) { - int ret,i; + int ret, i; + int try_times = 0; struct device *dev = &client->dev; g_client = client; @@ -516,14 +518,23 @@ static int ledring_probe(struct i2c_client *client, if (ret) goto err1; key_led_des->run_time = DEFAULT_SPEED; - ret = leds_init(key_led_des->mode); - if (ret < 0) { - goto err1; + for (i = 0; i < 3; i++) { + ret = leds_init(key_led_des->mode); + if (ret != 0) { + if (++try_times >= 3) + goto err1; + } else + break; } } else { - ret = leds_init(key_led_des->mode); - if (ret < 0) - goto err3; + for (i = 0; i < 3; i++) { + ret = leds_init(key_led_des->mode); + if (ret != 0) { + if (++try_times >= 3) + goto err3; + } else + break; + } key_led_des->pca_input_dev = input_allocate_device(); if (key_led_des->pca_input_dev == NULL) { pr_err("input_allocate_device err!\n");