From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15DA7C433ED for ; Sat, 1 May 2021 17:26:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D9012613B0 for ; Sat, 1 May 2021 17:26:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231629AbhEAR13 (ORCPT ); Sat, 1 May 2021 13:27:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:33140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231517AbhEAR13 (ORCPT ); Sat, 1 May 2021 13:27:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 60D56610EA; Sat, 1 May 2021 17:26:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619889998; bh=Z/8J3tEtnPmliYVnE6MzXaXCcUrw/IkcYjBD0EHp5ks=; h=From:To:Cc:Subject:Date:From; b=R89U2hQE516++iFOnmwo5LblofbRgmOHgJFekv/Xzc+4Tt8cTE94GbTtbji6WIeJh ljRbkL1qZ5t4KW2eRKA7ZBkROj42v84z5GffVxH7WWH/wYTzCWeCbnt+qaEEWOz1G6 kCW3xDNHdg8/F9+101d8J9eR/MZerYp/eulcd73ju8UiQ0Q3g+grRVY1C8UpToTnuL 2KLo1aNFzTI1g6HWpG6BzKLv+p94o77DfEsiyaVpSpsJbdUZ/kpBAMGMlu3uppCBs8 wqdNzagA5sr1vNxdzLFClTGGdvL7Attfn0100DxH43BndYYxn/w2L3M4EnVMFn1jp/ SmxR9PfHERliw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Jonathan Cameron , Jan Kiszka , Linus Walleij , Nuno Sa Subject: [RFC PATCH 0/4] IIO: Alignment fixes part 4 - bounce buffers for the hard cases. Date: Sat, 1 May 2021 18:25:11 +0100 Message-Id: <20210501172515.513486-1-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron I finally got around to do a manual audit of all the calls to iio_push_to_buffers_with_timestamp() which has the somewhat odd requirements of: 1. 8 byte alignment of the provided buffer. 2. space for an 8 byte naturally aligned timestamp to be inserted at the end. Unfortunately there were rather a lot of these left, but time to bite the bullet and clean them up. As discussed previous in https://lore.kernel.org/linux-iio/20200920112742.170751-1-jic23@kernel.org/ it is not easy to fix the alignment issue without requiring a bounce buffer. This final part of the 4 sets of fixes is concerned with the cases where bounce buffers are the proposed solutions. In these cases we have hardware that reads a prefix that we wish to drop. That makes it hard to directly read the data into the correct location. Rather than implementing bouce buffers in each case, this set provides some magic in the core to handle them via a new function. iio_push_to_buffers_with_ts_na() - non aligned Note this is totally untested as I don't have suitable hardware or emulation. I can fake something up in the dummy driver or via QEMU but I definitely want both eyes and testing on this series! Cc: Jan Kiszka Cc: Linus Walleij Cc: Nuno Sa Jonathan Cameron (4): iio: core: Introduce iio_push_to_buffers_with_ts_na() for non aligned case. iio: adc: ti-adc108s102: Fix alignment of buffer pushed to iio buffers. iio: gyro: mpu3050: Fix alignment and size issues with buffers. iio: imu: adis16400: Fix buffer alignment requirements. drivers/iio/adc/ti-adc108s102.c | 11 +++++----- drivers/iio/gyro/mpu3050-core.c | 24 ++++++++++----------- drivers/iio/imu/adis16400.c | 20 ++++++++++++----- drivers/iio/industrialio-buffer.c | 36 +++++++++++++++++++++++++++++++ include/linux/iio/buffer.h | 4 ++++ include/linux/iio/iio-opaque.h | 4 ++++ 6 files changed, 76 insertions(+), 23 deletions(-) -- 2.31.1