Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org,
	Lucas Tanure <tanureal@opensource.cirrus.com>,
	Cezary Rojewski <cezary.rojewski@intel.com>,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Subject: [PATCH 1/8] ASoC: cs43130: Replace scnprintf() with sysfs_emit()
Date: Mon,  1 Aug 2022 19:01:01 +0200	[thread overview]
Message-ID: <20220801170108.26340-2-tiwai@suse.de> (raw)
In-Reply-To: <20220801170108.26340-1-tiwai@suse.de>

sysfs_emit() is a new helper to simplify the sysfs string output.
Replace the open-code straightforwardly with this new helper.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/soc/codecs/cs43130.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c
index ca4d47cc9c91..06c6ad3ca2b7 100644
--- a/sound/soc/codecs/cs43130.c
+++ b/sound/soc/codecs/cs43130.c
@@ -1666,10 +1666,9 @@ static int cs43130_show_dc(struct device *dev, char *buf, u8 ch)
 	struct cs43130_private *cs43130 = i2c_get_clientdata(client);
 
 	if (!cs43130->hpload_done)
-		return scnprintf(buf, PAGE_SIZE, "NO_HPLOAD\n");
+		return sysfs_emit(buf, "NO_HPLOAD\n");
 	else
-		return scnprintf(buf, PAGE_SIZE, "%u\n",
-				 cs43130->hpload_dc[ch]);
+		return sysfs_emit(buf, "%u\n", cs43130->hpload_dc[ch]);
 }
 
 static ssize_t hpload_dc_l_show(struct device *dev,
@@ -1705,8 +1704,8 @@ static int cs43130_show_ac(struct device *dev, char *buf, u8 ch)
 
 	if (cs43130->hpload_done && cs43130->ac_meas) {
 		for (i = 0; i < ARRAY_SIZE(cs43130_ac_freq); i++) {
-			tmp = scnprintf(buf + j, PAGE_SIZE - j, "%u\n",
-					cs43130->hpload_ac[i][ch]);
+			tmp = sysfs_emit_at(buf, j, "%u\n",
+					    cs43130->hpload_ac[i][ch]);
 			if (!tmp)
 				break;
 
@@ -1715,7 +1714,7 @@ static int cs43130_show_ac(struct device *dev, char *buf, u8 ch)
 
 		return j;
 	} else {
-		return scnprintf(buf, PAGE_SIZE, "NO_HPLOAD\n");
+		return sysfs_emit(buf, "NO_HPLOAD\n");
 	}
 }
 
-- 
2.35.3


  reply	other threads:[~2022-08-01 17:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01 17:01 [PATCH 0/8] ASoC: Replace sprintf() with sysfs_emit() Takashi Iwai
2022-08-01 17:01 ` Takashi Iwai [this message]
2022-08-01 17:01 ` [PATCH 2/8] ASoC: tlv320aic26: " Takashi Iwai
2022-08-01 17:01 ` [PATCH 3/8] ASoC: Intel: sst: " Takashi Iwai
2022-08-01 17:01 ` [PATCH 4/8] ASoC: Intel: catpt: " Takashi Iwai
2022-08-02 10:17   ` Cezary Rojewski
2022-08-01 17:01 ` [PATCH 5/8] ASoC: Intel: skylake: " Takashi Iwai
2022-08-02 10:17   ` Cezary Rojewski
2022-08-01 17:01 ` [PATCH 6/8] ASoC: core: " Takashi Iwai
2022-08-01 17:01 ` [PATCH 7/8] ASoC: DAPM: Replace sprintf() calls with sysfs_emit_at() Takashi Iwai
2022-08-01 17:01 ` [PATCH 8/8] ASoC: omap: Replace sprintf() with sysfs_emit() Takashi Iwai
2022-08-01 18:54   ` Péter Ujfalusi
2022-08-15 16:23 ` [PATCH 0/8] ASoC: " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220801170108.26340-2-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tanureal@opensource.cirrus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox