Re: [PATCH v2] iio: adc: ti-ads7950: add GPIO support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Justin,

This looks good, one comment below:


[snip]

>+static int ti_ads7950_init_gpio(struct ti_ads7950_state *st)
>+{
>+	int ret;
>+
>+	/* Initialize GPIO */
>+	mutex_lock(&st->slock);

Lock is acquired here.

>+
>+	/* Default to GPIO input */
>+	st->gpio_direction_bitmask = 0x0;
>+	st->single_tx = cpu_to_be16(TI_ADS7950_CR_GPIO |
>+				    (st->gpio_direction_bitmask &
>+				    TI_ADS7950_GPIO_MASK));
>+	ret = spi_sync(st->spi, &st->scan_single_msg);
>+	mutex_unlock(&st->slock);

then released here.

>+	if (ret)
>+		return ret;
>+
>+	/* Default to signal low */
>+	st->gpio_signal_bitmask = 0x0;
>+	st->single_tx = cpu_to_be16(TI_ADS7950_CR_MANUAL |
>+				    TI_ADS7950_CR_WRITE |
>+				    (st->gpio_signal_bitmask &
>+				    TI_ADS7950_GPIO_MASK));
>+	ret = spi_sync(st->spi, &st->scan_single_msg);
>+	mutex_unlock(&st->slock);

and here as well, presumably there should be a mutex_lock() guarding the signal bitmask and transaction, right?

Thanks!
-- 
Florian




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux