From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752717AbbJTMxd (ORCPT ); Tue, 20 Oct 2015 08:53:33 -0400 Received: from mail-bn1bon0062.outbound.protection.outlook.com ([157.56.111.62]:61792 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752407AbbJTMx3 (ORCPT ); Tue, 20 Oct 2015 08:53:29 -0400 Authentication-Results: spf=none (sender IP is 165.204.84.222) smtp.mailfrom=amd.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=permerror action=none header.from=amd.com; X-WSS-ID: 0NWIRSZ-08-HPF-02 X-M-MSG: Subject: Re: [PATCH V3 2/4] ACPI/scan: Clean up acpi_check_dma To: Bjorn Helgaas References: <1440597279-11802-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1440597279-11802-3-git-send-email-Suravee.Suthikulpanit@amd.com> <20150914163411.GL829@google.com> <561D28B5.7030303@amd.com> <561D9978.9090406@amd.com> <20151020021735.GA20869@localhost> CC: Bjorn Helgaas , , , , , , , , , , Rob Herring , Jeremy Linton , Tom Lendacky From: Suravee Suthikulpanit Message-ID: <56263947.2090805@amd.com> Date: Tue, 20 Oct 2015 07:53:27 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151020021735.GA20869@localhost> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.180.168.240] X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.222;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(428002)(24454002)(377454003)(479174004)(164054003)(199003)(189002)(64706001)(92566002)(117636001)(23746002)(5004730100002)(105586002)(101416001)(19580405001)(86362001)(50466002)(19580395003)(99136001)(87266999)(54356999)(106466001)(5008740100001)(50986999)(64126003)(46102003)(65816999)(76176999)(5007970100001)(59896002)(65956001)(110136002)(97736004)(5001920100001)(47776003)(11100500001)(189998001)(65806001)(15975445007)(4001350100001)(2950100001)(87936001)(77096005)(36756003)(53416004)(93886004)(83506001)(5003600100002)(62816006);DIR:OUT;SFP:1101;SCL:1;SRVR:DM3PR12MB0859;H:atltwp02.amd.com;FPR:;SPF:None;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;DM3PR12MB0859;2:AlxbK6b4SKxjQVihm+IH/ujbfzzH+fjIGWukciJeeWwcIPHlKKM0H0tJDYedWvBbxh86RVgF0ibHZW2npPlYW59s8CC+opxX7njfUH4QX2R3K4SYyjaXNazlT5pL5MFlsvJE4Y1sj8wzTC8bbyWJjEOTBA4FCc7T2hXin6bN7VM=;3:m+6cR9xjrcKt+E4fr3M9VIeKGpLmucGknZxlkCOQwOmQWO56LGmGmhSuArPvHCzd+TaYWF5p38g+iIkzBfidltZAVyAI/RU9Okz7mXkCk7xnjnSFFYnTkZOsaR399FEhTU7p/iRk67RMJonsKkQn53JJ4kJDjJUKeElNULPSsD979C8dWcXObnW+wEgrGI8lo0yUQXwV0TWnbnbp6BiSDV74MP5h0ocMS16LWCE8TSZKNnZmPJQ3zDtfEEDX41cG1nYUq4Xt46GiTj7rfpqJUA==;25:wmigUZg5YNuwee4TIdNRqYEk2eydupBIYXa+RJxEe/dSvM9JyQ9eXMlm7oolHg/+7SMuxiPZLacC4jN+E5TyZwLNgE/Hes12Up3IoaUEL4kKMGyKWQVy0jqqbAqLePlEMLNWz6TQoqi2ZkRrQ+TCN1QzCMq+2HcncbaX+PLw/ewdRcj/EVMbEl8WLXNlWtI4jpkMtm4f1bH6C7qdyutmeUx6EM4ynOUkyEmnYlUo0cNS2V2GY5s4YzT4TbTTCXmUTN7tjkV40lndFX9I0Vo1QA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(42134001)(42139001);SRVR:DM3PR12MB0859; X-Microsoft-Exchange-Diagnostics: 1;DM3PR12MB0859;20:C94YVC1Lmfcg/ZYJNdiJCunnK+36k/AjehgfHO9zcsnsht5bUGj8qtxgtw0xTkIAT5oyyoA6+hR58fMVRuKqOgFIidmpTfhkDdEcXQolNlradLrtq/1Tq12VkxXX2ZgYBliIzlt8pK4rzxnV8ZdymVebNIkXdpEYp95e3V0Uo4MEOSShYeoU9JCdq0f7WhfmM6aVsMBnNhan5uFRpUxJrbCL5ulYqDfSqO9FwD/OTcFxty0TcivuGUj+xeJnxFj7j9pfr4CJMI5krlaodKi9fzIYTGcWHBGFO62w84rZ3GkJN8+K1S6wME+WsE18weyl15EBWNgWK8ObDtHLQIhYu/ZXzrDuvnlUXtrKPDUCnSC4H6lO9y9Lpn76dR61/T8x4TGUPlcOcPwwQ8EpgnZHleSddlWSatLPQd3F5Hu15BYcH+i5p7HHhpVDYq9bT6HkUA3o4xarjAI8ufGo28V2NKhKPJ5vIvYkLof05LqvJ/GJCbcbbsv1m6vLI4UANULr;4:Edvmp7c++tNAtxVekbeNUDyB8+kIkkRNjsIpCA0goANjZh3y416hcTZ+M5y4d2vD3K04QYaWya0YMqWh6CROrucL2pHkA/lZXc1AphrF41tU2yAEFHiaaLnYHfCOgzOuYLdmWbo28KqRE5zrb7HTiwF4bldI4PnyLhPDClWcAwZeITiiBBmKf1+hakBCIKyTOS/jYptC/up9eL4bsND4NmSnBngfAjBeEYNjmHJ7Y28ORziOL5sIGoSk0zhJ76xlwngeSuPs7ckrtCexV1nQEDFRRF+VuYE+h3Ypkch/t5XkZG4jEtVxop0Lj+Mihz9ym4Tn3+1dfTOG9G6J+k9IQtfpDKLtXjlgpn9Tmt7euFM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001);SRVR:DM3PR12MB0859;BCL:0;PCL:0;RULEID:;SRVR:DM3PR12MB0859; X-Forefront-PRVS: 073515755F X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DM3PR12MB0859;23:Zr2q74G2p6AhDCv7fkUQ8rX6U79pdhaOuIXCa?= =?Windows-1252?Q?kip7SNHuvmQWi3uE7uPKlilhPXmWqXBg5jrliI++NxoQBPdxbHQ2M1LJ?= =?Windows-1252?Q?bzyr1Kj+N2VaF48WRy+sBaBO00Ob+7lkvaPzwJkICCQZDBzHPQGjgIaX?= =?Windows-1252?Q?qwgtGcjg/i86ei3uyZw6Io9+eh7kNVp+HtpbP85U542CFzplY4W63+s/?= =?Windows-1252?Q?v1gw61DXs2vdXyc2TgyOrj5uWK9gyuSL4tRkKxdqj+t24z/RsKj1e59O?= =?Windows-1252?Q?IUGMzHSdIu09B4dvhLg5U7PvKYQNZLOUjqYb5E3t75FVCZ+yGHYmfopl?= =?Windows-1252?Q?xMZX4Kyc3Te8nAUVuSWMbP1dbFW0iD68A4prtynO6wrtRhHmMKQIBIgw?= =?Windows-1252?Q?D54eW0RyoUK+zlg2WA7tyw3kaxk4VRiTNc5RLq5Q6M2EE/pWRCVfkwn8?= =?Windows-1252?Q?cvhdtK+cA4df6Sl34Bw2+suv+2G+1UYUzjFI1PHblFDVLNdywfcUBNEa?= =?Windows-1252?Q?JESMXVybRIqQGSyjNyMOCy2249GvxpRyAEa1UgPPs5EgpLitmfpfHbks?= =?Windows-1252?Q?jMhBvrnQMchpG3pBkhBC2JyMrI//Ula3Q3qhs4pBJZhW/cgeJSE1RIun?= =?Windows-1252?Q?znNPuG4mEOmdeYOJWtBPYTQhWRkyYZ7m4fvLehl/4yq8jsYJ+dVftfNA?= =?Windows-1252?Q?jeCRcj+fdxioFTdU7HL8vPV6FolJVmuP5cxna6lBzzndT3LwWZL00oED?= =?Windows-1252?Q?tLRyFmPEw65YoTQtYVUKIHgU+hA5SATQfeobE399DPNnAVUW+X3LY5I0?= =?Windows-1252?Q?nFL3mgFAC8foRxYtlHNBdNAY6VmkoG9LnSkUc92E5J+Q9HFaRZiVWA+S?= =?Windows-1252?Q?1ZaCPOSvtnVopXz5u5/kZfMxi8HM6ZVRCYMjgaCkSZPWu3g4sTaQQXuZ?= =?Windows-1252?Q?VpgCh9B+QJPvHaXoOY+BHmfRh5Pb9mwIHpBXtssVe+nuWUCIzWIxcSvQ?= =?Windows-1252?Q?AASBLhUJG91oHJzAwL2kD7myPE8vfbbnKXjvkb2X1GzkKRguQKo84WAv?= =?Windows-1252?Q?wyg3VEOG1nSfotBVP5AikEz2W5EvpwcSvhdqZDtUMNq0+mDLcvBEbxYZ?= =?Windows-1252?Q?YVVnmqhMmXly/WbFZeJLqs4dIB5SXdktNc899eWwT/mQ580EtEK55Oq1?= =?Windows-1252?Q?OqsAxcZtEwkbJ4n8uT3g1GOwpJd3mEG+cbBRyfBW9LMw4xAoRfIoQlI3?= =?Windows-1252?Q?LST/ziiitfDNVs5HoWcI1rUYIfglGA2NtPi2CVOVxEZ/6KGTthKwlYRC?= =?Windows-1252?Q?KhGJYGeFeDRoYb3DvMrKbCTP+K6aWDGHHeMCf1wuuj59No85dgzDcznH?= =?Windows-1252?Q?tSEmjHHMPDl3LKsaOvydegA9ByKplgBctJ86QIywsSXSh+TDk7eKxGuL?= =?Windows-1252?Q?hS8T5Qz2gCdHwuhSLOlpRn5+x4MZEn3DHbBltvpPw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;DM3PR12MB0859;5:ST6qv1mN5RinsrqIonuspconAla7GJ6XRc9WTazjrBra0s072dy14kqha+FJqAzftnpMG8A+y5Swdeetolwzr9ZHuLVsUOPDxFq2PYg9gQkRJULcawdW5V7D7TE/K6XXS+0n9sZCnix9s9mS1TFXxg==;24:/cop59uQAhkujch65HxexQCPNHi9F5TpjjyGuHYUaeVV83BsXDvDctwq06vzmwZKbKl6XAD5BEl+RroU72CzjekeL9a86p9OrzN7hj/dUJU=;20:vdTbUDqtp2kCfrvZqxjZ7SfygDkFuMdm8PtvWPnSD92ZtxzWkXoDOXZzkFN0Oq6YmFB8KHkk4QPFG6gVErrcgxN9r+Ikr91z5M7JzxV/TIw7f2QJ8lZV0asMC4BmupwyCtNuIuApgKi4Y0P+5kg3/a+fJePmyxJLRNyGaJoizQCycFhBKAti6V7hUAajM/TZoaJ/STLK7KdVmxyyV7fpm19CDFORoqlug/lXP2SDtg8AJcusQ+S3Rrnt9HVlQUSf SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2015 12:53:25.2659 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.222];Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB0859 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bjorn/Rafael, Let me redo the patch with enum then. At least, that's more clear to everyone. Thanks, Suravee On 10/19/15 21:17, Bjorn Helgaas wrote: > On Tue, Oct 13, 2015 at 06:53:28PM -0500, Suravee Suthikulanit wrote: >> Bjorn / Rafael, >> >> On 10/13/2015 10:52 AM, Suravee Suthikulpanit wrote: >>> >>> On 09/14/2015 09:34 AM, Bjorn Helgaas wrote: >>>> [..] >>>> I think acpi_check_dma_coherency() is better, but only slightly. It >>>> still doesn't give a hint about the *sense* of the return value. I >>>> think it'd be easier to read if there were two functions, e.g., >>> >>> I have been going back-and-forth between the current version, and the >>> two-function-approach in the past. I can definitely go with this route >>> if you would prefer. Although, if acpi_dma_is_coherent() == 0, it would >>> be ambiguous whether DMA is not supported or non-coherent DMA is >>> supported. Then, we would need to call acpi_dma_is_supported() to find >>> out. So, that's okay with you? >> >> Thinking about this again, I still think having one API (which can >> tell whether DMA is supported or not, and if so whether it is >> coherent or non-coherent) would be the least confusing and least >> error prone. >> >> What if we would just have: >> >> enum dev_dma_type acpi_get_dev_dma_type(struct acpi_device *adev); >> >> where: >> enum dev_dma_type { >> DEV_DMA_NOT_SUPPORTED, >> DEV_DMA_NON_COHERENT, >> DEV_DMA_COHERENT, >> }; >> >> This would probably mean that we should modify >> drivers/base/property.c to replace: >> bool device_dma_is_coherent() >> to: >> enum dev_dma_type device_get_dma_type() >> >> We used to discuss the enum approach in the past >> (https://lkml.org/lkml/2015/8/25/868). But we only considered at the >> ACPI level at the time. Actually, this should also reflect in the >> property.c. >> >> At this point, only drivers/crypto/ccp/ccp-platform.c and >> drivers/net/ethernet/amd/xgbe/xgbe-main.c are calling the >> device_dma_is_coherent(). So, it should be easy to change this API. > > OK, I'm fine with either the enum or Rafael's 0/1/-ENOTSUPP idea. > > Bjorn > -- > To unsubscribe from this list: send the line "unsubscribe linux-acpi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >