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: <CAFRkauBxP-R2GB+DAYCXt1jf5UQY_cY8X7HqO4ZHkN6Njd8buw@mail.gmail.com>
Date:	Tue, 8 Oct 2013 15:48:02 +0800
From:	Axel Lin <axel.lin@...ics.com>
To:	Sonic Zhang <sonic.adi@...il.com>
Cc:	Linus Walleij <linus.walleij@...aro.org>,
	LKML <linux-kernel@...r.kernel.org>,
	adi-buildroot-devel@...ts.sourceforge.net,
	Sonic Zhang <sonic.zhang@...log.com>
Subject: Re: [PATCH] pinctrl: pinctrl-adi2: GPIO output value should be set
 after the GPIO interrupt is disabled.

2013/10/8 Sonic Zhang <sonic.adi@...il.com>:
> From: Sonic Zhang <sonic.zhang@...log.com>
>
> Use BIT macro as well.
>
> Signed-off-by: Sonic Zhang <sonic.zhang@...log.com>
> ---
>  drivers/pinctrl/pinctrl-adi2.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-adi2.c b/drivers/pinctrl/pinctrl-adi2.c
> index a74e6f4..7a39562 100644
> --- a/drivers/pinctrl/pinctrl-adi2.c
> +++ b/drivers/pinctrl/pinctrl-adi2.c
> @@ -766,9 +766,9 @@ static void adi_gpio_set_value(struct gpio_chip *chip, unsigned offset,
>         spin_lock_irqsave(&port->lock, flags);
>
>         if (value)
> -               writew(1 << offset, &regs->data_set);
> +               writew(BIT(offset), &regs->data_set);
>         else
> -               writew(1 << offset, &regs->data_clear);
> +               writew(BIT(offset), &regs->data_clear);
>
>         spin_unlock_irqrestore(&port->lock, flags);
>  }
> @@ -780,12 +780,14 @@ static int adi_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
>         struct gpio_port_t *regs = port->regs;
>         unsigned long flags;
>
> -       adi_gpio_set_value(chip, offset, value);
> -
>         spin_lock_irqsave(&port->lock, flags);
>
> -       writew(readw(&regs->inen) & ~(1 << offset), &regs->inen);
> -       writew(1 << offset, &regs->dir_set);
> +       writew(readw(&regs->inen) & ~BIT(offset), &regs->inen);
> +       if (value)
> +               writew(BIT(offset), &regs->data_set);
> +       else
> +               writew(BIT(offset), &regs->data_clear);

I think we can add an unlocked version of adi_gpio_set_value() to
avoid duplicated code.
--
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