diff options
author | Vitaly Kuznetsov <vkuznets@redhat.com> | 2015-01-20 10:45:05 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-01-25 12:18:00 -0500 |
commit | 67fae053bfc6e84144150e4c6c62670abb215c33 (patch) | |
tree | a3636a76dc94882f166e95e5ae49a9eed33c5081 | |
parent | 9c3a6f7e476fc4961297fc66b1177f9f8c8dd238 (diff) |
Drivers: hv: rename sc_lock to the more generic lock
sc_lock spinlock in struct vmbus_channel is being used to not only protect the
sc_list field, e.g. vmbus_open() function uses it to implement test-and-set
access to the state field. Rename it to the more generic 'lock' and add the
description.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/hv/channel.c | 6 | ||||
-rw-r--r-- | drivers/hv/channel_mgmt.c | 10 | ||||
-rw-r--r-- | include/linux/hyperv.h | 7 |
3 files changed, 14 insertions, 9 deletions
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index 18c4f23dacf1..2978f5ee8d2a 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c | |||
@@ -73,14 +73,14 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, | |||
73 | unsigned long flags; | 73 | unsigned long flags; |
74 | int ret, t, err = 0; | 74 | int ret, t, err = 0; |
75 | 75 | ||
76 | spin_lock_irqsave(&newchannel->sc_lock, flags); | 76 | spin_lock_irqsave(&newchannel->lock, flags); |
77 | if (newchannel->state == CHANNEL_OPEN_STATE) { | 77 | if (newchannel->state == CHANNEL_OPEN_STATE) { |
78 | newchannel->state = CHANNEL_OPENING_STATE; | 78 | newchannel->state = CHANNEL_OPENING_STATE; |
79 | } else { | 79 | } else { |
80 | spin_unlock_irqrestore(&newchannel->sc_lock, flags); | 80 | spin_unlock_irqrestore(&newchannel->lock, flags); |
81 | return -EINVAL; | 81 | return -EINVAL; |
82 | } | 82 | } |
83 | spin_unlock_irqrestore(&newchannel->sc_lock, flags); | 83 | spin_unlock_irqrestore(&newchannel->lock, flags); |
84 | 84 | ||
85 | newchannel->onchannel_callback = onchannelcallback; | 85 | newchannel->onchannel_callback = onchannelcallback; |
86 | newchannel->channel_callback_context = context; | 86 | newchannel->channel_callback_context = context; |
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 704c0e00f8d2..1e0b996ed643 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c | |||
@@ -146,7 +146,7 @@ static struct vmbus_channel *alloc_channel(void) | |||
146 | return NULL; | 146 | return NULL; |
147 | 147 | ||
148 | spin_lock_init(&channel->inbound_lock); | 148 | spin_lock_init(&channel->inbound_lock); |
149 | spin_lock_init(&channel->sc_lock); | 149 | spin_lock_init(&channel->lock); |
150 | 150 | ||
151 | INIT_LIST_HEAD(&channel->sc_list); | 151 | INIT_LIST_HEAD(&channel->sc_list); |
152 | INIT_LIST_HEAD(&channel->percpu_list); | 152 | INIT_LIST_HEAD(&channel->percpu_list); |
@@ -246,9 +246,9 @@ static void vmbus_process_rescind_offer(struct work_struct *work) | |||
246 | spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags); | 246 | spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags); |
247 | } else { | 247 | } else { |
248 | primary_channel = channel->primary_channel; | 248 | primary_channel = channel->primary_channel; |
249 | spin_lock_irqsave(&primary_channel->sc_lock, flags); | 249 | spin_lock_irqsave(&primary_channel->lock, flags); |
250 | list_del(&channel->sc_list); | 250 | list_del(&channel->sc_list); |
251 | spin_unlock_irqrestore(&primary_channel->sc_lock, flags); | 251 | spin_unlock_irqrestore(&primary_channel->lock, flags); |
252 | } | 252 | } |
253 | free_channel(channel); | 253 | free_channel(channel); |
254 | } | 254 | } |
@@ -323,9 +323,9 @@ static void vmbus_process_offer(struct work_struct *work) | |||
323 | * Process the sub-channel. | 323 | * Process the sub-channel. |
324 | */ | 324 | */ |
325 | newchannel->primary_channel = channel; | 325 | newchannel->primary_channel = channel; |
326 | spin_lock_irqsave(&channel->sc_lock, flags); | 326 | spin_lock_irqsave(&channel->lock, flags); |
327 | list_add_tail(&newchannel->sc_list, &channel->sc_list); | 327 | list_add_tail(&newchannel->sc_list, &channel->sc_list); |
328 | spin_unlock_irqrestore(&channel->sc_lock, flags); | 328 | spin_unlock_irqrestore(&channel->lock, flags); |
329 | 329 | ||
330 | if (newchannel->target_cpu != get_cpu()) { | 330 | if (newchannel->target_cpu != get_cpu()) { |
331 | put_cpu(); | 331 | put_cpu(); |
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 259023a34bec..5a2ba674795e 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h | |||
@@ -734,7 +734,12 @@ struct vmbus_channel { | |||
734 | */ | 734 | */ |
735 | void (*sc_creation_callback)(struct vmbus_channel *new_sc); | 735 | void (*sc_creation_callback)(struct vmbus_channel *new_sc); |
736 | 736 | ||
737 | spinlock_t sc_lock; | 737 | /* |
738 | * The spinlock to protect the structure. It is being used to protect | ||
739 | * test-and-set access to various attributes of the structure as well | ||
740 | * as all sc_list operations. | ||
741 | */ | ||
742 | spinlock_t lock; | ||
738 | /* | 743 | /* |
739 | * All Sub-channels of a primary channel are linked here. | 744 | * All Sub-channels of a primary channel are linked here. |
740 | */ | 745 | */ |