From patchwork Thu Jun 22 11:42:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 9804075 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 70CDD60386 for ; Thu, 22 Jun 2017 11:43:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F62C28628 for ; Thu, 22 Jun 2017 11:43:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53F8928637; Thu, 22 Jun 2017 11:43:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6489628628 for ; Thu, 22 Jun 2017 11:43:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752776AbdFVLnW (ORCPT ); Thu, 22 Jun 2017 07:43:22 -0400 Received: from mail-bl2nam02on0054.outbound.protection.outlook.com ([104.47.38.54]:58080 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750932AbdFVLmi (ORCPT ); Thu, 22 Jun 2017 07:42:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=2RTMEdZLesmnCDNbatYsFWoS1kFHAS2CD4yBMaizAxA=; b=J+VzUkeq6cfqAJ1gIehoRs4l+7LstfU9SF/36deF3p5k2Dsfn/ikZrzNY50OD+Ewq7FUJfnDBtH7ydNjDz9VFCnTM/hfJjohK6dd2VFt3THCdW0LbAczAMRFk8H1o84ocHhBHfXyT8L1JN6JPF0ArKuJOZ5NXymT5BPvnsZ1ZHc= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from ubuntu-010236106000.amd.com (165.204.78.1) by BY2PR12MB0146.namprd12.prod.outlook.com (10.162.82.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1199.15; Thu, 22 Jun 2017 11:42:33 +0000 From: Brijesh Singh To: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: gary.hook@amd.com, thomas.lendacky@amd.com, herbert@gondor.apana.org.au, davem@davemloft.net, Brijesh Singh Subject: [PATCH 1/3] crypto: ccp - Use devres interface to allocate PCI/iomap and cleanup Date: Thu, 22 Jun 2017 06:42:02 -0500 Message-Id: <20170622114204.4361-2-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170622114204.4361-1-brijesh.singh@amd.com> References: <20170622114204.4361-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN1PR19CA0031.namprd19.prod.outlook.com (10.163.220.41) To BY2PR12MB0146.namprd12.prod.outlook.com (10.162.82.19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1ba15be7-9e4b-4b80-f4c2-08d4b963c5f5 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500055)(300135000095)(300000501055)(300135300095)(22001)(300000502055)(300135100095)(48565401081)(300000503055)(300135400095)(201703131423075)(201703031133081)(300000504055)(300135200095)(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69HBoInhARFmnhFMua+ciitSiRjH++b0sIzs6Rt1S46j/zw8JXNAibDNi3lk87tbpkgmBXjDlxKQl+I1ZqscjbskVJZm1m1XqTeQ1QwWfd9ZY4CNhSBQDelnJXSse5YClsxTXFuG/fsxdbW+7qxM/NDxjtwTTtyX/V2d0G8rcTPyYN37gNYUseKZdv+E7KxeTPVfG6phV5veMhIjuE97TUi8Qn+jpUivos8UnENVdzx1KJphPqZ5VKcBEdXvfmLMjUOkZOcq6nJEWz23vNABv8ABrmvfpgDj1OEQ1C1IOyHPdaDb1BQPGtt4UZdUZ7CojHWHNClSIJp+Bm0R0u+vDwo1z3E2uQyqL18jcT4jvgc9tfYNLAeUG3s= X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0146; 20:Ud5ixb8Jlsg4EdvUrhYzgb7Z6SwPjzVpVBQK+yu8kWJnJBC8Jsdgx0zny1ojq5w3CZkyGkpurnruIQN2kK5nITJ+vRkm9RWBtlLZXKkYxD9+PSfQyxcGRTfAC4TLSSAmFSLvocqh0mE+NkYBCdxs5KOpmv3LpEtAA1Ilawt3tIkayOD371/RqfFBXTXmjgHXvx0FoTBbvh01gnW3C+yjiGWqyvdjnNW40luPYvz5u0GcIIVE64vviSLRH6hvlS4KGFt+tM8qi7L+2YIix1Cl+C1iHozutQDT8nd/yTGXg3CsGKSuy6V9jQKVCI0ifS7pICYHR4oOPN9vj6dL4qVN5p3KVRly0t6Ezjp5mVZ5MvGhMirOy0kAo853pTiXkceAuMqItqcEpjpaBWXs1Pggct5DaAwnfUu7qJSOCwkEcjvPgbnyVV2BjUSgG8AiVG/EfUKb249eTs7UZTC1Ix+HVgKIL2dbKM8QRnRA/5VBTykiUzglGbyfINy7S2QfxWEl X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6041248)(20161123564025)(20161123562025)(20161123558100)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR12MB0146; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR12MB0146; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR12MB0146; 4:RZfPOmF4fEXHNL+4kJR8Czp8m17dm75VO0FjRIkB4F?= =?us-ascii?Q?5yoAjKLCXn8E6kPd1AT7sHfCyWg9Awn0LazzNuLX0gkeeSAX4HxJboGBAkKA?= =?us-ascii?Q?Pv/TAWOlsAD2z4NrR5XWN4aJcN+8gmmTVDAedYR5RxBSoQ701IRyc/a8Q5Q8?= =?us-ascii?Q?cqxAucmD4cQakp0oxNto1iFsd7YuyoRu4fJzMQoqWsy/ZPAiI1y9i31gXXH0?= =?us-ascii?Q?dLaEl1k2qviO2pqhRgseavWLHGrMFEsb8kSd7/4e8KkbGd/vW09UKd1ouVT6?= =?us-ascii?Q?mp/BA37gG1/7BJq7dkQwKV6GZPJzi6KRy/2rtCm739I0T8XuJtA8ajUeP6pp?= =?us-ascii?Q?vCf4vHDo8HPPbAPAZHl2LfLZriXrK1opgdZqt0c7cO47C5hJXNDO9uT4KKM9?= =?us-ascii?Q?ZYoGoH6oDckulLuoW/am+L8/fF8PH3R8eWKNCgI3Dkp7buywBJXBbfaHNYkg?= =?us-ascii?Q?h0XdEtctaB+E6BrNv8IhBKwBjpuEzWld8zuF01LBtbEszNHhGw5fRBkURzzL?= =?us-ascii?Q?L5GzmuFiJZwMEyHnD+kwsYGzbMoBtQJcfZ28cuViHOb6Ql/3IBV+KxxPsPFo?= =?us-ascii?Q?pJ9QJANzufVQ10L1BPC6gr8DFFColOaWLkztlBnPEIQZwF5iNrxbgj1jTeLP?= =?us-ascii?Q?prjIzrMX1eaMWphvOaRWija2QNKi2biab7faQvyxvIy+78pmThRGftaYZOc1?= =?us-ascii?Q?s2bqicH8dPRmtawKnGohG9e1RZygguDCg9jvzXKIoFxEZn1boaIyukLlXa7s?= =?us-ascii?Q?sACykUirh/mczGuPMQtOpuPL7vIOcZRWm1CY+AxjaeYo/rkyC432eVmboWGe?= =?us-ascii?Q?08oKiCfls6DFyJrcUhw/d986mkbArtMXHSzC4KftFZNj5kzuN/Qnp4nzd7+1?= =?us-ascii?Q?LeAVt+Wf4A00ji/w+yGst3O/5EhMo5d/AAjPne+cnWapu4iwOlRxwEdq1MCh?= =?us-ascii?Q?+enZOYOnfxMb8Q6BrVP90MMm+fDi4WzvvV+U7SR6yE5bqZJNJKESH7GBTyIf?= =?us-ascii?Q?85OMpHyXAaksJqo22cUWCtfmEwCqQKzGlrDXF5m3ABLrZUie3/I3fZJMXHmh?= =?us-ascii?Q?QFxigbeMZbeLHVJ3jrOk7d7SIGrsMjTEfKRdkokaqopT/BwRZSZ6kNBFCkmx?= =?us-ascii?Q?Yt7Xqa7W1JBqbmN40GG2TcJ9uKsqfomjsONkyc1mQ2AnAVlEZ+omkQDkxN1g?= =?us-ascii?Q?hLk7uMSZhxiKOikn6kNiBLHnPUxc/Nq0iJ?= X-Forefront-PRVS: 03468CBA43 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39400400002)(39850400002)(39410400002)(39860400002)(39840400002)(39450400003)(6666003)(25786009)(81166006)(7736002)(575784001)(110136004)(86362001)(38730400002)(48376002)(50466002)(5003940100001)(66066001)(8676002)(3846002)(4326008)(47776003)(6116002)(2906002)(36756003)(189998001)(53416004)(478600001)(76176999)(50986999)(6486002)(5660300001)(305945005)(42186005)(2950100002)(53936002)(50226002)(33646002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR12MB0146; H:ubuntu-010236106000.amd.com; FPR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p; 24:KrL+W6uHOjU3w9wHnbbrcu7gKtHAiNy3uGGWR0n9YguMh3IufNFYGKx1226B1SM93L1Q84OpIJlSRpeEmMqmGbrfkLIqligdxDxObEwLOaY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0146; 7:GNPZipu32zxEIyBWFLX/CL+A7phX3HiGfNTBwXqSjGsJh2nM8c8jqxpnypsH2aGpokWmn4kUkLdCZPzQzEbFiKlmT8jg1kcb0htpz1XWR4nlhgakn8/phOWfXWzkMKgY5lRd58u6BCpfvfOGjRIv++xOJO0kjcE54AVhRSeWRNW+NUxvqKcbL/5rIiu/y9C0gFz30D5ySn8y7NS6L+GH10fGXnK+GSwVqeiaKixGgvmElbHsUTZsjM6+vl/MfNvc1yLMn9UL0ekAq/6p6r8ehcws8o2C0odW0IzUI+isRsyp4DrXG3s69GNmACoMo9fmHk21/lzQIOUxYVVDKcw/7somNSGTh69PaDOjeNDifV4Clq6G/Xcyh3qIopvwkXngcuhNT3etQbu+q7oNDHOcoXDUYeB+xN4d/mlEfqEOxhjcQP7DR0eM9+xJShU7tteTlbqHQg6h3omKDybxyFMnuDXeETiHIAMuBvhn3Q+YpZv2blzT3dh802vSUYRJC2J0SG2y5gTTy8ryCK52l9OgdLVJOhZHBapT619/wKi6EN40Vzuz4Lw76bCwNtXGvdVZrd0fb6T1VyMVREokslYtxHzIBniEHUdTDZQiPlaODZMCOH1SAIU/7S7J9/TnC8E6PinmUHRipnEUYVHkQUPrwU/U2VAmUdpCV7pUVvLNELpz6+q/+yfN6Yly9iVrMuhlGwnq64LU4/CIvILTKV57oZ2I68LMqb2N3IBlp7SuB1XB2cQ+RKvJG1Am73XoeLJtIN/7YQpQHpg7mVKATyjGemmznJBQdcUdrSMXsIkuhaY= X-Microsoft-Exchange-Diagnostics: 1; BY2PR12MB0146; 20:qDqoLt3IVSBTw4+T+DDIvKOUzczv/6274g4GDIcxhfqC5GnHEF1lmQxP+10WJz14Rke95sBBHrXRVGtWSy69V9oNn0Oxcm/11rFur8iwOZ8Qb+ZN6rjjWC+Ka2S+4n6EVoQ2d7Aoe6dJXx30dbWehBJkaH0jKdconrPnAj7RrfGUONFpMYSaV3f/PkXuWPf3x5XHYcmaPwrcRfuyO0gyoFAc15DouJTPTIHxZZk8n7gBB0xZNrqkMsYnX/TzHVIV X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2017 11:42:33.5526 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0146 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Update pci and platform files to use devres interface to allocate the PCI and iomap resources. Also add helper functions to consolicate module init, exit and power mangagement code duplication. Signed-off-by: Brijesh Singh --- drivers/crypto/ccp/ccp-dev-v3.c | 8 +++ drivers/crypto/ccp/ccp-dev.c | 61 ++++++++++++++++++++ drivers/crypto/ccp/ccp-dev.h | 6 ++ drivers/crypto/ccp/ccp-pci.c | 114 +++++++++----------------------------- drivers/crypto/ccp/ccp-platform.c | 56 ++----------------- 5 files changed, 107 insertions(+), 138 deletions(-) diff --git a/drivers/crypto/ccp/ccp-dev-v3.c b/drivers/crypto/ccp/ccp-dev-v3.c index 367c2e3..1cae5a3 100644 --- a/drivers/crypto/ccp/ccp-dev-v3.c +++ b/drivers/crypto/ccp/ccp-dev-v3.c @@ -586,6 +586,14 @@ static const struct ccp_actions ccp3_actions = { .irqhandler = ccp_irq_handler, }; +const struct ccp_vdata ccpv3_platform = { + .version = CCP_VERSION(3, 0), + .setup = NULL, + .perform = &ccp3_actions, + .bar = 2, + .offset = 0, +}; + const struct ccp_vdata ccpv3 = { .version = CCP_VERSION(3, 0), .setup = NULL, diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index 2506b50..ce35e43 100644 --- a/drivers/crypto/ccp/ccp-dev.c +++ b/drivers/crypto/ccp/ccp-dev.c @@ -538,8 +538,69 @@ bool ccp_queues_suspended(struct ccp_device *ccp) return ccp->cmd_q_count == suspended; } + +int ccp_dev_suspend(struct ccp_device *ccp, pm_message_t state) +{ + unsigned long flags; + unsigned int i; + + spin_lock_irqsave(&ccp->cmd_lock, flags); + + ccp->suspending = 1; + + /* Wake all the queue kthreads to prepare for suspend */ + for (i = 0; i < ccp->cmd_q_count; i++) + wake_up_process(ccp->cmd_q[i].kthread); + + spin_unlock_irqrestore(&ccp->cmd_lock, flags); + + /* Wait for all queue kthreads to say they're done */ + while (!ccp_queues_suspended(ccp)) + wait_event_interruptible(ccp->suspend_queue, + ccp_queues_suspended(ccp)); + + return 0; +} + +int ccp_dev_resume(struct ccp_device *ccp) +{ + unsigned long flags; + unsigned int i; + + spin_lock_irqsave(&ccp->cmd_lock, flags); + + ccp->suspending = 0; + + /* Wake up all the kthreads */ + for (i = 0; i < ccp->cmd_q_count; i++) { + ccp->cmd_q[i].suspended = 0; + wake_up_process(ccp->cmd_q[i].kthread); + } + + spin_unlock_irqrestore(&ccp->cmd_lock, flags); + + return 0; +} #endif +int ccp_dev_init(struct ccp_device *ccp) +{ + if (ccp->vdata->setup) + ccp->vdata->setup(ccp); + + ccp->io_regs = ccp->io_map + ccp->vdata->offset; + + return ccp->vdata->perform->init(ccp); +} + +void ccp_dev_destroy(struct ccp_device *ccp) +{ + if (!ccp) + return; + + ccp->vdata->perform->destroy(ccp); +} + static int __init ccp_mod_init(void) { #ifdef CONFIG_X86 diff --git a/drivers/crypto/ccp/ccp-dev.h b/drivers/crypto/ccp/ccp-dev.h index a70154a..df2e76e 100644 --- a/drivers/crypto/ccp/ccp-dev.h +++ b/drivers/crypto/ccp/ccp-dev.h @@ -652,6 +652,11 @@ void ccp_dmaengine_unregister(struct ccp_device *ccp); void ccp5_debugfs_setup(struct ccp_device *ccp); void ccp5_debugfs_destroy(void); +int ccp_dev_init(struct ccp_device *ccp); +void ccp_dev_destroy(struct ccp_device *ccp); +int ccp_dev_suspend(struct ccp_device *ccp, pm_message_t state); +int ccp_dev_resume(struct ccp_device *ccp); + /* Structure for computation functions that are device-specific */ struct ccp_actions { int (*aes)(struct ccp_op *); @@ -679,6 +684,7 @@ struct ccp_vdata { const unsigned int offset; }; +extern const struct ccp_vdata ccpv3_platform; extern const struct ccp_vdata ccpv3; extern const struct ccp_vdata ccpv5a; extern const struct ccp_vdata ccpv5b; diff --git a/drivers/crypto/ccp/ccp-pci.c b/drivers/crypto/ccp/ccp-pci.c index e880d4cf4..490ad0a 100644 --- a/drivers/crypto/ccp/ccp-pci.c +++ b/drivers/crypto/ccp/ccp-pci.c @@ -150,28 +150,13 @@ static void ccp_free_irqs(struct ccp_device *ccp) ccp->irq = 0; } -static int ccp_find_mmio_area(struct ccp_device *ccp) -{ - struct device *dev = ccp->dev; - struct pci_dev *pdev = to_pci_dev(dev); - resource_size_t io_len; - unsigned long io_flags; - - io_flags = pci_resource_flags(pdev, ccp->vdata->bar); - io_len = pci_resource_len(pdev, ccp->vdata->bar); - if ((io_flags & IORESOURCE_MEM) && - (io_len >= (ccp->vdata->offset + 0x800))) - return ccp->vdata->bar; - - return -EIO; -} - static int ccp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { struct ccp_device *ccp; struct ccp_pci *ccp_pci; struct device *dev = &pdev->dev; - unsigned int bar; + void __iomem * const *iomap_table; + int bar_mask; int ret; ret = -ENOMEM; @@ -193,32 +178,34 @@ static int ccp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) ccp->get_irq = ccp_get_irqs; ccp->free_irq = ccp_free_irqs; - ret = pci_request_regions(pdev, "ccp"); + ret = pcim_enable_device(pdev); if (ret) { - dev_err(dev, "pci_request_regions failed (%d)\n", ret); + dev_err(dev, "pcim_enable_device failed (%d)\n", ret); goto e_err; } - ret = pci_enable_device(pdev); + bar_mask = pci_select_bars(pdev, IORESOURCE_MEM); + ret = pcim_iomap_regions(pdev, bar_mask, "ccp"); if (ret) { - dev_err(dev, "pci_enable_device failed (%d)\n", ret); - goto e_regions; + dev_err(dev, "pcim_iomap_regions failed (%d)\n", ret); + goto e_err; } - pci_set_master(pdev); - - ret = ccp_find_mmio_area(ccp); - if (ret < 0) - goto e_device; - bar = ret; + iomap_table = pcim_iomap_table(pdev); + if (!iomap_table) { + dev_err(dev, "pcim_iomap_table failed\n"); + ret = -ENOMEM; + goto e_err; + } - ret = -EIO; - ccp->io_map = pci_iomap(pdev, bar, 0); + ccp->io_map = iomap_table[ccp->vdata->bar]; if (!ccp->io_map) { - dev_err(dev, "pci_iomap failed\n"); - goto e_device; + dev_err(dev, "ioremap failed\n"); + ret = -ENOMEM; + goto e_err; } - ccp->io_regs = ccp->io_map + ccp->vdata->offset; + + pci_set_master(pdev); ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48)); if (ret) { @@ -226,32 +213,20 @@ static int ccp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (ret) { dev_err(dev, "dma_set_mask_and_coherent failed (%d)\n", ret); - goto e_iomap; + goto e_err; } } dev_set_drvdata(dev, ccp); - if (ccp->vdata->setup) - ccp->vdata->setup(ccp); - - ret = ccp->vdata->perform->init(ccp); + ret = ccp_dev_init(ccp); if (ret) - goto e_iomap; + goto e_err; dev_notice(dev, "enabled\n"); return 0; -e_iomap: - pci_iounmap(pdev, ccp->io_map); - -e_device: - pci_disable_device(pdev); - -e_regions: - pci_release_regions(pdev); - e_err: dev_notice(dev, "initialization failed\n"); return ret; @@ -265,13 +240,7 @@ static void ccp_pci_remove(struct pci_dev *pdev) if (!ccp) return; - ccp->vdata->perform->destroy(ccp); - - pci_iounmap(pdev, ccp->io_map); - - pci_disable_device(pdev); - - pci_release_regions(pdev); + ccp_dev_destroy(ccp); dev_notice(dev, "disabled\n"); } @@ -281,47 +250,16 @@ static int ccp_pci_suspend(struct pci_dev *pdev, pm_message_t state) { struct device *dev = &pdev->dev; struct ccp_device *ccp = dev_get_drvdata(dev); - unsigned long flags; - unsigned int i; - - spin_lock_irqsave(&ccp->cmd_lock, flags); - - ccp->suspending = 1; - - /* Wake all the queue kthreads to prepare for suspend */ - for (i = 0; i < ccp->cmd_q_count; i++) - wake_up_process(ccp->cmd_q[i].kthread); - spin_unlock_irqrestore(&ccp->cmd_lock, flags); - - /* Wait for all queue kthreads to say they're done */ - while (!ccp_queues_suspended(ccp)) - wait_event_interruptible(ccp->suspend_queue, - ccp_queues_suspended(ccp)); - - return 0; + return ccp_dev_suspend(ccp, state); } static int ccp_pci_resume(struct pci_dev *pdev) { struct device *dev = &pdev->dev; struct ccp_device *ccp = dev_get_drvdata(dev); - unsigned long flags; - unsigned int i; - - spin_lock_irqsave(&ccp->cmd_lock, flags); - - ccp->suspending = 0; - /* Wake up all the kthreads */ - for (i = 0; i < ccp->cmd_q_count; i++) { - ccp->cmd_q[i].suspended = 0; - wake_up_process(ccp->cmd_q[i].kthread); - } - - spin_unlock_irqrestore(&ccp->cmd_lock, flags); - - return 0; + return ccp_dev_resume(ccp); } #endif diff --git a/drivers/crypto/ccp/ccp-platform.c b/drivers/crypto/ccp/ccp-platform.c index e26969e..4a970b1 100644 --- a/drivers/crypto/ccp/ccp-platform.c +++ b/drivers/crypto/ccp/ccp-platform.c @@ -102,19 +102,6 @@ static void ccp_free_irqs(struct ccp_device *ccp) free_irq(ccp->irq, dev); } -static struct resource *ccp_find_mmio_area(struct ccp_device *ccp) -{ - struct device *dev = ccp->dev; - struct platform_device *pdev = to_platform_device(dev); - struct resource *ior; - - ior = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (ior && (resource_size(ior) >= 0x800)) - return ior; - - return NULL; -} - static int ccp_platform_probe(struct platform_device *pdev) { struct ccp_device *ccp; @@ -144,7 +131,7 @@ static int ccp_platform_probe(struct platform_device *pdev) ccp->get_irq = ccp_get_irqs; ccp->free_irq = ccp_free_irqs; - ior = ccp_find_mmio_area(ccp); + ior = platform_get_resource(pdev, IORESOURCE_MEM, 0); ccp->io_map = devm_ioremap_resource(dev, ior); if (IS_ERR(ccp->io_map)) { ret = PTR_ERR(ccp->io_map); @@ -172,7 +159,7 @@ static int ccp_platform_probe(struct platform_device *pdev) dev_set_drvdata(dev, ccp); - ret = ccp->vdata->perform->init(ccp); + ret = ccp_dev_init(ccp); if (ret) goto e_err; @@ -190,7 +177,7 @@ static int ccp_platform_remove(struct platform_device *pdev) struct device *dev = &pdev->dev; struct ccp_device *ccp = dev_get_drvdata(dev); - ccp->vdata->perform->destroy(ccp); + ccp_dev_destroy(ccp); dev_notice(dev, "disabled\n"); @@ -203,47 +190,16 @@ static int ccp_platform_suspend(struct platform_device *pdev, { struct device *dev = &pdev->dev; struct ccp_device *ccp = dev_get_drvdata(dev); - unsigned long flags; - unsigned int i; - - spin_lock_irqsave(&ccp->cmd_lock, flags); - ccp->suspending = 1; - - /* Wake all the queue kthreads to prepare for suspend */ - for (i = 0; i < ccp->cmd_q_count; i++) - wake_up_process(ccp->cmd_q[i].kthread); - - spin_unlock_irqrestore(&ccp->cmd_lock, flags); - - /* Wait for all queue kthreads to say they're done */ - while (!ccp_queues_suspended(ccp)) - wait_event_interruptible(ccp->suspend_queue, - ccp_queues_suspended(ccp)); - - return 0; + return ccp_dev_suspend(ccp, state); } static int ccp_platform_resume(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct ccp_device *ccp = dev_get_drvdata(dev); - unsigned long flags; - unsigned int i; - - spin_lock_irqsave(&ccp->cmd_lock, flags); - ccp->suspending = 0; - - /* Wake up all the kthreads */ - for (i = 0; i < ccp->cmd_q_count; i++) { - ccp->cmd_q[i].suspended = 0; - wake_up_process(ccp->cmd_q[i].kthread); - } - - spin_unlock_irqrestore(&ccp->cmd_lock, flags); - - return 0; + return ccp_dev_resume(ccp); } #endif @@ -258,7 +214,7 @@ MODULE_DEVICE_TABLE(acpi, ccp_acpi_match); #ifdef CONFIG_OF static const struct of_device_id ccp_of_match[] = { { .compatible = "amd,ccp-seattle-v1a", - .data = (const void *)&ccpv3 }, + .data = (const void *)&ccpv3_platform }, { }, }; MODULE_DEVICE_TABLE(of, ccp_of_match);