From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763221AbdJQQM3 (ORCPT ); Tue, 17 Oct 2017 12:12:29 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:43375 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753767AbdJQQM1 (ORCPT ); Tue, 17 Oct 2017 12:12:27 -0400 X-Google-Smtp-Source: AOwi7QA+ffPScFRF33HIcNEr5BWGf7XwKmdkx/SRpUjlix0E6YWQtUtuenhS2AP1mvHMz4Ixq2TW0g== Subject: Re: [PATCH 1/9] SOC: brcmstb: add memory API To: Christoph Hellwig , Jim Quinlan Cc: linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-mips@linux-mips.org, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, Florian Fainelli , Ralf Baechle , Catalin Marinas , Will Deacon , Bjorn Helgaas , Rob Herring , Mark Rutland , Gregory Fong , Kevin Cernekee , Brian Norris References: <1507761269-7017-1-git-send-email-jim2101024@gmail.com> <1507761269-7017-2-git-send-email-jim2101024@gmail.com> <20171017082413.GA10574@infradead.org> From: Florian Fainelli Message-ID: Date: Tue, 17 Oct 2017 09:12:22 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20171017082413.GA10574@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/17/2017 01:24 AM, Christoph Hellwig wrote: >> +/* Macros to help extract property data */ >> +#define U8TOU32(b, offs) \ >> + ((((u32)b[0 + offs] << 0) & 0x000000ff) | \ >> + (((u32)b[1 + offs] << 8) & 0x0000ff00) | \ >> + (((u32)b[2 + offs] << 16) & 0x00ff0000) | \ >> + (((u32)b[3 + offs] << 24) & 0xff000000)) > > Please us helpers like get_unaligned_le32 instead opencoding them. > >> +#define DT_PROP_DATA_TO_U32(b, offs) (fdt32_to_cpu(U8TOU32(b, offs))) > > And together with this it looks really whacky. So you're converting > from le to native first and then do another conversion from be to cpu? > > Something doesn't work out here. > >> +/* -------------------- Functions -------------------- */ > > Please remove pointless comments like this one. > >> + >> +/* >> + * If the DT nodes are handy, determine which MEMC holds the specified >> + * physical address. >> + */ >> +#ifdef CONFIG_ARCH_BRCMSTB >> +int __brcmstb_memory_phys_addr_to_memc(phys_addr_t pa, void __iomem *base) > > Please move this into the arm arch code. No, this needs to work on both ARM and ARM64, hence the reason why this is in a reasonably architecture neutral place. > >> +#elif defined(CONFIG_MIPS) > > And this into the mips arch code. Same reason as above. > >> +EXPORT_SYMBOL(brcmstb_memory_phys_addr_to_memc); > >> +EXPORT_SYMBOL(brcmstb_memory_memc_size); > > Why is this exported? Because the PCIE RC driver can be built as a module. -- Florian