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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 13 Feb 2019 02:53:58 +0000
From:   <Tristram.Ha@...rochip.com>
To:     <andrew@...n.ch>
CC:     <sergio.paracuellos@...il.com>, <f.fainelli@...il.com>,
        <pavel@....cz>, <UNGLinuxDriver@...rochip.com>,
        <netdev@...r.kernel.org>
Subject: RE: [PATCH v1 net-next 3/4] net: dsa: microchip: use readx_poll_time
 for polling

> > -static int ksz9477_wait_vlan_ctrl_ready(struct ksz_device *dev, u32
> waiton,
> > -					int timeout)
> > -{
> > -	u8 data;
> > -
> > -	do {
> > -		ksz_read8(dev, REG_SW_VLAN_CTRL, &data);
> > -		if (!(data & waiton))
> > -			break;
> > -		usleep_range(1, 10);
> > -	} while (timeout-- > 0);
> > -
> > -	if (timeout <= 0)
> > -		return -ETIMEDOUT;
> > -
> > -	return 0;
> 
> Hi Tristram
> 
> I think it would be better to keep ksz9477_wait_vlan_ctrl_ready(),
> ksz9477_wait_alu_ready() etc, and change there implementation to use
> readx_poll_timeout(). The function names act as better documentation
> for what we are waiting for than the parameters being passed to
> readx_poll_timeout().

The macro readx_poll_timeout() was suggested when the MIB counter read timeout code was implemented.  It is a little awkward to use with ksz_read as the macro was designed to use with readb, readw, and readl call.

Maybe the whole macro can be copied and modified to accommodate ksz_read?

In the spirit of always updating the driver with better code the ksz9477_wait_ functions are also replaced to use readx_poll_timeout().  If the function code is just replaced with a macro inside there is not much point to declare the code as a function.

I think I just leave the old code as is.

Powered by blists - more mailing lists