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: <CAHp75VdYjz6f2wBXsTL1kf5z-jcM68sMhtmkdgJM+TiPZb=gww@mail.gmail.com>
Date:   Thu, 1 Feb 2018 17:31:54 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Baolin Wang <baolin.wang@...aro.org>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        devicetree <devicetree@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Mark Brown <broonie@...nel.org>
Subject: Re: [PATCH v2 2/2] gpio: Add GPIO driver for Spreadtrum SC9860 platform

On Thu, Feb 1, 2018 at 5:04 AM, Baolin Wang <baolin.wang@...aro.org> wrote:
> The Spreadtrum SC9860 platform GPIO controller contains 16 groups and
> each group contains 16 GPIOs. Each GPIO can set input/output and has
> the interrupt capability.

Just noticed couple of more improvements you can do.

> +       case IRQ_TYPE_EDGE_RISING:
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 0);
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 0);
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IEV, 1);
> +               irq_set_handler_locked(data, handle_edge_irq);
> +               break;
> +       case IRQ_TYPE_EDGE_FALLING:
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 0);
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 0);
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IEV, 0);
> +               irq_set_handler_locked(data, handle_edge_irq);
> +               break;
> +       case IRQ_TYPE_EDGE_BOTH:
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 0);
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 1);
> +               irq_set_handler_locked(data, handle_edge_irq);
> +               break;
> +       case IRQ_TYPE_LEVEL_HIGH:
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 1);
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 0);
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IEV, 1);
> +               irq_set_handler_locked(data, handle_level_irq);
> +               break;
> +       case IRQ_TYPE_LEVEL_LOW:
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 1);
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 0);
> +               sprd_gpio_update(chip, offset, SPRD_GPIO_IEV, 0);
> +               irq_set_handler_locked(data, handle_level_irq);
> +               break;
> +       default:
> +               return -EINVAL;

I guess you can use fallthrough and reduce some lines, but I have no
strong opinion which will look better.

> +       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +       sprd_gpio->base = devm_ioremap_nocache(&pdev->dev, res->start,
> +                                              resource_size(res));

Didn't notice before, why not to simple call devm_ioremap_resource() ?

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ