Skip to content

Commit

Permalink
iio: adc: sc27xx: Use devm_hwspin_lock_request_specific() to simplify…
Browse files Browse the repository at this point in the history
… code

Change to use devm_hwspin_lock_request_specific() to help to simplify the
cleanup code for drivers requesting one hwlock.

Signed-off-by: Baolin Wang <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
  • Loading branch information
wangbaolin719 authored and jic23 committed Oct 13, 2019
1 parent 0c8a6e7 commit 420119f
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions drivers/iio/adc/sc27xx_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,6 @@ static void sc27xx_adc_disable(void *_data)
SC27XX_MODULE_ADC_EN, 0);
}

static void sc27xx_adc_free_hwlock(void *_data)
{
struct hwspinlock *hwlock = _data;

hwspin_lock_free(hwlock);
}

static int sc27xx_adc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
Expand Down Expand Up @@ -520,19 +513,12 @@ static int sc27xx_adc_probe(struct platform_device *pdev)
return ret;
}

sc27xx_data->hwlock = hwspin_lock_request_specific(ret);
sc27xx_data->hwlock = devm_hwspin_lock_request_specific(dev, ret);
if (!sc27xx_data->hwlock) {
dev_err(dev, "failed to request hwspinlock\n");
return -ENXIO;
}

ret = devm_add_action_or_reset(dev, sc27xx_adc_free_hwlock,
sc27xx_data->hwlock);
if (ret) {
dev_err(dev, "failed to add hwspinlock action\n");
return ret;
}

sc27xx_data->dev = dev;

ret = sc27xx_adc_enable(sc27xx_data);
Expand Down

0 comments on commit 420119f

Please sign in to comment.