Re: [PATCH 41/49] rc-core: rename mutex

2014-07-25 Thread Mauro Carvalho Chehab
Em Fri, 04 Apr 2014 01:34:43 +0200
David Härdeman da...@hardeman.nu escreveu:

 Having a mutex named lock is a bit misleading.

Please rebase.

 
 Signed-off-by: David Härdeman da...@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 

Re: [PATCH 41/49] rc-core: rename mutex

2014-04-10 Thread James Hogan
On Friday 04 April 2014 01:34:43 David Härdeman wrote:
 Having a mutex named lock is a bit misleading.

Why? A mutex is a type of lock so what's the problem?

A little grep'ing and sed'ing reveals that out of the 1578 unique mutex names 
in the kernel source I have to hand, 540 contain lock, and 921 contain 
mutex.

Cheers
James

 
 Signed-off-by: David Härdeman da...@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 

[PATCH 41/49] rc-core: rename mutex

2014-04-03 Thread David Härdeman
Having a mutex named lock is a bit misleading.

Signed-off-by: David Härdeman da...@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