Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4498716rwb; Mon, 8 Aug 2022 01:55:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Uvwy2WikjXI9Ydnm3+l4Yxtz8hCQOY7gtyzMQ/XGOlVyYrD2Sqsg/GRHyPSMVyLFhX9qU X-Received: by 2002:a17:906:4fd0:b0:72e:dd6c:1b95 with SMTP id i16-20020a1709064fd000b0072edd6c1b95mr13180149ejw.323.1659948942355; Mon, 08 Aug 2022 01:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659948942; cv=none; d=google.com; s=arc-20160816; b=hOR+EUk3Lrkb8VIAlA9wALWMRIWPuStNNkacd8+fJclTtB8UnEmz4z3caAEAiicrCp BSRFpGsCNoQz4k9VYA/4UGWyBDk5AvJ9RzTFliKNXcuGYlo8Dj0fxMF8UbgF1orlxC96 gzk/dXY62MHTabZsW57hzK0locBYP08qyq/wqlDezvKcyWK3mU4k63NZx2tOTCCkPwUD ukb7GdYJkGCk7qIshVOrLXKNm9Pqi3wCdlGtWCV3nAwWonyxHdkNg8tZuNK5pj7KcF+2 Q0xCqUFVdIJs558isnXCoKwdTIIrG8xUpeh3pRMaW8E2Cj/Q5wTVeSpE7Ef7twaQngGi N8+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=06U8E+kkdcGYHatHElwJVouvOAddvHNck0H9FBHDuRM=; b=XXqAq643GS1qO8bbInESz2Ukz8nla3qrSJRmx4wjvwjgg+1NDoC2t6effHEF4bAWfq cyjO+lUnvhY/FefCDX1gZyaoYdEoLMKZj+Y/f7rR8WsqtfhZaQzyn08m19fpiw5VcAN4 oeY00A9lWigtLRDS8Pb/f2V1cx4Kp/HRtj8IeBBJA3IjZpY0KcSDg5vBn7el+OOv9rmM Sush8gp/EZUH2w3w3nM33zFg60AAsHnDrUvPit84GoaTUJiNcgUhBvs5OvOM/VEwkWbX REXhrMdVcSZiXVbwcJH6x1JZNCsxETaLv9pFTwqkGJkaz7QTwoJ0P2XB7QJRP2u11HP3 wnLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cVNY3ibk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm22-20020a170907949600b00730822632e8si10384271ejc.535.2022.08.08.01.55.16; Mon, 08 Aug 2022 01:55:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cVNY3ibk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236801AbiHHIx4 (ORCPT + 99 others); Mon, 8 Aug 2022 04:53:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235395AbiHHIxy (ORCPT ); Mon, 8 Aug 2022 04:53:54 -0400 Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8352D11471; Mon, 8 Aug 2022 01:53:53 -0700 (PDT) Received: by mail-qt1-x829.google.com with SMTP id s2so6002463qtx.6; Mon, 08 Aug 2022 01:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=06U8E+kkdcGYHatHElwJVouvOAddvHNck0H9FBHDuRM=; b=cVNY3ibkN6rkAC6vUeiJw+Wz4hBi1SAlgYndgWeTy7IRaMSpSj7dW4Hc4LZGDlyzEL 9PJdwUK3ir7hkZwrBE1BYCu/QT5EcnECF1xgblRESMpFJ6yGDdZAZIfzsUfUUqW+vsGP JozX+u2h9rVyrfiT9rGTBp8Bl4abqGpRd688nJdh6Cd8FXfw+YOIa4VgbE++stO2s9+9 4cUpafXRx3pabUygbe9v+TCg3m9PJM5vxBkLh5rpYvQggbo9l48o3WNT123xH9ee+oXT gYHa2sIqWORuizyGnYKYJ1vV1+AJWgmqyVDiV3nbrAOQXOX5lOKEGzEFRCGLy+FQQxV4 ygzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=06U8E+kkdcGYHatHElwJVouvOAddvHNck0H9FBHDuRM=; b=sObTUnR742IEG8oGJSHZ8Qb3O01qeNvmeJrRffmgOFF5YDF40NOZCigBXEzlK0swmE NuKfvcHIZT5E2wwgIQKK+eLIJOMzPr+kakIt8/5zCvXVe1ep6kiJYUH5sghNYGLWuzV5 vB790KC5drBrlQL64eE8MGYb20Yo6gA0KtSIFHq8xyjJdW/jIdmskJqn1gn4TfKIQNEB 3i6j5ae+LFUjv4JWw2C2R10QoOhdYjRh3U0vhN1VWvOUhl2AbCOyVyidCfMBok4cQ//4 ZKAM9sYo/CcT1uhUlpceFXr1VUNP+8hR93dPiKYNA8IjBS8qUg2GqwXr6tV0WEmHUBLa NRhQ== X-Gm-Message-State: ACgBeo2bYbZoaanGpoGh+Cz3MR3kmfaN2gEIvSo6kwGmyrj0Bphob+E0 S3bUJJD4eNJz6UworgyPlmeWeO7t/AmwqsMLIG+FpnCbVcg= X-Received: by 2002:a05:622a:1105:b0:342:fb95:d7a with SMTP id e5-20020a05622a110500b00342fb950d7amr1856144qty.61.1659948832601; Mon, 08 Aug 2022 01:53:52 -0700 (PDT) MIME-Version: 1.0 References: <49086f5c1401d7d28ebf921a67b49f8403ddb16a.1659872590.git.ang.iglesiasg@gmail.com> In-Reply-To: <49086f5c1401d7d28ebf921a67b49f8403ddb16a.1659872590.git.ang.iglesiasg@gmail.com> From: Andy Shevchenko Date: Mon, 8 Aug 2022 10:53:16 +0200 Message-ID: Subject: Re: [PATCH v5 2/5] iio: pressure: bmp280: Fix alignment for DMA safety To: Angel Iglesias Cc: linux-iio , Jonathan Cameron , Lars-Peter Clausen , Paul Cercueil , Ulf Hansson , "Rafael J. Wysocki" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 7, 2022 at 1:56 PM Angel Iglesias wrote: > > Adds DMA-safe buffers to driver data struct to store raw data from sensors > > The multiple buffers used thorough the driver share the same memory > allocated as part of the device data instance. The union containing > the buffers is aligned to allow safe usage with DMA operations, such > as regmap bulk read calls. ... > #include > #include > #include + Blank line. > +#include ... > + union { > + /* sensor data buffer */ > + u8 data[3]; > + /* calibration data buffers */ > + __le16 bmp280_cal[BMP280_CONTIGUOUS_CALIB_REGS / 2]; > + __be16 bmp180_cal[BMP180_REG_CALIB_COUNT / 2]; > + } buf __aligned(IIO_DMA_MINALIGN); Hmm... And which field in the struct defines which of the buffers is being used? Also, do you need a non-anonymous union? > }; ... > + /* parse temperature calibration data */ Be consistent! Check all your patches for the consistency (comments, other code style, etc). ... > + calib->H5 = sign_extend32(((get_unaligned_le16(data->buf.data) >> 4) & 0xfff), 11); (It's not directly related to this change, but good to ask) Are you going to change all those masks to use GENMASK()? ... > + struct bmp180_calib *calib = &data->calib.bmp180; > int ret; > int i; > - struct bmp180_calib *calib = &data->calib.bmp180; Exactly my point given the previous patch, now you have a ping-pong style of changes: the introduced line in the series is being touched again in the very same series without any need. ... > u8 oss = data->oversampling_press; > + int ret; Ditto. -- With Best Regards, Andy Shevchenko