lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 9 Sep 2020 17:17:11 +0300
From:   Vadym Kochan <vadym.kochan@...ision.eu>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Jiri Pirko <jiri@...lanox.com>,
        Ido Schimmel <idosch@...lanox.com>,
        Andrew Lunn <andrew@...n.ch>,
        Oleksandr Mazur <oleksandr.mazur@...ision.eu>,
        Serhiy Boiko <serhiy.boiko@...ision.eu>,
        Serhiy Pshyk <serhiy.pshyk@...ision.eu>,
        Volodymyr Mytnyk <volodymyr.mytnyk@...ision.eu>,
        Taras Chornyi <taras.chornyi@...ision.eu>,
        Andrii Savka <andrii.savka@...ision.eu>,
        netdev <netdev@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Mickey Rachamim <mickeyr@...vell.com>
Subject: Re: [PATCH net-next v7 1/6] net: marvell: prestera: Add driver for
 Prestera family ASIC devices

On Mon, Sep 07, 2020 at 10:55:49AM +0300, Andy Shevchenko wrote:
> On Mon, Sep 7, 2020 at 10:30 AM Vadym Kochan <vadym.kochan@...ision.eu> 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@...ision.eu> 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.
> 
> ...

Here are my points why I'd like to keep this macro:

1) It hides accessing of the 'struct device * dev' which may help in
   the future if the 'dev' will move to other place or if there will
   some additional logic to get this.
   
   This is the main point.

2) I think that even by reading sw->dev->dev the developer will jump to the
   place where it is defined.
   
   This is not strong point and really by seen just sw->dev->dev at
   it is more understandable to see where 'dev' sits.

3) From the code-writing perspective it was easier for developer
   prestera_dev() instead of sw->dev->dev.

   This is how I felt during the writing the code.

> 
> > > > +       /* 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

Powered by blists - more mailing lists