Commit 80d994d2 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jens Axboe
Browse files

pktcdvd: Use DEFINE_SHOW_ATTRIBUTE() to simplify code



Use DEFINE_SHOW_ATTRIBUTE() helper macro to simplify the code.
No functional change.

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230310164549.22133-7-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 93c8f6f3
Loading
Loading
Loading
Loading
+3 −20
Original line number Original line Diff line number Diff line
@@ -487,24 +487,7 @@ static int pkt_seq_show(struct seq_file *m, void *p)
			pd->write_congestion_on);
			pd->write_congestion_on);
	return 0;
	return 0;
}
}

DEFINE_SHOW_ATTRIBUTE(pkt_seq);
static int pkt_debugfs_seq_show(struct seq_file *m, void *p)
{
	return pkt_seq_show(m, p);
}

static int pkt_debugfs_fops_open(struct inode *inode, struct file *file)
{
	return single_open(file, pkt_debugfs_seq_show, inode->i_private);
}

static const struct file_operations debug_fops = {
	.open		= pkt_debugfs_fops_open,
	.read		= seq_read,
	.llseek		= seq_lseek,
	.release	= single_release,
	.owner		= THIS_MODULE,
};


static void pkt_debugfs_dev_new(struct pktcdvd_device *pd)
static void pkt_debugfs_dev_new(struct pktcdvd_device *pd)
{
{
@@ -514,8 +497,8 @@ static void pkt_debugfs_dev_new(struct pktcdvd_device *pd)
	if (!pd->dfs_d_root)
	if (!pd->dfs_d_root)
		return;
		return;


	pd->dfs_f_info = debugfs_create_file("info", 0444,
	pd->dfs_f_info = debugfs_create_file("info", 0444, pd->dfs_d_root,
					     pd->dfs_d_root, pd, &debug_fops);
					     pd, &pkt_seq_fops);
}
}


static void pkt_debugfs_dev_remove(struct pktcdvd_device *pd)
static void pkt_debugfs_dev_remove(struct pktcdvd_device *pd)