Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754375AbbETVd0 (ORCPT ); Wed, 20 May 2015 17:33:26 -0400 Received: from mail-bn1on0147.outbound.protection.outlook.com ([157.56.110.147]:31694 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754050AbbETVdQ (ORCPT ); Wed, 20 May 2015 17:33:16 -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: 0NOO3V6-07-RXN-02 X-M-MSG: Message-ID: <555CFD7D.5090208@amd.com> Date: Wed, 20 May 2015 16:32:45 -0500 From: Suravee Suthikulanit User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Will Deacon CC: "rjw@rjwysocki.net" , "lenb@kernel.org" , Catalin Marinas , "bhelgaas@google.com" , "thomas.lendacky@amd.com" , "herbert@gondor.apana.org.au" , "davem@davemloft.net" , "arnd@arndb.de" , "msalter@redhat.com" , "hanjun.guo@linaro.org" , "al.stone@linaro.org" , "grant.likely@linaro.org" , "leo.duran@amd.com" , "linux-arm-kernel@lists.infradead.org" , "linux-acpi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linaro-acpi@lists.linaro.org" , "netdev@vger.kernel.org" , "linux-crypto@vger.kernel.org" Subject: Re: [V4 PATCH 4/6] device property: Introduces device_dma_is_coherent() References: <1431724994-21601-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1431724994-21601-5-git-send-email-Suravee.Suthikulpanit@amd.com> <20150520102829.GB11498@arm.com> In-Reply-To: <20150520102829.GB11498@arm.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD038;1:YP7d2CNmq2NclyMwp2gWby4EyFKYdU7u70pmcOFp8h0zfRGo1fzV7U1v2kqv9S4jC0c5KRvqEyaFy9K7ClOFgwpWkTFud301RoYbqOYh78i7BRTiaJV4J+MfndbVwKfwAqSnlJV2S/wDJU6+UeoFQJWWdBplTIxMg5JvzmamYS7pCgPnyssM7RMy6yVsD3lSFlXAG9OodiJuSxasgj0cjm5n64Cm8xdkC1RYDYkGAaGhD8rguGJOPhoeOALBFeF2oJGTfNRRi4wgsar7Kk3m0w== X-Forefront-Antispam-Report: CIP:165.204.84.221;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(428002)(164054003)(24454002)(199003)(479174004)(51704005)(189002)(377454003)(76176999)(68736005)(4001350100001)(36756003)(65956001)(64706001)(575784001)(189998001)(47776003)(92566002)(64126003)(86362001)(97736004)(87936001)(2950100001)(4001540100001)(46102003)(5001830100001)(5001860100001)(110136002)(33656002)(77096005)(120886001)(87266999)(19580405001)(105586002)(80316001)(50466002)(62966003)(77156002)(19580395003)(59896002)(65816999)(106466001)(65806001)(50986999)(23746002)(101416001)(83506001)(54356999);DIR:OUT;SFP:1102;SCL:1;SRVR:BN1PR02MB248;H:atltwp01.amd.com;FPR:;SPF:None;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1PR02MB248;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1PR02MB149; 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:BN1PR02MB248;BCL:0;PCL:0;RULEID:;SRVR:BN1PR02MB248; X-Forefront-PRVS: 0582641F53 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2015 21:33:08.2957 (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: BN1PR02MB248 X-OriginatorOrg: amd.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1943 Lines: 57 On 5/20/2015 5:28 AM, Will Deacon wrote: > On Fri, May 15, 2015 at 10:23:12PM +0100, Suravee Suthikulpanit wrote: >> Currently, device drivers, which support both OF and ACPI, >> need to call two separate APIs, of_dma_is_coherent() and >> acpi_dma_is_coherent()) to determine device coherency attribute. >> >> This patch simplifies this process by introducing a new device >> property API, device_dma_is_coherent(), which calls the appropriate >> interface based on the booting architecture. >> >> Signed-off-by: Suravee Suthikulpanit >> CC: Rafael J. Wysocki >> --- >> drivers/base/property.c | 12 ++++++++++++ >> include/linux/property.h | 2 ++ >> 2 files changed, 14 insertions(+) >> >> diff --git a/drivers/base/property.c b/drivers/base/property.c >> index 1d0b116..8123c6e 100644 >> --- a/drivers/base/property.c >> +++ b/drivers/base/property.c >> @@ -14,6 +14,7 @@ >> #include >> #include >> #include >> +#include >> #include >> >> /** >> @@ -519,3 +520,14 @@ unsigned int device_get_child_node_count(struct device *dev) >> return count; >> } >> EXPORT_SYMBOL_GPL(device_get_child_node_count); >> + >> +bool device_dma_is_coherent(struct device *dev) >> +{ >> + if (IS_ENABLED(CONFIG_OF) && dev->of_node) >> + return of_dma_is_coherent(dev->of_node); >> + else if (has_acpi_companion(dev)) >> + return acpi_dma_is_coherent(acpi_node(dev->fwnode)); > > I don't think you need the has_acpi_companion check, as acpi_node handles > this and acpi_dma_is_coherent(NULL) returns false. > > Will > You are right. Thanks, Suravee -- 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/