All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] staging: iio: ad2s1210: Destroy mutex at remove
@ 2019-05-18 22:15 Tallys Martins
  2019-05-18 22:15 ` [PATCH 2/2] staging: iio: ad2s1210: Add devicetree yaml doc Tallys Martins
  2019-05-19 11:12 ` [PATCH 1/2] staging: iio: ad2s1210: Destroy mutex at remove Jonathan Cameron
  0 siblings, 2 replies; 5+ messages in thread
From: Tallys Martins @ 2019-05-18 22:15 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Stefan Popa,
	Jonathan Cameron, Hartmut Knaack, Peter Meerwald-Stadler,
	Greg Kroah-Hartman
  Cc: linux-iio, devel, linux-kernel, kernel-usp, Tallys Martins,
	Souza Guilherme

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-05-20 10:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-18 22:15 [PATCH 1/2] staging: iio: ad2s1210: Destroy mutex at remove Tallys Martins
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.