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]
Date:   Wed, 27 Jul 2022 16:37:18 +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 8/8] net: dsa: mv88e6xxx: switch to
 device_/fwnode_ APIs

On Wed, Jul 27, 2022 at 08:43:21AM +0200, Marcin Wojtas wrote:
> In order to support both DT and ACPI in future, modify the
> mv88e6xx driver  code to use device_/fwnode_ equivalent routines.
> No functional change is introduced by this patch.

...

>  static int mv88e6xxx_probe(struct mdio_device *mdiodev)
>  {
>  	struct dsa_mv88e6xxx_pdata *pdata = mdiodev->dev.platform_data;

> +	struct fwnode_handle *fwnode = dev_fwnode(&mdiodev->dev);

Move this...

>  	const struct mv88e6xxx_info *compat_info = NULL;
>  	struct device *dev = &mdiodev->dev;
> -	struct device_node *np = dev->of_node;

...here as

	struct fwnode_handle *fwnode = dev_fwnode(dev);

>  	struct mv88e6xxx_chip *chip;
>  	int port;
>  	int err;

> +	if (fwnode)

Redundant check.

> +		compat_info = device_get_match_data(dev);
> +	else if (pdata) {
>  		compat_info = pdata_device_get_match_data(dev);

	compat_info - device_get_match_data(dev);
	if (!compat_info && pdata)
		compat_info = pdata_device_get_match_data(dev);

...

> +		if (fwnode)
> +			device_property_read_u32(dev, "eeprom-length",
> +						 &chip->eeprom_len);
>  		else
>  			chip->eeprom_len = pdata->eeprom_len;

Can be done w/o conditional

		chip->eeprom_len = pdata->eeprom_len;
		device_property_read_u32(dev, "eeprom-length", &chip->eeprom_len);

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ