Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1753424rdb; Sat, 2 Dec 2023 08:02:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IFSj2xAf/DU0p212kWmOzyPGwH7iQtTwi4dYjplby69b+8hhP/VgGS9EWx7fwaZo6LFrH0f X-Received: by 2002:a17:90b:893:b0:286:6cc0:cae3 with SMTP id bj19-20020a17090b089300b002866cc0cae3mr874817pjb.90.1701532937555; Sat, 02 Dec 2023 08:02:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701532937; cv=none; d=google.com; s=arc-20160816; b=MgVEoTDz6GnaZeZ+KX3CicENnDrMTFXWoMNFpp47fuCQSSBBuIAiVg75oOlDoUquSS 10M4QNw6oWtTohp2QD+NrHj+WwwQpFA28UfHoNySEhuBgFxkp2zXNX3z42YSFftZ4raV vU72eNGclc0Qn1PvoiY1qC5XG3h0rzKeieQpLGvrjkuU/XXEkfzS0GiRt0lB1/Rg0uSS GEDaQP1yDMyWJjcMuDx1PkHqkbw6jMmKZxDuHsvdFJvedRTm0O3GeyUToAlhoop72wdh eK7IdWnk2pq+rD+x0g59WChzCcFy4wva4+uTDU2V2FLtJxvI+QG61CQGIRnTdlmj/rZY lkuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+zbUHE0EDF9NighZCZllGwGHM0VmtCGXJk4I5SDoYos=; fh=mgOjolbKmhzaykN+/7s8d0v0PJnjoBTpv7v/x3GkZH0=; b=eZ9wwNHHnYLBe/a6ZUYEld5fBPrH5uyLx/h5HM/DozDyt/hNGYWrpuQ90HH8xWdBJo vSPIEEy2mI5fNElnRcp2nv/JJmWGttsLs7ZGpSgqf8U2P446tx8oUSaVMJA6nnLUpt+Q 6zZnteHvJ9OiyJgj39c0YDHI9d/osqZAeg2pWjmSCQap3jk9CZ7dLeMPjr5VmPELyka1 R1Yv3zAGHueMHiviDNxRk6KzYpWCcTD2Y9bVUk9zlZ6q0XVsKagfKYI6TK9jkyf8/Qas b13Qb1PZkA82XUoqoWLnzjSsJxWrFWstTP9hBXHG2nTDtQXnuDZnBcXydaYX3jbJf8QB x91Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=uLhAajAA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=subdimension.ro Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id jj17-20020a170903049100b001d074e76f8fsi966973plb.153.2023.12.02.08.02.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 08:02:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=uLhAajAA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=subdimension.ro Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 145B28088A56; Sat, 2 Dec 2023 08:02:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232987AbjLBQBz (ORCPT + 99 others); Sat, 2 Dec 2023 11:01:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjLBQBy (ORCPT ); Sat, 2 Dec 2023 11:01:54 -0500 Received: from mail.subdimension.ro (skycaves.subdimension.ro [172.104.132.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0FEB94; Sat, 2 Dec 2023 08:01:59 -0800 (PST) Received: from sunspire (unknown [188.24.94.216]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mail.subdimension.ro (Postfix) with ESMTPSA id 1AE6628EE6F; Sat, 2 Dec 2023 16:01:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=subdimension.ro; s=skycaves; t=1701532917; bh=jB8oEC6mjeL2dllM2of5rXMFZjB7XW3eFIvJcBkpmWo=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=uLhAajAAo+TjG7a0Fh4VrOH3X3D00QY7UL9uAav0gJvvnLaWnpNacmHpqxFxUXsNE Frbs/MOfShNfXMJhQVRY7C+R6lxpcvjHqPbEgvS7fc+fTMUx6nw8y6HD1ASYgg3tru g2Q3f4/tJEmfJqzo9XwfRcH9tuoBlk7mqjnwWrWk= Date: Sat, 2 Dec 2023 18:01:55 +0200 From: Petre Rodan To: Jonathan Cameron Cc: Jonathan Cameron , linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Lars-Peter Clausen , Andy Shevchenko , Angel Iglesias , Matti Vaittinen , Andreas Klinger , Rob Herring , Krzysztof Kozlowski Subject: Re: [PATCH v3 2/2] iio: pressure: driver for Honeywell HSC/SSC series pressure sensors Message-ID: References: <20231126102721.15322-1-petre.rodan@subdimension.ro> <20231126183334.625d2d8b@jic23-huawei> <20231201182453.00005673@Huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231201182453.00005673@Huawei.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sat, 02 Dec 2023 08:02:11 -0800 (PST) Hello! On Fri, Dec 01, 2023 at 06:24:53PM +0000, Jonathan Cameron wrote: > > > > +static int hsc_spi_probe(struct spi_device *spi) > > > > +{ > > > > + struct iio_dev *indio_dev; > > > > + struct hsc_data *hsc; > > > > + struct device *dev = &spi->dev; > > > > + > > > > + indio_dev = devm_iio_device_alloc(dev, sizeof(*hsc)); > > > > + if (!indio_dev) > > > > + return -ENOMEM; > > > > + > > > > + hsc = iio_priv(indio_dev); > > > > + hsc->xfer = hsc_spi_xfer; > > > > > > Also, pass the callback and spi->dev into hsc probe. Easy to use > > > a container_of() to get back to the struct spi_device *spi > > > > I'd rather simply pass along the client struct. > > > > I don't like the fact it has to be a void * > > The core code has no idea what is in there. At least we constraint it > somewhat with a struct device. but ... that is the nice part. the core code never needs to know what exactly is behind that pointer, since it only gets used by the i2c/spi module that provided that pointer in the first place. I've never seen a better use of void * :) I could define a struct client_handle; in the .h, use a pointer to that that as function argument, do a lot of castings, but I feel like it's still a void * with extra steps. cheers, peter