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


Groups > linux.kernel > #1409983

Re: [PATCH] pinctrl: copy per-pin driver private data to struct pin_desc

From Linus Walleij <linus.walleij@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH] pinctrl: copy per-pin driver private data to struct pin_desc
Date 2016-05-31 10:30 +0200
Message-ID <rENdL-eU-7@gated-at.bofh.it> (permalink)
References <rCzeW-5mD-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, May 25, 2016 at 7:09 AM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:

> Currently, struct pinctrl_pin_desc can have per-pin driver private
> data, but it is not copied to struct pin_desc.
>
> For a driver with sparse pin space, for-loop search like below would
> be necessary in order to get the driver-specific data for a desired
> pin number.
>
>   for (i = 0; i < pctldev->desc->npins; i++)
>           if (pin_number == pctldev->desc->pins[i].number)
>                   return pctldev->desc->pins[i].drv_data;
>
> This is not efficient for a driver with a large number of pins.
> So, copy the data to struct pin_desc when each pin is registered
> for the faster radix tree lookup.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Looks useful. I was a bit hesitant since the patch does not make
use of the new member, but I guess you need this for future
patches so applied it anyways. The refactoring looks nice in
all ways.

Yours,
Linus Walleij

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


Thread

[PATCH] pinctrl: copy per-pin driver private data to struct pin_desc Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-05-25 07:10 +0200
  Re: [PATCH] pinctrl: copy per-pin driver private data to struct pin_desc Linus Walleij <linus.walleij@linaro.org> - 2016-05-31 10:30 +0200

csiph-web