diff options
author | Gary R Hook <gary.hook@amd.com> | 2016-03-16 10:02:26 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-03-17 07:09:02 -0400 |
commit | 03a6f29000fdc13adc2bb2e22efd07a51d334154 (patch) | |
tree | 6bcfe5e38d88a74da2086b40eaea3dad0fd24af3 | |
parent | d1558f4e95cb14b0fff5c0b839c15a21f7e8aed0 (diff) |
crypto: ccp - fix lock acquisition code
This patch simplifies an unneeded read-write lock.
Signed-off-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | drivers/crypto/ccp/ccp-dev.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index 336e5b780fcb..4dbc18727235 100644 --- a/drivers/crypto/ccp/ccp-dev.c +++ b/drivers/crypto/ccp/ccp-dev.c | |||
@@ -53,7 +53,7 @@ static DEFINE_RWLOCK(ccp_unit_lock); | |||
53 | static LIST_HEAD(ccp_units); | 53 | static LIST_HEAD(ccp_units); |
54 | 54 | ||
55 | /* Round-robin counter */ | 55 | /* Round-robin counter */ |
56 | static DEFINE_RWLOCK(ccp_rr_lock); | 56 | static DEFINE_SPINLOCK(ccp_rr_lock); |
57 | static struct ccp_device *ccp_rr; | 57 | static struct ccp_device *ccp_rr; |
58 | 58 | ||
59 | /* Ever-increasing value to produce unique unit numbers */ | 59 | /* Ever-increasing value to produce unique unit numbers */ |
@@ -128,14 +128,14 @@ static struct ccp_device *ccp_get_device(void) | |||
128 | */ | 128 | */ |
129 | read_lock_irqsave(&ccp_unit_lock, flags); | 129 | read_lock_irqsave(&ccp_unit_lock, flags); |
130 | if (!list_empty(&ccp_units)) { | 130 | if (!list_empty(&ccp_units)) { |
131 | write_lock_irqsave(&ccp_rr_lock, flags); | 131 | spin_lock(&ccp_rr_lock); |
132 | dp = ccp_rr; | 132 | dp = ccp_rr; |
133 | if (list_is_last(&ccp_rr->entry, &ccp_units)) | 133 | if (list_is_last(&ccp_rr->entry, &ccp_units)) |
134 | ccp_rr = list_first_entry(&ccp_units, struct ccp_device, | 134 | ccp_rr = list_first_entry(&ccp_units, struct ccp_device, |
135 | entry); | 135 | entry); |
136 | else | 136 | else |
137 | ccp_rr = list_next_entry(ccp_rr, entry); | 137 | ccp_rr = list_next_entry(ccp_rr, entry); |
138 | write_unlock_irqrestore(&ccp_rr_lock, flags); | 138 | spin_unlock(&ccp_rr_lock); |
139 | } | 139 | } |
140 | read_unlock_irqrestore(&ccp_unit_lock, flags); | 140 | read_unlock_irqrestore(&ccp_unit_lock, flags); |
141 | 141 | ||