mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefani Seibold <stefani@seibold.net>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] samples/kfifo: Rename read_lock/write_lock
Date: Tue, 05 Oct 2021 11:42:57 +0200	[thread overview]
Message-ID: <5cb013d281fc064a7e928eb16bdfa9d5d77987e1.camel@seibold.net> (raw)
In-Reply-To: <20210923172918.o22iwgvn3w7ilh44@linutronix.de>

Acked by Stefani Seibold <stefani@seibold.net>

On Thu, 2021-09-23 at 19:29 +0200, Sebastian Andrzej Siewior wrote:
> The variables names read_lock and write_lock can clash with functions
> used for
> read/writer locks.
> 
> Rename read_lock to read_access and write_lock to write_access to avoid
> a name
> collision.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Link:
> https://lkml.kernel.org/r/20210806152551.qio7c3ho6pexezup@linutronix.de
> ---
> 
> Repost.
> 
>  samples/kfifo/bytestream-example.c |   12 ++++++------
>  samples/kfifo/inttype-example.c    |   12 ++++++------
>  samples/kfifo/record-example.c     |   12 ++++++------
>  3 files changed, 18 insertions(+), 18 deletions(-)
> ---
> --- a/samples/kfifo/bytestream-example.c
> +++ b/samples/kfifo/bytestream-example.c
> @@ -22,10 +22,10 @@
>  #define        PROC_FIFO       "bytestream-fifo"
>  
>  /* lock for procfs read access */
> -static DEFINE_MUTEX(read_lock);
> +static DEFINE_MUTEX(read_access);
>  
>  /* lock for procfs write access */
> -static DEFINE_MUTEX(write_lock);
> +static DEFINE_MUTEX(write_access);
>  
>  /*
>   * define DYNAMIC in this example for a dynamically allocated fifo.
> @@ -116,12 +116,12 @@ static ssize_t fifo_write(struct file *f
>         int ret;
>         unsigned int copied;
>  
> -       if (mutex_lock_interruptible(&write_lock))
> +       if (mutex_lock_interruptible(&write_access))
>                 return -ERESTARTSYS;
>  
>         ret = kfifo_from_user(&test, buf, count, &copied);
>  
> -       mutex_unlock(&write_lock);
> +       mutex_unlock(&write_access);
>         if (ret)
>                 return ret;
>  
> @@ -134,12 +134,12 @@ static ssize_t fifo_read(struct file *fi
>         int ret;
>         unsigned int copied;
>  
> -       if (mutex_lock_interruptible(&read_lock))
> +       if (mutex_lock_interruptible(&read_access))
>                 return -ERESTARTSYS;
>  
>         ret = kfifo_to_user(&test, buf, count, &copied);
>  
> -       mutex_unlock(&read_lock);
> +       mutex_unlock(&read_access);
>         if (ret)
>                 return ret;
>  
> --- a/samples/kfifo/inttype-example.c
> +++ b/samples/kfifo/inttype-example.c
> @@ -22,10 +22,10 @@
>  #define        PROC_FIFO       "int-fifo"
>  
>  /* lock for procfs read access */
> -static DEFINE_MUTEX(read_lock);
> +static DEFINE_MUTEX(read_access);
>  
>  /* lock for procfs write access */
> -static DEFINE_MUTEX(write_lock);
> +static DEFINE_MUTEX(write_access);
>  
>  /*
>   * define DYNAMIC in this example for a dynamically allocated fifo.
> @@ -109,12 +109,12 @@ static ssize_t fifo_write(struct file *f
>         int ret;
>         unsigned int copied;
>  
> -       if (mutex_lock_interruptible(&write_lock))
> +       if (mutex_lock_interruptible(&write_access))
>                 return -ERESTARTSYS;
>  
>         ret = kfifo_from_user(&test, buf, count, &copied);
>  
> -       mutex_unlock(&write_lock);
> +       mutex_unlock(&write_access);
>         if (ret)
>                 return ret;
>  
> @@ -127,12 +127,12 @@ static ssize_t fifo_read(struct file *fi
>         int ret;
>         unsigned int copied;
>  
> -       if (mutex_lock_interruptible(&read_lock))
> +       if (mutex_lock_interruptible(&read_access))
>                 return -ERESTARTSYS;
>  
>         ret = kfifo_to_user(&test, buf, count, &copied);
>  
> -       mutex_unlock(&read_lock);
> +       mutex_unlock(&read_access);
>         if (ret)
>                 return ret;
>  
> --- a/samples/kfifo/record-example.c
> +++ b/samples/kfifo/record-example.c
> @@ -22,10 +22,10 @@
>  #define        PROC_FIFO       "record-fifo"
>  
>  /* lock for procfs read access */
> -static DEFINE_MUTEX(read_lock);
> +static DEFINE_MUTEX(read_access);
>  
>  /* lock for procfs write access */
> -static DEFINE_MUTEX(write_lock);
> +static DEFINE_MUTEX(write_access);
>  
>  /*
>   * define DYNAMIC in this example for a dynamically allocated fifo.
> @@ -123,12 +123,12 @@ static ssize_t fifo_write(struct file *f
>         int ret;
>         unsigned int copied;
>  
> -       if (mutex_lock_interruptible(&write_lock))
> +       if (mutex_lock_interruptible(&write_access))
>                 return -ERESTARTSYS;
>  
>         ret = kfifo_from_user(&test, buf, count, &copied);
>  
> -       mutex_unlock(&write_lock);
> +       mutex_unlock(&write_access);
>         if (ret)
>                 return ret;
>  
> @@ -141,12 +141,12 @@ static ssize_t fifo_read(struct file *fi
>         int ret;
>         unsigned int copied;
>  
> -       if (mutex_lock_interruptible(&read_lock))
> +       if (mutex_lock_interruptible(&read_access))
>                 return -ERESTARTSYS;
>  
>         ret = kfifo_to_user(&test, buf, count, &copied);
>  
> -       mutex_unlock(&read_lock);
> +       mutex_unlock(&read_access);
>         if (ret)
>                 return ret;
>  



  parent reply	other threads:[~2021-10-05 10:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23 17:29 Sebastian Andrzej Siewior
2021-10-05  8:55 ` Sebastian Andrzej Siewior
2021-10-05  9:42 ` Stefani Seibold [this message]
2021-10-05 13:41   ` Greg Kroah-Hartman
2021-10-05 14:18     ` Sebastian Andrzej Siewior

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=5cb013d281fc064a7e928eb16bdfa9d5d77987e1.camel@seibold.net \
    --to=stefani@seibold.net \
    --cc=bigeasy@linutronix.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®