Subject: samples/kfifo: Rename read_lock/write_lock From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Date: Thu Jul 1 17:43:16 2021 +0200 From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> 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> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20210806152551.qio7c3ho6pexezup@linutronix.de --- 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(-) --- @ samples/kfifo/bytestream-example.c:25 @ #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. @ samples/kfifo/bytestream-example.c:119 @ 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; @ samples/kfifo/bytestream-example.c:137 @ 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 @ samples/kfifo/bytestream-example.c:25 @ #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. @ samples/kfifo/bytestream-example.c:112 @ 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; @ samples/kfifo/bytestream-example.c:130 @ 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 @ samples/kfifo/bytestream-example.c:25 @ #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. @ samples/kfifo/bytestream-example.c:126 @ 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; @ samples/kfifo/bytestream-example.c:144 @ 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;