Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3633828rwb; Sat, 12 Nov 2022 09:21:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf7rwTFY1nPv3dwM2MSKVVeXLESv9SqFsjzfK+mnwg6yHhVbw66aFduuGqM2bU30cDWrPUTC X-Received: by 2002:a17:90a:b894:b0:200:a7b4:6511 with SMTP id o20-20020a17090ab89400b00200a7b46511mr6944016pjr.101.1668273710440; Sat, 12 Nov 2022 09:21:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668273710; cv=none; d=google.com; s=arc-20160816; b=bJTjqePVc8keapsVpnXFu0g0gEmNvlTU1FYA+AsIbU6AvK1DMfjPySbhlx9T3vCyp0 47k75D55Fl/Sfk3JP5j2JfQvM7Qwl+lwwMSKPANzdkmCYwLZtL4TKe9KIDSLV+KaRJ18 1cAjNBYaMkXyKNJPDcQkKdPzrA7S3FpWWWccecSIcucPLFc6sz1kcumLk0tWnKk+aOlL 16CzIKrUNUVftmq3aYFzXrU8UCGZJBK4aI+hhSWxl8lXWJfOh2dkWlnYR8gyE7UeBRMa cgK4/qqf18FORfcjC4VY/WKJPignQ8pYtadoBHc5M6A9LXD2nF95GnNomUZPIYFKm62K VkJA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=/3KlAFfv7ytu4V6y3lopyF4MlgYKb80awXLcLt7EOS4=; b=H1He49DlFEXiNR46CFZJbUE5K+34aGrQ6jePyYqdyzD6DxADOxiMWD7863SY+G9Esd nwzUrISDniepxNPw66Y1ZMp1I42mrsRX5Gdg5DsffnrII1hVuSWiykr9RxrX5LL+4TRX iLV0kJPwZ83Gha+YAZkLNWGJEmFrNKI1odl81RgphPZPRwxRs34e2RrwqKyLOJMr/Fz6 SHXnosS5k01TEH1F42NBfai5Sl9igMgFNVislinm6HmH86VwQnvTRF3LQQT1j7CosdWc ZNA1GCkk96q4DnSxKCc5A8E23lhjmkdXYwLAA0TSgrHgdqORTlcxi7ALUsg/EWnpiYEP s11g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rr8x0S3u; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v21-20020a63d555000000b0046ae2a99bc3si5551549pgi.357.2022.11.12.09.21.37; Sat, 12 Nov 2022 09:21:50 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=Rr8x0S3u; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234982AbiKLQil (ORCPT + 90 others); Sat, 12 Nov 2022 11:38:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234974AbiKLQii (ORCPT ); Sat, 12 Nov 2022 11:38:38 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E649E13FBD; Sat, 12 Nov 2022 08:38:36 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 82D8860C02; Sat, 12 Nov 2022 16:38:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 758F2C433C1; Sat, 12 Nov 2022 16:38:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668271115; bh=KEiKqzioFQGruCHYGHrlQ43igNpeASPP8FviAOa/NZM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Rr8x0S3uFDthtVzGeycWVrrgBqYy+QwCgAUyOeZb9hJisjSEHuqIcDE69dk9Tj8ku Qk/fGQbT37XgGL1E5XUTpGstaTF85HGQzWn7BLe7Kfioq7H4f6YOOfcxpVbJ3yGNuS NWvvR12jEB0tETWqFH+4VM9Y0/9eDr+SarieuNJqzyXMpi/oXwqnN8ebgAoagV/qPJ 8YPDx7wUS21Yv8sMg8ZgX7iYioZbDxVy9dpO6vtDCqatacu+VQvARvRlgk3SGkr/yC 6l2xr3RluoVFTR6oB7H2UOQThfkqunUgJJSJkrcvTaYLrG2JZDFwq5KIGWIZ8VBDJI vQDayv/ZL1zvw== Date: Sat, 12 Nov 2022 16:50:49 +0000 From: Jonathan Cameron To: Rasmus Villemoes Cc: Cosmin Tanislav , Lars-Peter Clausen , Michael Hennerich , devicetree@vger.kernel.org, Rob Herring , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/5] iio: addac: ad74413r: add spi_device_id table Message-ID: <20221112165049.51a5f391@jic23-huawei> In-Reply-To: <20221111143921.742194-2-linux@rasmusvillemoes.dk> References: <20221111143921.742194-1-linux@rasmusvillemoes.dk> <20221111143921.742194-2-linux@rasmusvillemoes.dk> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Fri, 11 Nov 2022 15:39:17 +0100 Rasmus Villemoes wrote: > Silence the run-time warning > > SPI driver ad74413r has no spi_device_id for adi,ad74412r > > Signed-off-by: Rasmus Villemoes > --- > drivers/iio/addac/ad74413r.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c > index 899bcd83f40b..37485be88a63 100644 > --- a/drivers/iio/addac/ad74413r.c > +++ b/drivers/iio/addac/ad74413r.c > @@ -1457,12 +1457,20 @@ static const struct of_device_id ad74413r_dt_id[] = { > }; > MODULE_DEVICE_TABLE(of, ad74413r_dt_id); > > +static const struct spi_device_id ad74413r_spi_id[] = { > + { .name = "ad74412r", .driver_data = (kernel_ulong_t)&ad74412r_chip_info_data }, > + { .name = "ad74413r", .driver_data = (kernel_ulong_t)&ad74413r_chip_info_data }, > + {}, Trivial, but prefer not to have a comma after a "NULL" terminator like this. It would never make sense to add anything after it in the array. Now you are matching existing driver style, but I'd still rather not see more instances of this added. Also, driver_data is not currently used. It should be because adding this spi_id table means the driver can be probed via various routes where device_get_match_data() == NULL. Hence, alongside this change you need to have a fallback to cover that case. Something along the lines of... st->chip_info = device_get_match_data(..); if (!st->chip_info) { struct spi_device_id *id = spi_get_device_id(); if (!id) return -EINVAL; st->chip_info = (void *)id->driver_data; //or better yet cast to the correct type I'm just too lazy to look it up ;) if (!st->chip_info) return -EINVAL; } > +}; > +MODULE_DEVICE_TABLE(spi, ad74413r_spi_id); > + > static struct spi_driver ad74413r_driver = { > .driver = { > .name = "ad74413r", > .of_match_table = ad74413r_dt_id, > }, > .probe = ad74413r_probe, > + .id_table = ad74413r_spi_id, > }; > > module_driver(ad74413r_driver,