On Mon, Oct 14, 2019 at 11:43:46AM +0300, Andy Shevchenko wrote: > Deduplicate restoring PADCFGx registers by using a common helper. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> > --- > drivers/pinctrl/intel/pinctrl-intel.c | 51 +++++++++++++-------------- > 1 file changed, 24 insertions(+), 27 deletions(-) > > diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c > index bc013599a9a3..18467e2efe99 100644 > --- a/drivers/pinctrl/intel/pinctrl-intel.c > +++ b/drivers/pinctrl/intel/pinctrl-intel.c > @@ -1588,6 +1588,27 @@ intel_gpio_update_pad_mode(void __iomem *hostown, u32 mask, u32 value) > return curr; > } > > +static void intel_restore_padcfg(struct intel_pinctrl *pctrl, unsigned int pin, > + unsigned int reg, u32 value) > +{ > + struct device *dev = pctrl->dev; > + unsigned int n = reg / sizeof(u32); > + void __iomem *padcfg; > + u32 mask = (reg == PADCFG0) ? PADCFG0_GPIORXSTATE : 0; > + u32 val; Looks better if you order them like: u32 mask = (reg == PADCFG0) ? PADCFG0_GPIORXSTATE : 0; unsigned int n = reg / sizeof(u32); struct device *dev = pctrl->dev; void __iomem *padcfg; u32 val;