Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752899AbbETMAy (ORCPT ); Wed, 20 May 2015 08:00:54 -0400 Received: from mail-by2on0117.outbound.protection.outlook.com ([207.46.100.117]:25186 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751184AbbETMAs (ORCPT ); Wed, 20 May 2015 08:00:48 -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; X-WSS-ID: 0NONDD2-08-2HN-02 X-M-MSG: Message-ID: <555C7759.3040304@amd.com> Date: Wed, 20 May 2015 07:00:25 -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: Catalin Marinas , Arnd Bergmann CC: , , , , , , Murali Karicheri , , , , , Rob Herring , , , "Rafael J. Wysocki" , , , , , David Woodhouse , Subject: Re: [V4 PATCH 3/6] pci: Generic function for setting up PCI device DMA coherency References: <1431724994-21601-1-git-send-email-Suravee.Suthikulpanit@amd.com> <3954735.qeaTp8qOcM@vostro.rjw.lan> <20150520092415.GA25313@e104818-lin.cambridge.arm.com> <2072233.lIH4idDurI@wuerfel> <20150520093401.GC25313@e104818-lin.cambridge.arm.com> In-Reply-To: <20150520093401.GC25313@e104818-lin.cambridge.arm.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD009;1:cgCqL0SZF3MACwgnX8NN8b936jdIu/luq0UAdmvfL7s8VL7nbaQcnIQvatu1jv3DkwDhSxY8AmKG97O8aI8oh5ApZQi31H6F7RtnQLtykNXOmrL2rzOa//T5wcWXaxiQRGyPDi4JuD+Wr0UnLOfGOMuvVk4H+L72SrpMdohESIdTGukP8k4y7ifOiJ+OxjcK36Apa5yGFSyqw4YnEnQPcx9/n3IceyejELNEqWlY3DBONMy+4VhILHXCH7qiYqjolTRpBucMk9Iv8I9Jfz7jLA== X-Forefront-Antispam-Report: CIP:165.204.84.222;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(428002)(377454003)(479174004)(189002)(199003)(51704005)(57704003)(24454002)(5001860100001)(5001770100001)(5001830100001)(76176999)(33656002)(64126003)(106466001)(189998001)(23746002)(59896002)(80316001)(36756003)(83506001)(47776003)(62966003)(101416001)(65816999)(50466002)(65806001)(64706001)(86362001)(65956001)(87936001)(4001540100001)(87266999)(97736004)(46102003)(77156002)(4001350100001)(50986999)(2950100001)(68736005)(54356999)(92566002)(105586002)(93886004)(120886001)(77096005)(5510600003)(41533002);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR02MB065;H:atltwp02.amd.com;FPR:;SPF:None;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB065; 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:BLUPR02MB065;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB065; X-Forefront-PRVS: 0582641F53 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2015 12:00:41.3213 (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.222];Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB065 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2112 Lines: 55 On 5/20/2015 4:34 AM, Catalin Marinas wrote: > On Wed, May 20, 2015 at 11:27:54AM +0200, Arnd Bergmann wrote: >> On Wednesday 20 May 2015 10:24:15 Catalin Marinas wrote: >>> On Sat, May 16, 2015 at 01:59:00AM +0200, Rafael J. Wysocki wrote: >>>> On Friday, May 15, 2015 04:23:11 PM Suravee Suthikulpanit wrote: >>>>> +/** >>>>> + * pci_dma_configure - Setup DMA configuration >>>>> + * @pci_dev: ptr to pci_dev struct of the PCI device >>>>> + * >>>>> + * Function to update PCI devices's DMA configuration using the same >>>>> + * info from the OF node or ACPI node of host bridge's parent (if any). >>>>> + */ >>>>> +static void pci_dma_configure(struct pci_dev *pci_dev) >>>>> +{ >>>>> + struct device *dev = &pci_dev->dev; >>>>> + struct device *bridge = pci_get_host_bridge_device(pci_dev); >>>>> + struct device *host = bridge->parent; >>>>> + struct acpi_device *adev; >>>>> + >>>>> + if (!host) >>>>> + return; >>>>> + >>>>> + if (acpi_disabled) { >>>>> + of_dma_configure(dev, host->of_node); >>>> >>>> I'd rather do >>>> >>>> if (IS_ENABLED(CONFIG_OF) && host->of_node) { >>>> of_dma_configure(dev, host->of_node); >>> >>> Nitpick: do we need the CONFIG_OF check? If disabled, I don't think >>> anyone would set host->of_node. >> >> If of_dma_configure() is defined in a file that is built conditionally >> based on CONFIG_OF, you need it. > > We have a dummy of_dma_configure() already when !CONFIG_OF, otherwise > we would need #ifndef here. I already replied, I think for other > architectures we need this check to avoid a useless host->of_node test. > It seems that there are several places that have similar check. Would it be good to convert this into a macro? Something like: #define OF_NODE_ENABLED(dev) (IS_ENABLED(CONFIG_OF) && dev->of_node) Thanks all for the review feedback. 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/