All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] samples/kfifo: Rename read_lock/write_lock
@ 2021-09-23 17:29 Sebastian Andrzej Siewior
  2021-10-05  8:55 ` Sebastian Andrzej Siewior
  2021-10-05  9:42 ` Stefani Seibold
  0 siblings, 2 replies; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-09-23 17:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Stefani Seibold, Thomas Gleixner, Greg Kroah-Hartman, Peter Zijlstra

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;
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] samples/kfifo: Rename read_lock/write_lock
  2021-09-23 17:29 [PATCH] samples/kfifo: Rename read_lock/write_lock Sebastian Andrzej Siewior
@ 2021-10-05  8:55 ` Sebastian Andrzej Siewior
  2021-10-05  9:42 ` Stefani Seibold
  1 sibling, 0 replies; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-10-05  8:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Stefani Seibold, Thomas Gleixner, Greg Kroah-Hartman, Peter Zijlstra

On 2021-09-23 19:29:19 [+0200], To linux-kernel@vger.kernel.org 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.

ping.

Sebastian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] samples/kfifo: Rename read_lock/write_lock
  2021-09-23 17:29 [PATCH] samples/kfifo: Rename read_lock/write_lock Sebastian Andrzej Siewior
  2021-10-05  8:55 ` Sebastian Andrzej Siewior
@ 2021-10-05  9:42 ` Stefani Seibold
  2021-10-05 13:41   ` Greg Kroah-Hartman
  1 sibling, 1 reply; 5+ messages in thread
From: Stefani Seibold @ 2021-10-05  9:42 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, linux-kernel
  Cc: Thomas Gleixner, Greg Kroah-Hartman, Peter Zijlstra

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;
>  



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] samples/kfifo: Rename read_lock/write_lock
  2021-10-05  9:42 ` Stefani Seibold
@ 2021-10-05 13:41   ` Greg Kroah-Hartman
  2021-10-05 14:18     ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2021-10-05 13:41 UTC (permalink / raw)
  To: Stefani Seibold
  Cc: Sebastian Andrzej Siewior, linux-kernel, Thomas Gleixner, Peter Zijlstra

On Tue, Oct 05, 2021 at 11:42:57AM +0200, Stefani Seibold wrote:
> Acked by Stefani Seibold <stefani@seibold.net>

WHo is supposed to take these?

Want me to take them through my char/misc tree?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] samples/kfifo: Rename read_lock/write_lock
  2021-10-05 13:41   ` Greg Kroah-Hartman
@ 2021-10-05 14:18     ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-10-05 14:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Stefani Seibold, linux-kernel, Thomas Gleixner, Peter Zijlstra

On 2021-10-05 15:41:06 [+0200], Greg Kroah-Hartman wrote:
> On Tue, Oct 05, 2021 at 11:42:57AM +0200, Stefani Seibold wrote:
> > Acked by Stefani Seibold <stefani@seibold.net>
> 
> WHo is supposed to take these?
> 
> Want me to take them through my char/misc tree?

Yes, please (if it is up to me).

> thanks,
> 
> greg k-h

Sebastian

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-05 14:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23 17:29 [PATCH] samples/kfifo: Rename read_lock/write_lock Sebastian Andrzej Siewior
2021-10-05  8:55 ` Sebastian Andrzej Siewior
2021-10-05  9:42 ` Stefani Seibold
2021-10-05 13:41   ` Greg Kroah-Hartman
2021-10-05 14:18     ` Sebastian Andrzej Siewior

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.