Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1023225lqo; Sat, 11 May 2024 04:27:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUc/Gz+JEn58q+f+wlNfsl9Nz3c7WmeHSoTNpkw1vhlePpReD6HO3mgwXfOnfA4zAYgFXr2P6HBju5OCxQ4wZH8N1N+4IGbviqS7DUsTw== X-Google-Smtp-Source: AGHT+IHHxwDFR8BmXMjpoWiuAA0JooxU3FNt5YoWNH/s55NJprvB8BjfDZBl18z2DqgyER9XlgfC X-Received: by 2002:a17:902:daca:b0:1ec:8607:5f11 with SMTP id d9443c01a7336-1ef43c095e5mr89872765ad.14.1715426856814; Sat, 11 May 2024 04:27:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715426856; cv=pass; d=google.com; s=arc-20160816; b=lUTbPrmcSU3HeVnWmjqqbx85BW0owQHZmml3e/eINpRiUwJT0Z5Sqx+hdpEKPDxLav CGisC7LNmbRRfAo0oi4WJ98xJkTtuCXO9bivy48MB75BN3fBB6yXIdIEuzIh0mKIcgXR S71wxIDReHWwbWfaEYMLxmHbS+bKa6PFOV30bZZbzVaL3S2+Y1LhcLG39Ehf50HgHTaQ FNHA22QiSOy1SPX9UsN/vrOR2sPI1PVoJgsokGdKD3387i6FheUCMw6t8U4rwF3VkJ3A 3nHOPDC9v+pRQBBfyJVZgKHWs9tRn3SWrtUrDfreOlU1nZQv/G11LRVJrQbJxJjSfe9y XfLQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=2zYI49fwSrSjnPth7/Y6yET+IBoVH/YzfaiK8q4Aq30=; fh=OlNk4yTUPK+x2ge/7NnYYDDY0UP12rdA9/pOWfMrUcg=; b=f2D2iYlpfHTpx+IAVtCTrsctCth2Qwjtfk2xwGbVeThss5H0taFTLuNYQzv/q7+ZGX wzJ+2aCw7AGh6mLCwHSwR5jorG4hsyhpm0R5Ds04TXz3tVXQeQjm1601QxRTncPpjPie yAg65Fiu45x355TulO2jis6oq41jg8xgdD8DxtK+03BHw6QmxsU64+3cA9USZNAXcMQO KVxvB//7NdOxzJQcl7ltFHLksm1aBxcW5st9XUgCj0pUKLzaCuKbWF/9JGBy2gSLWJr/ 3VcqIG4LMt5j1cGiJ509O+1lcoMn12xpujZvJEFp3ZzG0uZ9rVHGIKCIER2u9dLu9dxh wmNg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o2GkE73F; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-176505-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176505-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0bf32c2bsi52978585ad.316.2024.05.11.04.27.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 04:27:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176505-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o2GkE73F; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-176505-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176505-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 3C388B21060 for ; Sat, 11 May 2024 11:27:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D7D0F55782; Sat, 11 May 2024 11:27:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="o2GkE73F" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F14822F26; Sat, 11 May 2024 11:27:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715426844; cv=none; b=t0eCiPscx7b/kAAJRhM3nUtC1YWMa4dwNLjI4hWzBL4QHZo/iaWsAlu3P6PkpgnT6v8x31m9F+cEoJZzOVuO08m7lVQzUhgBw4Vt+onS3oJYwG0mKczBolYrWSbs8cTv+L16lAOr2raO6DV1yMdRgMXylilC8tTcbdNfWQmE7zo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715426844; c=relaxed/simple; bh=cLCZ4jToTqkciTsy8QBqqHWI/zM1DZ9FtzabW+MzE48=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qL5rti8acOoyG3ujyEu7SDFkIzXzTg90EOBBTwm/1YiqRujrhwdW4VNfPW2Jza4bVun90hsMDRDWnDZEX+PQVdOlzFuGs/bELZ4SS8/QKczlwipVYSxDvAlEV3n94+L4o0mjiUJRZTpsg6sC/ltSDt8OWSUiK23jSmMRYL2HF7Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=o2GkE73F; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FC6BC2BBFC; Sat, 11 May 2024 11:27:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715426843; bh=cLCZ4jToTqkciTsy8QBqqHWI/zM1DZ9FtzabW+MzE48=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=o2GkE73FrAa/+XpTYJt769JLx61wNiPupSK/TSVabLktm7Y1yWVICyXwKBuWRZFEB Gvuh7khf85hCHpGHrhiM9idlCTh8gXErvNGRw/tXNzKwVh4RTEzaE5vfNuAYMGhBWd 2XQ5y3yPydVXdH+W6dLNMnKQxojBHGrS34FKfzks5QWrsaJEmgGkgpP82EWjsk2/qf KoRWzeytA0mIIAphSCuxi1hfow9NEMRQtmcd1tg1pkrpkhf9e5QY/VYnzi3Noe4lEH fiv3MqYSislw5yrsWsvp4G7g3gZ1QQtLxxCxSJzX+JlKd3zihZUwygJcITMS0zhKd6 87fiD6Sx9Cdxw== Date: Sat, 11 May 2024 12:27:08 +0100 From: Jonathan Cameron To: Ramona Gradinariu Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, robh@kernel.org, nuno.sa@analog.com Subject: Re: [PATCH 7/7] drivers: iio: imu: Add support for adis1657x family Message-ID: <20240511122708.68fac075@jic23-huawei> In-Reply-To: <9f0a8fdb-dd34-4a53-948d-d4ed0410de6f@gmail.com> References: <20240426135339.185602-1-ramona.bolboaca13@gmail.com> <20240426135339.185602-8-ramona.bolboaca13@gmail.com> <20240428154523.17b27fa8@jic23-huawei> <9f0a8fdb-dd34-4a53-948d-d4ed0410de6f@gmail.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 8 May 2024 17:32:34 +0300 Ramona Gradinariu wrote: > Hello Jonathan, > > Some explanations from my side. > > >> @@ -437,6 +467,130 @@ static int adis16475_set_filter(struct adis16475 *st, const u32 filter) > >> return 0; > >> } > >> > >> +static ssize_t adis16475_get_fifo_enabled(struct device *dev, > >> + struct device_attribute *attr, > >> + char *buf) > >> +{ > >> + struct iio_dev *indio_dev = dev_to_iio_dev(dev); > >> + struct adis16475 *st = iio_priv(indio_dev); > >> + int ret; > >> + u16 val; > >> + > >> + ret = adis_read_reg_16(&st->adis, ADIS16475_REG_FIFO_CTRL, &val); > >> + if (ret) > >> + return ret; > >> + val = FIELD_GET(ADIS16475_FIFO_EN_MASK, val); > >> + > >> + return sysfs_emit(buf, "%d\n", val); > > As below, might as well put the FIELD_GET() in the sysfs_emit rather than > > writing the local parameter. > > In all instances where I did, I did it to avoid casting. v2 inlines the values and > the cast is needed to avoid compilation errors. I'd guess that is because the type in the sysfs_emit isn't the same as FIELD_GET() returns? That will correspond to the type of the ADIS16475_FIFO_EN_MASK which is defined as UL I think. So just use %lu here instead and need to cast goes away. > > > > >> + if (adis->data->burst_max_len) > >> + burst_max_length = adis->data->burst_max_len; > >> + else > >> + burst_max_length = burst_length; > >> + > >> + tx = adis->buffer + burst_max_length; > >> + tx[0] = ADIS_READ_REG(burst_req); > >> + > >> + if (burst_req) > > If !burst_req does the rest of this do anything at all? > > If so flip the logic as > > if (!burst_req) > > return adis16475_push_single_sample(pf); > > > > the rest... > > return spi_sync(adis->spi, &adis->msg); > > The update is needed even if burst_req is false. The adis message has to be updated > based on the burst request value, which is then used either in > adis16475_push_single_sample or in spi_sync call. Which update? The content of tx[0]? If so that is non obvious so definitely need a comment. Perhaps even wrap up the update in a function with a name that makes it clear it's changing the adis->msg. adis_update_msg_burst() or something like that. > > > > > > >> + return spi_sync(adis->spi, &adis->msg); > >> + > >> + return adis16475_push_single_sample(pf); > >> +} > >> + Jonathan