Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1650503
| From | Marc Zyngier <marc.zyngier@arm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 2/2] PCI: Add tango PCIe host bridge support |
| Date | 2017-05-25 15:30 +0200 |
| Message-ID | <tL0ZY-iP-17@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <tylpw-1FW-23@gated-at.bofh.it> <tKWCZ-5Vo-11@gated-at.bofh.it> <tKZKy-81K-31@gated-at.bofh.it> <tL03U-89G-7@gated-at.bofh.it> <tL0nf-8hT-3@gated-at.bofh.it> |
| Organization | ARM Ltd |
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...
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH v4 2/2] PCI: Add tango PCIe host bridge support Marc Zyngier <marc.zyngier@arm.com> - 2017-05-25 10:50 +0200
Re: [PATCH v4 2/2] PCI: Add tango PCIe host bridge support Mason <slash.tmp@free.fr> - 2017-05-25 14:10 +0200
Re: [PATCH v4 2/2] PCI: Add tango PCIe host bridge support Marc Zyngier <marc.zyngier@arm.com> - 2017-05-25 14:30 +0200
Re: [PATCH v4 2/2] PCI: Add tango PCIe host bridge support Mason <slash.tmp@free.fr> - 2017-05-25 14:50 +0200
Re: [PATCH v4 2/2] PCI: Add tango PCIe host bridge support Marc Zyngier <marc.zyngier@arm.com> - 2017-05-25 15:30 +0200
csiph-web