From patchwork Mon Jul 12 06:10:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 472963 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2681381jao; Mon, 12 Jul 2021 00:21:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw42CXgdOJwz1Go2ddkIAcoqs0XUgh6+v8EwvvTdSZcp6IQMsKorYAilnLlVltuQa6m87Br X-Received: by 2002:a17:906:2590:: with SMTP id m16mr51234236ejb.265.1626074468960; Mon, 12 Jul 2021 00:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626074468; cv=none; d=google.com; s=arc-20160816; b=a+7ExoE3WtmrDVcwxuCcRVhSS+l9ufrw1UY0DuycjEh0ZRUvI7GCTrLkb1osLQqp6A P0rp3Hmz+7qjhYhvROPKhlqf4FgDYhCc1mzAn4JZUI0b7TDtKDK5fH9S3/DkMnGO34Ge /dOw+0EfKhs1aN07RiZhKdo/BqkJ0jpr0nr6MKynX3czGpCE6n7V9UAaj3fKwwJqR4t+ TmCTRDWFyoG9+Ymx9SeK15CeNWVdU1UfKItyCrzRFyFyZnJ6VqosXPXdbwaUo4DSu+Yf IIZUVuCWJmSLGcgwR+KpbPZW6uFVtSzQd14BietbRa15wTbuRIeZ3Z9aRUF2w+qbGbsN fJGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0nOcSf+UuUwPEQT2Z2waAGBz1j2HXQb7jQPDcJBvFzM=; b=L65p4HY2q3vDFjd9hIunLX2bBtQ0vGwiOvvYJpXR+Dtf8Q/kAgYXHfMFOufmz1S0UB z3sJ4t8IrkS9BitPs4Pz3nC423n6hUM7EZlYpYhpha6xwvBVoV9nG/457pwbiGK1p82g T8lLJZ2hHNOh8gAFtQdeLzZbngwg8Uvmvb5Io4cybVBK2+Zrki38Bn4sEP5a32WeTvC4 UsG7dzyBDtShgMYCkmkUVlQPitjYMRFsiX50mKlQIGFKp2TLIfcRjqHpVe8pdvdAgT9v c3C1/+VDMttN1Vu14HuYxVuIELyu1rByF6e7CEn7o+Th2JmypJUtK/94DpTqudTQY1T3 MCPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cv2VZngu; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d9si16909677edq.169.2021.07.12.00.21.08; Mon, 12 Jul 2021 00:21:08 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cv2VZngu; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243751AbhGLHWm (ORCPT + 12 others); Mon, 12 Jul 2021 03:22:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:59464 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344887AbhGLHV1 (ORCPT ); Mon, 12 Jul 2021 03:21:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2A9A5613EE; Mon, 12 Jul 2021 07:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626074319; bh=OFEpPVa1c0xmqHhP4EMGDdS7QiF8qyjTE0NYsve4vmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cv2VZnguh26gTCLOryZTmrVdYs1c7yt5iuVCLx+s9ofdZJaLIFU1gPuX99mIphksH lSLEkC6DAh09gE5Vd1MoX3wwBsHMGVBhFfyZDyEBjUtrQpRVU416yuf4K/jG9lUQkc rlmHaETgPf+BXhKL7U7FxU5bwXsDCgJzDvRfVweg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Stephan Gerhold , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.12 541/700] iio: gyro: bmg160: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Mon, 12 Jul 2021 08:10:24 +0200 Message-Id: <20210712061033.923406249@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jonathan Cameron [ Upstream commit 06778d881f3798ce93ffbbbf801234292250b598 ] To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned. Found during an audit of all calls of uses of iio_push_to_buffers_with_timestamp() Fixes: 13426454b649 ("iio: bmg160: Separate i2c and core driver") Signed-off-by: Jonathan Cameron Cc: Stephan Gerhold Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20210501170121.512209-11-jic23@kernel.org Signed-off-by: Sasha Levin --- drivers/iio/gyro/bmg160_core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.30.2 diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c index 029ef4c34604..457fa8702d19 100644 --- a/drivers/iio/gyro/bmg160_core.c +++ b/drivers/iio/gyro/bmg160_core.c @@ -98,7 +98,11 @@ struct bmg160_data { struct iio_trigger *motion_trig; struct iio_mount_matrix orientation; struct mutex mutex; - s16 buffer[8]; + /* Ensure naturally aligned timestamp */ + struct { + s16 chans[3]; + s64 timestamp __aligned(8); + } scan; u32 dps_range; int ev_enable_state; int slope_thres; @@ -882,12 +886,12 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p) mutex_lock(&data->mutex); ret = regmap_bulk_read(data->regmap, BMG160_REG_XOUT_L, - data->buffer, AXIS_MAX * 2); + data->scan.chans, AXIS_MAX * 2); mutex_unlock(&data->mutex); if (ret < 0) goto err; - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, pf->timestamp); err: iio_trigger_notify_done(indio_dev->trig);