From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:54396 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753766AbdKIJJy (ORCPT ); Thu, 9 Nov 2017 04:09:54 -0500 Subject: Patch "iio: pressure: ms5611: claim direct mode during oversampling changes" has been added to the 4.9-stable tree To: amsfield22@gmail.com, alexander.levin@verizon.com, gregkh@linuxfoundation.org, jic23@kernel.org Cc: , From: Date: Thu, 09 Nov 2017 10:09:34 +0100 Message-ID: <1510218574975@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled iio: pressure: ms5611: claim direct mode during oversampling changes to the 4.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: iio-pressure-ms5611-claim-direct-mode-during-oversampling-changes.patch and it can be found in the queue-4.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From foo@baz Thu Nov 9 09:48:01 CET 2017 From: Alison Schofield Date: Fri, 20 Jan 2017 12:22:58 -0800 Subject: iio: pressure: ms5611: claim direct mode during oversampling changes From: Alison Schofield [ Upstream commit 3bc1abcddb24f55b9c251e03caa4f9bd22ff748b ] Driver was checking for direct mode before changing oversampling ratios, but was not locking it. Use the claim/release helper functions to guarantee the device stays in direct mode while the oversampling ratios are being updated. Continue to use the drivers private state lock to protect against conflicting direct mode access of the state data. Signed-off-by: Alison Schofield Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/iio/pressure/ms5611_core.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/drivers/iio/pressure/ms5611_core.c +++ b/drivers/iio/pressure/ms5611_core.c @@ -308,6 +308,7 @@ static int ms5611_write_raw(struct iio_d { struct ms5611_state *st = iio_priv(indio_dev); const struct ms5611_osr *osr = NULL; + int ret; if (mask != IIO_CHAN_INFO_OVERSAMPLING_RATIO) return -EINVAL; @@ -321,12 +322,11 @@ static int ms5611_write_raw(struct iio_d if (!osr) return -EINVAL; - mutex_lock(&st->lock); + ret = iio_device_claim_direct_mode(indio_dev); + if (ret) + return ret; - if (iio_buffer_enabled(indio_dev)) { - mutex_unlock(&st->lock); - return -EBUSY; - } + mutex_lock(&st->lock); if (chan->type == IIO_TEMP) st->temp_osr = osr; @@ -334,6 +334,8 @@ static int ms5611_write_raw(struct iio_d st->pressure_osr = osr; mutex_unlock(&st->lock); + iio_device_release_direct_mode(indio_dev); + return 0; } Patches currently in stable-queue which might be from amsfield22@gmail.com are queue-4.9/iio-pressure-ms5611-claim-direct-mode-during-oversampling-changes.patch queue-4.9/iio-proximity-sx9500-claim-direct-mode-during-raw-proximity-reads.patch queue-4.9/iio-magnetometer-mag3110-claim-direct-mode-during-raw-writes.patch queue-4.9/iio-trigger-free-trigger-resource-correctly.patch