Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1016236pxb; Thu, 4 Mar 2021 00:37:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwjg8G8yXY5T7L7hT92wmMtRAO7XJlJ3ZCY7x9PgptpZUPYi9W5Y1IuWFvf0Z8stMB1n2B/ X-Received: by 2002:a05:6402:34c8:: with SMTP id w8mr3179396edc.235.1614847038501; Thu, 04 Mar 2021 00:37:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614847038; cv=none; d=google.com; s=arc-20160816; b=r/1own3bWFJTqG6COXLYzd5qr5kCV7ZxHUDvmHnIpZc3kulEZv1zVoinXtmloc49r3 2h2cew9cgoltNAQNvGmNS8mWcnE/3/nmJEqrTl7KZbOFdH9pn6YrD7WpW9m7yN3d5iNc TghPERZoqmFEGabpcwrEYnvaKluVIBWfmiTgU31l5HWkbC6IXUkeWqpl12pb3xckD5eo /6e/31p2LbRZAW2gZrq37XNfXgWOhW3YecjDkpDTKhwdKO2Rab/yPLqY6TsshCcb1CdJ HmpeHP/Ao5vRxSuFQ5lZiN60YH6dKm8YeKre+1uznzG6pb3Xd53FqU2p2yD6iiB6CJhG XQ2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=sPKBz+JqtazZhwYkXKQ+JX9QN9LmBsPbDgC/LVqfRZ8=; b=q8QX461tSAe8Mv/bu5vbgAYIGAir6tWB+H5h4br7KlJsApvSxYdnvq9yMS0Q2IftzQ YCuRs2K5ypKggKkWxSxw4/UGB2wy4hw6hvIWQdfTL97aERFZBcW6yBuySmB0NGJ/ZnIp R/mBZN1GBZ9KTnxUcIe9UXUiiYhSq7h7xGsVLIeFDgTMj0ClWtY5uMqjsq1WSkj2+Kgp Sh+ferPy5c2nnIq7Bb5jHN11cxV+C0o+BCnQ9drFzclNvDvRv9TtKSn4r1+q6neSBvid gCXpGjJzINNtYLeitB/PtpFudcw33tZVo3xHOPsQEVm+gEpbylXCsFt4BQaPl6Hu82su Zfyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i11si8827553edl.441.2021.03.04.00.36.55; Thu, 04 Mar 2021 00:37:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444045AbhCCMPR (ORCPT + 99 others); Wed, 3 Mar 2021 07:15:17 -0500 Received: from mga17.intel.com ([192.55.52.151]:50156 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1841810AbhCCGiH (ORCPT ); Wed, 3 Mar 2021 01:38:07 -0500 IronPort-SDR: c83ZcA82RkRczXgl5i59GxccgYZGylr0JMG86BuoM2IeMQgH4yycrfzhpmRSdbE5lcgugAAzsp +swzsKSf2pTQ== X-IronPort-AV: E=McAfee;i="6000,8403,9911"; a="167012874" X-IronPort-AV: E=Sophos;i="5.81,219,1610438400"; d="scan'208";a="167012874" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Mar 2021 22:35:57 -0800 IronPort-SDR: Gy3mAPxL2/2WviYYVKUVJHi6hQ4UjNDKPADQJzNEPFb7llQZquOPv8f7Z4bWgwEnfCYCeU79xt GKmB5DG5WRWA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,219,1610438400"; d="scan'208";a="383870896" Received: from host.sh.intel.com ([10.239.154.115]) by orsmga002.jf.intel.com with ESMTP; 02 Mar 2021 22:35:55 -0800 From: Ye Xiang To: jikos@kernel.org, jic23@kernel.org, srinivas.pandruvada@linux.intel.com Cc: linux-input@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Ye Xiang Subject: [PATCH 1/4] iio: hid-sensor-humidity: Fix alignment issue of timestamp channel Date: Wed, 3 Mar 2021 14:36:12 +0800 Message-Id: <20210303063615.12130-2-xiang.ye@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210303063615.12130-1-xiang.ye@intel.com> References: <20210303063615.12130-1-xiang.ye@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/iio/humidity/hid-sensor-humidity.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/iio/humidity/hid-sensor-humidity.c b/drivers/iio/humidity/hid-sensor-humidity.c index ec88ae3f233d..74383abc0d44 100644 --- a/drivers/iio/humidity/hid-sensor-humidity.c +++ b/drivers/iio/humidity/hid-sensor-humidity.c @@ -15,7 +15,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; @@ -129,9 +132,8 @@ static int humidity_proc_event(struct hid_sensor_hub_device *hsdev, 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; } @@ -146,7 +148,7 @@ static int humidity_capture_sample(struct hid_sensor_hub_device *hsdev, 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: -- 2.17.1