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  linux-cve-announce  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]
Message-ID: <20171129191138.ntlfw5fb4xacwyun@mwanda>
Date:   Wed, 29 Nov 2017 22:11:38 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Souptick Joarder <jrdr.linux@...il.com>
Cc:     David Daney <david.daney@...ium.com>,
        Mark Rutland <mark.rutland@....com>, linux-mips@...ux-mips.org,
        devel@...verdev.osuosl.org, devicetree@...r.kernel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        ralf@...ux-mips.org, Carlos Munoz <cmunoz@...ium.com>,
        Rob Herring <robh+dt@...nel.org>, Andrew Lunn <andrew@...n.ch>,
        "Steven J. Hill" <steven.hill@...ium.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Florian Fainelli <f.fainelli@...il.com>,
        James Hogan <james.hogan@...s.com>,
        "David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH v4 7/8] netdev: octeon-ethernet: Add Cavium Octeon III
 support.

On Wed, Nov 29, 2017 at 09:37:15PM +0530, Souptick Joarder wrote:
> >> +static int bgx_port_sgmii_set_link_speed(struct bgx_port_priv *priv, struct port_status status)
> >> +{
> >> +       u64     data;
> >> +       u64     prtx;
> >> +       u64     miscx;
> >> +       int     timeout;
> >> +
> 
> >> +
> >> +       switch (status.speed) {
> >> +       case 10:
> >
> > In my opinion, instead of hard coding the value, is it fine to use ENUM ?
>    Similar comments applicable in other places where hard coded values are used.
> 

10 means 10M right?  That's not really a magic number.  It's fine.

> >> +static int bgx_port_init_xaui_link(struct bgx_port_priv *priv)
> >> +{
> 
> >> +
> >> +               if (use_ber) {
> >> +                       timeout = 10000;
> >> +                       do {
> >> +                               data =
> >> +                               oct_csr_read(BGX_SPU_BR_STATUS1(priv->node, priv->bgx, priv->index));
> >> +                               if (data & BIT(0))
> >> +                                       break;
> >> +                               timeout--;
> >> +                               udelay(1);
> >> +                       } while (timeout);
> >
> > In my opinion, it's better to implement similar kind of loops inside macros.

I don't understand what you mean here.  For what it's worth this code
seems clear enough to me (except for the bad indenting of oct_csr_read().

It should be something like:
				data = oct_csr_read(BGX_SPU_BR_STATUS1(priv->node,
						priv->bgx, priv->index));

That's over the 80 char limit but so is the original code.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ