From patchwork Mon Jul 12 06:11:02 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: 472853 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2647448jao; Sun, 11 Jul 2021 23:29:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyiFvHCZXU+ohhOsbft+PpZaxq8Q7nChNGOrEg8qq4UEQKti+mTEiCj+vSBAWgFcIzbOli X-Received: by 2002:a17:906:8558:: with SMTP id h24mr19527960ejy.519.1626071353248; Sun, 11 Jul 2021 23:29:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626071353; cv=none; d=google.com; s=arc-20160816; b=FPlG9bV2KKXpcNPctjBPHUE7QS/sN/1TNitNHARGa5BE5ZB9gX3eJcSjJser4beA1Y sKDmk38H9j9hUickb0HWCISDjd3vgEn0vYBGRD0bSbbx36rtM10cuFwG/dY0nPlztFBv sr4zCOCmEpmspYXmZH0RAlWFQd9EFskLE6Dj3WDRckAAiEXzmnVYigO8l9i/qXUEwh9y gz9VFsrzoEXVxErprBuy2naRaMqRSONoC8w8Ugpoxf+oZrqtX5IrIw3io8BOfQccXWXy 7iQkehiEwSRNvAzg0rz9hz2jjBgQJbSgakc+t7IFBk2CJfgTMZ1eEK/DpOL9ZfSsQCnv yFQg== 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=IoT7ffJZ9enxjFmjO8s+n28WEpDQWkSFIBY5MNo4QPc=; b=ux6jWg35+adL69IfRDaA+XeU6R+f47UCf4rU4SqV/Jc//DscAVM8ebpVTHKayz2VU3 Bryzlc0WSq+2xJkyCMmfRoFJ57Z1968VFpPnsLE9nAt5gb1MNgDsBngD2vPa8mEYj+PY SYWzt5lYm4pbg2TMOLeQlZPu7Lk4A7NFrRUYliDm6gvumdll6fzhXSiFjf9PS6aSyI4Y WO+vn60/U1pkcbfvARUU4j9ZCdQLmLZqjklomn9N7z2gwMTrKoRx3M/PhSO40/puXKY1 Z+p0yftVrRA/yHDjr3CcUxD7/+cL6nGtTPdb4IBeCtvmlg2REWclaWaH9vMqLbvedGp/ RHiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zXqgqLeu; 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 bz6si16420285ejc.610.2021.07.11.23.29.13; Sun, 11 Jul 2021 23:29:13 -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=zXqgqLeu; 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 S235236AbhGLGb2 (ORCPT + 12 others); Mon, 12 Jul 2021 02:31:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:45894 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233251AbhGLG2v (ORCPT ); Mon, 12 Jul 2021 02:28:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 45BCA61183; Mon, 12 Jul 2021 06:25:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626071109; bh=wCWALNa4ewvd6omXSa8C7gZQ+oFtRheEIXd3ZHgH6+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zXqgqLeu99AQe+JXE9FW4dnBTu242SvEB7tCLOyixvJQu3+NP4x7FoJNkFej4B/iJ wlE8rfO5j5atcWahkiEQuEnP60q8poKc8xRd4CRIAbF6tAvcGSCMNbg5hsziz19kLK 9H8TWcsilpoVaNL4xShoMh+NVaxG6KnKPrIKHaP8= 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.4 278/348] iio: light: tcs3414: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Mon, 12 Jul 2021 08:11:02 +0200 Message-Id: <20210712060740.548920149@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060659.886176320@linuxfoundation.org> References: <20210712060659.886176320@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 7c0291c5fe76..85bfe3b63f4f 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: