Skip to content

Commit 880732a

Browse files
Sebastian Andrzej Siewiorgregkh
Sebastian Andrzej Siewior
authored andcommitted
samples/kfifo: Rename read_lock/write_lock
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 <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Acked-by: Stefani Seibold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 85385a5 commit 880732a

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

samples/kfifo/bytestream-example.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
#define PROC_FIFO "bytestream-fifo"
2323

2424
/* lock for procfs read access */
25-
static DEFINE_MUTEX(read_lock);
25+
static DEFINE_MUTEX(read_access);
2626

2727
/* lock for procfs write access */
28-
static DEFINE_MUTEX(write_lock);
28+
static DEFINE_MUTEX(write_access);
2929

3030
/*
3131
* define DYNAMIC in this example for a dynamically allocated fifo.
@@ -116,12 +116,12 @@ static ssize_t fifo_write(struct file *file, const char __user *buf,
116116
int ret;
117117
unsigned int copied;
118118

119-
if (mutex_lock_interruptible(&write_lock))
119+
if (mutex_lock_interruptible(&write_access))
120120
return -ERESTARTSYS;
121121

122122
ret = kfifo_from_user(&test, buf, count, &copied);
123123

124-
mutex_unlock(&write_lock);
124+
mutex_unlock(&write_access);
125125
if (ret)
126126
return ret;
127127

@@ -134,12 +134,12 @@ static ssize_t fifo_read(struct file *file, char __user *buf,
134134
int ret;
135135
unsigned int copied;
136136

137-
if (mutex_lock_interruptible(&read_lock))
137+
if (mutex_lock_interruptible(&read_access))
138138
return -ERESTARTSYS;
139139

140140
ret = kfifo_to_user(&test, buf, count, &copied);
141141

142-
mutex_unlock(&read_lock);
142+
mutex_unlock(&read_access);
143143
if (ret)
144144
return ret;
145145

samples/kfifo/inttype-example.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
#define PROC_FIFO "int-fifo"
2323

2424
/* lock for procfs read access */
25-
static DEFINE_MUTEX(read_lock);
25+
static DEFINE_MUTEX(read_access);
2626

2727
/* lock for procfs write access */
28-
static DEFINE_MUTEX(write_lock);
28+
static DEFINE_MUTEX(write_access);
2929

3030
/*
3131
* define DYNAMIC in this example for a dynamically allocated fifo.
@@ -109,12 +109,12 @@ static ssize_t fifo_write(struct file *file, const char __user *buf,
109109
int ret;
110110
unsigned int copied;
111111

112-
if (mutex_lock_interruptible(&write_lock))
112+
if (mutex_lock_interruptible(&write_access))
113113
return -ERESTARTSYS;
114114

115115
ret = kfifo_from_user(&test, buf, count, &copied);
116116

117-
mutex_unlock(&write_lock);
117+
mutex_unlock(&write_access);
118118
if (ret)
119119
return ret;
120120

@@ -127,12 +127,12 @@ static ssize_t fifo_read(struct file *file, char __user *buf,
127127
int ret;
128128
unsigned int copied;
129129

130-
if (mutex_lock_interruptible(&read_lock))
130+
if (mutex_lock_interruptible(&read_access))
131131
return -ERESTARTSYS;
132132

133133
ret = kfifo_to_user(&test, buf, count, &copied);
134134

135-
mutex_unlock(&read_lock);
135+
mutex_unlock(&read_access);
136136
if (ret)
137137
return ret;
138138

samples/kfifo/record-example.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
#define PROC_FIFO "record-fifo"
2323

2424
/* lock for procfs read access */
25-
static DEFINE_MUTEX(read_lock);
25+
static DEFINE_MUTEX(read_access);
2626

2727
/* lock for procfs write access */
28-
static DEFINE_MUTEX(write_lock);
28+
static DEFINE_MUTEX(write_access);
2929

3030
/*
3131
* define DYNAMIC in this example for a dynamically allocated fifo.
@@ -123,12 +123,12 @@ static ssize_t fifo_write(struct file *file, const char __user *buf,
123123
int ret;
124124
unsigned int copied;
125125

126-
if (mutex_lock_interruptible(&write_lock))
126+
if (mutex_lock_interruptible(&write_access))
127127
return -ERESTARTSYS;
128128

129129
ret = kfifo_from_user(&test, buf, count, &copied);
130130

131-
mutex_unlock(&write_lock);
131+
mutex_unlock(&write_access);
132132
if (ret)
133133
return ret;
134134

@@ -141,12 +141,12 @@ static ssize_t fifo_read(struct file *file, char __user *buf,
141141
int ret;
142142
unsigned int copied;
143143

144-
if (mutex_lock_interruptible(&read_lock))
144+
if (mutex_lock_interruptible(&read_access))
145145
return -ERESTARTSYS;
146146

147147
ret = kfifo_to_user(&test, buf, count, &copied);
148148

149-
mutex_unlock(&read_lock);
149+
mutex_unlock(&read_access);
150150
if (ret)
151151
return ret;
152152

0 commit comments

Comments
 (0)