Skip to content

Commit 3adb82e

Browse files
scuciureanjic23
authored andcommitted
iio: dac: vf610_dac: Replace indio_dev->mlock with own device lock
As part of the general cleanup of indio_dev->mlock, this change replaces it with a local lock on the device's state structure. Signed-off-by: Sergiu Cuciurean <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 0b2884e commit 3adb82e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/iio/dac/vf610_dac.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct vf610_dac {
3636
struct device *dev;
3737
enum vf610_conversion_mode_sel conv_mode;
3838
void __iomem *regs;
39+
struct mutex lock;
3940
};
4041

4142
static void vf610_dac_init(struct vf610_dac *info)
@@ -64,15 +65,15 @@ static int vf610_set_conversion_mode(struct iio_dev *indio_dev,
6465
struct vf610_dac *info = iio_priv(indio_dev);
6566
int val;
6667

67-
mutex_lock(&indio_dev->mlock);
68+
mutex_lock(&info->lock);
6869
info->conv_mode = mode;
6970
val = readl(info->regs + VF610_DACx_STATCTRL);
7071
if (mode)
7172
val |= VF610_DAC_LPEN;
7273
else
7374
val &= ~VF610_DAC_LPEN;
7475
writel(val, info->regs + VF610_DACx_STATCTRL);
75-
mutex_unlock(&indio_dev->mlock);
76+
mutex_unlock(&info->lock);
7677

7778
return 0;
7879
}
@@ -147,9 +148,9 @@ static int vf610_write_raw(struct iio_dev *indio_dev,
147148

148149
switch (mask) {
149150
case IIO_CHAN_INFO_RAW:
150-
mutex_lock(&indio_dev->mlock);
151+
mutex_lock(&info->lock);
151152
writel(VF610_DAC_DAT0(val), info->regs);
152-
mutex_unlock(&indio_dev->mlock);
153+
mutex_unlock(&info->lock);
153154
return 0;
154155

155156
default:
@@ -205,6 +206,8 @@ static int vf610_dac_probe(struct platform_device *pdev)
205206
indio_dev->channels = vf610_dac_iio_channels;
206207
indio_dev->num_channels = ARRAY_SIZE(vf610_dac_iio_channels);
207208

209+
mutex_init(&info->lock);
210+
208211
ret = clk_prepare_enable(info->clk);
209212
if (ret) {
210213
dev_err(&pdev->dev,

0 commit comments

Comments
 (0)