($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Hungyu Lin <dennylin0707@gmail.com>
Cc: okaya@kernel.org, vkoul@kernel.org, Frank.Li@kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dmaengine: qcom: hidma: use sysfs_emit() in sysfs show callbacks
Date: Mon, 8 Jun 2026 11:27:09 -0500	[thread overview]
Message-ID: <aibtXevTXeJ499Hg@SMW015318> (raw)
In-Reply-To: <20260607163119.78717-1-dennylin0707@gmail.com>

On Sun, Jun 07, 2026 at 04:31:19PM +0000, Hungyu Lin wrote:
> [You don't often get email from dennylin0707@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Replace sprintf() and strlen() patterns in sysfs show callbacks
> with sysfs_emit().
>
> sysfs_emit() is the preferred helper for formatting sysfs output
> and simplifies the implementation.
>
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/dma/qcom/hidma.c          |  6 ++----
>  drivers/dma/qcom/hidma_mgmt_sys.c | 19 ++++++++-----------
>  2 files changed, 10 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/dma/qcom/hidma.c b/drivers/dma/qcom/hidma.c
> index 5a8dca8db5ce..7a7f302a9699 100644
> --- a/drivers/dma/qcom/hidma.c
> +++ b/drivers/dma/qcom/hidma.c
> @@ -624,12 +624,10 @@ static ssize_t hidma_show_values(struct device *dev,
>  {
>         struct hidma_dev *mdev = dev_get_drvdata(dev);
>
> -       buf[0] = 0;
> -
>         if (strcmp(attr->attr.name, "chid") == 0)
> -               sprintf(buf, "%d\n", mdev->chidx);
> +               return sysfs_emit(buf, "%d\n", mdev->chidx);
>
> -       return strlen(buf);
> +       return 0;
>  }
>
>  static inline void  hidma_sysfs_uninit(struct hidma_dev *dev)
> diff --git a/drivers/dma/qcom/hidma_mgmt_sys.c b/drivers/dma/qcom/hidma_mgmt_sys.c
> index 930eae0a6257..9672ef9ee8fc 100644
> --- a/drivers/dma/qcom/hidma_mgmt_sys.c
> +++ b/drivers/dma/qcom/hidma_mgmt_sys.c
> @@ -102,15 +102,12 @@ static ssize_t show_values(struct device *dev, struct device_attribute *attr,
>         struct hidma_mgmt_dev *mdev = dev_get_drvdata(dev);
>         unsigned int i;
>
> -       buf[0] = 0;
> -
>         for (i = 0; i < ARRAY_SIZE(hidma_mgmt_files); i++) {
> -               if (strcmp(attr->attr.name, hidma_mgmt_files[i].name) == 0) {
> -                       sprintf(buf, "%d\n", hidma_mgmt_files[i].get(mdev));
> -                       break;
> -               }
> +               if (strcmp(attr->attr.name, hidma_mgmt_files[i].name) == 0)
> +                       return sysfs_emit(buf, "%d\n",
> +                                       hidma_mgmt_files[i].get(mdev));
>         }
> -       return strlen(buf);
> +       return 0;
>  }
>
>  static ssize_t set_values(struct device *dev, struct device_attribute *attr,
> @@ -143,15 +140,15 @@ static ssize_t show_values_channel(struct kobject *kobj,
>         struct hidma_chan_attr *chattr;
>         struct hidma_mgmt_dev *mdev;
>
> -       buf[0] = 0;
>         chattr = container_of(attr, struct hidma_chan_attr, attr);
>         mdev = chattr->mdev;
> +
>         if (strcmp(attr->attr.name, "priority") == 0)
> -               sprintf(buf, "%d\n", mdev->priority[chattr->index]);
> +               return sysfs_emit(buf, "%d\n", mdev->priority[chattr->index]);
>         else if (strcmp(attr->attr.name, "weight") == 0)
> -               sprintf(buf, "%d\n", mdev->weight[chattr->index]);
> +               return sysfs_emit(buf, "%d\n", mdev->weight[chattr->index]);
>
> -       return strlen(buf);
> +       return 0;
>  }
>
>  static ssize_t set_values_channel(struct kobject *kobj,
> --
> 2.34.1
>

      parent reply	other threads:[~2026-06-08 16:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-07 16:31 [PATCH] dmaengine: qcom: hidma: use sysfs_emit() in sysfs show callbacks Hungyu Lin
2026-06-07 16:38 ` sashiko-bot
2026-06-07 18:30 ` Dmitry Baryshkov
2026-06-08 16:27 ` Frank Li [this message]

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=aibtXevTXeJ499Hg@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=Frank.Li@kernel.org \
    --cc=dennylin0707@gmail.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=okaya@kernel.org \
    --cc=vkoul@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox