Commit 62148f09 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] cec: rename cec_devnode fhs_lock to just lock

This lock will be used to protect more than just the fhs list.
So rename it to just 'lock'.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent fa8410b3
...@@ -124,10 +124,10 @@ static void cec_queue_event(struct cec_adapter *adap, ...@@ -124,10 +124,10 @@ static void cec_queue_event(struct cec_adapter *adap,
u64 ts = ktime_get_ns(); u64 ts = ktime_get_ns();
struct cec_fh *fh; struct cec_fh *fh;
mutex_lock(&adap->devnode.fhs_lock); mutex_lock(&adap->devnode.lock);
list_for_each_entry(fh, &adap->devnode.fhs, list) list_for_each_entry(fh, &adap->devnode.fhs, list)
cec_queue_event_fh(fh, ev, ts); cec_queue_event_fh(fh, ev, ts);
mutex_unlock(&adap->devnode.fhs_lock); mutex_unlock(&adap->devnode.lock);
} }
/* /*
...@@ -191,12 +191,12 @@ static void cec_queue_msg_monitor(struct cec_adapter *adap, ...@@ -191,12 +191,12 @@ static void cec_queue_msg_monitor(struct cec_adapter *adap,
u32 monitor_mode = valid_la ? CEC_MODE_MONITOR : u32 monitor_mode = valid_la ? CEC_MODE_MONITOR :
CEC_MODE_MONITOR_ALL; CEC_MODE_MONITOR_ALL;
mutex_lock(&adap->devnode.fhs_lock); mutex_lock(&adap->devnode.lock);
list_for_each_entry(fh, &adap->devnode.fhs, list) { list_for_each_entry(fh, &adap->devnode.fhs, list) {
if (fh->mode_follower >= monitor_mode) if (fh->mode_follower >= monitor_mode)
cec_queue_msg_fh(fh, msg); cec_queue_msg_fh(fh, msg);
} }
mutex_unlock(&adap->devnode.fhs_lock); mutex_unlock(&adap->devnode.lock);
} }
/* /*
...@@ -207,12 +207,12 @@ static void cec_queue_msg_followers(struct cec_adapter *adap, ...@@ -207,12 +207,12 @@ static void cec_queue_msg_followers(struct cec_adapter *adap,
{ {
struct cec_fh *fh; struct cec_fh *fh;
mutex_lock(&adap->devnode.fhs_lock); mutex_lock(&adap->devnode.lock);
list_for_each_entry(fh, &adap->devnode.fhs, list) { list_for_each_entry(fh, &adap->devnode.fhs, list) {
if (fh->mode_follower == CEC_MODE_FOLLOWER) if (fh->mode_follower == CEC_MODE_FOLLOWER)
cec_queue_msg_fh(fh, msg); cec_queue_msg_fh(fh, msg);
} }
mutex_unlock(&adap->devnode.fhs_lock); mutex_unlock(&adap->devnode.lock);
} }
/* Notify userspace of an adapter state change. */ /* Notify userspace of an adapter state change. */
......
...@@ -508,14 +508,14 @@ static int cec_open(struct inode *inode, struct file *filp) ...@@ -508,14 +508,14 @@ static int cec_open(struct inode *inode, struct file *filp)
filp->private_data = fh; filp->private_data = fh;
mutex_lock(&devnode->fhs_lock); mutex_lock(&devnode->lock);
/* Queue up initial state events */ /* Queue up initial state events */
ev_state.state_change.phys_addr = adap->phys_addr; ev_state.state_change.phys_addr = adap->phys_addr;
ev_state.state_change.log_addr_mask = adap->log_addrs.log_addr_mask; ev_state.state_change.log_addr_mask = adap->log_addrs.log_addr_mask;
cec_queue_event_fh(fh, &ev_state, 0); cec_queue_event_fh(fh, &ev_state, 0);
list_add(&fh->list, &devnode->fhs); list_add(&fh->list, &devnode->fhs);
mutex_unlock(&devnode->fhs_lock); mutex_unlock(&devnode->lock);
return 0; return 0;
} }
...@@ -540,9 +540,9 @@ static int cec_release(struct inode *inode, struct file *filp) ...@@ -540,9 +540,9 @@ static int cec_release(struct inode *inode, struct file *filp)
cec_monitor_all_cnt_dec(adap); cec_monitor_all_cnt_dec(adap);
mutex_unlock(&adap->lock); mutex_unlock(&adap->lock);
mutex_lock(&devnode->fhs_lock); mutex_lock(&devnode->lock);
list_del(&fh->list); list_del(&fh->list);
mutex_unlock(&devnode->fhs_lock); mutex_unlock(&devnode->lock);
/* Unhook pending transmits from this filehandle. */ /* Unhook pending transmits from this filehandle. */
mutex_lock(&adap->lock); mutex_lock(&adap->lock);
......
...@@ -117,7 +117,7 @@ static int __must_check cec_devnode_register(struct cec_devnode *devnode, ...@@ -117,7 +117,7 @@ static int __must_check cec_devnode_register(struct cec_devnode *devnode,
/* Initialization */ /* Initialization */
INIT_LIST_HEAD(&devnode->fhs); INIT_LIST_HEAD(&devnode->fhs);
mutex_init(&devnode->fhs_lock); mutex_init(&devnode->lock);
/* Part 1: Find a free minor number */ /* Part 1: Find a free minor number */
mutex_lock(&cec_devnode_lock); mutex_lock(&cec_devnode_lock);
...@@ -181,10 +181,10 @@ static void cec_devnode_unregister(struct cec_devnode *devnode) ...@@ -181,10 +181,10 @@ static void cec_devnode_unregister(struct cec_devnode *devnode)
if (!devnode->registered || devnode->unregistered) if (!devnode->registered || devnode->unregistered)
return; return;
mutex_lock(&devnode->fhs_lock); mutex_lock(&devnode->lock);
list_for_each_entry(fh, &devnode->fhs, list) list_for_each_entry(fh, &devnode->fhs, list)
wake_up_interruptible(&fh->wait); wake_up_interruptible(&fh->wait);
mutex_unlock(&devnode->fhs_lock); mutex_unlock(&devnode->lock);
devnode->registered = false; devnode->registered = false;
devnode->unregistered = true; devnode->unregistered = true;
......
...@@ -57,8 +57,8 @@ struct cec_devnode { ...@@ -57,8 +57,8 @@ struct cec_devnode {
int minor; int minor;
bool registered; bool registered;
bool unregistered; bool unregistered;
struct mutex fhs_lock;
struct list_head fhs; struct list_head fhs;
struct mutex lock;
}; };
struct cec_adapter; struct cec_adapter;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment