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:   Thu, 11 Aug 2022 02:30:28 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Ravi Gunasekaran <r-gunasekaran@...com>
Cc:     davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, linux-omap@...r.kernel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, kishon@...com,
        vigneshr@...com
Subject: Re: [PATCH v2 net-next] net: ethernet: ti: davinci_mdio: Add
 workaround for errata i2329

> +static int davinci_mdiobb_read(struct mii_bus *bus, int phy, int reg)
> +{
> +	int ret;
> +	struct mdiobb_ctrl *ctrl = bus->priv;
> +	struct davinci_mdio_data *data;
> +
> +	data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl);
> +
> +	if (phy & ~PHY_REG_MASK || reg & ~PHY_ID_MASK)
> +		return -EINVAL;

You don't need this. Leave it up to the bit banging code to do the
validation. This also breaks C45, which the bit banging code can do,
and it looks like the hardware cannot.

> +
> +	ret = pm_runtime_resume_and_get(data->dev);
> +	if (ret < 0)
> +		return ret;
> +
> +	ret = mdiobb_read(bus, phy, reg);
> +
> +	pm_runtime_mark_last_busy(data->dev);
> +	pm_runtime_put_autosuspend(data->dev);

Once you take the validation out, this function then all becomes about
runtime power management. Should the bit banging core actually be
doing this? It seems like it is something which could be useful for
other devices.

struct mii_bus has a parent member. If set, you could apply these run
time PM functions to that. Please add a patch to modify the core bit
banging code, and then you should be able to remove these helpers.

>  static int davinci_mdio_probe(struct platform_device *pdev)
>  {
>  	struct mdio_platform_data *pdata = dev_get_platdata(&pdev->dev);
> @@ -340,12 +535,30 @@ static int davinci_mdio_probe(struct platform_device *pdev)
>  	struct phy_device *phy;
>  	int ret, addr;
>  	int autosuspend_delay_ms = -1;
> +	const struct soc_device_attribute *soc_match_data;

netdev uses reverse christmas tree. Variables should be sorted longest
first, shortest last.

       Andrew

Powered by blists - more mailing lists