Re: [PATCH v2 1/2] seq_file: Introduce DEFINE_SHOW_ATTRIBUTE() helper macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andy,

> The DEFINE_SHOW_ATTRIBUTE() helper macro would be useful for current
> users, which are many of them, and for new comers to decrease code
> duplication.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
> include/linux/seq_file.h | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
> 
> diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
> index c32929802c25..73adc12ab773 100644
> --- a/include/linux/seq_file.h
> +++ b/include/linux/seq_file.h
> @@ -144,6 +144,19 @@ void *__seq_open_private(struct file *, const struct seq_operations *, int);
> int seq_open_private(struct file *, const struct seq_operations *, int);
> int seq_release_private(struct inode *, struct file *);
> 
> +#define DEFINE_SHOW_ATTRIBUTE(__name)					      \
> +static int __name ## _open(struct inode *inode, struct file *file)	      \
> +{									      \
> +	return single_open(file, __name ## _show, inode->i_private);	      \
> +}									      \
> +									      \
> +static const struct file_operations __name ## _fops = {			      \
> +	.open		= __name ## _open,				      \
> +	.read		= seq_read,					      \
> +	.llseek		= seq_lseek,					      \
> +	.release	= single_release,				      \
> +}									      \
> +

can we define this in hci_debugfs.c first and get that patch merged into bluetooth-next. And only as a follow up patch try to generalize this in seq_file.h. I really don’t like to carry a patch for seq_file.h in the bluetooth-next tree.

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux