Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1407468

Re: [PATCH v3] gpio: UniPhier: add driver for UniPhier GPIO controller

From Linus Walleij <linus.walleij@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH v3] gpio: UniPhier: add driver for UniPhier GPIO controller
Date 2016-05-26 11:10 +0200
Message-ID <rCZsK-4u8-9@gated-at.bofh.it> (permalink)
References (3 earlier) <pMLsR-7SM-1@gated-at.bofh.it> <pMLVV-8qL-47@gated-at.bofh.it> <pMM5B-ay-35@gated-at.bofh.it> <pMM5B-ay-37@gated-at.bofh.it> <rAKo9-TE-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, May 20, 2016 at 6:30 AM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:

> So, I'd like to know the recommended driver coding style
> based on 4.7-rc1.

Sure, best is to look at other recently added drivers
I guess.

> Diving into the git-log so far, I came up the following list:
>
> [1] The "dev" member of gpiochip was renamed to "parent"

Yes.

> [2] The most recommended register function is now
>     devm_gpiochip_add_data()

Yes, saves some code.

> [3] Pass the driver private data to the
>     3rd argument of devm_gpiochip_add_data().

Yes.

> [4] Do not use container_of() to covert
>     from gpiochip to driver private data.
>     Instead, gpiochip_get_data() should be used.

Yes.

>     (I used of_mm_gpio_chip in v3,
>      but I needed to use container_of() to
>      convert from gpiochip to of_mm_gpio_chip.
>      I am wondering if you are happy with it or not.)

We will see when we look at the code ;)
I guess it is OK. The alternative is to use gpio-generic instead,
see commit 42178e2a1e42b480ada954750f248b53d3fb5940
"drivers/gpio: Switch gpio-mpc8xxx to use gpio-generic"
for an example of that approach.

> [5] gpiochip.owner is being deprecated.
>     So, platform drivers need not set
>      "gpiochip.owner =  THIS_MODULE".

Yes.

> Correct?

Yes.

> Is there anything else missing?

I advice to add a .get_direction() callback if possible and
also .set_single_ended() if the GPIO chip supports open
drain / open source in hardware.

Yours,
Linus Walleij

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH v3] gpio: UniPhier: add driver for UniPhier GPIO controller Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-05-20 06:40 +0200
  Re: [PATCH v3] gpio: UniPhier: add driver for UniPhier GPIO controller Linus Walleij <linus.walleij@linaro.org> - 2016-05-26 11:10 +0200

csiph-web