public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* re: [PATCH] spi: hisi-kunpeng: Fixed the wrong debugfs node name in hisi_spi debugfs initialization
@ 2025-11-11  2:01 liudingyuan
  2025-11-11 12:19 ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: liudingyuan @ 2025-11-11  2:01 UTC (permalink / raw)
  To: shenyang (M), broonie@kernel.org
  Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jonathan Cameron, Kangfenglong, liuyonglong, lujunhua (E),
	yubowen (H)


> 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>
> ---
>  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))
> --
> 2.33.0

Gentle ping on this patch.

^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH] spi: hisi-kunpeng: Fixed the wrong debugfs node name in hisi_spi debugfs initialization
@ 2025-10-24  6:31 Devyn Liu
  2025-10-31 15:32 ` Jonathan Cameron
  2025-11-03 11:09 ` Yang Shen
  0 siblings, 2 replies; 5+ messages in thread
From: Devyn Liu @ 2025-10-24  6:31 UTC (permalink / raw)
  To: shenyang39, broonie
  Cc: linux-spi, linux-kernel, jonathan.cameron, kangfenglong,
	liuyonglong, lujunhua7, yubowen8, liudingyuan

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>
---
 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))
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-11-11 12:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-11  2:01 [PATCH] spi: hisi-kunpeng: Fixed the wrong debugfs node name in hisi_spi debugfs initialization liudingyuan
2025-11-11 12:19 ` Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2025-10-24  6:31 Devyn Liu
2025-10-31 15:32 ` Jonathan Cameron
2025-11-03 11:09 ` Yang Shen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox