From patchwork Wed May 20 22:09:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 6450621 Return-Path: X-Original-To: patchwork-linux-acpi@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 DB6FDC0432 for ; Wed, 20 May 2015 22:10:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01AB4203B0 for ; Wed, 20 May 2015 22:10:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E0E4220450 for ; Wed, 20 May 2015 22:10:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754842AbbETWKK (ORCPT ); Wed, 20 May 2015 18:10:10 -0400 Received: from mail-bn1on0112.outbound.protection.outlook.com ([157.56.110.112]:46322 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753607AbbETWJe (ORCPT ); Wed, 20 May 2015 18:09:34 -0400 Received: from BLUPR02CA042.namprd02.prod.outlook.com (25.160.23.160) by BY2PR02MB250.namprd02.prod.outlook.com (10.242.232.13) with Microsoft SMTP Server (TLS) id 15.1.160.19; Wed, 20 May 2015 22:09:30 +0000 Received: from BL2FFO11FD006.protection.gbl (2a01:111:f400:7c09::124) by BLUPR02CA042.outlook.office365.com (2a01:111:e400:8ad::32) with Microsoft SMTP Server (TLS) id 15.1.166.22 via Frontend Transport; Wed, 20 May 2015 22:09:30 +0000 Authentication-Results: spf=temperror (sender IP is 165.204.84.221) smtp.mailfrom=amd.com; arm.com; dkim=none (message not signed) header.d=none; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of amd.com: DNS Timeout) Received: from atltwp01.amd.com (165.204.84.221) by BL2FFO11FD006.mail.protection.outlook.com (10.173.161.2) with Microsoft SMTP Server id 15.1.172.14 via Frontend Transport; Wed, 20 May 2015 22:09:27 +0000 X-WSS-ID: 0NOO5JQ-07-U3I-02 X-M-MSG: Received: from satlvexedge01.amd.com (satlvexedge01.amd.com [10.177.96.28]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by atltwp01.amd.com (Axway MailGate 5.3.1) with ESMTPS id 2A154CAE655; Wed, 20 May 2015 18:09:25 -0400 (EDT) Received: from SATLEXDAG06.amd.com (10.181.40.13) by satlvexedge01.amd.com (10.177.96.28) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 20 May 2015 17:09:37 -0500 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by satlexdag06.amd.com (10.181.40.13) with Microsoft SMTP Server id 14.3.195.1; Wed, 20 May 2015 18:09:24 -0400 From: Suravee Suthikulpanit To: , , , , , , , CC: , , , , , , , , , , , "Suravee Suthikulpanit" Subject: [V5 PATCH 4/5] crypto: ccp - Unify coherency checking logic with device_dma_is_coherent() Date: Wed, 20 May 2015 17:09:17 -0500 Message-ID: <1432159758-4486-5-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1432159758-4486-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1432159758-4486-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD006; 1:sMcVgPyhw3p8gUTD5bt5jV0xCu/klu+pEPZ6xiAMC4GYisqsQMYMfeWDv+UwmAait2fWikre4I4iQcLDxonBMs8b/kxRJoCF9+mInVhDRLsKdbvDNMvwfyNQ933fC0Lu5MdK/didpyCIGgytm3DTqp2TZmss7dxtprjrhkJ90sIDMCEyCmuEDJHCL5wh8LbSjk1ZVd/glOHeL88ftzSEOlPDdytgEpkI/tHSUox0zakQ/KZpujk1oex4iazm2suZzDso5SPWphjX4brFzBdHtO9KsuoPhKQ1pDS8nFBCs0/bSBFbUpPSjC31PqK9NhGs X-Forefront-Antispam-Report: CIP:165.204.84.221; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(199003)(189002)(77156002)(2201001)(50226001)(86362001)(97736004)(4001540100001)(101416001)(64706001)(50466002)(50986999)(48376002)(53416004)(46102003)(92566002)(77096005)(105586002)(68736005)(2950100001)(62966003)(76176999)(106466001)(189998001)(5001860100001)(5001830100001)(5001770100001)(5001920100001)(47776003)(19580395003)(19580405001)(36756003)(229853001)(87936001)(309714004); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR02MB250; H:atltwp01.amd.com; FPR:; SPF:TempError; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR02MB250; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BY2PR02MB250; BCL:0; PCL:0; RULEID:; SRVR:BY2PR02MB250; X-Forefront-PRVS: 0582641F53 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2015 22:09:27.8748 (UTC) X-MS-Exchange-CrossTenant-Id: fde4dada-be84-483f-92cc-e026cbee8e96 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fde4dada-be84-483f-92cc-e026cbee8e96; Ip=[165.204.84.221]; Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR02MB250 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Currently, the driver has separate logic to determine device coherency for DT vs ACPI. This patch simplifies the code with a call to device_dma_is_coherent(). Signed-off-by: Tom Lendacky Signed-off-by: Suravee Suthikulpanit --- drivers/crypto/ccp/ccp-platform.c | 60 +-------------------------------------- 1 file changed, 1 insertion(+), 59 deletions(-) diff --git a/drivers/crypto/ccp/ccp-platform.c b/drivers/crypto/ccp/ccp-platform.c index b1c20b2..e446781 100644 --- a/drivers/crypto/ccp/ccp-platform.c +++ b/drivers/crypto/ccp/ccp-platform.c @@ -90,58 +90,6 @@ static struct resource *ccp_find_mmio_area(struct ccp_device *ccp) return NULL; } -#ifdef CONFIG_ACPI -static int ccp_acpi_support(struct ccp_device *ccp) -{ - struct ccp_platform *ccp_platform = ccp->dev_specific; - struct acpi_device *adev = ACPI_COMPANION(ccp->dev); - acpi_handle handle; - acpi_status status; - unsigned long long data; - int cca; - - /* Retrieve the device cache coherency value */ - handle = adev->handle; - do { - status = acpi_evaluate_integer(handle, "_CCA", NULL, &data); - if (!ACPI_FAILURE(status)) { - cca = data; - break; - } - } while (!ACPI_FAILURE(status)); - - if (ACPI_FAILURE(status)) { - dev_err(ccp->dev, "error obtaining acpi coherency value\n"); - return -EINVAL; - } - - ccp_platform->coherent = !!cca; - - return 0; -} -#else /* CONFIG_ACPI */ -static int ccp_acpi_support(struct ccp_device *ccp) -{ - return -EINVAL; -} -#endif - -#ifdef CONFIG_OF -static int ccp_of_support(struct ccp_device *ccp) -{ - struct ccp_platform *ccp_platform = ccp->dev_specific; - - ccp_platform->coherent = of_dma_is_coherent(ccp->dev->of_node); - - return 0; -} -#else -static int ccp_of_support(struct ccp_device *ccp) -{ - return -EINVAL; -} -#endif - static int ccp_platform_probe(struct platform_device *pdev) { struct ccp_device *ccp; @@ -182,13 +130,7 @@ static int ccp_platform_probe(struct platform_device *pdev) goto e_err; } - if (ccp_platform->use_acpi) - ret = ccp_acpi_support(ccp); - else - ret = ccp_of_support(ccp); - if (ret) - goto e_err; - + ccp_platform->coherent = device_dma_is_coherent(ccp->dev); if (ccp_platform->coherent) ccp->axcache = CACHE_WB_NO_ALLOC; else