From patchwork Mon Jul 12 06:10:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 472984 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2683997jao; Mon, 12 Jul 2021 00:24:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHilDpjLH5k0hqvHkbIplLwZBhLKEvkJoJ+FGPtfVE8AOmzO6ZlESQm7lC3bv/rG4YSFAw X-Received: by 2002:a05:6402:1812:: with SMTP id g18mr17183324edy.325.1626074596883; Mon, 12 Jul 2021 00:23:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626074596; cv=none; d=google.com; s=arc-20160816; b=spLwFiy+eAp6oq00XAGDXrlKHJMxfo4viOY/nZcFFCK3O3tUH/PK49RRfJ7W6FFgPa WITPnrbIg98B/gz/rYsnNiBpTEW+uvm+143+XEjqyhwLUzIRHuxhW1w6cD0P9NUQ8ZOk yvfKKZAQmiOOaodvZ7QCplXlE5hVdIiKnepRWGws+4MVbL9aEPhyoxVfW8rKn2fzQynH BpMez5q4Fwdi2GJlAcHhJlnKev8YZPgcaW9w5Yvczau3ZHqKDJQm2MI+lqD+/PjGJdda odXv+cBCxUlexfcIsbMRNqh17vlo70Eu34+8mtphV1C3/wlgV76g2i397W1eLD8yl2T8 3jyA== 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=WvCXsuu5Zfoy72a5BG/G+iqKWNYOdOR/MnkRpWpFFjI=; b=QWTCLo1/Jj97R3ZElfqwcxG3W11R9qVKQ7M98VqUDAi/Xpa9y8Eg9aDKJDDqWCMhQW nvhjSgADHzY3e9yP4rv8qF9CnS7bHUkHfJdvmFABXZxAwrQLNsSbd0oHBUPZ8C7EeC1U l/vhofLzmPi4kaEjaM/zR2ijflWHQijql4fbFNNjpfzLlQ2rSiMferBCczmOTS7cPrFZ C3F0JzmY8lTyxRcaOGIRId5pwisfYC2z2FkTiQYpbxWHta0NoXnnMWQsAX1fEUhxbAQO cJPgtv3pHPvZWmrq0WyuxIRP7qtqnpoHr43vuqkqKg0EUtA9r9JqSOY3wenCR0xdQ22I 445Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u2mSIlY7; 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.23.16; Mon, 12 Jul 2021 00:23:16 -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=u2mSIlY7; 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 S242975AbhGLHXa (ORCPT + 12 others); Mon, 12 Jul 2021 03:23:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:59998 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241920AbhGLHVv (ORCPT ); Mon, 12 Jul 2021 03:21:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B3C67613F3; Mon, 12 Jul 2021 07:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626074343; bh=FMiubnISiMI2iY0NdN5wTlY0ucMqsT2sp82WSl3hFSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u2mSIlY79/YBU02mZxZAR8aUSzhApV38MDlTJGgSBNTLFDI+jNAVLw/tPqkUQdayO 0fLPDpGhCXwITGSEpcG7K6dDxHSz+MZ+J3nju/LKrBIRkCvYgDlHqKnwpIt78mDJm1 gw2erYjJt30Gj8jxtFCrsDuWiiwqDx+trkV1DltQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.12 549/700] iio: light: tcs3414: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Mon, 12 Jul 2021 08:10:32 +0200 Message-Id: <20210712061034.709626902@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 ff08fbc22ab32ccc6690c21b0e5e1d402dcc076f ] 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: a244e7b57f0f ("iio: Add driver for AMS/TAOS tcs3414 digital color sensor") Signed-off-by: Jonathan Cameron Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20210501170121.512209-19-jic23@kernel.org Signed-off-by: Sasha Levin --- drivers/iio/light/tcs3414.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.30.2 diff --git a/drivers/iio/light/tcs3414.c b/drivers/iio/light/tcs3414.c index 6fe5d46f80d4..0593abd600ec 100644 --- a/drivers/iio/light/tcs3414.c +++ b/drivers/iio/light/tcs3414.c @@ -53,7 +53,11 @@ struct tcs3414_data { u8 control; u8 gain; u8 timing; - u16 buffer[8]; /* 4x 16-bit + 8 bytes timestamp */ + /* Ensure timestamp is naturally aligned */ + struct { + u16 chans[4]; + s64 timestamp __aligned(8); + } scan; }; #define TCS3414_CHANNEL(_color, _si, _addr) { \ @@ -209,10 +213,10 @@ static irqreturn_t tcs3414_trigger_handler(int irq, void *p) if (ret < 0) goto done; - data->buffer[j++] = ret; + data->scan.chans[j++] = ret; } - iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, iio_get_time_ns(indio_dev)); done: