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: <20121210230749.7820F3E081F@localhost>
Date:	Mon, 10 Dec 2012 23:07:49 +0000
From:	Grant Likely <grant.likely@...retlab.ca>
To:	Mathias Nyman <mathias.nyman@...ux.intel.com>,
	linus.walleij@...aro.org
Cc:	mika.westerberg@...ux.intel.com, rafael.j.wysocki@...el.com,
	linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
	Mathias Nyman <mathias.nyman@...ux.intel.com>
Subject: Re: [PATCH 1/1] gpio: add Lynxpoint chipset gpio driver.

On Fri,  7 Dec 2012 16:01:39 +0200, Mathias Nyman <mathias.nyman@...ux.intel.com> wrote:
> Add gpio support for Intel Lynxpoint chipset.
> Lynxpoint supports 94 gpio pins which can generate interrupts.
> Driver will fail requests for pins that are marked as owned by ACPI, or
> set in an alternate mode (non-gpio).
> 
> Signed-off-by: Mathias Nyman <mathias.nyman@...ux.intel.com>
> ---
> +static void lp_gpio_set(struct gpio_chip *chip, unsigned gpio, int value)
> +{
> +	struct lp_gpio *lg = container_of(chip, struct lp_gpio, chip);
> +	unsigned long reg = gpio_reg(chip, gpio, LP_CONFIG1);
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&lg->lock, flags);
> +
> +	if (value)
> +		outl(inl(reg) | OUT_LVL_BIT, reg);
> +	else
> +		outl(inl(reg) & ~OUT_LVL_BIT, reg);
> +
> +	spin_unlock_irqrestore(&lg->lock, flags);
> +}

A *lot* of drivers implement their own GPIO ops like this, and they all
end up looking the same. Please take a look at
drivers/gpio/gpio-generic.c and see if you can use the stock operations
provided there.

g.

--
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