From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D328F1E7C27; Thu, 30 Jan 2025 14:23:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738246996; cv=none; b=Xr4GMQzt8n376YmcmpM1fPfN/Fybpwsef6mZjiGygiZDMbF8n52ytngcSxnmX+FZruq6ntVRIbzyosSeLRljbnNpNJ5J8sxNJtzC6X4VODN6YbhS+KcmjyNGJtTN1w62cpTVLHUpGC0np42GQdh9ah/gB60nYClQADnKulZxAp0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738246996; c=relaxed/simple; bh=xQR7bAgAvEw8ats7VGflv6QLyd4M2jKPZFeJkBcZmoU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Hu/ETL+t8Xj0yM0KTxrDvdx5VJG2nDr9bjjF5BuU9ViZuGH7F5MTV7YNHprXL3oPJsWe6lqLug7WLXwCJMMsIovPugU/jclYo5U23xiefZOZKagaSrLadZC3ncZ6PVSL6HEMUYJv5YNuvWRC+31ZVvDhXUeUlFjo8fS60NsnRbA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WmubwQn7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="WmubwQn7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE09DC4CED2; Thu, 30 Jan 2025 14:23:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1738246995; bh=xQR7bAgAvEw8ats7VGflv6QLyd4M2jKPZFeJkBcZmoU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WmubwQn7Nz0doVkAEhGIqfZuuIkCcRKUvgW+7XOy2P8bdHSFnxkuOCzRGv4bDCvLU 6q2fti3UedPKT8yBbnmXLjr0Tc8qGE90E3Fvq8dkJSIl8n8R0lFpNg+0tbFZlbYbd+ mu9//qnSR2c3nHsEF5yYx794Ac/EXHlcWt76TZlk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Carlos Song , Frank Li , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.10 047/133] iio: gyro: fxas21002c: Fix missing data update in trigger handler Date: Thu, 30 Jan 2025 15:00:36 +0100 Message-ID: <20250130140144.415615532@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250130140142.491490528@linuxfoundation.org> References: <20250130140142.491490528@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Carlos Song commit fa13ac6cdf9b6c358e7d77c29fb60145c7a87965 upstream. The fxas21002c_trigger_handler() may fail to acquire sample data because the runtime PM enters the autosuspend state and sensor can not return sample data in standby mode.. Resume the sensor before reading the sample data into the buffer within the trigger handler. After the data is read, place the sensor back into the autosuspend state. Fixes: a0701b6263ae ("iio: gyro: add core driver for fxas21002c") Signed-off-by: Carlos Song Signed-off-by: Frank Li Link: https://patch.msgid.link/20241116152945.4006374-1-Frank.Li@nxp.com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/gyro/fxas21002c_core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/drivers/iio/gyro/fxas21002c_core.c +++ b/drivers/iio/gyro/fxas21002c_core.c @@ -730,14 +730,21 @@ static irqreturn_t fxas21002c_trigger_ha int ret; mutex_lock(&data->lock); + ret = fxas21002c_pm_get(data); + if (ret < 0) + goto out_unlock; + ret = regmap_bulk_read(data->regmap, FXAS21002C_REG_OUT_X_MSB, data->buffer, CHANNEL_SCAN_MAX * sizeof(s16)); if (ret < 0) - goto out_unlock; + goto out_pm_put; iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, data->timestamp); +out_pm_put: + fxas21002c_pm_put(data); + out_unlock: mutex_unlock(&data->lock);