From patchwork Wed Mar 16 14:02:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary R Hook X-Patchwork-Id: 8600671 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B05C9C0553 for ; Wed, 16 Mar 2016 14:03:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5ECB42021F for ; Wed, 16 Mar 2016 14:03:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CDD742034B for ; Wed, 16 Mar 2016 14:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966712AbcCPOC7 (ORCPT ); Wed, 16 Mar 2016 10:02:59 -0400 Received: from mail-bn1on0068.outbound.protection.outlook.com ([157.56.110.68]:27776 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966737AbcCPOC4 (ORCPT ); Wed, 16 Mar 2016 10:02:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=GbYnczLIdLkuDXLQvkvDkttF1s1nkaXAlpuiX6iGKug=; b=3PRJBgFvOTlrC8NSW468DlYoF5VsiTEKsYoMN/IS3hPLBY7muclBEdzVAcJ8HFwXEdPXvmAcdZdoTi2VUxCPgb76R4Q5axOKAM6O8lBuAn6IsABbdQiDjrHF0bDL1r0xOikHoYYwKrLK4sjC+2gsVwH/doElHEVP1TGLSfzsiyM= Authentication-Results: davemloft.net; dkim=none (message not signed) header.d=none; davemloft.net; dmarc=none action=none header.from=amd.com; Received: from [127.0.1.1] (165.204.77.1) by SN1PR12MB0349.namprd12.prod.outlook.com (10.162.4.155) with Microsoft SMTP Server (TLS) id 15.1.434.16; Wed, 16 Mar 2016 14:02:48 +0000 Subject: [PATCH] crypto: ccp - fix lock acquisition code From: Gary R Hook To: CC: , Date: Wed, 16 Mar 2016 09:02:26 -0500 Message-ID: <20160316140226.28262.97717.stgit@taos> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BY2PR05CA058.namprd05.prod.outlook.com (10.141.250.48) To SN1PR12MB0349.namprd12.prod.outlook.com (25.162.4.155) X-MS-Office365-Filtering-Correlation-Id: 71e5f9ac-5d28-438e-61ff-08d34da3a846 X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0349; 2:YlOdx7hJxHEPciB52EZj4ZZOza89xy/qj2vgOESGupeix2prNy7gX3cIhNKk9YqdOHWl0/vjuHoTrM6enpnHiC5GBb2XvnNqDIPxVLuVvtXY6usTsPrYhLrKS458Ql9mgwPb+6APPeU+WlhM+cvglvGmgepj8pNgHa9XWzLkZj03geowX19mg/Ti+cZws4ys; 3:v2aXQwwMNpMzDX1qqfTGcl6s9abVBSXxCB0xSFy50h1gs0LJFQZ2PwwAegFCTV7dDtEXzlyGUaKdYL3scjSEG8xZzbdBzcz9R1f28WIKkT2Qp47vBQFkN0CHrc4T8cQa; 25:BrXp9LfnY38dvJb/fqcS3RsE4YVLkEc8oTwUc0H+5EHbtBfJ2/amfG7WS6DuwtIAuHhflE5EIxPTf4Txw+TK7qcBVlhxSgFz2eMOYHC44SoFpz3JbnXSzF2cjXDvYg+IIv1/pyzGgo/enkMyh6/NX5HLyGAA/NX+RZSYIfzvU6ZYnDPLyQxtKSQpKj/CxIfZl0M8OCzPQaJLvs7wnZa/tZDI1V3ESESr69Y1nRg3sO+en0jViSsz2PomBeLAtURlb2PH9jYklpdK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7 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:SN1PR12MB0349; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0349; X-Forefront-PRVS: 08831F51DC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(103116003)(50986999)(47776003)(66066001)(5004730100002)(97746001)(189998001)(110136002)(33716001)(54356999)(19580395003)(33646002)(86362001)(230700001)(92566002)(83506001)(1076002)(4001350100001)(4326007)(3846002)(23676002)(229853001)(586003)(19580405001)(2906002)(81166005)(1096002)(5008740100001)(2351001)(6116002)(50466002)(42186005)(77096005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0349; H:[127.0.1.1]; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjFQUjEyTUIwMzQ5OzIzOkJQVVJIY01GU2daOU5CaXpOclp3elBJakZO?= =?utf-8?B?VHNBSVNobDhjSDBVNnJYanhVM3Z2MGtzSisvVUdFbHlVeUljUFliOVQ5Z2R0?= =?utf-8?B?djRXZTVrQ2szRVF6ekVsbEpPU2VEZ1JVRWt6eVBUbXQyenl5N2dSdWFMeFlQ?= =?utf-8?B?ZDJkNTdxL2xTN285YkpKNDlDcksybGt5YnNFaWxxUWsvcW5PZDNvUGY3U1kv?= =?utf-8?B?Tk4waHFSSm54TFNPRXdkUUZFTlIvZW5wQ2kxcm14ME95anBEd0VNaVpWK242?= =?utf-8?B?UmtvZmpOU3cxUkZCS3BPWVc2bUdOdUI0RFgyWGM2bjVoa091UGo5NU9aRlBO?= =?utf-8?B?aGQwODFqekhTektocXc1ZmhkZzlDZVhQUTlHaXJ6U3FQMlY5dkdOUnZtVmFZ?= =?utf-8?B?bHFEZFErTEZteDRHdUEzM3VjbG41TkdXMkpmTWxXT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==?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0349; 5:xxZdSnwCX2XskqIEAjRXX1mYy0q3HCBuj/Lideb/jD1A+AGlU28SwMhfftO9nzRf7T4FDSB8mpztE8qX2ueWzAQLjOMUqV1Fb5qSWzFf6UJekGxAW2diPD2wrvOXIXrFlGCr6M+zfnYSSGAtNA6Mcw==; 24:ipETIBkc+tQVhlP0cJVtqjjC51HKFmX4wq8JE4HVol3Hz5OtVdMBk8dyqsAPzFGTBstyFkcB+W++6KJa4e9+jPIv5O0WOqTosBQVIIpYPJw=; 20:kEOpMqjZBaSrq8n4R2qfbt8QnKzqqdpyk7PJy1kZibbgLmuz/qSJVn0FqL8HvO2Sq2jwcIyfQfrFz1Z47InUmt87yzJsj6eyFJAFHg0X8MbUmxPJlAA5OOMT0ZhCqCRni7BH8aaKatbgjMInJir61HQBAmYdqPFsE9Asn5W64ZsRC3tf6f24yirRJwvkD+lZ0H6rTmdApMhhBPiyqFdpdm8vAXFkw8W+8AZ8x/wZgp3CwttI3V+jKYXcViwG4hPK SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2016 14:02:48.3346 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0349 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch simplifies an unneeded read-write lock. Signed-off-by: Gary R Hook --- drivers/crypto/ccp/ccp-dev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index 336e5b7..4dbc187 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); static LIST_HEAD(ccp_units); /* Round-robin counter */ -static DEFINE_RWLOCK(ccp_rr_lock); +static DEFINE_SPINLOCK(ccp_rr_lock); static struct ccp_device *ccp_rr; /* Ever-increasing value to produce unique unit numbers */ @@ -128,14 +128,14 @@ static struct ccp_device *ccp_get_device(void) */ read_lock_irqsave(&ccp_unit_lock, flags); if (!list_empty(&ccp_units)) { - write_lock_irqsave(&ccp_rr_lock, flags); + spin_lock(&ccp_rr_lock); dp = ccp_rr; if (list_is_last(&ccp_rr->entry, &ccp_units)) ccp_rr = list_first_entry(&ccp_units, struct ccp_device, entry); else ccp_rr = list_next_entry(ccp_rr, entry); - write_unlock_irqrestore(&ccp_rr_lock, flags); + spin_unlock(&ccp_rr_lock); } read_unlock_irqrestore(&ccp_unit_lock, flags);