summaryrefslogtreecommitdiffstats
path: root/net/rfkill/core.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-01-28 16:05:45 -0800
committerDavid S. Miller <davem@davemloft.net>2016-01-28 16:05:45 -0800
commitbd7c5e31552c06f1186606de8914a135e55f6bac (patch)
treea3d29b319537297a3023af1949b15cca2cc38824 /net/rfkill/core.c
parentc731f0e3493cc9031a0aceea6a50c70beed23e6d (diff)
parent6736fde9672ff6717ac576e9bba2fd5f3dfec822 (diff)
downloadop-kernel-dev-bd7c5e31552c06f1186606de8914a135e55f6bac.zip
op-kernel-dev-bd7c5e31552c06f1186606de8914a135e55f6bac.tar.gz
Merge tag 'mac80211-for-davem-2016-01-26' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211
Johannes Berg says: ==================== Here's a first set of fixes for the 4.5-rc cycle: * make regulatory messages much less verbose by default * various remain-on-channel fixes * scheduled scanning fixes with hardware restart * a PS-Poll handling fix; was broken just recently * bugfix to avoid buffering non-bufferable MMPDUs * world regulatory domain data fix * a fix for scanning causing other work to get stuck * hwsim: revert an older problematic patch that caused some userspace tools to have issues - not that big a deal as it's a debug only driver though ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rfkill/core.c')
-rw-r--r--net/rfkill/core.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index f53bf3b6..cf5b69a 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -1095,17 +1095,6 @@ static unsigned int rfkill_fop_poll(struct file *file, poll_table *wait)
return res;
}
-static bool rfkill_readable(struct rfkill_data *data)
-{
- bool r;
-
- mutex_lock(&data->mtx);
- r = !list_empty(&data->events);
- mutex_unlock(&data->mtx);
-
- return r;
-}
-
static ssize_t rfkill_fop_read(struct file *file, char __user *buf,
size_t count, loff_t *pos)
{
@@ -1122,8 +1111,11 @@ static ssize_t rfkill_fop_read(struct file *file, char __user *buf,
goto out;
}
mutex_unlock(&data->mtx);
+ /* since we re-check and it just compares pointers,
+ * using !list_empty() without locking isn't a problem
+ */
ret = wait_event_interruptible(data->read_wait,
- rfkill_readable(data));
+ !list_empty(&data->events));
mutex_lock(&data->mtx);
if (ret)
OpenPOWER on IntegriCloud