Re: [PATCH v2] ASoC: use seq_file to dump the contents of dai_list,platform_list and codec_list
From: Andy Shevchenko
Date: Tue Jan 23 2018 - 12:08:57 EST
On Thu, Jan 18, 2018 at 7:31 AM, Donglin Peng <dolinux.peng@xxxxxxxxx> wrote:
> Now the debugfs files dais/platforms/codecs have a size limit PAGE_SIZE and
> the user can not see the whole contents of dai_list/platform_list/codec_list
> when they are larger than this limit.
>
> This patch uses seq_file instead to make sure dais/platforms/codecs show the
> full contents of dai_list/platform_list/codec_list.
If it's not critical, I would suggest to wait till v4.16-rc1, where I
would like to push [1], and switch to DEFINE_SHOW_ATTRIBUTE() macro.
> +static int codec_list_seq_open(struct inode *inode, struct file *file)
> +{
> + return single_open(file, codec_list_seq_show, NULL);
> }
>
> static const struct file_operations codec_list_fops = {
> + .open = codec_list_seq_open,
> + .read = seq_read,
> + .llseek = seq_lseek,
> + .release = single_release,
> };
This will be just
DEFINE_SHOW_ATTRIBUTE(codec_list_seq);
> +static int dai_list_seq_open(struct inode *inode, struct file *file)
> +{
> + return single_open(file, dai_list_seq_show, NULL);
> }
>
> static const struct file_operations dai_list_fops = {
> + .open = dai_list_seq_open,
> + .read = seq_read,
> + .llseek = seq_lseek,
> + .release = single_release,
> };
Ditto.
> +static int platform_list_seq_open(struct inode *inode, struct file *file)
> +{
> + return single_open(file, platform_list_seq_show, NULL);
> }
>
> static const struct file_operations platform_list_fops = {
> + .open = platform_list_seq_open,
> + .read = seq_read,
> + .llseek = seq_lseek,
> + .release = single_release,
> };
Ditto.
[1]: https://patchwork.kernel.org/patch/10178813/
--
With Best Regards,
Andy Shevchenko