Skip to content

Commit

Permalink
spi: dw: don't use mrst prefix anymore
Browse files Browse the repository at this point in the history
Since driver is used on other platforms and debugfs stuff would be useful there
as well let's substitute mrst_ by dw_ where it suits. Additionally let's use
SPI master device name when print registers dump.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Andy Shevchenko authored and Mark Brown committed Sep 13, 2014
1 parent 551f6a5 commit 53288fe
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions drivers/spi/spi-dw.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,20 @@ struct chip_data {

#ifdef CONFIG_DEBUG_FS
#define SPI_REGS_BUFSIZE 1024
static ssize_t spi_show_regs(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
static ssize_t dw_spi_show_regs(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct dw_spi *dws;
struct dw_spi *dws = file->private_data;
char *buf;
u32 len = 0;
ssize_t ret;

dws = file->private_data;

buf = kzalloc(SPI_REGS_BUFSIZE, GFP_KERNEL);
if (!buf)
return 0;

len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"MRST SPI0 registers:\n");
"%s registers:\n", dev_name(&dws->master->dev));
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"=================================\n");
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
Expand Down Expand Up @@ -106,41 +104,41 @@ static ssize_t spi_show_regs(struct file *file, char __user *user_buf,
len += snprintf(buf + len, SPI_REGS_BUFSIZE - len,
"=================================\n");

ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);
ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);
kfree(buf);
return ret;
}

static const struct file_operations mrst_spi_regs_ops = {
static const struct file_operations dw_spi_regs_ops = {
.owner = THIS_MODULE,
.open = simple_open,
.read = spi_show_regs,
.read = dw_spi_show_regs,
.llseek = default_llseek,
};

static int mrst_spi_debugfs_init(struct dw_spi *dws)
static int dw_spi_debugfs_init(struct dw_spi *dws)
{
dws->debugfs = debugfs_create_dir("mrst_spi", NULL);
dws->debugfs = debugfs_create_dir("dw_spi", NULL);
if (!dws->debugfs)
return -ENOMEM;

debugfs_create_file("registers", S_IFREG | S_IRUGO,
dws->debugfs, (void *)dws, &mrst_spi_regs_ops);
dws->debugfs, (void *)dws, &dw_spi_regs_ops);
return 0;
}

static void mrst_spi_debugfs_remove(struct dw_spi *dws)
static void dw_spi_debugfs_remove(struct dw_spi *dws)
{
debugfs_remove_recursive(dws->debugfs);
}

#else
static inline int mrst_spi_debugfs_init(struct dw_spi *dws)
static inline int dw_spi_debugfs_init(struct dw_spi *dws)
{
return 0;
}

static inline void mrst_spi_debugfs_remove(struct dw_spi *dws)
static inline void dw_spi_debugfs_remove(struct dw_spi *dws)
{
}
#endif /* CONFIG_DEBUG_FS */
Expand Down Expand Up @@ -682,7 +680,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
goto err_dma_exit;
}

mrst_spi_debugfs_init(dws);
dw_spi_debugfs_init(dws);
return 0;

err_dma_exit:
Expand All @@ -699,7 +697,7 @@ void dw_spi_remove_host(struct dw_spi *dws)
{
if (!dws)
return;
mrst_spi_debugfs_remove(dws);
dw_spi_debugfs_remove(dws);

if (dws->dma_ops && dws->dma_ops->dma_exit)
dws->dma_ops->dma_exit(dws);
Expand Down

0 comments on commit 53288fe

Please sign in to comment.