Re: [PATCH net-next v7 1/6] net: marvell: prestera: Add driver for Prestera family ASIC devices
From: Andy Shevchenko
Date: Mon Sep 07 2020 - 03:56:40 EST
On Mon, Sep 7, 2020 at 10:30 AM Vadym Kochan <vadym.kochan@xxxxxxxxxxx> wrote:
> On Fri, Sep 04, 2020 at 10:12:07PM +0300, Andy Shevchenko wrote:
> > On Fri, Sep 4, 2020 at 7:52 PM Vadym Kochan <vadym.kochan@xxxxxxxxxxx> wrote:
I'm assuming that you agree on all non-commented.
...
> > > +#define prestera_dev(sw) ((sw)->dev->dev)
> >
> > The point of this is...? (What I see it's 2 characters longer)
> >
> > ...
> It is not about the length but rather about easier semantics, so
> the prestera_dev() is more easier to remember than sw->dev->dev.
It actually makes it opposite, now I have to go somewhere in the file,
quite far from the place where it is used, and check what it is. Then
I return to the code I'm reading and after a few more lines of code I
will forget what that macro means.
...
> > > + /* firmware requires that port's mac address consist of the first
> > > + * 5 bytes of base mac address
> > > + */
> >
> >
> > > + memcpy(dev->dev_addr, sw->base_mac, dev->addr_len - 1);
> >
> > Can't you call above helper for that?
>
> Not sure if I got this right, but I assume that may be just use
> ether_addr_copy() and then just perform the below assignment on the
> last byte ?
No, I mean the function where you have the same comment and something
else. I'm wondering if you may call it from here. Or refactor code to
make it possible to call from here.
--
With Best Regards,
Andy Shevchenko