Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1453438pxb; Wed, 12 Jan 2022 15:21:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzTqx0PyJcuWoEmMQoFXLY1bXlh8TH0WvX4yjzAzZP+MPjPRlq6uasEz/pidudjc38J2Jmo X-Received: by 2002:a17:902:8306:b0:14a:306a:75f with SMTP id bd6-20020a170902830600b0014a306a075fmr1741358plb.41.1642029712122; Wed, 12 Jan 2022 15:21:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642029712; cv=none; d=google.com; s=arc-20160816; b=mhfrwowlRJaI/dASFtgCyAIzfZWljB3T/BOG3fNCQ0ppzDbzmuZR57u1FzQTVL0qP4 Iu/uogeSBRFIJ2IHQfsobDk3MAK+fEP604N5eThg3YmCKsLWdmqNlWIsq9/5nt3ja/oU NuAl6L93AeDJZb8Rjo/84Ij25wixwQQGMKrXfHib0ug7jd0UQKy1lEiZprAdRpy7mX41 9eDgb9RBL9IjaOOZrzB1xHnGD/zlcr6GEaXQAyUn2DslvegqVF3aSXEiq8PHN5OkwDZj HRudnjVl9R4B+UjSd/0K2iH1+bFUkd21F9+fZ+7awBmqDSPkfj4PZ+GrlRCX7nbyBtgJ SjUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=swEbmnyLSeN7aiIoLnsPgDG3gh2KSMSrPSEJTJTzFbQ=; b=TqhfTbM2UeO2AMvcGKiR8bjndQyi39qr7v9C70mJYyuk1LruSF2hKdi6rht7brAwPt uVYM6d6CrpU7za20qZMdYZqRlj1sBleUrH7/FTM26FSGQKFmE9UVuvXEOihlgGeP2Mtd LwvLeDpoHM3CB+GwVUKJRwTdX819DLjoLaQS5zeszA5yy6Ct0vfhGoZMxNiwhIJ50jg3 V++COrlfr0UbWDCLs/QCJMta+UXp9T3fNqtZxJausiOBWSXVbTFEZWabPeHeOLmRDO0C Ym9FYBiHfqa8H0DAv0aXv8oEk+ea5mMUitBqQaqYi5AS7Cf2HfbGLFZuVbbEnDxBfM1C 7ZIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lvkw4cRK; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h16si1516186plf.356.2022.01.12.15.21.42; Wed, 12 Jan 2022 15:21:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lvkw4cRK; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354409AbiALPEh (ORCPT + 71 others); Wed, 12 Jan 2022 10:04:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348028AbiALPEf (ORCPT ); Wed, 12 Jan 2022 10:04:35 -0500 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9D07C061748 for ; Wed, 12 Jan 2022 07:04:34 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id k21so9345834lfu.0 for ; Wed, 12 Jan 2022 07:04:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=swEbmnyLSeN7aiIoLnsPgDG3gh2KSMSrPSEJTJTzFbQ=; b=lvkw4cRKCOzBKAPvoz7fYi4Ww+7YlPfKoAgKVLsIgKF1EJ+8wEQe6UxECLKYwzDnLE B6oDSef20ebGk9u85lnz7rEBAUMWRtwpyuCT7L5tzcrfQOz8wh7TZ2HKYlneuRS6vvZL 2mzMh6se/ObK3+x60YBQABVSeb3VrI4eHRc1v7BRB2NV0kOKjry5g7lgbvmVmJtVueJ9 KnDoZbh+45MmI7u5fj7DHOebV2iwZmI1uYwa1RpTgz0hD3M/CnW+fBXsXOOTtlYGu/16 A5HG6WxtCNk9V2MKJTFdEJHaI/4RRxI0j/0ly6jrKbitmexN4vjhY8socp2Bkpl/gWCl FZYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=swEbmnyLSeN7aiIoLnsPgDG3gh2KSMSrPSEJTJTzFbQ=; b=DnZrnKv5vKV3jrcsWmuF7iNHlC1bI1w6fUFhb+QoSyrKJU9ooFBWjn6hoTJSbPw2hz EQgrbzrz9VTQJ13L+ffkhD0CGrU2SNbwy/b1b9dK3TOvJCLqXE5Pa+U0c6fXqg+ZH8cv xrMTDwk3GBOBSIl7YUHd5S328ttidijP27Z6zTO8Mbm+mO5pQucaL/c/uVI/qjAleKWS Ftcw7WyvvkRyVgO7agC+zuU3pl55ROSXkIY7pioUsNYGKOks5Twljzs8SNVSeaaSUE/U v7r/0HTdXCkxRoqJKFRC7KREUw9tcxL9/rHTku2nWFBLRpCbbiMA9Ie1fOITgmlk4sNm epvQ== X-Gm-Message-State: AOAM533KAz3h/dvU4lnLLdTvJuA1mAk0Y9m+xGdPD6HAla6Pvt6WW/BA 2RvRDCAJ4TbCp0Ozcq26BMsMEqsrpU9vosYApBDTmsMS0t/3z39t X-Received: by 2002:a19:6748:: with SMTP id e8mr118080lfj.358.1641999873143; Wed, 12 Jan 2022 07:04:33 -0800 (PST) MIME-Version: 1.0 References: <20220111171424.862764-1-Jerome.Pouiller@silabs.com> <20220111171424.862764-9-Jerome.Pouiller@silabs.com> <20220112105859.u4j76o7cpsr4znmb@pali> <42104281.b1Mx7tgHyx@pc-42> <20220112114332.jadw527pe7r2j4vv@pali> In-Reply-To: <20220112114332.jadw527pe7r2j4vv@pali> From: Ulf Hansson Date: Wed, 12 Jan 2022 16:03:56 +0100 Message-ID: Subject: Re: [PATCH v9 08/24] wfx: add bus_sdio.c To: =?UTF-8?Q?Pali_Roh=C3=A1r?= , =?UTF-8?B?SsOpcsO0bWUgUG91aWxsZXI=?= Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Kalle Valo , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , "David S . Miller" , devicetree@vger.kernel.org, Rob Herring , linux-mmc@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Wed, 12 Jan 2022 at 12:43, Pali Roh=C3=A1r wrote: > > On Wednesday 12 January 2022 12:18:58 J=C3=A9r=C3=B4me Pouiller wrote: > > On Wednesday 12 January 2022 11:58:59 CET Pali Roh=C3=A1r wrote: > > > On Tuesday 11 January 2022 18:14:08 Jerome Pouiller wrote: > > > > +static const struct sdio_device_id wfx_sdio_ids[] =3D { > > > > + { SDIO_DEVICE(SDIO_VENDOR_ID_SILABS, SDIO_DEVICE_ID_SILABS_WF= 200) }, > > > > + { }, > > > > +}; > > > > > > Hello! Is this table still required? > > > > As far as I understand, if the driver does not provide an id_table, the > > probe function won't be never called (see sdio_match_device()). > > > > Since, we rely on the device tree, we could replace SDIO_VENDOR_ID_SILA= BS > > and SDIO_DEVICE_ID_SILABS_WF200 by SDIO_ANY_ID. However, it does not hu= rt > > to add an extra filter here. > > Now when this particular id is not required, I'm thinking if it is still > required and it is a good idea to define these SDIO_VENDOR_ID_SILABS > macros into kernel include files. As it would mean that other broken > SDIO devices could define these bogus numbers too... And having them in > common kernel includes files can cause issues... e.g. other developers > could think that it is correct to use them as they are defined in common > header files. But as these numbers are not reliable (other broken cards > may have same ids as wf200) and their usage may cause issues in future. > > Ulf, any opinion? The sdio_match_device() is what is being used to match the device to its sdio_driver, which is being called from the sdio_bus_type's ->match() callback. In regards to the DT compatible strings from a drivers' .of_match_table, that is currently left to be matched by the sdio driver's ->probe() function internally, by calling of_driver_match_device(). In other words, I think what Jerome has suggested here seems reasonable to me. Matching on "SDIO_ANY_ID" would work too, but I think it's better with a poor filter like SDIO_VENDOR_ID_SILABS*, rather than none. An entirely different and new approach would be to extend sdio_match_device() to call of_driver_match_device() too. However, in that case we would also need to add a new corresponding ->probe() callback for the sdio_driver, as the current one takes a const struct sdio_device_id, which doesn't work when matching on DT compatibles. > > Btw, is there any project which maintains SDIO ids, like there is > pci-ids.ucw.cz for PCI or www.linux-usb.org/usb-ids.html for USB? > > > > > +MODULE_DEVICE_TABLE(sdio, wfx_sdio_ids); > > > > + > > > > +struct sdio_driver wfx_sdio_driver =3D { > > > > + .name =3D "wfx-sdio", > > > > + .id_table =3D wfx_sdio_ids, > > > > + .probe =3D wfx_sdio_probe, > > > > + .remove =3D wfx_sdio_remove, > > > > + .drv =3D { > > > > + .owner =3D THIS_MODULE, > > > > + .of_match_table =3D wfx_sdio_of_match, > > > > + } > > > > +}; > > > > -- > > > > 2.34.1 > > > > > > > > > > > > > -- > > J=C3=A9r=C3=B4me Pouiller Kind regards Uffe