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, 6 Apr 2011 16:12:25 +0400
From:	Anton Vorontsov <cbouatmailru@...il.com>
To:	Jamie Iles <jamie@...ieiles.com>
Cc:	linux-kernel@...r.kernel.org, linux@....linux.org.uk,
	tglx@...utronix.de, grant.likely@...retlab.ca, arnd@...db.de,
	nico@...xnic.net
Subject: Re: [RFC PATCH 7/7] basic_mmio_gpio: support direction registers

On Wed, Apr 06, 2011 at 12:11:03PM +0100, Jamie Iles wrote:
> Most controllers require the direction of a GPIO to be set by writing to
> a direction register.  Add support for either an input direction
> register or an output direction register.
> 
> Signed-off-by: Jamie Iles <jamie@...ieiles.com>
> Cc: Anton Vorontsov <cbouatmailru@...il.com>
> Cc: Grant Likely <grant.likely@...retlab.ca>
[...]
> @@ -71,6 +71,8 @@ struct bgpio_chip {
>       void __iomem *reg_set;
>       void __iomem *reg_clr;
>       void __iomem *reg_in;
> +     void __iomem *reg_dirout;
> +     void __iomem *reg_dirin;
>

I guess you don't need both reg_dirout and reg_dirin in the runtime.
How about just renaming it to "reg_dir" and just assinging it with
either dirout or dirin in bgpio_setup_direction()?

[...]
> +	/* Shadowed direction registers to clear/set direction safely. */
> +	unsigned long outputs, inputs;

Same as obove, maybe just a single 'dir' variable?

Plus, a minor nit: the coding style suggests:

	unsigned long outputs;
	unsigned long inputs;

[...]
>  static int bgpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
>  {
> +	struct bgpio_chip *bgc = to_bgpio_chip(gc);
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&bgc->lock, flags);
> +	bgc->outputs &= ~bgc->pin2mask(bgc, gpio);
> +	bgc->write_reg(bgc->reg_dirout, bgc->outputs);
> +	spin_unlock_irqrestore(&bgc->lock, flags);
>

Because of the lock, the code in these routines is dense and hard to
read, so I would rather add empty lines near the locking calls, just
like in bgpio_set() (also makes it look consistent).

Otherwise,

Acked-by: Anton Vorontsov <cbouatmailru@...il.com>

Thanks!

-- 
Anton Vorontsov
Email: cbouatmailru@...il.com
--
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