[v1] pinctrl: tangier: simplify locking using cleanup helpers
Commit Message
Use lock guards from cleanup.h to simplify locking.
Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
drivers/pinctrl/intel/pinctrl-tangier.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
base-commit: e58e519b80ba79cd73abb1d631d429b7322ac9cb
Comments
On Thu, Nov 23, 2023 at 07:32:12PM +0530, Raag Jadav wrote:
> Use lock guards from cleanup.h to simplify locking.
>
> Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
On Thu, Nov 23, 2023 at 04:28:16PM +0200, Mika Westerberg wrote:
> On Thu, Nov 23, 2023 at 07:32:12PM +0530, Raag Jadav wrote:
> > Use lock guards from cleanup.h to simplify locking.
> >
> > Signed-off-by: Raag Jadav <raag.jadav@intel.com>
>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Pushed to my review and testing queue, thanks!
On Fri, Nov 24, 2023 at 01:09:17PM +0200, Andy Shevchenko wrote:
> On Thu, Nov 23, 2023 at 04:28:16PM +0200, Mika Westerberg wrote:
> > On Thu, Nov 23, 2023 at 07:32:12PM +0530, Raag Jadav wrote:
> > > Use lock guards from cleanup.h to simplify locking.
> > >
> > > Signed-off-by: Raag Jadav <raag.jadav@intel.com>
> >
> > Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>
> Pushed to my review and testing queue, thanks!
Awesome, I noticed a few commits having duplicate Acks in Intel tree.
Raag
On Fri, Nov 24, 2023 at 02:08:05PM +0200, Raag Jadav wrote:
> On Fri, Nov 24, 2023 at 01:09:17PM +0200, Andy Shevchenko wrote:
> > On Thu, Nov 23, 2023 at 04:28:16PM +0200, Mika Westerberg wrote:
> > > On Thu, Nov 23, 2023 at 07:32:12PM +0530, Raag Jadav wrote:
> > > > Use lock guards from cleanup.h to simplify locking.
> > > >
> > > > Signed-off-by: Raag Jadav <raag.jadav@intel.com>
> > >
> > > Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> >
> > Pushed to my review and testing queue, thanks!
>
> Awesome, I noticed a few commits having duplicate Acks in Intel tree.
You are right, I have mistakenly run a msg-filter before applying my byt
series. Thanks for spotting this, now should be fixed!
@@ -9,6 +9,7 @@
*/
#include <linux/bits.h>
+#include <linux/cleanup.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/errno.h>
@@ -220,7 +221,6 @@ static int tng_pinmux_set_mux(struct pinctrl_dev *pctldev,
const struct intel_pingroup *grp = &tp->groups[group];
u32 bits = grp->mode << BUFCFG_PINMODE_SHIFT;
u32 mask = BUFCFG_PINMODE_MASK;
- unsigned long flags;
unsigned int i;
/*
@@ -232,11 +232,11 @@ static int tng_pinmux_set_mux(struct pinctrl_dev *pctldev,
return -EBUSY;
}
+ guard(raw_spinlock_irqsave)(&tp->lock);
+
/* Now enable the mux setting for each pin in the group */
- raw_spin_lock_irqsave(&tp->lock, flags);
for (i = 0; i < grp->grp.npins; i++)
tng_update_bufcfg(tp, grp->grp.pins[i], bits, mask);
- raw_spin_unlock_irqrestore(&tp->lock, flags);
return 0;
}
@@ -248,14 +248,13 @@ static int tng_gpio_request_enable(struct pinctrl_dev *pctldev,
struct tng_pinctrl *tp = pinctrl_dev_get_drvdata(pctldev);
u32 bits = BUFCFG_PINMODE_GPIO << BUFCFG_PINMODE_SHIFT;
u32 mask = BUFCFG_PINMODE_MASK;
- unsigned long flags;
if (!tng_buf_available(tp, pin))
return -EBUSY;
- raw_spin_lock_irqsave(&tp->lock, flags);
+ guard(raw_spinlock_irqsave)(&tp->lock);
+
tng_update_bufcfg(tp, pin, bits, mask);
- raw_spin_unlock_irqrestore(&tp->lock, flags);
return 0;
}
@@ -360,7 +359,6 @@ static int tng_config_set_pin(struct tng_pinctrl *tp, unsigned int pin,
unsigned int param = pinconf_to_config_param(config);
unsigned int arg = pinconf_to_config_argument(config);
u32 mask, term, value = 0;
- unsigned long flags;
switch (param) {
case PIN_CONFIG_BIAS_DISABLE:
@@ -432,9 +430,9 @@ static int tng_config_set_pin(struct tng_pinctrl *tp, unsigned int pin,
return -EINVAL;
}
- raw_spin_lock_irqsave(&tp->lock, flags);
+ guard(raw_spinlock_irqsave)(&tp->lock);
+
tng_update_bufcfg(tp, pin, value, mask);
- raw_spin_unlock_irqrestore(&tp->lock, flags);
return 0;
}