From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942334AbdEYNUZ (ORCPT ); Thu, 25 May 2017 09:20:25 -0400 Received: from foss.arm.com ([217.140.101.70]:50040 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933110AbdEYNUV (ORCPT ); Thu, 25 May 2017 09:20:21 -0400 Subject: Re: [PATCH v4 2/2] PCI: Add tango PCIe host bridge support To: Mason References: <4a354b33-d59c-4ebb-4b31-0388ac8090d4@sigmadesigns.com> <62bb805a-abd6-9aca-3641-8037f42a3b95@arm.com> <57673076-4fbd-92ab-453c-3d77fd65407f@free.fr> <1b0ec9c9-1036-619e-19c7-16818ca728e3@arm.com> Cc: Marc Gonzalez , Bjorn Helgaas , linux-pci , Thomas Gleixner , Robin Murphy , Lorenzo Pieralisi , Liviu Dudau , David Laight , Linux ARM , Thibaud Cornic , Phuong Nguyen , LKML From: Marc Zyngier Organization: ARM Ltd Message-ID: <276e40e8-6539-2765-7ce7-9a942b56d54d@arm.com> Date: Thu, 25 May 2017 14:20:16 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/05/17 13:41, Mason wrote: > On 25/05/2017 14:23, Marc Zyngier wrote: >> On 25/05/17 13:00, Mason wrote: >>> On 25/05/2017 10:48, Marc Zyngier wrote: >>>> Please have some defines for these magic values. >>> >>> Typical driver do >>> #define MUX_OFFSET 0x48 >>> and then access the register's value through >>> readl_relaxed(pcie->base + MUX_OFFSET); >>> >>> I can't do that because the registers were shuffled around >>> between revision 1 and revision 2. Thus, instead of an >>> explicitly-named macro (MUX_OFFSET), I used an explicitly- >>> named field (pcie->mux) and access the register's value >>> through readl_relaxed(pcie->mux); >> >> That doesn't prevent you from having a TANGO_V1_MUX_OFFSET define, which >> you can supplement with a V2 at some point. >> >>> This is equivalent to providing the offset definitions in the >>> init functions, instead of at the top of the file. >> >> Sorry, my brain parses text far better than hex number. > > Well, the hex numbers do need to show up somewhere :-) > > IIUC, you're saying that > #define MUX_OFFSET 0x48 > is clearer than > pcie->mux = base + 0x48; yes. > > OK, I can accept that. Maybe our brains have been trained > to easily recognize and ingest the macro, or maybe it's > the caps, or maybe the fact that the statement does > several things (addition and assignment and hex). > > Out of curiosity, how would you feel about > pcie->MUX_OFFSET = 0x48; > and then using > readl_relaxed(pcie->base + pcie->MUX_OFFSET); > > It feels weird to me, I think mostly because it is > an unusual pattern. Exactly. Use existing practices help the reviewers quite a lot. > > Anyway, I'll add the macros, if that improves review and > maintenance. Thanks, M. -- Jazz is not dead. It just smells funny...