From patchwork Mon Jul 12 06:11:01 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: 472846 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2647214jao; Sun, 11 Jul 2021 23:28:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfJVXAPqM0E/o8x1s5BDwtN2Olg/xoQi/uzCDy4zZtbnM4LCgvOqRTvR9cTWBeSJs7aWGP X-Received: by 2002:a05:6402:101a:: with SMTP id c26mr63366464edu.317.1626071335086; Sun, 11 Jul 2021 23:28:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626071335; cv=none; d=google.com; s=arc-20160816; b=VPbO0YnVTTsezYHTnDsb1jy8DtA9KtS/UodpWRwoLHZkCEWymkMmkHNfjwLK03zxbo PFwabGZKaQjfgJyMTvRiY97l37gkH3TjJzkJs1Zv1GwJ5lBt9F8dmkpE8fJGgd1t9rd5 0fTr1ZfHOr/upxfAEKSW149uADkrnjJSAOIusoNRPvrokYyfwC0Dkv/LTfT3Pzpi0X0z iFpYAEtjBUO/UctfznebsSdxxyVEsufq/QyIbqV0GNEcFUhoMJ71/Hp/j68UjGt8PwM4 btkBqaBpSP2SnJhxqUY53TXsQr2dbL7+WrUupbpjZ76Amw1Q4K6bEhmz0uWEAIT2RQub 9ceA== 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=HkOzDUZO1IqWywyH3Wf0se8ges46VNpxNCM89t5j+es=; b=s7TZ3A/rqj379RIL4HmnpL3s4R6/f+X/wnramfq9nULQPE3Z9y4EQlCYnizOf8Iz8U iNY1kWpv+JY3awb3SpYOLGUS+wXL/S5e20uf0tf3elSQO2eRYQSTYJUBOiAdXS0wOEUd 23Hru1jhIGBDgwGIRlsHanw0d7VtPQ1oW07L6HXNEpmSIc8Of0MyHNwiXgfUGclUdm82 NbZjfo8iUi0ssUBO52QFGE6aAzDgHeusA76etLMzKCUm05g9ip3Q1vLvS2ECLjk3Fl+l xq/uw4R3KMoCdSx4CJN/43vV2KNGw3m1mVRtJStIZ9mx9Q4zdNbiDIQVJnr5yGgKrEzD jgJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SKIjmRIx; 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.28.54; Sun, 11 Jul 2021 23:28:55 -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=SKIjmRIx; 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 S233445AbhGLGau (ORCPT + 12 others); Mon, 12 Jul 2021 02:30:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:48518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235152AbhGLG2u (ORCPT ); Mon, 12 Jul 2021 02:28:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EBBC6610CD; Mon, 12 Jul 2021 06:25:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626071107; bh=t73rlMJNOSD3lPi6PGJim8kd/BxNWSjZ872C0Kpw20o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SKIjmRIxErMU61jDbxd+Hjl5EmbLu7RaZt6K3iSUV90EyqnwkuxmvopiBgtQe8jYc lGxiObP3+ltMDHdYCF2EvM7oedPvCOyDtigXlkQR0slzPyDqhUDxmVFElLDSSCy3jk cVY9xFCSnZ93b38O8XRZGp+lmwV2XEXE7QnpRcNo= 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 277/348] iio: light: isl29125: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Mon, 12 Jul 2021 08:11:01 +0200 Message-Id: <20210712060740.425972294@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 3d4725194de6935dba2ad7c9cc075c885008f747 ] 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: 6c25539cbc46 ("iio: Add Intersil isl29125 digital color light sensor driver") Signed-off-by: Jonathan Cameron Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20210501170121.512209-18-jic23@kernel.org Signed-off-by: Sasha Levin --- drivers/iio/light/isl29125.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.30.2 diff --git a/drivers/iio/light/isl29125.c b/drivers/iio/light/isl29125.c index e37894f0ae0b..15906925e588 100644 --- a/drivers/iio/light/isl29125.c +++ b/drivers/iio/light/isl29125.c @@ -51,7 +51,11 @@ struct isl29125_data { struct i2c_client *client; u8 conf1; - u16 buffer[8]; /* 3x 16-bit, padding, 8 bytes timestamp */ + /* Ensure timestamp is naturally aligned */ + struct { + u16 chans[3]; + s64 timestamp __aligned(8); + } scan; }; #define ISL29125_CHANNEL(_color, _si) { \ @@ -184,10 +188,10 @@ static irqreturn_t isl29125_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: