public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Ye Bin <yebin10@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Michal Simek <michal.simek@xilinx.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Hulk Robot <hulkci@huawei.com>
Subject: Re: [PATCH -next] char: xilinx_hwicap: use DEFINE_MUTEX() for mutex lock
Date: Sat, 10 Apr 2021 10:58:09 +0200	[thread overview]
Message-ID: <YHFooZWlC+PV1kV0@kroah.com> (raw)
In-Reply-To: <20210409095136.2293754-1-yebin10@huawei.com>

On Fri, Apr 09, 2021 at 05:51:36PM +0800, Ye Bin wrote:
> mutex lock can be initialized automatically with DEFINE_MUTEX()
> rather than explicitly calling mutex_init().
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Ye Bin <yebin10@huawei.com>
> ---
>  drivers/char/xilinx_hwicap/xilinx_hwicap.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> index 067396bedf22..4d586233dfa4 100644
> --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> @@ -111,7 +111,7 @@
>  /* An array, which is set to true when the device is registered. */
>  static DEFINE_MUTEX(hwicap_mutex);
>  static bool probed_devices[HWICAP_DEVICES];
> -static struct mutex icap_sem;
> +static DEFINE_MUTEX(icap_sem);
>  
>  static struct class *icap_class;
>  
> @@ -857,7 +857,6 @@ static int __init hwicap_module_init(void)
>  	int retval;
>  
>  	icap_class = class_create(THIS_MODULE, "xilinx_config");
> -	mutex_init(&icap_sem);
>  
>  	devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR);
>  	retval = register_chrdev_region(devt,
> 

What actually does this help out with?  Why is it wrong to explicitly
call mutex_init() instead of a magic macro?

What good are these changes causing?

thanks,

greg k-h

      reply	other threads:[~2021-04-10  8:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09  9:51 [PATCH -next] char: xilinx_hwicap: use DEFINE_MUTEX() for mutex lock Ye Bin
2021-04-10  8:58 ` Greg Kroah-Hartman [this message]

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=YHFooZWlC+PV1kV0@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=hulkci@huawei.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=yebin10@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox