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]
Message-ID: <YuETUjgDzKjvM6lb@smile.fi.intel.com>
Date:   Wed, 27 Jul 2022 13:28:34 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Marcin Wojtas <mw@...ihalf.com>
Cc:     linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
        netdev@...r.kernel.org, rafael@...nel.org, sean.wang@...iatek.com,
        Landen.Chao@...iatek.com, linus.walleij@...aro.org, andrew@...n.ch,
        vivien.didelot@...il.com, f.fainelli@...il.com, olteanv@...il.com,
        davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, linux@...linux.org.uk, hkallweit1@...il.com,
        gjb@...ihalf.com, jaz@...ihalf.com, tn@...ihalf.com,
        Samer.El-Haj-Mahmoud@....com, upstream@...ihalf.com
Subject: Re: [net-next: PATCH v3 2/8] net: mdio: switch fixed-link PHYs API
 to fwnode_

On Wed, Jul 27, 2022 at 08:43:15AM +0200, Marcin Wojtas wrote:
> fixed-link PHYs API is used by DSA and a number of drivers
> and was depending on of_. Switch to fwnode_ so to make it
> hardware description agnostic and allow to be used in ACPI
> world as well.

...

> +	/* Old binding */
> +	len = fwnode_property_count_u32(fwnode, "fixed-link");
> +	if (len == 5)
> +		return true;
> +
> +	return false;

Can be

	return len == 5;

or

	return fwnode_...(...) == 5;

Original also good, so up to you,

...

> +		if (fwnode_property_read_u32(fixed_link_node, "speed",
> +					     &status.speed)) {
> +			fwnode_handle_put(fixed_link_node);
> +			return -EINVAL;
> +		}

Why shadowing actual error code?

Either

	ret = fwnode_...(...);
	if (ret) {
		...
		return ret;
	}

or add a comment explaining the above magic transformations.

...

> +	/* Old binding */
> +	if (fwnode_property_read_u32_array(fwnode, "fixed-link", fixed_link_prop,
> +					   ARRAY_SIZE(fixed_link_prop)) == 0) {
> +		status.link = 1;
> +		status.duplex = fixed_link_prop[1];
> +		status.speed  = fixed_link_prop[2];
> +		status.pause  = fixed_link_prop[3];
> +		status.asym_pause = fixed_link_prop[4];
> +		goto register_phy;
> +	}
> +
> +	return -ENODEV;

Ditto.

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ