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] [day] [month] [year] [list]
Message-ID: <87390b6svn.fsf@dell.be.48ers.dk>
Date:	Thu, 15 Nov 2012 11:51:56 +0100
From:	Peter Korsgaard <jacmet@...site.dk>
To:	Andreas Larsson <andreas@...sler.com>
Cc:	Wolfram Sang <w.sang@...gutronix.de>,
	Ben Dooks <ben-linux@...ff.org>, linux-i2c@...r.kernel.org,
	Grant Likely <grant.likely@...retlab.ca>,
	devicetree-discuss@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
	software@...sler.com
Subject: Re: [PATCH v4 2/2] i2c: i2c-ocores: Add support for the GRLIB port of the controller and custom getreg and setreg functions

>>>>> "Andreas" == Andreas Larsson <andreas@...sler.com> writes:

Hi,

 Andreas> The registers in the GRLIB port of the controller are 32-bit
 Andreas> and in big endian byte order. The PRELOW and PREHIGH registers
 Andreas> are merged into one register. The subsequent registers have
 Andreas> their offset decreased accordingly. Hence the register access
 Andreas> needs to be handled in a non-standard manner using custom
 Andreas> getreg and setreg functions.

 Andreas> A type is added as the data of the of match table entries. A
 Andreas> new entry with a different compatible string is added to the
 Andreas> table. The type of that entry triggers usage of the grlib
 Andreas> functions.

 Andreas> Signed-off-by: Andreas Larsson <andreas@...sler.com>
 Andreas> ---
 Andreas>  Changes since v3:
 Andreas>  - Use a separate entry in the of match table for the grlib
 Andreas>  variant and trigger grlib function usage on type put in the
 Andreas>  data field of that table entry

Thanks. A few more comments:


 Andreas>  static inline void oc_setreg(struct ocores_i2c *i2c, int reg, u8 value)
 Andreas>  {
 Andreas> -	if (i2c->reg_io_width == 4)
 Andreas> +	if (i2c->setreg)
 Andreas> +		i2c->setreg(i2c, reg, value);
 Andreas> +	else if (i2c->reg_io_width == 4)
 Andreas>  		iowrite32(value, i2c->base + (reg << i2c->reg_shift));
 Andreas>  	else if (i2c->reg_io_width == 2)
 Andreas>  		iowrite16(value, i2c->base + (reg << i2c->reg_shift));

It would have been nice to add oc_getreg_8/16/32 functions and always
use the function pointers - But ok, that can be done later.

 
 Andreas>  #ifdef CONFIG_OF
 Andreas> +static int ocores_i2c_get_type(struct platform_device *pdev);
 Andreas> +

Why not just move the implementation up here instead of the forward
declaration?

 
 Andreas> +static int ocores_i2c_get_type(struct platform_device *pdev)
 Andreas> +{
 Andreas> +	const struct of_device_id *match;
 Andreas> +
 Andreas> +	match = of_match_node(ocores_i2c_match, pdev->dev.of_node);
 Andreas> +	if (match)
 Andreas> +		return (int)match->data;

Can this ever fail? If not, you might as well do the of_match_node
inline in the probe instead of this helper.

Other than that it looks good.

-- 
Bye, Peter Korsgaard
--
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