Subject: Re: [PATCH net-next 3/6] net: enetc: add definition for offset between eMAC and pMAC regs

From: Simon Horman <[email-masked]>
Date: Mon, 23 Jan 2023 13:44:07 +0100

On Mon, Jan 23, 2023 at 01:24:11PM +0200, Vladimir Oltean wrote:
> On Sun, Jan 22, 2023 at 05:29:33PM +0100, Simon Horman wrote:
> > > +#define ENETC_PMAC_OFFSET	0x1000
> > > +
> > >  #define ENETC_PM0_CMD_CFG	0x8008
> > >  #define ENETC_PM1_CMD_CFG	0x9008
> > >  #define ENETC_PM0_TX_EN		BIT(0)
> > > @@ -280,57 +282,57 @@ enum enetc_bdr_type {TX, RX};
> > >  /* Port MAC counters: Port MAC 0 corresponds to the eMAC and
> > >   * Port MAC 1 to the pMAC.
> > >   */
> > > -#define ENETC_PM_REOCT(mac)	(0x8100 + 0x1000 * (mac))
> > > -#define ENETC_PM_RALN(mac)	(0x8110 + 0x1000 * (mac))
> > 
> > ...
> > 
> > > +#define ENETC_PM_REOCT(mac)	(0x8100 + ENETC_PMAC_OFFSET * (mac))
> > > +#define ENETC_PM_RALN(mac)	(0x8110 + ENETC_PMAC_OFFSET * (mac))
> > 
> > I'm not sure if it is an improvement, but did you consider something
> > like this? *completely untested*
> > 
> > #define ENETC_PM(mac, reg)	((reg) + ENETC_PMAC_OFFSET * (mac))
> > #define ENETC_PM_REOCT(mac)	ENETC_PM(mac, 0x8100)
> > #define ENETC_PM_RALN(mac)	ENETC_PM(mac, 0x8110)
> 
> Hmm, I appreciate you looking at the patch, but in the end, I just
> consider your proposed alternative to be a variation on the same theme,
> and not necessarily a better way of expressing the definitions.
> This means I wouldn't consider resending the patch set just to make this
> change.

Thanks for considering my idea. I've no objections to you not acting on it.