[alsa-devel] [PATCH v2] ASoC: use seq_file to dump the contents of dai_list, platform_list and codec_list

Andy Shevchenko andy.shevchenko at gmail.com
Tue Jan 23 18:08:15 CET 2018


On Thu, Jan 18, 2018 at 7:31 AM, Donglin Peng <dolinux.peng at gmail.com> 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


More information about the Alsa-devel mailing list