Commit 40fafc8e authored by oujiefeng's avatar oujiefeng Committed by Mark Brown

spi: hisi-kunpeng: Fix the debugfs directory name incorrect

Change the debugfs directory name from hisi_spi65535 to hisi_spi0.

Fixes: 2b2142f2 ("spi: hisi-kunpeng: Add debugfs support")
Signed-off-by: default avataroujiefeng <oujiefeng@huawei.com>
Signed-off-by: default avatarJay Fang <f.fangjian@huawei.com>
Link: https://lore.kernel.org/r/20211117012119.55558-1-f.fangjian@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 44ebcb44
...@@ -127,7 +127,6 @@ struct hisi_spi { ...@@ -127,7 +127,6 @@ struct hisi_spi {
void __iomem *regs; void __iomem *regs;
int irq; int irq;
u32 fifo_len; /* depth of the FIFO buffer */ u32 fifo_len; /* depth of the FIFO buffer */
u16 bus_num;
/* Current message transfer state info */ /* Current message transfer state info */
const void *tx; const void *tx;
...@@ -165,7 +164,10 @@ static int hisi_spi_debugfs_init(struct hisi_spi *hs) ...@@ -165,7 +164,10 @@ static int hisi_spi_debugfs_init(struct hisi_spi *hs)
{ {
char name[32]; char name[32];
snprintf(name, 32, "hisi_spi%d", hs->bus_num); struct spi_controller *master;
master = container_of(hs->dev, struct spi_controller, dev);
snprintf(name, 32, "hisi_spi%d", master->bus_num);
hs->debugfs = debugfs_create_dir(name, NULL); hs->debugfs = debugfs_create_dir(name, NULL);
if (!hs->debugfs) if (!hs->debugfs)
return -ENOMEM; return -ENOMEM;
...@@ -467,7 +469,6 @@ static int hisi_spi_probe(struct platform_device *pdev) ...@@ -467,7 +469,6 @@ static int hisi_spi_probe(struct platform_device *pdev)
hs = spi_controller_get_devdata(master); hs = spi_controller_get_devdata(master);
hs->dev = dev; hs->dev = dev;
hs->irq = irq; hs->irq = irq;
hs->bus_num = pdev->id;
hs->regs = devm_platform_ioremap_resource(pdev, 0); hs->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(hs->regs)) if (IS_ERR(hs->regs))
...@@ -490,7 +491,7 @@ static int hisi_spi_probe(struct platform_device *pdev) ...@@ -490,7 +491,7 @@ static int hisi_spi_probe(struct platform_device *pdev)
master->use_gpio_descriptors = true; master->use_gpio_descriptors = true;
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP;
master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
master->bus_num = hs->bus_num; master->bus_num = pdev->id;
master->setup = hisi_spi_setup; master->setup = hisi_spi_setup;
master->cleanup = hisi_spi_cleanup; master->cleanup = hisi_spi_cleanup;
master->transfer_one = hisi_spi_transfer_one; master->transfer_one = hisi_spi_transfer_one;
...@@ -506,15 +507,15 @@ static int hisi_spi_probe(struct platform_device *pdev) ...@@ -506,15 +507,15 @@ static int hisi_spi_probe(struct platform_device *pdev)
return ret; return ret;
} }
if (hisi_spi_debugfs_init(hs))
dev_info(dev, "failed to create debugfs dir\n");
ret = spi_register_controller(master); ret = spi_register_controller(master);
if (ret) { if (ret) {
dev_err(dev, "failed to register spi master, ret=%d\n", ret); dev_err(dev, "failed to register spi master, ret=%d\n", ret);
return ret; return ret;
} }
if (hisi_spi_debugfs_init(hs))
dev_info(dev, "failed to create debugfs dir\n");
dev_info(dev, "hw version:0x%x max-freq:%u kHz\n", dev_info(dev, "hw version:0x%x max-freq:%u kHz\n",
readl(hs->regs + HISI_SPI_VERSION), readl(hs->regs + HISI_SPI_VERSION),
master->max_speed_hz / 1000); master->max_speed_hz / 1000);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment