stm class: Mark src::link __rcu
Source device's link is protected with srcu, mark it as such to have proper build-time validation of accesses to this field. The update side that's dereferencing it under an update lock also needs an accessor to dereference this field to keep sparse happy. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
fab6266e82
commit
0df771dedf
|
@ -781,17 +781,20 @@ fail_detach:
|
||||||
static void __stm_source_link_drop(struct stm_source_device *src,
|
static void __stm_source_link_drop(struct stm_source_device *src,
|
||||||
struct stm_device *stm)
|
struct stm_device *stm)
|
||||||
{
|
{
|
||||||
|
struct stm_device *link;
|
||||||
|
|
||||||
spin_lock(&src->link_lock);
|
spin_lock(&src->link_lock);
|
||||||
if (WARN_ON_ONCE(src->link != stm)) {
|
link = srcu_dereference_check(src->link, &stm_source_srcu, 1);
|
||||||
|
if (WARN_ON_ONCE(link != stm)) {
|
||||||
spin_unlock(&src->link_lock);
|
spin_unlock(&src->link_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
stm_output_free(src->link, &src->output);
|
stm_output_free(link, &src->output);
|
||||||
/* caller must hold stm::link_lock */
|
/* caller must hold stm::link_lock */
|
||||||
list_del_init(&src->link_entry);
|
list_del_init(&src->link_entry);
|
||||||
/* matches stm_find_device() from stm_source_link_store() */
|
/* matches stm_find_device() from stm_source_link_store() */
|
||||||
stm_put_device(src->link);
|
stm_put_device(link);
|
||||||
rcu_assign_pointer(src->link, NULL);
|
rcu_assign_pointer(src->link, NULL);
|
||||||
|
|
||||||
spin_unlock(&src->link_lock);
|
spin_unlock(&src->link_lock);
|
||||||
|
|
|
@ -74,7 +74,7 @@ struct stm_source_device {
|
||||||
struct device dev;
|
struct device dev;
|
||||||
struct stm_source_data *data;
|
struct stm_source_data *data;
|
||||||
spinlock_t link_lock;
|
spinlock_t link_lock;
|
||||||
struct stm_device *link;
|
struct stm_device __rcu *link;
|
||||||
struct list_head link_entry;
|
struct list_head link_entry;
|
||||||
/* one output per stm_source device */
|
/* one output per stm_source device */
|
||||||
struct stp_policy_node *policy_node;
|
struct stp_policy_node *policy_node;
|
||||||
|
|
Loading…
Reference in New Issue