gpio: pca953x: code shrink
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Fri, 9 Sep 2016 09:17:34 +0000 (11:17 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 12 Sep 2016 12:45:34 +0000 (14:45 +0200)
commit53661f3bc64a3203efad5daa6cf4c4e87c53b394
tree80ac9f16c18ea7e74d3c0235b691e29385e42b20
parent14bf873e5921fd414cf6f0b31b799eeabd27dd74
gpio: pca953x: code shrink

There are multiple places in the driver code where a
switch (chip->chip_type) is used to determine the proper register
offset.

Unduplicate the code by adding a simple structure holding the possible
offsets that differ between the pca953x and pca957x chip families and
use it to avoid the checks.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-pca953x.c