From: Tallys Martins <tallysmartins@gmail.com>
To: Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Stefan Popa <stefan.popa@analog.com>,
Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.or, kernel-usp@googlegroups.com,
Tallys Martins <tallysmartins@gmail.com>,
Souza Guilherme <gdsdsilva@inf.ufpel.edu.br>
Subject: [PATCH 1/2] staging: iio: ad2s1210: Destroy mutex at remove
Date: Sat, 18 May 2019 19:15:57 -0300 [thread overview]
Message-ID: <20190518221558.21799-1-tallysmartins@gmail.com> (raw)
Ensure the mutex will be destroyed on drive removal.
Also adds mutex comment description.
Signed-off-by: Tallys Martins <tallysmartins@gmail.com>
Signed-off-by: Souza Guilherme <gdsdsilva@inf.ufpel.edu.br>
Co-developed-by: Souza Guilherme <gdsdsilva@inf.ufpel.edu.br>
---
drivers/staging/iio/resolver/ad2s1210.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index b6be0bc202f5..b91cf57c5e57 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -86,7 +86,7 @@ static const struct ad2s1210_gpio gpios[] = {
static const unsigned int ad2s1210_resolution_value[] = { 10, 12, 14, 16 };
struct ad2s1210_state {
- struct mutex lock;
+ struct mutex lock; /* lock to protect the state on r/w operations */
struct spi_device *sdev;
struct gpio_desc *gpios[5];
unsigned int fclkin;
@@ -689,8 +689,10 @@ static int ad2s1210_probe(struct spi_device *spi)
static int ad2s1210_remove(struct spi_device *spi)
{
struct iio_dev *indio_dev = spi_get_drvdata(spi);
+ struct ad2s1210_state *ad2s1210_ad = iio_priv(indio_dev);
iio_device_unregister(indio_dev);
+ mutex_destroy(&ad2s1210_ad->lock);
return 0;
}
--
2.21.0
next reply other threads:[~2019-05-18 22:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-18 22:15 Tallys Martins [this message]
2019-05-18 22:15 ` [PATCH 2/2] staging: iio: ad2s1210: Add devicetree yaml doc Tallys Martins
2019-05-19 11:17 ` Jonathan Cameron
2019-05-20 10:17 ` Alexandru Ardelean
2019-05-19 11:12 ` [PATCH 1/2] staging: iio: ad2s1210: Destroy mutex at remove Jonathan Cameron
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=20190518221558.21799-1-tallysmartins@gmail.com \
--to=tallysmartins@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=devel@driverdev.osuosl.org \
--cc=gdsdsilva@inf.ufpel.edu.br \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=kernel-usp@googlegroups.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.or \
--cc=pmeerw@pmeerw.net \
--cc=stefan.popa@analog.com \
/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;
as well as URLs for NNTP newsgroup(s).