[PATCH v2 1/4] pinctrl: intel: refine set_mux hook

Raag Jadav posted 4 patches 2 years, 8 months ago
There is a newer version of this series
[PATCH v2 1/4] pinctrl: intel: refine set_mux hook
Posted by Raag Jadav 2 years, 8 months ago
Utilize a temporary variable for common shift operation
inside ->set_mux() hook and improve readability.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
 drivers/pinctrl/intel/pinctrl-intel.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index c7a71c49df0a..e8adf2580321 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -411,18 +411,19 @@ static int intel_pinmux_set_mux(struct pinctrl_dev *pctldev,
 	/* Now enable the mux setting for each pin in the group */
 	for (i = 0; i < grp->grp.npins; i++) {
 		void __iomem *padcfg0;
-		u32 value;
+		u32 value, pmode;
 
 		padcfg0 = intel_get_padcfg(pctrl, grp->grp.pins[i], PADCFG0);
-		value = readl(padcfg0);
 
+		value = readl(padcfg0);
 		value &= ~PADCFG0_PMODE_MASK;
 
 		if (grp->modes)
-			value |= grp->modes[i] << PADCFG0_PMODE_SHIFT;
+			pmode = grp->modes[i];
 		else
-			value |= grp->mode << PADCFG0_PMODE_SHIFT;
+			pmode = grp->mode;
 
+		value |= pmode << PADCFG0_PMODE_SHIFT;
 		writel(value, padcfg0);
 	}
 
-- 
2.17.1
Re: [PATCH v2 1/4] pinctrl: intel: refine set_mux hook
Posted by Andy Shevchenko 2 years, 8 months ago
On Fri, Jun 09, 2023 at 01:55:36PM +0530, Raag Jadav wrote:
> Utilize a temporary variable for common shift operation
> inside ->set_mux() hook and improve readability.

Seems the bloat-o-meter statistics is missing here.

-- 
With Best Regards,
Andy Shevchenko
RE: [PATCH v2 1/4] pinctrl: intel: refine set_mux hook
Posted by Jadav, Raag 2 years, 8 months ago
> On Fri, Jun 09, 2023 at 01:55:36PM +0530, Raag Jadav wrote:
> > Utilize a temporary variable for common shift operation inside
> > ->set_mux() hook and improve readability.
> 
> Seems the bloat-o-meter statistics is missing here.

I changed the commit message as pointed out by Mika in v1.
Do I change it back?
Re: [PATCH v2 1/4] pinctrl: intel: refine set_mux hook
Posted by Andy Shevchenko 2 years, 8 months ago
On Mon, Jun 12, 2023 at 07:15:59AM +0000, Jadav, Raag wrote:
> > On Fri, Jun 09, 2023 at 01:55:36PM +0530, Raag Jadav wrote:
> > > Utilize a temporary variable for common shift operation inside
> > > ->set_mux() hook and improve readability.
> > 
> > Seems the bloat-o-meter statistics is missing here.
> 
> I changed the commit message as pointed out by Mika in v1.
> Do I change it back?

No back, only forward!

I.e. you need to update Subject to follow the pattern, ->set_mux()
in this case) and add a note that the change makes code smaller.
It will be two selling points.

-- 
With Best Regards,
Andy Shevchenko