All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [PATCH 4/7] ALSA: core: Replace scnprintf() with sysfs_emit()
Date: Mon,  1 Aug 2022 18:56:36 +0200	[thread overview]
Message-ID: <20220801165639.26030-5-tiwai@suse.de> (raw)
In-Reply-To: <20220801165639.26030-1-tiwai@suse.de>

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

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/core/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/core/init.c b/sound/core/init.c
index 3ac95c66a4b5..193dae361fac 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -784,7 +784,7 @@ static ssize_t id_show(struct device *dev,
 		       struct device_attribute *attr, char *buf)
 {
 	struct snd_card *card = container_of(dev, struct snd_card, card_dev);
-	return scnprintf(buf, PAGE_SIZE, "%s\n", card->id);
+	return sysfs_emit(buf, "%s\n", card->id);
 }
 
 static ssize_t id_store(struct device *dev, struct device_attribute *attr,
@@ -822,7 +822,7 @@ static ssize_t number_show(struct device *dev,
 			   struct device_attribute *attr, char *buf)
 {
 	struct snd_card *card = container_of(dev, struct snd_card, card_dev);
-	return scnprintf(buf, PAGE_SIZE, "%i\n", card->number);
+	return sysfs_emit(buf, "%i\n", card->number);
 }
 
 static DEVICE_ATTR_RO(number);
-- 
2.35.3


  parent reply	other threads:[~2022-08-01 16:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01 16:56 [PATCH 0/7] ALSA: Replace sprintf() with sysfs_emit() Takashi Iwai
2022-08-01 16:56 ` [PATCH 1/7] ALSA: ac97: " Takashi Iwai
2022-08-01 16:56 ` [PATCH 2/7] ALSA: aoa: " Takashi Iwai
2022-08-01 16:56 ` [PATCH 3/7] ALSA: control-led: " Takashi Iwai
2022-08-01 16:56 ` Takashi Iwai [this message]
2022-08-01 16:56 ` [PATCH 5/7] ALSA: pcm: " Takashi Iwai
2022-08-01 16:56 ` [PATCH 6/7] ALSA: hda: " Takashi Iwai
2022-08-01 16:56 ` [PATCH 7/7] ALSA: line6: " Takashi Iwai

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=20220801165639.26030-5-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.