leds: leds-qpnp-wled: correct various coding style issues

Correct warnings flagged by checkpatch.  In particular, modify
the following:

 - Add 'const' to the type of a struct of_device_id variable.

 - Use octal file permissions instead of symbolic.

 - Replace sscanf() for a single integer with kstrtoint().

 - Update the LEDS_QPNP_WLED Kconfig entry to use the name
   'Qualcomm Technologies, Inc.'

 - Expand the description of the LEDS_QPNP_WLED config
   option.

Change-Id: I848983cd7beeb1a41191aba94fc8b33ce45fb2bc
Signed-off-by: David Collins <collinsd@codeaurora.org>
This commit is contained in:
David Collins 2017-02-01 17:32:31 -08:00
parent a0b77a2163
commit 8ef7a9ac26
2 changed files with 26 additions and 33 deletions

View file

@ -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"

View file

@ -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",},
{ },
};