From patchwork Mon Jul 12 06:10:23 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: 472974 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2683397jao; Mon, 12 Jul 2021 00:24:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZSpDTrp+uiJ9efgmAGs2jd/vZbzy3NyB98T+mCuzBOuolKTKVhwFs9eSMOrJHA1g/jy2/ X-Received: by 2002:a17:907:7808:: with SMTP id la8mr51845050ejc.13.1626074645257; Mon, 12 Jul 2021 00:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626074645; cv=none; d=google.com; s=arc-20160816; b=xSNN9exxcdUT0tYY9fDFA3fBC7inqiST7lAP4pRzpQkCAkZvKEVUP532lc2zXBIN87 T32rhHk0ngi6DURTkoP0+scmTSqIV92EMRYdYV8R8mHaVcY1lpbd2R12DGcJcANF9Hl4 7W42lfydXjbgrq7JFJwYVznLf4p/mE7FGPBeo58ukK/vWcYYgaOD5GeCR1HA56l4SV8H ivhQF0bQ0H55m6CxYi3tnsjo6vmWl1BcsRc1NmDNtmqEPk0DcLjTvmzAmmrK7fxEdvqx b+9NWxVyrGSEhCuokBg0pzkJ0YVqKfVPYJzZEVyhCk4jWlUJ7dmB2UENebx3y4SKjQcH 8jPA== 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=P4vq8jXRQ/R5fF7qhjCpIDb1WMtzMnfatzHAWquRS6qL/Ph0B1dZ9uFYEPu0GIwq2x LjkoD3KZFTHZgp5aWxX5XX9ivYcqp96p/1+X6oK63rV8qtdTNIeuqC9pEFgdiK4gGFkF b+7jPEo/W1uoTyeVathHbnqFVbo9uLGfC5ngOYVt+ZhdKWeVVjAtUq/JfdrpLMdKseD0 d/Qy42avackkSYRToXHwXBALUau5XKhnZLMZq0CaLXIxyWyPbdsGOWA1U8DVq9f0rIzf RuohqMiTvq/Ic8hUTSQnE1iK5AfQxv7EQqC/76aFVENkFBjS3nrc37A+kCv9btFV3mez gJog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0O396TM2; 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.24.05; Mon, 12 Jul 2021 00:24:05 -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=0O396TM2; 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 S241931AbhGLH0P (ORCPT + 12 others); Mon, 12 Jul 2021 03:26:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:35256 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239850AbhGLHXf (ORCPT ); Mon, 12 Jul 2021 03:23:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AE59E613D8; Mon, 12 Jul 2021 07:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626074447; bh=0vtx1rzit57snHuBv4JPMsOTKelZthfIUK7q67ljMk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0O396TM2SMW7KnYuLTtk+zESvCA61+VEL9jFHdyr5/xqsnDhWepstRHEm8ke72mEW +HuqDAXpA0tdlyXcefQrBSfyV/0k9ch0er8WICZZ2d4yOdUI3K5G4T7tgirRcQRWSN jLBRpaBTHJIjdntTramHVCB3p2qb/gR+EzuG5N0E= 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.12 540/700] iio: adc: vf610: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Date: Mon, 12 Jul 2021 08:10:23 +0200 Message-Id: <20210712061033.833321926@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 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