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: <55E89E27.6050708@gmail.com>
Date:	Thu, 03 Sep 2015 12:23:19 -0700
From:	Florian Fainelli <f.fainelli@...il.com>
To:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
	Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
	"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
	devicetree@...r.kernel.org
CC:	Tawfik Bayouk <tawfik@...vell.com>,
	Nadav Haklai <nadavh@...vell.com>,
	Lior Amsalem <alior@...vell.com>,
	Gregory Clement <gregory.clement@...e-electrons.com>,
	Ezequiel Garcia <ezequiel.garcia@...e-electrons.com>,
	linux-arm-kernel@...ts.infradead.org,
	Grant Likely <grant.likely@...retlab.ca>,
	Rob Herring <robh+dt@...nel.org>,
	Mark Rutland <mark.rutland@....com>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	Christian Gmeiner <christian.gmeiner@...il.com>
Subject: Re: [PATCHv4 2/5] net: phy: extend fixed driver with fixed_phy_register()

On 03/09/15 12:20, Sergei Shtylyov wrote:
> Hello.
> 
> On 05/16/2014 06:14 PM, Thomas Petazzoni wrote:
> 
>> The existing fixed_phy_add() function has several drawbacks that
>> prevents it from being used as is for OF-based declaration of fixed
>> PHYs:
>>
>>   * The address of the PHY on the fake bus needs to be passed, while a
>>     dynamic allocation is desired.
>>
>>   * Since the phy_device instantiation is post-poned until the next
>>     mdiobus scan, there is no way to associate the fixed PHY with its
>>     OF node, which later prevents of_phy_connect() from finding this
>>     fixed PHY from a given OF node.
>>
>> To solve this, this commit introduces fixed_phy_register(), which will
>> allocate an available PHY address, add the PHY using fixed_phy_add()
>> and instantiate the phy_device structure associated with the provided
>> OF node.
>>
>> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>
>> Acked-by: Florian Fainelli <f.fainelli@...il.com>
>> Acked-by: Grant Likely <grant.likely@...aro.org>
>> ---
>>   drivers/net/phy/fixed.c   | 61
>> +++++++++++++++++++++++++++++++++++++++++++++++
>>   include/linux/phy_fixed.h | 11 +++++++++
>>   2 files changed, 72 insertions(+)
>>
>> diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c
>> index e41546d..d60d875 100644
>> --- a/drivers/net/phy/fixed.c
>> +++ b/drivers/net/phy/fixed.c
> [...]
>> @@ -203,6 +204,66 @@ err_regs:
> [...]
>> +int fixed_phy_register(unsigned int irq,
>> +               struct fixed_phy_status *status,
>> +               struct device_node *np)
>> +{
>> +    struct fixed_mdio_bus *fmb = &platform_fmb;
>> +    struct phy_device *phy;
>> +    int phy_addr;
>> +    int ret;
>> +
>> +    /* Get the next available PHY address, up to PHY_MAX_ADDR */
>> +    spin_lock(&phy_fixed_addr_lock);
>> +    if (phy_fixed_addr == PHY_MAX_ADDR) {
>> +        spin_unlock(&phy_fixed_addr_lock);
>> +        return -ENOSPC;
>> +    }
>> +    phy_addr = phy_fixed_addr++;
>> +    spin_unlock(&phy_fixed_addr_lock);
>> +
>> +    ret = fixed_phy_add(PHY_POLL, phy_addr, status);
> 
>    Was rummaging in the fixed_phy driver and a bug sprang right at me:
> 'phy' should have been passed here, not PHY_POLL. Luckily, all callers
> pass PHY_POLL anyway...

Are we looking at the same header file for the prototype of fixed_phy_add()?

extern int fixed_phy_add(unsigned int irq, int phy_id,
                         struct fixed_phy_status *status,
                         int link_gpio);

First argument is correct here.. at any rate, if something needs fixing,
just go ahead and submit a patch.
--
Florian
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ