All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David Härdeman" <david@hardeman.nu>
To: linux-media@vger.kernel.org
Cc: m.chehab@samsung.com
Subject: [PATCH 41/49] rc-core: rename mutex
Date: Fri, 04 Apr 2014 01:34:43 +0200	[thread overview]
Message-ID: <20140403233443.27099.29952.stgit@zeus.muc.hardeman.nu> (raw)
In-Reply-To: <20140403232420.27099.94872.stgit@zeus.muc.hardeman.nu>

Having a mutex named "lock" is a bit misleading.

Signed-off-by: David Härdeman <david@hardeman.nu>
---
 drivers/media/rc/img-ir/img-ir-hw.c |    4 ++-
 drivers/media/rc/rc-main.c          |   42 ++++++++++++++++++-----------------
 include/media/rc-core.h             |    5 ++--
 3 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/drivers/media/rc/img-ir/img-ir-hw.c b/drivers/media/rc/img-ir/img-ir-hw.c
index 5bc7903..a9abbb4 100644
--- a/drivers/media/rc/img-ir/img-ir-hw.c
+++ b/drivers/media/rc/img-ir/img-ir-hw.c
@@ -666,11 +666,11 @@ static void img_ir_set_protocol(struct img_ir_priv *priv, u64 proto)
 {
 	struct rc_dev *rdev = priv->hw.rdev;
 
-	mutex_lock(&rdev->lock);
+	mutex_lock(&rdev->mutex);
 	rdev->enabled_protocols = proto;
 	rdev->allowed_wakeup_protocols = proto;
 	rdev->enabled_wakeup_protocols = proto;
-	mutex_unlock(&rdev->lock);
+	mutex_unlock(&rdev->mutex);
 }
 
 /* Set up IR decoders */
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 7caca4f..bd4dfab 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -109,7 +109,7 @@ int rc_open(struct rc_dev *dev)
 {
 	int err = 0;
 
-	mutex_lock(&dev->lock);
+	mutex_lock(&dev->mutex);
 
 	if (dev->dead)
 		err = -ENODEV;
@@ -119,7 +119,7 @@ int rc_open(struct rc_dev *dev)
 			dev->users--;
 	}
 
-	mutex_unlock(&dev->lock);
+	mutex_unlock(&dev->mutex);
 
 	return err;
 }
@@ -127,12 +127,12 @@ EXPORT_SYMBOL_GPL(rc_open);
 
 void rc_close(struct rc_dev *dev)
 {
-	mutex_lock(&dev->lock);
+	mutex_lock(&dev->mutex);
 
 	if (!dev->dead && !--dev->users && dev->close)
 		dev->close(dev);
 
-	mutex_unlock(&dev->lock);
+	mutex_unlock(&dev->mutex);
 }
 EXPORT_SYMBOL_GPL(rc_close);
 
@@ -322,7 +322,7 @@ struct rc_filter_attribute {
  * It returns the protocol names of supported protocols.
  * Enabled protocols are printed in brackets.
  *
- * dev->lock is taken to guard against races between store_protocols and
+ * dev->mutex is taken to guard against races between store_protocols and
  * show_protocols.
  */
 static ssize_t show_protocols(struct device *device,
@@ -339,7 +339,7 @@ static ssize_t show_protocols(struct device *device,
 		return -EINVAL;
 
 	rc_event(dev, RC_KEY, RC_KEY_REPEAT, 1);
-	mutex_lock(&dev->lock);
+	mutex_lock(&dev->mutex);
 
 	if (fattr->type == RC_FILTER_NORMAL) {
 		enabled = dev->enabled_protocols;
@@ -349,7 +349,7 @@ static ssize_t show_protocols(struct device *device,
 		allowed = dev->allowed_wakeup_protocols;
 	}
 
-	mutex_unlock(&dev->lock);
+	mutex_unlock(&dev->mutex);
 
 	IR_dprintk(1, "%s: allowed - 0x%llx, enabled - 0x%llx\n",
 		   __func__, (long long)allowed, (long long)enabled);
@@ -449,7 +449,7 @@ static int parse_protocol_change(u64 *protocols, const char *buf)
  * See parse_protocol_change() for the valid commands.
  * Returns @len on success or a negative error code.
  *
- * dev->lock is taken to guard against races between store_protocols and
+ * dev->mutex is taken to guard against races between store_protocols and
  * show_protocols.
  */
 static ssize_t store_protocols(struct device *device,
@@ -488,7 +488,7 @@ static ssize_t store_protocols(struct device *device,
 		return -EINVAL;
 	}
 
-	mutex_lock(&dev->lock);
+	mutex_lock(&dev->mutex);
 
 	old_protocols = *current_protocols;
 	new_protocols = old_protocols;
@@ -532,7 +532,7 @@ static ssize_t store_protocols(struct device *device,
 	rc = len;
 
 out:
-	mutex_unlock(&dev->lock);
+	mutex_unlock(&dev->mutex);
 	return rc;
 }
 
@@ -550,7 +550,7 @@ out:
  * Bits of the filter value corresponding to set bits in the filter mask are
  * compared against input scancodes and non-matching scancodes are discarded.
  *
- * dev->lock is taken to guard against races between store_filter and
+ * dev->mutex is taken to guard against races between store_filter and
  * show_filter.
  */
 static ssize_t show_filter(struct device *device,
@@ -571,12 +571,12 @@ static ssize_t show_filter(struct device *device,
 	else
 		filter = &dev->scancode_wakeup_filter;
 
-	mutex_lock(&dev->lock);
+	mutex_lock(&dev->mutex);
 	if (fattr->mask)
 		val = filter->mask;
 	else
 		val = filter->data;
-	mutex_unlock(&dev->lock);
+	mutex_unlock(&dev->mutex);
 
 	return sprintf(buf, "%#x\n", val);
 }
@@ -597,7 +597,7 @@ static ssize_t show_filter(struct device *device,
  * Bits of the filter value corresponding to set bits in the filter mask are
  * compared against input scancodes and non-matching scancodes are discarded.
  *
- * dev->lock is taken to guard against races between store_filter and
+ * dev->mutex is taken to guard against races between store_filter and
  * show_filter.
  */
 static ssize_t store_filter(struct device *device,
@@ -633,7 +633,7 @@ static ssize_t store_filter(struct device *device,
 	if (!set_filter)
 		return -EINVAL;
 
-	mutex_lock(&dev->lock);
+	mutex_lock(&dev->mutex);
 
 	new_filter = *filter;
 	if (fattr->mask)
@@ -654,7 +654,7 @@ static ssize_t store_filter(struct device *device,
 	*filter = new_filter;
 
 unlock:
-	mutex_unlock(&dev->lock);
+	mutex_unlock(&dev->mutex);
 	return (ret < 0) ? ret : len;
 }
 
@@ -1087,7 +1087,7 @@ static long rc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	struct rc_dev *dev = client->dev;
 	int ret;
 
-	ret = mutex_lock_interruptible(&dev->lock);
+	ret = mutex_lock_interruptible(&dev->mutex);
 	if (ret)
 		return ret;
 
@@ -1099,7 +1099,7 @@ static long rc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	ret = rc_do_ioctl(dev, cmd, arg);
 
 out:
-	mutex_unlock(&dev->lock);
+	mutex_unlock(&dev->mutex);
 	return ret;
 }
 
@@ -1226,7 +1226,7 @@ struct rc_dev *rc_allocate_device(void)
 	mutex_init(&dev->txmutex);
 	init_waitqueue_head(&dev->txwait);
 	init_waitqueue_head(&dev->rxwait);
-	mutex_init(&dev->lock);
+	mutex_init(&dev->mutex);
 
 	dev->dev.type = &rc_dev_type;
 	dev->dev.class = &rc_class;
@@ -1339,9 +1339,9 @@ void rc_unregister_device(struct rc_dev *dev)
 	if (!dev)
 		return;
 
-	mutex_lock(&dev->lock);
+	mutex_lock(&dev->mutex);
 	dev->dead = true;
-	mutex_unlock(&dev->lock);
+	mutex_unlock(&dev->mutex);
 
 	spin_lock(&dev->client_lock);
 	list_for_each_entry(client, &dev->client_list, node)
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index 25c1d38..a310e5b 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -268,8 +268,7 @@ enum rc_filter_type {
  * @driver_name: name of the hardware driver which registered this device
  * @map_name: name of the default keymap
  * @rc_kt: current rc_keytable
- * @lock: used to ensure we've filled in all protocol details before
- *	anyone can call show_protocols or store_protocols
+ * @mutex: used where a more specific lock/mutex/etc is not available
  * @dead: used to determine if the device is still alive
  * @client_list: list of clients (processes which have opened the rc chardev)
  * @client_lock: protects client_list
@@ -334,7 +333,7 @@ struct rc_dev {
 	const char			*map_name;
 	struct rc_keytable		*keytables[RC_MAX_KEYTABLES];
 	struct list_head		keytable_list;
-	struct mutex			lock;
+	struct mutex			mutex;
 	bool				dead;
 	struct list_head		client_list;
 	spinlock_t			client_lock;


  parent reply	other threads:[~2014-04-03 23:34 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-03 23:31 [PATCH 00/49] rc-core: my current patch queue David Härdeman
2014-04-03 23:31 ` [PATCH 01/49] bt8xx: fixup RC5 decoding David Härdeman
2014-04-03 23:31 ` [PATCH 02/49] rc-core: improve ir-kbd-i2c get_key functions David Härdeman
2014-04-03 23:31 ` [PATCH 03/49] rc-core: document the protocol type David Härdeman
2014-04-03 23:31 ` [PATCH 04/49] rc-core: do not change 32bit NEC scancode format for now David Härdeman
2014-04-04 13:18   ` James Hogan
2014-04-03 23:31 ` [PATCH 05/49] rc-core: split dev->s_filter David Härdeman
2014-04-04 13:08   ` James Hogan
2014-04-03 23:31 ` [PATCH 06/49] rc-core: remove generic scancode filter David Härdeman
2014-04-04 13:30   ` James Hogan
2014-04-03 23:31 ` [PATCH 07/49] dib0700: NEC scancode cleanup David Härdeman
2014-04-03 23:31 ` [PATCH 08/49] lmedm04: " David Härdeman
2014-04-03 23:32 ` [PATCH 09/49] saa7134: NEC scancode fix David Härdeman
2014-04-03 23:32 ` [PATCH 10/49] [RFC] rc-core: use the full 32 bits for NEC scancodes David Härdeman
2014-04-03 23:32 ` [PATCH 11/49] [RFC] rc-core: don't throw away protocol information David Härdeman
2014-04-03 23:32 ` [PATCH 12/49] rc-core: simplify sysfs code David Härdeman
2014-04-03 23:32 ` [PATCH 13/49] rc-core: remove protocol arrays David Härdeman
2014-04-03 23:32 ` [PATCH 14/49] rc-core: rename dev->scanmask to dev->scancode_mask David Härdeman
2014-04-03 23:32 ` [PATCH 15/49] rc-core: merge rc5 and streamzap decoders David Härdeman
2014-04-03 23:32 ` [PATCH 16/49] rc-core: use an IDA rather than a bitmap David Härdeman
2014-07-25 22:39   ` Mauro Carvalho Chehab
2014-04-03 23:32 ` [PATCH 17/49] rc-core: add chardev David Härdeman
2014-04-03 23:32 ` [PATCH 18/49] rc-core: allow chardev to be read David Härdeman
2014-04-03 23:32 ` [PATCH 19/49] rc-core: use a kfifo for TX data David Härdeman
2014-04-03 23:32 ` [PATCH 20/49] rc-core: allow chardev to be written David Härdeman
2014-04-03 23:33 ` [PATCH 21/49] rc-core: add ioctl support to the rc chardev David Härdeman
2014-04-03 23:33 ` [PATCH 22/49] rc-core: add an ioctl for getting IR RX settings David Härdeman
2014-04-03 23:33 ` [PATCH 23/49] rc-loopback: add RCIOCGIRRX ioctl support David Härdeman
2014-04-03 23:33 ` [PATCH 24/49] rc-core: add an ioctl for setting IR RX settings David Härdeman
2014-04-03 23:33 ` [PATCH 25/49] rc-loopback: add RCIOCSIRRX ioctl support David Härdeman
2014-04-03 23:33 ` [PATCH 26/49] rc-core: add an ioctl for getting IR TX settings David Härdeman
2014-04-03 23:33 ` [PATCH 27/49] rc-loopback: add RCIOCGIRTX ioctl support David Härdeman
2014-04-03 23:33 ` [PATCH 28/49] rc-core: add an ioctl for setting IR TX settings David Härdeman
2014-04-03 23:33 ` [PATCH 29/49] rc-loopback: add RCIOCSIRTX ioctl support David Härdeman
2014-04-03 23:33 ` [PATCH 30/49] rc-core: leave the internals of rc_dev alone David Härdeman
2014-07-24  1:50   ` Mauro Carvalho Chehab
2014-04-03 23:33 ` [PATCH 31/49] rc-core: split rc-main.c into rc-main.c and rc-keytable.c David Härdeman
2014-07-25 22:44   ` Mauro Carvalho Chehab
2014-04-03 23:33 ` [PATCH 32/49] rc-core: prepare for multiple keytables David Härdeman
2014-07-25 22:52   ` Mauro Carvalho Chehab
2014-04-03 23:34 ` [PATCH 33/49] rc-core: make the keytable of rc_dev an array David Härdeman
2014-04-03 23:34 ` [PATCH 34/49] rc-core: add ioctls for adding/removing keytables from userspace David Härdeman
2014-04-03 23:34 ` [PATCH 35/49] rc-core: remove redundant spinlock David Härdeman
2014-04-03 23:34 ` [PATCH 36/49] rc-core: make keytable RCU-friendly David Härdeman
2014-04-03 23:34 ` [PATCH 37/49] rc-core: allow empty keymaps David Härdeman
2014-07-25 22:58   ` Mauro Carvalho Chehab
2014-04-03 23:34 ` [PATCH 38/49] rc-core: rename ir-raw.c David Härdeman
2014-04-03 23:34 ` [PATCH 39/49] rc-core: make IR raw handling a separate module David Härdeman
2014-07-25 23:04   ` Mauro Carvalho Chehab
2014-04-03 23:34 ` [PATCH 40/49] rc-ir-raw: simplify locking David Härdeman
2014-07-25 23:08   ` Mauro Carvalho Chehab
2014-04-03 23:34 ` David Härdeman [this message]
2014-04-10 21:28   ` [PATCH 41/49] rc-core: rename mutex James Hogan
2014-07-25 23:12   ` Mauro Carvalho Chehab
2014-04-03 23:34 ` [PATCH 42/49] rc-ir-raw: atomic reads of protocols David Härdeman
2014-07-25 23:13   ` Mauro Carvalho Chehab
2014-04-03 23:34 ` [PATCH 43/49] rc-core: fix various sparse warnings David Härdeman
2014-04-03 23:34 ` [PATCH 44/49] rc-core: don't report scancodes via input devices David Härdeman
2014-07-25 23:16   ` Mauro Carvalho Chehab
2014-04-03 23:35 ` [PATCH 45/49] rc-ir-raw: add various rc_events David Härdeman
2014-07-25 23:16   ` Mauro Carvalho Chehab
2014-04-03 23:35 ` [PATCH 46/49] rc-core: use struct rc_event for all rc communication David Härdeman
2014-07-25 23:19   ` Mauro Carvalho Chehab
2014-04-03 23:35 ` [PATCH 47/49] rc-core: add keytable events David Härdeman
2014-04-03 23:35 ` [PATCH 48/49] rc-core: move remaining keytable functions David Härdeman
2014-04-03 23:35 ` [PATCH 49/49] rc-core: make rc-core.h userspace friendly David Härdeman
2014-04-04  2:05 ` [PATCH 00/49] rc-core: my current patch queue Mauro Carvalho Chehab
2014-06-26 20:07 ` David Härdeman

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=20140403233443.27099.29952.stgit@zeus.muc.hardeman.nu \
    --to=david@hardeman.nu \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    /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 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.