mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: justinpopo6@gmail.com, linux-iio@vger.kernel.org
Cc: linux-gpio@vger.kernel.org,
	bcm-kernel-feedback-list@broadcom.com, bgolaszewski@baylibre.com,
	linus.walleij@linaro.org, knaack.h@gmx.de, lars@metafoo.de,
	pmeerw@pmeerw.net, david@lechnology.com,
	linux-kernel@vger.kernel.org, jic23@kernel.org,
	Justin Chen <justinpopo6@gmail.com>
Subject: Re: [PATCH v2] iio: adc: ti-ads7950: add GPIO support
Date: Tue, 12 Feb 2019 18:47:44 -0800	[thread overview]
Message-ID: <CE4AF546-6CC0-4292-B5F5-6715C3EE7B6A@gmail.com> (raw)
In-Reply-To: <1550021937-12202-1-git-send-email-justinpopo6@gmail.com>

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

      reply	other threads:[~2019-02-13  2:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13  1:38 justinpopo6
2019-02-13  2:47 ` Florian Fainelli [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CE4AF546-6CC0-4292-B5F5-6715C3EE7B6A@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=david@lechnology.com \
    --cc=jic23@kernel.org \
    --cc=justinpopo6@gmail.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®