diff mbox

[1/1] spi: dw: Make debugfs name unique between instances

Message ID 1482398292-46946-1-git-send-email-preid@electromag.com.au (mailing list archive)
State Accepted
Commit 13288bdf4adbaa6bd1267f10044c1bc25d90ce7f
Headers show

Commit Message

Phil Reid Dec. 22, 2016, 9:18 a.m. UTC
Some system have multiple dw devices. Currently the driver uses a
fixed name for the debugfs dir. Append dev name to the debugfs dir
name to make it unique.

Signed-off-by: Phil Reid <preid@electromag.com.au>
---
 drivers/spi/spi-dw.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Andy Shevchenko Jan. 1, 2017, 3:46 p.m. UTC | #1
On Thu, Dec 22, 2016 at 11:18 AM, Phil Reid <preid@electromag.com.au> wrote:
> Some system have multiple dw devices. Currently the driver uses a
> fixed name for the debugfs dir. Append dev name to the debugfs dir
> name to make it unique.


> --- a/drivers/spi/spi-dw.c
> +++ b/drivers/spi/spi-dw.c
> @@ -107,7 +107,10 @@ static ssize_t dw_spi_show_regs(struct file *file, char __user *user_buf,
>
>  static int dw_spi_debugfs_init(struct dw_spi *dws)
>  {
> -       dws->debugfs = debugfs_create_dir("dw_spi", NULL);
> +       char name[128];
> +
> +       snprintf(name, 128, "dw_spi-%s", dev_name(&dws->master->dev));

128 is too much.
Perhaps something like 32 and use bus number instead of dev_name().

> +       dws->debugfs = debugfs_create_dir(name, NULL);
>         if (!dws->debugfs)
>                 return -ENOMEM;
diff mbox

Patch

diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index 27960e4..c4226c0 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -107,7 +107,10 @@  static ssize_t dw_spi_show_regs(struct file *file, char __user *user_buf,
 
 static int dw_spi_debugfs_init(struct dw_spi *dws)
 {
-	dws->debugfs = debugfs_create_dir("dw_spi", NULL);
+	char name[128];
+
+	snprintf(name, 128, "dw_spi-%s", dev_name(&dws->master->dev));
+	dws->debugfs = debugfs_create_dir(name, NULL);
 	if (!dws->debugfs)
 		return -ENOMEM;