gpiolib: convert to use DEFINE_SEQ_ATTRIBUTE macro
Use DEFINE_SEQ_ATTRIBUTE macro to simplify the code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
This commit is contained in:
parent
d284c16f84
commit
425c5b3e17
|
@ -4402,31 +4402,18 @@ static int gpiolib_seq_show(struct seq_file *s, void *v)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct seq_operations gpiolib_seq_ops = {
|
static const struct seq_operations gpiolib_sops = {
|
||||||
.start = gpiolib_seq_start,
|
.start = gpiolib_seq_start,
|
||||||
.next = gpiolib_seq_next,
|
.next = gpiolib_seq_next,
|
||||||
.stop = gpiolib_seq_stop,
|
.stop = gpiolib_seq_stop,
|
||||||
.show = gpiolib_seq_show,
|
.show = gpiolib_seq_show,
|
||||||
};
|
};
|
||||||
|
DEFINE_SEQ_ATTRIBUTE(gpiolib);
|
||||||
static int gpiolib_open(struct inode *inode, struct file *file)
|
|
||||||
{
|
|
||||||
return seq_open(file, &gpiolib_seq_ops);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct file_operations gpiolib_operations = {
|
|
||||||
.owner = THIS_MODULE,
|
|
||||||
.open = gpiolib_open,
|
|
||||||
.read = seq_read,
|
|
||||||
.llseek = seq_lseek,
|
|
||||||
.release = seq_release,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int __init gpiolib_debugfs_init(void)
|
static int __init gpiolib_debugfs_init(void)
|
||||||
{
|
{
|
||||||
/* /sys/kernel/debug/gpio */
|
/* /sys/kernel/debug/gpio */
|
||||||
debugfs_create_file("gpio", S_IFREG | S_IRUGO, NULL, NULL,
|
debugfs_create_file("gpio", 0444, NULL, NULL, &gpiolib_fops);
|
||||||
&gpiolib_operations);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
subsys_initcall(gpiolib_debugfs_init);
|
subsys_initcall(gpiolib_debugfs_init);
|
||||||
|
|
Loading…
Reference in New Issue