ASoC: ti: omap-mcbsp-st: Use guard() for spin locks

Clean up the code using guard() for spin locks.
Merely code refactoring, and no behavior change.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Tested-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Link: https://patch.msgid.link/20260508103837.138142-7-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
bui duc phuc 2026-05-08 17:38:36 +07:00 committed by Mark Brown
parent a8217778be
commit d94e794e82
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -156,7 +156,7 @@ static int omap_mcbsp_st_set_chgain(struct omap_mcbsp *mcbsp, int channel,
if (!st_data)
return -ENOENT;
spin_lock_irq(&mcbsp->lock);
guard(spinlock_irq)(&mcbsp->lock);
if (channel == 0)
st_data->ch0gain = chgain;
else if (channel == 1)
@ -166,7 +166,6 @@ static int omap_mcbsp_st_set_chgain(struct omap_mcbsp *mcbsp, int channel,
if (st_data->enabled)
omap_mcbsp_st_chgain(mcbsp);
spin_unlock_irq(&mcbsp->lock);
return ret;
}
@ -180,14 +179,13 @@ static int omap_mcbsp_st_get_chgain(struct omap_mcbsp *mcbsp, int channel,
if (!st_data)
return -ENOENT;
spin_lock_irq(&mcbsp->lock);
guard(spinlock_irq)(&mcbsp->lock);
if (channel == 0)
*chgain = st_data->ch0gain;
else if (channel == 1)
*chgain = st_data->ch1gain;
else
ret = -EINVAL;
spin_unlock_irq(&mcbsp->lock);
return ret;
}
@ -199,10 +197,9 @@ static int omap_mcbsp_st_enable(struct omap_mcbsp *mcbsp)
if (!st_data)
return -ENODEV;
spin_lock_irq(&mcbsp->lock);
guard(spinlock_irq)(&mcbsp->lock);
st_data->enabled = 1;
omap_mcbsp_st_start(mcbsp);
spin_unlock_irq(&mcbsp->lock);
return 0;
}
@ -215,10 +212,9 @@ static int omap_mcbsp_st_disable(struct omap_mcbsp *mcbsp)
if (!st_data)
return -ENODEV;
spin_lock_irq(&mcbsp->lock);
guard(spinlock_irq)(&mcbsp->lock);
omap_mcbsp_st_stop(mcbsp);
st_data->enabled = 0;
spin_unlock_irq(&mcbsp->lock);
return ret;
}
@ -241,13 +237,12 @@ static ssize_t st_taps_show(struct device *dev,
ssize_t status = 0;
int i;
spin_lock_irq(&mcbsp->lock);
guard(spinlock_irq)(&mcbsp->lock);
for (i = 0; i < st_data->nr_taps; i++)
status += sysfs_emit_at(buf, status, (i ? ", %d" : "%d"),
st_data->taps[i]);
if (i)
status += sysfs_emit_at(buf, status, "\n");
spin_unlock_irq(&mcbsp->lock);
return status;
}
@ -260,19 +255,17 @@ static ssize_t st_taps_store(struct device *dev,
struct omap_mcbsp_st_data *st_data = mcbsp->st_data;
int val, tmp, status, i = 0;
spin_lock_irq(&mcbsp->lock);
guard(spinlock_irq)(&mcbsp->lock);
memset(st_data->taps, 0, sizeof(st_data->taps));
st_data->nr_taps = 0;
do {
status = sscanf(buf, "%d%n", &val, &tmp);
if (status < 0 || status == 0) {
size = -EINVAL;
goto out;
return -EINVAL;
}
if (val < -32768 || val > 32767) {
size = -EINVAL;
goto out;
return -EINVAL;
}
st_data->taps[i++] = val;
buf += tmp;
@ -283,9 +276,6 @@ static ssize_t st_taps_store(struct device *dev,
st_data->nr_taps = i;
out:
spin_unlock_irq(&mcbsp->lock);
return size;
}