From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50C72C433E1 for ; Mon, 22 Mar 2021 12:59:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D2476199F for ; Mon, 22 Mar 2021 12:59:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233249AbhCVM6A (ORCPT ); Mon, 22 Mar 2021 08:58:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:41972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232306AbhCVMrX (ORCPT ); Mon, 22 Mar 2021 08:47:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E1886619B1; Mon, 22 Mar 2021 12:43:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1616416988; bh=gVDbF7zwSoKBSxcK3ATgzWhkIuDV0BXEUwwLKtES7EA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q+ZL+lWqWzKDa7buZol8/xH87iDD4tjHyAwZ334hdUyQPfF3tyHKh3+AwAZo7YOGz kcuYK3uQ3VhNvig0WxzmAM6w4gILptXmbtW9sMKPA+0i28Xjo/yZYfTBALFcYj6Db7 SlBgALN1Lq10Omf6Ry3Ji6pdGpnyG59n7o+XMvKQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Xiang , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.4 44/60] iio: hid-sensor-humidity: Fix alignment issue of timestamp channel Date: Mon, 22 Mar 2021 13:28:32 +0100 Message-Id: <20210322121923.842328908@linuxfoundation.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210322121922.372583154@linuxfoundation.org> References: <20210322121922.372583154@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ye Xiang commit 37e89e574dc238a4ebe439543c5ab4fbb2f0311b upstream. This patch ensures that, there is sufficient space and correct alignment for the timestamp. Fixes: d7ed89d5aadf ("iio: hid: Add humidity sensor support") Signed-off-by: Ye Xiang Cc: Link: https://lore.kernel.org/r/20210303063615.12130-2-xiang.ye@intel.com Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/humidity/hid-sensor-humidity.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/drivers/iio/humidity/hid-sensor-humidity.c +++ b/drivers/iio/humidity/hid-sensor-humidity.c @@ -17,7 +17,10 @@ struct hid_humidity_state { struct hid_sensor_common common_attributes; struct hid_sensor_hub_attribute_info humidity_attr; - s32 humidity_data; + struct { + s32 humidity_data; + u64 timestamp __aligned(8); + } scan; int scale_pre_decml; int scale_post_decml; int scale_precision; @@ -127,9 +130,8 @@ static int humidity_proc_event(struct hi struct hid_humidity_state *humid_st = iio_priv(indio_dev); if (atomic_read(&humid_st->common_attributes.data_ready)) - iio_push_to_buffers_with_timestamp(indio_dev, - &humid_st->humidity_data, - iio_get_time_ns(indio_dev)); + iio_push_to_buffers_with_timestamp(indio_dev, &humid_st->scan, + iio_get_time_ns(indio_dev)); return 0; } @@ -144,7 +146,7 @@ static int humidity_capture_sample(struc switch (usage_id) { case HID_USAGE_SENSOR_ATMOSPHERIC_HUMIDITY: - humid_st->humidity_data = *(s32 *)raw_data; + humid_st->scan.humidity_data = *(s32 *)raw_data; return 0; default: