Minor optimizations for Cherryview pinctrl
Subsystems (3)
cover Minor optimizations for Cherryview pinctrl
This series implements minor optimizations for Cherryview pinctrl driver.
The numbers are as tested with gcc 7.5.0 and may vary with newer versions.
Raag Jadav (2):
pinctrl: cherryview: simplify exit path of set_mux hook
pinctrl: cherryview: simplify exit path of gpio_request_enable hook
drivers/pinctrl/intel/pinctrl-cherryview.c | 24 ++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/2 pinctrl: cherryview: simplify exit path of set_mux hook
Simplify exit path of ->set_mux() hook and save a few bytes.
add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-34 (-34)
Function old new delta chv_pinmux_set_mux 640 606 -34
Total: Before=19233, After=19199, chg -0.18%
--- drivers/pinctrl/intel/pinctrl-cherryview.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/pinctrl/intel/pinctrl-cherryview.c +8 -4
@@ -716,18 +716,21 @@ static int chv_pinmux_set_mux(struct pinctrl_dev *pctldev,struct device *dev = pctrl->dev;const struct intel_pingroup *grp;unsigned long flags; -int i; +int i, ret; grp = &pctrl->soc->groups[group]; +/* In case we never really enter any of the below loops */ + ret =0 ; +raw_spin_lock_irqsave (&chv_lock, flags);/* Check first that the pad is not locked */ for (i =0 ; i < grp->grp.npins; i++) {if (chv_pad_locked (pctrl, grp->grp.pins[i])) { -raw_spin_unlock_irqrestore (&chv_lock, flags);dev_warn (dev,"unable to set mode for locked pin %u\n" , grp->grp.pins[i]); -return -EBUSY ; + ret = -EBUSY ; + goto out_unlock; } }
@@ -765,9 +768,10 @@ static int chv_pinmux_set_mux(struct pinctrl_dev *pctldev, invert_oe ? "" : "not "); } +out_unlock:raw_spin_unlock_irqrestore (&chv_lock, flags); -return 0 ; +return ret; } static void chv_gpio_clear_triggering(struct intel_pinctrl *pctrl,
Signature · 1 line
2.17.1
PATCH 2/2 pinctrl: cherryview: simplify exit path of gpio_request_enable hook
In reply to Raag JadavSimplify exit path of ->gpio_request_enable() hook and save a few bytes.
add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-10 (-10)
Function old new delta chv_gpio_request_enable 296 286 -10
Total: Before=19199, After=19189, chg -0.05%
--- drivers/pinctrl/intel/pinctrl-cherryview.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/pinctrl/intel/pinctrl-cherryview.c +8 -4
@@ -803,15 +803,18 @@ static int chv_gpio_request_enable(struct pinctrl_dev *pctldev,struct intel_pinctrl *pctrl =pinctrl_dev_get_drvdata (pctldev);unsigned long flags;u32 value; +int ret; + +/* For positive cases */ + ret =0 ;raw_spin_lock_irqsave (&chv_lock, flags);if (chv_pad_locked (pctrl, offset)) { value =chv_readl (pctrl, offset,CHV_PADCTRL0 );if (!(value &CHV_PADCTRL0_GPIOEN )) { -/* Locked so cannot enable */ -raw_spin_unlock_irqrestore (&chv_lock, flags); -return -EBUSY ; + ret = -EBUSY ; + goto out_unlock; } }else {struct intel_community_context *cctx = &pctrl->context.communities[0 ];
@@ -845,9 +848,10 @@ static int chv_gpio_request_enable(struct pinctrl_dev *pctldev,chv_writel (pctrl, offset,CHV_PADCTRL0 , value); } +out_unlock:raw_spin_unlock_irqrestore (&chv_lock, flags); -return 0 ; +return ret; } static void chv_gpio_disable_free(struct pinctrl_dev *pctldev,
Signature · 1 line
2.17.1
Mika Westerberg
maintainerQuoted 3 lines · Raag Jadav
This series implements minor optimizations for Cherryview pinctrl driver.
The numbers are as tested with gcc 7.5.0 and may vary with newer versions.
Exactly they may vary and also depending on which compiler options you pass. Same comments to this series as I gave for the previous one.