Commit 8eac0379 authored by Christian Marangi's avatar Christian Marangi Committed by Lee Jones

leds: leds-lp5523: Convert to sysfs_emit API

Convert sprintf to the much safer sysfs_emit API to handle output for
sysfs.
Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
Link: https://lore.kernel.org/r/20240626221520.2846-2-ansuelsmth@gmail.comSigned-off-by: default avatarLee Jones <lee@kernel.org>
parent 6f2fdde9
...@@ -245,8 +245,8 @@ static ssize_t lp5523_selftest(struct device *dev, ...@@ -245,8 +245,8 @@ static ssize_t lp5523_selftest(struct device *dev,
goto fail; goto fail;
if (adc >= vdd || adc < LP5523_ADC_SHORTCIRC_LIM) if (adc >= vdd || adc < LP5523_ADC_SHORTCIRC_LIM)
pos += sprintf(buf + pos, "LED %d FAIL\n", pos += sysfs_emit_at(buf, pos, "LED %d FAIL\n",
led->chan_nr); led->chan_nr);
lp55xx_write(chip, LP5523_REG_LED_PWM_BASE + led->chan_nr, lp55xx_write(chip, LP5523_REG_LED_PWM_BASE + led->chan_nr,
0x00); 0x00);
...@@ -257,10 +257,10 @@ static ssize_t lp5523_selftest(struct device *dev, ...@@ -257,10 +257,10 @@ static ssize_t lp5523_selftest(struct device *dev,
led++; led++;
} }
if (pos == 0) if (pos == 0)
pos = sprintf(buf, "OK\n"); pos = sysfs_emit(buf, "OK\n");
goto release_lock; goto release_lock;
fail: fail:
pos = sprintf(buf, "FAIL\n"); pos = sysfs_emit(buf, "FAIL\n");
release_lock: release_lock:
mutex_unlock(&chip->lock); mutex_unlock(&chip->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment