All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: Devyn Liu <liudingyuan@h-partners.com>
Cc: <shenyang39@huawei.com>, <broonie@kernel.org>,
	<linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<kangfenglong@huawei.com>, <liuyonglong@huawei.com>,
	<lujunhua7@h-partners.com>, <yubowen8@huawei.com>,
	<liudingyuan@huawei.com>
Subject: Re: [PATCH] spi: hisi-kunpeng: Fixed the wrong debugfs node name in hisi_spi debugfs initialization
Date: Fri, 31 Oct 2025 15:32:07 +0000	[thread overview]
Message-ID: <20251031153207.000031ee@huawei.com> (raw)
In-Reply-To: <20251024063133.3796584-1-liudingyuan@h-partners.com>

On Fri, 24 Oct 2025 14:31:33 +0800
Devyn Liu <liudingyuan@h-partners.com> wrote:

> In hisi_spi_debugfs_init, spi controller pointer is calculated by
> container_of macro, and the member is hs->dev. But the host pointer cannot
> be calculated offset directly by this, because hs->dev points to the
> device in platform device(pdev->dev), and it is the host->dev.parent
> points to the pdev->dev, which is set in __spi_alloc_controller.
> 
> In this patch, this issues is fixed by getting the spi_controller data
> from pdev->dev->driver_data directly, driver_data points to the spi
> controller data in the probe stage.
> 
> Signed-off-by: Devyn Liu <liudingyuan@h-partners.com>

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

> ---
>  drivers/spi/spi-hisi-kunpeng.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/spi-hisi-kunpeng.c b/drivers/spi/spi-hisi-kunpeng.c
> index dadf558dd9c0..7458a4bc0856 100644
> --- a/drivers/spi/spi-hisi-kunpeng.c
> +++ b/drivers/spi/spi-hisi-kunpeng.c
> @@ -164,7 +164,7 @@ static int hisi_spi_debugfs_init(struct hisi_spi *hs)
>  
>  	struct spi_controller *host;
>  
> -	host = container_of(hs->dev, struct spi_controller, dev);
> +	host = hs->dev->driver_data;
>  	snprintf(name, 32, "hisi_spi%d", host->bus_num);
>  	hs->debugfs = debugfs_create_dir(name, NULL);
>  	if (IS_ERR(hs->debugfs))


  reply	other threads:[~2025-10-31 15:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-24  6:31 [PATCH] spi: hisi-kunpeng: Fixed the wrong debugfs node name in hisi_spi debugfs initialization Devyn Liu
2025-10-31 15:32 ` Jonathan Cameron [this message]
2025-11-03 11:09 ` Yang Shen
  -- strict thread matches above, loose matches on Subject: below --
2025-11-11  2:01 liudingyuan
2025-11-11 12:19 ` Mark Brown
2026-01-08  7:53 Devyn Liu
2026-01-13 11:42 ` 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=20251031153207.000031ee@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=broonie@kernel.org \
    --cc=kangfenglong@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=liudingyuan@h-partners.com \
    --cc=liudingyuan@huawei.com \
    --cc=liuyonglong@huawei.com \
    --cc=lujunhua7@h-partners.com \
    --cc=shenyang39@huawei.com \
    --cc=yubowen8@huawei.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 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.