Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751234AbdHCHkO (ORCPT ); Thu, 3 Aug 2017 03:40:14 -0400 Received: from mail-oi0-f45.google.com ([209.85.218.45]:33216 "EHLO mail-oi0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751032AbdHCHkM (ORCPT ); Thu, 3 Aug 2017 03:40:12 -0400 MIME-Version: 1.0 In-Reply-To: <1500635890-12714-1-git-send-email-chenjh@rock-chips.com> References: <1500635681-12477-1-git-send-email-chenjh@rock-chips.com> <1500635890-12714-1-git-send-email-chenjh@rock-chips.com> From: Linus Walleij Date: Thu, 3 Aug 2017 09:40:10 +0200 Message-ID: Subject: Re: [PATCH v7 08/12] pinctrl: Add pinctrl driver for the RK805 PMIC To: Joseph Chen Cc: Alexandre Courbot , Dmitry Torokhov , "open list:ARM/Rockchip SoC..." , "linux-kernel@vger.kernel.org" , Tao Huang , Tony Xie , zhangqing@rock-chips.com, David Wu , "devicetree@vger.kernel.org" , w.egorov@phytec.de, Liam Girdwood , Mark Brown , Rob Herring , Mark Rutland , "linux-gpio@vger.kernel.org" , Linux Input Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2262 Lines: 65 On Fri, Jul 21, 2017 at 1:18 PM, Joseph Chen wrote: > RK805 is one of Rockchip PMICs family, it has 2 output only GPIOs. > > This driver is also designed for other Rockchip PMICs to expend. > Different PMIC maybe have different pin features, for example, > RK816 has one pin which can be used for TS or GPIO(input/out). > The mainly difference between PMICs pins are pinmux, direction > and output value, that is 'struct rk805_pin_config'. > > Signed-off-by: Joseph Chen OK nice! Some comments: > +config PINCTRL_RK805 > + tristate "Pinctrl and GPIO driver for RK805 PMIC" > + depends on MFD_RK808 && GPIOLIB Nowadays I would recommend simply: depends on MFD_RK808 select GPIOLIB > +#include > +#include Just #include > +#define FUNCTION_GROUP(fname, mux, gname) \ > + { \ > + .name = #fname, \ > + .groups = gname##_gpio_groups, \ > + .ngroups = ARRAY_SIZE(gname##_gpio_groups), \ > + .mux_option = RK805_PINMUX_##mux, \ > + } > + > +#define PINGROUP(pg_name, pin_id) \ > + { \ > + .name = #pg_name, \ > + .pins = {RK805_##pin_id}, \ > + .npins = 1, \ > + } > + > +/* RK805: 2 output only GPIOs */ > +static const struct pinctrl_pin_desc rk805_pins_desc[] = { > + PINCTRL_PIN(RK805_GPIO0, "gpio0"), > + PINCTRL_PIN(RK805_GPIO1, "gpio1"), > +}; > + > +static const struct rk805_pin_function rk805_pin_functions[] = { > + FUNCTION_GROUP(gpio, GPIO, rk805), > +}; > + > +static const struct rk805_pin_group rk805_pin_groups[] = { > + PINGROUP(gpio0, GPIO0), > + PINGROUP(gpio1, GPIO1), > +}; It looks like the macros just obscure things? Why not simply inline the data and open code it as it is just two pins? Apart from this it looks nice and complete. Yours, Linus Walleij