diff options
author | Takashi Iwai <tiwai@suse.de> | 2022-08-01 19:01:08 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-08-15 01:19:51 +0100 |
commit | a111ae4d7f0796cf2ea0e8bf3ab6c06a401e0560 (patch) | |
tree | cff70a3fbabc94fbe63c9270dff99318493a1451 /sound/soc/ti | |
parent | 69f7cbfb08c7ee2ca565f532b0073b847db20bdc (diff) | |
download | linux-a111ae4d7f0796cf2ea0e8bf3ab6c06a401e0560.tar.bz2 |
ASoC: omap: Replace sprintf() with sysfs_emit()
For sysfs outputs, it's safer to use a new helper, sysfs_emit(),
instead of the raw sprintf() & co. This patch replaces the open code
with new helpers, sysfs_emit() and sysfs_emit_at(), with the proper
string offset.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://lore.kernel.org/r/20220801170108.26340-9-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/ti')
-rw-r--r-- | sound/soc/ti/omap-mcbsp-st.c | 6 | ||||
-rw-r--r-- | sound/soc/ti/omap-mcbsp.c | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/sound/soc/ti/omap-mcbsp-st.c b/sound/soc/ti/omap-mcbsp-st.c index 7e8179cae92e..8163f453bf36 100644 --- a/sound/soc/ti/omap-mcbsp-st.c +++ b/sound/soc/ti/omap-mcbsp-st.c @@ -244,10 +244,10 @@ static ssize_t st_taps_show(struct device *dev, spin_lock_irq(&mcbsp->lock); for (i = 0; i < st_data->nr_taps; i++) - status += sprintf(&buf[status], (i ? ", %d" : "%d"), - st_data->taps[i]); + status += sysfs_emit_at(buf, status, (i ? ", %d" : "%d"), + st_data->taps[i]); if (i) - status += sprintf(&buf[status], "\n"); + status += sysfs_emit_at(buf, status, "\n"); spin_unlock_irq(&mcbsp->lock); return status; diff --git a/sound/soc/ti/omap-mcbsp.c b/sound/soc/ti/omap-mcbsp.c index c4ac1f30b9fe..0b377bb7737f 100644 --- a/sound/soc/ti/omap-mcbsp.c +++ b/sound/soc/ti/omap-mcbsp.c @@ -517,7 +517,7 @@ static ssize_t prop##_show(struct device *dev, \ { \ struct omap_mcbsp *mcbsp = dev_get_drvdata(dev); \ \ - return sprintf(buf, "%u\n", mcbsp->prop); \ + return sysfs_emit(buf, "%u\n", mcbsp->prop); \ } \ \ static ssize_t prop##_store(struct device *dev, \ @@ -560,11 +560,11 @@ static ssize_t dma_op_mode_show(struct device *dev, for (s = &dma_op_modes[i]; i < ARRAY_SIZE(dma_op_modes); s++, i++) { if (dma_op_mode == i) - len += sprintf(buf + len, "[%s] ", *s); + len += sysfs_emit_at(buf, len, "[%s] ", *s); else - len += sprintf(buf + len, "%s ", *s); + len += sysfs_emit_at(buf, len, "%s ", *s); } - len += sprintf(buf + len, "\n"); + len += sysfs_emit_at(buf, len, "\n"); return len; } |