[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CE4AF546-6CC0-4292-B5F5-6715C3EE7B6A@gmail.com>
Date: Tue, 12 Feb 2019 18:47:44 -0800
From: Florian Fainelli <f.fainelli@...il.com>
To: justinpopo6@...il.com, linux-iio@...r.kernel.org
CC: linux-gpio@...r.kernel.org, bcm-kernel-feedback-list@...adcom.com,
bgolaszewski@...libre.com, linus.walleij@...aro.org,
knaack.h@....de, lars@...afoo.de, pmeerw@...erw.net,
david@...hnology.com, linux-kernel@...r.kernel.org,
jic23@...nel.org, Justin Chen <justinpopo6@...il.com>
Subject: Re: [PATCH v2] iio: adc: ti-ads7950: add GPIO support
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
Powered by blists - more mailing lists