Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946394AbbEOV1e (ORCPT ); Fri, 15 May 2015 17:27:34 -0400 Received: from mail-by2on0126.outbound.protection.outlook.com ([207.46.100.126]:44640 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1946153AbbEOVYA (ORCPT ); Fri, 15 May 2015 17:24:00 -0400 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=amd.com; arm.com; dkim=none (message not signed) header.d=none; X-WSS-ID: 0NOEU3T-07-0N4-02 X-M-MSG: From: Suravee Suthikulpanit To: , , , , , , , , CC: , , , , , , , , , , , "Suravee Suthikulpanit" Subject: [V4 PATCH 5/6] crypto: ccp - Unify coherency checking logic with device_dma_is_coherent() Date: Fri, 15 May 2015 16:23:13 -0500 Message-ID: <1431724994-21601-6-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1431724994-21601-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1431724994-21601-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD007;1:jw9Y6dukMFIHGViNZ8uMGA2pFzSEEXKEhAFXEnR9F0wvzwC2TXUG3gQCDxIfRlc5+9WYBumihBLjBnbi9FlPesH5BE76B+Eq3LR4UHzmM0caemNmdWslOBD3/pPB6dwWTEbxzc1Q+47ZKlKUKtZDQ8w6YNDQWJCZIgJ1CG0lsPxgCf+XpxM142hkfc3s475ZayeA9XZxPBvci+7pjmlR879n52/QvV9FdVwXJlffqN1ZZo1jz+aDyVCCcynNG+reSDH/XIRvkhY0pei3ehpOyPD9iubE0VE8iWdU820ULyyStf9VWMDKXfrBR4cC/7dy X-Forefront-Antispam-Report: CIP:165.204.84.221;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(428002)(189002)(199003)(2201001)(86362001)(106466001)(53416004)(50466002)(87936001)(46102003)(229853001)(48376002)(101416001)(189998001)(19580405001)(77096005)(5001770100001)(47776003)(2950100001)(19580395003)(50226001)(36756003)(105586002)(92566002)(77156002)(62966003)(76176999)(50986999);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR02MB067;H:atltwp01.amd.com;FPR:;SPF:None;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB067;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB196; 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:BLUPR02MB067;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB067; X-Forefront-PRVS: 0577AD41D6 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2015 21:23:54.3751 (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: BLUPR02MB067 X-OriginatorOrg: amd.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2579 Lines: 97 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 CC: Herbert Xu --- 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 -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/