public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: David Baum <davidbaum461@gmail.com>
Cc: alex.deucher@amd.com, christian.koenig@amd.com,
	lijo.lazar@amd.com, airlied@gmail.com, simona@ffwll.ch,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: switch XGMI sysfs show helpers to sysfs_emit_at()
Date: Fri, 13 Mar 2026 10:04:38 -0400	[thread overview]
Message-ID: <CADnq5_O=Ycrhk1uXO2EfPimZ8EP=nVX4sJ4BUkaB8e0Hwp3_eg@mail.gmail.com> (raw)
In-Reply-To: <20260313015226.39727-1-davidbaum461@gmail.com>

Applied.  Thanks!

Alex

On Fri, Mar 13, 2026 at 4:55 AM David Baum <davidbaum461@gmail.com> wrote:
>
> The XGMI sysfs show helpers amdgpu_xgmi_show_num_hops() and
> amdgpu_xgmi_show_num_links() currently populate the output buffer with
> sprintf() and then call sysfs_emit(buf, "%s\n", buf) to append the final
> newline.
>
> Convert both helpers to use sysfs_emit_at() while tracking the current
> offset. This keeps buffer construction in the sysfs helpers, avoids
> feeding the output buffer back into the final formatted write, and
> matches the style already used by
> amdgpu_xgmi_show_connected_port_num().
>
> Signed-off-by: David Baum <davidbaum461@gmail.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> index 11e56df1d91b..13fc7247fe23 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> @@ -469,12 +469,12 @@ static ssize_t amdgpu_xgmi_show_num_hops(struct device *dev,
>         struct drm_device *ddev = dev_get_drvdata(dev);
>         struct amdgpu_device *adev = drm_to_adev(ddev);
>         struct psp_xgmi_topology_info *top = &adev->psp.xgmi_context.top_info;
> -       int i;
> +       int i, offset = 0;
>
>         for (i = 0; i < top->num_nodes; i++)
> -               sprintf(buf + 3 * i, "%02x ", top->nodes[i].num_hops);
> +               offset += sysfs_emit_at(buf, offset, "%02x ", top->nodes[i].num_hops);
>
> -       return sysfs_emit(buf, "%s\n", buf);
> +       return offset + sysfs_emit_at(buf, offset, "\n");
>  }
>
>  static ssize_t amdgpu_xgmi_show_num_links(struct device *dev,
> @@ -484,12 +484,12 @@ static ssize_t amdgpu_xgmi_show_num_links(struct device *dev,
>         struct drm_device *ddev = dev_get_drvdata(dev);
>         struct amdgpu_device *adev = drm_to_adev(ddev);
>         struct psp_xgmi_topology_info *top = &adev->psp.xgmi_context.top_info;
> -       int i;
> +       int i, offset = 0;
>
>         for (i = 0; i < top->num_nodes; i++)
> -               sprintf(buf + 3 * i, "%02x ", top->nodes[i].num_links);
> +               offset += sysfs_emit_at(buf, offset, "%02x ", top->nodes[i].num_links);
>
> -       return sysfs_emit(buf, "%s\n", buf);
> +       return offset + sysfs_emit_at(buf, offset, "\n");
>  }
>
>  static ssize_t amdgpu_xgmi_show_connected_port_num(struct device *dev,
> --
> 2.50.1 (Apple Git-155)
>

  reply	other threads:[~2026-03-13 14:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13  1:52 [PATCH] drm/amdgpu: switch XGMI sysfs show helpers to sysfs_emit_at() David Baum
2026-03-13 14:04 ` Alex Deucher [this message]
2026-03-13 21:16 ` Claude review: " Claude Code Review Bot
2026-03-13 21:16 ` Claude Code Review Bot

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='CADnq5_O=Ycrhk1uXO2EfPimZ8EP=nVX4sJ4BUkaB8e0Hwp3_eg@mail.gmail.com' \
    --to=alexdeucher@gmail.com \
    --cc=airlied@gmail.com \
    --cc=alex.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=davidbaum461@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lijo.lazar@amd.com \
    --cc=simona@ffwll.ch \
    /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