From patchwork Mon Jul 12 06:10:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 472911 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2661413jao; Sun, 11 Jul 2021 23:51:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHcpb6rXL8ZacbwUMeW2x3t84QC8noCMGYSWCsWeRz/TXsRpfmXpd/mJc/XqMieCVKnA82 X-Received: by 2002:a17:906:3e8a:: with SMTP id a10mr50553745ejj.479.1626072619537; Sun, 11 Jul 2021 23:50:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626072619; cv=none; d=google.com; s=arc-20160816; b=ZIBuRTM7totxiExHAybYn+yoo8s7oySzB1DztCq7yjf9x0+tE583ve7ZEcRbMZ4ybQ pU7YKTvkwI73EEBYSsdDGXylFHVG11vp/AlrtQkoPLd/LAVZKgloYpUxN77MGXTdUF1l d28QE8HTCiydyH2oKpIMhDvVZp6+6aFQarIGETySp3yjVeHPGjIlQHTYckp7THcZ0p5i KLzEJ4WpXPVWz6tX0fa1O+mbE571mhPt2nGFOWrVPnK4G0DKz+mU2H8yMWrwVyMMxNsZ yweM1cpx9O+hAHALbLN2MG5fRhIwfvQpDMTxJzO19n+V4CLEs/byfJ1HL9pvdcjUA2kK 8j+A== 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=g9cuUdzTQ4TWnHOaZsAEL62l81I1IrHxEHRHaKU+PmQ=; b=r47RY1QYS92+orqcF0wIwYGBJ1EkdL07RoxgfP/YfpdrAwl5RCqPuqL8qkR96gizmA UTW6cb/W55e5fWD01/hT9vN56ziTzBM0nB/2FvLzwqUQO049n7R+i8aE5BIzl1LXAHRk Y2OwKq+9F/V4Ci/+ez9YGPGNae0McYCAmyEgzGEg35sa+OpT70FMftpafBQiZQS49j3I 2Ht0q6ywCMkzAlP/ySyfAdTwp7BuoogTe5Q0o0fuUpvxR88StkpGq2l7CxkAwCee9Q7U d4wjNoiBJAr8Ly5SVb+iZwKuOqazPZeDmbgy7WD0BEhdlIhB2ftV5DvxRJV+bvnw3/SO tKPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D92ZZQmS; 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 r25si3440466edp.437.2021.07.11.23.50.19; Sun, 11 Jul 2021 23:50:19 -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=D92ZZQmS; 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 S238551AbhGLGwX (ORCPT + 12 others); Mon, 12 Jul 2021 02:52:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:46964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239042AbhGLGt1 (ORCPT ); Mon, 12 Jul 2021 02:49:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C75FD61221; Mon, 12 Jul 2021 06:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626072333; bh=0vtx1rzit57snHuBv4JPMsOTKelZthfIUK7q67ljMk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D92ZZQmSleVQF+nsggXPNSDXjmbSfIX6eAY6xCozESPQ27oRLqEtPquqjPavI8aO3 9e09g7K7Ea4iDCPzfxpa1ADl/qgeVs+8Jt7Os9sSLksR4eO1gIXDJh8nFnhcV3NwSv 35pG2+a/hPj9iWMjMfv/vaHbUCMs2GMDyFS/qYYk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Stefan-Gabriel Mirea , Sanchayan Maity , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.10 453/593] iio: adc: vf610: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Mon, 12 Jul 2021 08:10:13 +0200 Message-Id: <20210712060939.175443067@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060843.180606720@linuxfoundation.org> References: <20210712060843.180606720@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 7765dfaa22ea08abf0c175e7553826ba2a939632 ] 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: 0010d6b44406 ("iio: adc: vf610: Add IIO buffer support for Vybrid ADC") Signed-off-by: Jonathan Cameron Cc: Stefan-Gabriel Mirea Cc: Sanchayan Maity Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20210501170121.512209-10-jic23@kernel.org Signed-off-by: Sasha Levin --- drivers/iio/adc/vf610_adc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.30.2 diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c index 1d794cf3e3f1..fd57fc43e8e5 100644 --- a/drivers/iio/adc/vf610_adc.c +++ b/drivers/iio/adc/vf610_adc.c @@ -167,7 +167,11 @@ struct vf610_adc { u32 sample_freq_avail[5]; struct completion completion; - u16 buffer[8]; + /* Ensure the timestamp is naturally aligned */ + struct { + u16 chan; + s64 timestamp __aligned(8); + } scan; }; static const u32 vf610_hw_avgs[] = { 1, 4, 8, 16, 32 }; @@ -579,9 +583,9 @@ static irqreturn_t vf610_adc_isr(int irq, void *dev_id) if (coco & VF610_ADC_HS_COCO0) { info->value = vf610_adc_read_data(info); if (iio_buffer_enabled(indio_dev)) { - info->buffer[0] = info->value; + info->scan.chan = info->value; iio_push_to_buffers_with_timestamp(indio_dev, - info->buffer, + &info->scan, iio_get_time_ns(indio_dev)); iio_trigger_notify_done(indio_dev->trig); } else