All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 6/9] pktcdvd: Use DEFINE_SHOW_ATTRIBUTE() to simplify code
Date: Fri, 20 Jan 2023 08:26:21 +0100	[thread overview]
Message-ID: <Y8pCHeVNDjGYCh3L@kroah.com> (raw)
In-Reply-To: <20230119220809.5518-6-andriy.shevchenko@linux.intel.com>

On Fri, Jan 20, 2023 at 12:08:06AM +0200, Andy Shevchenko wrote:
> Use DEFINE_SHOW_ATTRIBUTE() helper macro to simplify the code.
> No functional change.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/block/pktcdvd.c | 23 +++--------------------
>  1 file changed, 3 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
> index a53d21dbf2ab..2c5441303e55 100644
> --- a/drivers/block/pktcdvd.c
> +++ b/drivers/block/pktcdvd.c
> @@ -504,24 +504,7 @@ static int pkt_seq_show(struct seq_file *m, void *p)
>  			pd->write_congestion_on);
>  	return 0;
>  }
> -
> -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,
> -};
> +DEFINE_SHOW_ATTRIBUTE(pkt_seq);
>  
>  static void pkt_debugfs_dev_new(struct pktcdvd_device *pd)
>  {
> @@ -531,8 +514,8 @@ static void pkt_debugfs_dev_new(struct pktcdvd_device *pd)
>  	if (!pd->dfs_d_root)
>  		return;

This check shouldn't be here either.

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

For further cleanup, there's no need to keep this dentry at all as the
whole directory is later removed.

But that's future cleanups, for this, nice work:

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

  reply	other threads:[~2023-01-20  7:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19 22:08 [PATCH v1 1/9] pktcdvd: Get rid of custom printing macros Andy Shevchenko
2023-01-19 22:08 ` [PATCH v1 2/9] pktcdvd: replace sscanf() by kstrtoul() Andy Shevchenko
2023-01-19 22:40   ` David Laight
2023-01-20 11:47     ` 'Andy Shevchenko'
2023-01-19 22:08 ` [PATCH v1 3/9] pktcdvd: use sysfs_emit() to instead of scnprintf() Andy Shevchenko
2023-01-20  7:27   ` Greg Kroah-Hartman
2023-01-19 22:08 ` [PATCH v1 4/9] pktcdvd: Get rid of pkt_seq_show() forward declaration Andy Shevchenko
2023-01-20  7:27   ` Greg Kroah-Hartman
2023-01-19 22:08 ` [PATCH v1 5/9] pktcdvd: Drop redundant castings for sector_t Andy Shevchenko
2023-01-20  7:28   ` Greg Kroah-Hartman
2023-01-19 22:08 ` [PATCH v1 6/9] pktcdvd: Use DEFINE_SHOW_ATTRIBUTE() to simplify code Andy Shevchenko
2023-01-20  7:26   ` Greg Kroah-Hartman [this message]
2023-01-19 22:08 ` [PATCH v1 7/9] pktcdvd: Use put_unaligned_be16() and get_unaligned_be16() Andy Shevchenko
2023-01-19 22:08 ` [PATCH v1 8/9] pktcdvd: Get rid of redundant 'else' Andy Shevchenko
2023-01-20  7:26   ` Greg Kroah-Hartman
2023-01-19 22:08 ` [PATCH v1 9/9] pktcdvd: Sort headers Andy Shevchenko
2023-01-20  7:28   ` Greg Kroah-Hartman
2023-01-20  7:24 ` [PATCH v1 1/9] pktcdvd: Get rid of custom printing macros Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y8pCHeVNDjGYCh3L@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.