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>] [day] [month] [year] [list]
Date:	Thu, 18 Nov 2010 09:40:58 -0800
From:	David Daney <ddaney@...iumnetworks.com>
To:	Milton Miller <miltonm@....com>
CC:	devicetree-discuss@...ts.ozlabs.org, grant.likely@...retlab.ca,
	linux-kernel@...r.kernel.org,
	"netdev@...r.kernel.org Cyril Chemparathy" <cyril@...com>,
	Arnaud Patard <arnaud.patard@...-net.org>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>
Subject: Re: [1/2] of/phylib: Use device tree properties to initialize Marvell
 PHYs.

On 11/17/2010 09:38 PM, Milton Miller wrote:
[...]
>> +static int marvell_of_reg_init(struct phy_device *phydev)
>> +{
>> +	const __be32 *paddr;
>> +	int len, i, saved_page, current_page, page_changed, ret;
>> +
>> +	if (!phydev->dev.of_node)
>> +		return 0;
>> +
>> +	paddr = of_get_property(phydev->dev.of_node, "marvell,reg-init",&len);
>> +	if (!paddr || len<  (2 * sizeof(u32)))
>> +		return 0;
>> +
>> +	saved_page = phy_read(phydev, 22);
>> +	if (saved_page<  0)
>> +		return saved_page;
>> +	page_changed = 0;
>> +	current_page = saved_page;
>> +
>> +	ret = 0;
>> +	len /= sizeof(u32);
>> +	for (i = 0; i<  len / 2; i += 2) {
>
> i<  len - 1 would execute all the register inits specified in the property.
>

Right, a bit of a snafu I think.  I will fix it.


>> +		u32 reg_spec =  be32_to_cpup(&paddr[i]);
>> +		u32 val_spec =  be32_to_cpup(&paddr[i + 1]);
>> +		u16 reg = reg_spec&  0xffff;
>> +		u16 reg_page = reg_spec>>  16;
>> +		u16 val_bits = val_spec&  0xffff;
>> +		u16 mask = val_spec>>  16;
>> +		int val;
>> +
>
> While the outcome is the same, this code also mixes sizeof(u32)
> with __be32 pointer math.

I will think about how to make it more consistent.

Thank you for looking at it,
David Daney
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ