mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 01:41:39 +00:00
crypto: cavium/nitrox - convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Yangtao Li <tiny.windzz@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
8362ea16f6
commit
88d905e20b
1 changed files with 9 additions and 39 deletions
|
@ -13,18 +13,7 @@ static int firmware_show(struct seq_file *s, void *v)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int firmware_open(struct inode *inode, struct file *file)
|
DEFINE_SHOW_ATTRIBUTE(firmware);
|
||||||
{
|
|
||||||
return single_open(file, firmware_show, inode->i_private);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct file_operations firmware_fops = {
|
|
||||||
.owner = THIS_MODULE,
|
|
||||||
.open = firmware_open,
|
|
||||||
.read = seq_read,
|
|
||||||
.llseek = seq_lseek,
|
|
||||||
.release = single_release,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int device_show(struct seq_file *s, void *v)
|
static int device_show(struct seq_file *s, void *v)
|
||||||
{
|
{
|
||||||
|
@ -41,18 +30,7 @@ static int device_show(struct seq_file *s, void *v)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nitrox_open(struct inode *inode, struct file *file)
|
DEFINE_SHOW_ATTRIBUTE(device);
|
||||||
{
|
|
||||||
return single_open(file, device_show, inode->i_private);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct file_operations nitrox_fops = {
|
|
||||||
.owner = THIS_MODULE,
|
|
||||||
.open = nitrox_open,
|
|
||||||
.read = seq_read,
|
|
||||||
.llseek = seq_lseek,
|
|
||||||
.release = single_release,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int stats_show(struct seq_file *s, void *v)
|
static int stats_show(struct seq_file *s, void *v)
|
||||||
{
|
{
|
||||||
|
@ -69,18 +47,7 @@ static int stats_show(struct seq_file *s, void *v)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nitrox_stats_open(struct inode *inode, struct file *file)
|
DEFINE_SHOW_ATTRIBUTE(stats);
|
||||||
{
|
|
||||||
return single_open(file, stats_show, inode->i_private);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct file_operations nitrox_stats_fops = {
|
|
||||||
.owner = THIS_MODULE,
|
|
||||||
.open = nitrox_stats_open,
|
|
||||||
.read = seq_read,
|
|
||||||
.llseek = seq_lseek,
|
|
||||||
.release = single_release,
|
|
||||||
};
|
|
||||||
|
|
||||||
void nitrox_debugfs_exit(struct nitrox_device *ndev)
|
void nitrox_debugfs_exit(struct nitrox_device *ndev)
|
||||||
{
|
{
|
||||||
|
@ -97,13 +64,16 @@ int nitrox_debugfs_init(struct nitrox_device *ndev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
ndev->debugfs_dir = dir;
|
ndev->debugfs_dir = dir;
|
||||||
f = debugfs_create_file("firmware", 0400, dir, ndev, &firmware_fops);
|
f = debugfs_create_file("firmware", 0400, dir, ndev,
|
||||||
|
&firmware_fops);
|
||||||
if (!f)
|
if (!f)
|
||||||
goto err;
|
goto err;
|
||||||
f = debugfs_create_file("device", 0400, dir, ndev, &nitrox_fops);
|
f = debugfs_create_file("device", 0400, dir, ndev,
|
||||||
|
&device_fops);
|
||||||
if (!f)
|
if (!f)
|
||||||
goto err;
|
goto err;
|
||||||
f = debugfs_create_file("stats", 0400, dir, ndev, &nitrox_stats_fops);
|
f = debugfs_create_file("stats", 0400, dir, ndev,
|
||||||
|
&stats_fops);
|
||||||
if (!f)
|
if (!f)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue