summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2017-02-08 17:47:44 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2017-02-08 17:47:43 -0800
commit2c9038e7d14cac188bfaa423f5ee9735d1f85e02 (patch)
treeb4de214a45d69ca7bd0f68f720834374d5f76470
parent331a26c52b451e0b1236194f6b5cc9970608b029 (diff)
parent8ef7a9ac26ae30c16333afc742a841876be37570 (diff)
Merge "leds: leds-qpnp-wled: correct various coding style issues"
-rw-r--r--drivers/leds/Kconfig9
-rw-r--r--drivers/leds/leds-qpnp-wled.c50
2 files changed, 26 insertions, 33 deletions
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 168543d682b6..966227a3df1a 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -619,11 +619,10 @@ config LEDS_QPNP_WLED
tristate "Support for QPNP WLED"
depends on LEDS_CLASS && SPMI
help
- This driver supports the WLED (White LED) functionality of
- Qualcomm Technologies PNP PMIC. WLED is used for display backlight.
-
- To compile this driver as a module, choose M here: the module will
- be called leds-qpnp-wled.
+ This driver supports the WLED (White LED) functionality of Qualcomm
+ Technologies, Inc. QPNP PMICs. WLED is used for LCD backlight with
+ variable brightness. It also supports outputting the Avdd supply for
+ AMOLED displays.
config LEDS_SYSCON
bool "LED support for LEDs on system controllers"
diff --git a/drivers/leds/leds-qpnp-wled.c b/drivers/leds/leds-qpnp-wled.c
index 718badb16ea1..1e24c79c3f0a 100644
--- a/drivers/leds/leds-qpnp-wled.c
+++ b/drivers/leds/leds-qpnp-wled.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -721,10 +721,11 @@ static ssize_t qpnp_wled_ramp_ms_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct qpnp_wled *wled = dev_get_drvdata(dev);
- int data;
+ int data, rc;
- if (sscanf(buf, "%d", &data) != 1)
- return -EINVAL;
+ rc = kstrtoint(buf, 10, &data);
+ if (rc)
+ return rc;
wled->ramp_ms = data;
return count;
@@ -744,10 +745,11 @@ static ssize_t qpnp_wled_ramp_step_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct qpnp_wled *wled = dev_get_drvdata(dev);
- int data;
+ int data, rc;
- if (sscanf(buf, "%d", &data) != 1)
- return -EINVAL;
+ rc = kstrtoint(buf, 10, &data);
+ if (rc)
+ return rc;
wled->ramp_step = data;
return count;
@@ -832,8 +834,9 @@ static ssize_t qpnp_wled_fs_curr_ua_store(struct device *dev,
int data, i, rc, temp;
u8 reg;
- if (sscanf(buf, "%d", &data) != 1)
- return -EINVAL;
+ rc = kstrtoint(buf, 10, &data);
+ if (rc)
+ return rc;
for (i = 0; i < wled->num_strings; i++) {
if (data < QPNP_WLED_FS_CURR_MIN_UA)
@@ -869,24 +872,15 @@ static ssize_t qpnp_wled_fs_curr_ua_store(struct device *dev,
/* sysfs attributes exported by wled */
static struct device_attribute qpnp_wled_attrs[] = {
- __ATTR(dump_regs, (S_IRUGO | S_IWUSR | S_IWGRP),
- qpnp_wled_dump_regs_show,
- NULL),
- __ATTR(dim_mode, (S_IRUGO | S_IWUSR | S_IWGRP),
- qpnp_wled_dim_mode_show,
- qpnp_wled_dim_mode_store),
- __ATTR(fs_curr_ua, (S_IRUGO | S_IWUSR | S_IWGRP),
- qpnp_wled_fs_curr_ua_show,
- qpnp_wled_fs_curr_ua_store),
- __ATTR(start_ramp, (S_IRUGO | S_IWUSR | S_IWGRP),
- NULL,
- qpnp_wled_ramp_store),
- __ATTR(ramp_ms, (S_IRUGO | S_IWUSR | S_IWGRP),
- qpnp_wled_ramp_ms_show,
- qpnp_wled_ramp_ms_store),
- __ATTR(ramp_step, (S_IRUGO | S_IWUSR | S_IWGRP),
- qpnp_wled_ramp_step_show,
- qpnp_wled_ramp_step_store),
+ __ATTR(dump_regs, 0664, qpnp_wled_dump_regs_show, NULL),
+ __ATTR(dim_mode, 0664, qpnp_wled_dim_mode_show,
+ qpnp_wled_dim_mode_store),
+ __ATTR(fs_curr_ua, 0664, qpnp_wled_fs_curr_ua_show,
+ qpnp_wled_fs_curr_ua_store),
+ __ATTR(start_ramp, 0664, NULL, qpnp_wled_ramp_store),
+ __ATTR(ramp_ms, 0664, qpnp_wled_ramp_ms_show, qpnp_wled_ramp_ms_store),
+ __ATTR(ramp_step, 0664, qpnp_wled_ramp_step_show,
+ qpnp_wled_ramp_step_store),
};
/* worker for setting wled brightness */
@@ -2196,7 +2190,7 @@ static int qpnp_wled_remove(struct platform_device *pdev)
return 0;
}
-static struct of_device_id spmi_match_table[] = {
+static const struct of_device_id spmi_match_table[] = {
{ .compatible = "qcom,qpnp-wled",},
{ },
};