Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2539446rdb; Sun, 3 Dec 2023 23:26:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVffNxesMjcSm9b6X9G9tdzBVHu0boT9vYoQcM5RU3TRvvMwgxkOK1qbEyYm/EAtxgyHWJ X-Received: by 2002:a05:6358:10a:b0:170:17eb:b3e with SMTP id f10-20020a056358010a00b0017017eb0b3emr3331023rwa.40.1701674774409; Sun, 03 Dec 2023 23:26:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701674774; cv=none; d=google.com; s=arc-20160816; b=Z9fA1NcHbL8N/nKlWA1tMIMhLT8k9zJ0eTozOxljzGvGrlzZ4I9Ki7P+cae8vtyx88 Aa5kFgm5ZFpDxdk3wp9kuzrDzV76w0bbyz9NnO/KWefoDfs5X7yevCgd5JbFfqW6uosl MpRdCHR8Prjuri6Jtaz5WaZj+IAxK2oAOjsqpZ4jt+ROdAIpDlNhgzFdYdKUkYfs4tIr O1TAK8ew42ec7CKAl795dUueErwislt3rS9YjS0COFCU9TFsSMXnYQP7LrJs4us1nUA5 5yF/2L2oiDbX3rYY3JiHkjIk8u99yDLQzER0c7tSEUCs4CUdhxoIyNz9Xrr4yMMoVZwR TLhQ== 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=6Xxz1IMztyI/DW8EzDBtMH+QkyqwQ5t+SJRSYEC/SOc=; fh=p/SGz1E48p8PkBKSYlXYb5M1KcI/kJgjwlVP+sRZCI4=; b=tKzvSahRvdtoH7zbZAp+mWl/JFO3XmbJuAu6jDPhbiKc+WrirtmJN5Ip+ktDppKv+d dkArzSodKetgEULb0f3zpAZ3S4XIvP9gAEc/DaoeT/yET4RvpOa3s7HDzBka5gJbDzL+ HkWNdG9piaYlyGherPOBQ00011QK2OelHlrYJp0gsSxi2I6WB1ziok5qIM/TamvAtNxO Ox8F09gZy4uNFZeWN6bAxujx9GAhsLEEm1SlfLgrTsCBqQzizsbZfsTnNT4WKnpeAX1a H+qpTUCanYwKkvZGqW7mHe4GoGppCjJL932l55zyuL5edi8iu5AoQqHNhrDXr/rkW9pe ed5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=iD65mHNY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id u6-20020a63ef06000000b005c21538543esi3514489pgh.433.2023.12.03.23.26.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 23:26:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=iD65mHNY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id BF03E806229D; Sun, 3 Dec 2023 23:26:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229633AbjLDHYv (ORCPT + 99 others); Mon, 4 Dec 2023 02:24:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229693AbjLDHYu (ORCPT ); Mon, 4 Dec 2023 02:24:50 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24226F3 for ; Sun, 3 Dec 2023 23:24:55 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-50be3eed85aso2304704e87.2 for ; Sun, 03 Dec 2023 23:24:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1701674693; x=1702279493; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=6Xxz1IMztyI/DW8EzDBtMH+QkyqwQ5t+SJRSYEC/SOc=; b=iD65mHNYTVsaATpGhHMlCRNLFfSnxqdxPDshLNMj8FIn6q4HrsMPDzouP/sVNn+O7u CuE3d9eXxoLV7rrBLNHZnIHAmuDwHHtGpnZlc31uWuGslkLhr0FPq7E/qhpAMAgAY6e7 801yX/7aXIVD7UAd3gLgXEA4W2xc2tkIXwtHA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701674693; x=1702279493; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6Xxz1IMztyI/DW8EzDBtMH+QkyqwQ5t+SJRSYEC/SOc=; b=a8UsoMSDjiU9sX+OZvdJl2NdgCusTALU1pzd11NhGPVNzM1Azgnq0/9VFv+ixI9br4 URZYA7BJFSmfDvbub/6yIr0dI0Ket9hvBm3rRRN9qomckMJ3UY1XNbSYK3nUXcHYbppZ waf9RshP20Er9Apmv9iWGcQavoEqlHrfjoXp0F9FuPeZDdiRSLVvzlAMls82d0YIFC7e ins6vg8y0/ILKlTkPpJErfAvLrE7IN8LhOYpfXsa0jiuuGjJE+fJi+9GkQYgJrURxSka wDEbfNze+YukAo6YA9wIgTEI/Xee4P2Oi6buUDU1EzD3Q27C2B2SrL4KiermRcwYOIVO L7QQ== X-Gm-Message-State: AOJu0YxxmvYOSKuJACVz2K/bOzgT9HyB+knBAMnCMGgwoMVSrMzfNsV6 3ZroB5fOWOh9rjrc309YecF4DPWlQSz62PpW/9y9HMp+mYbKQhOCQho= X-Received: by 2002:a19:ac4a:0:b0:50b:f51a:299a with SMTP id r10-20020a19ac4a000000b0050bf51a299amr600460lfc.32.1701674693388; Sun, 03 Dec 2023 23:24:53 -0800 (PST) MIME-Version: 1.0 References: <20231128084236.157152-1-wenst@chromium.org> <20231128084236.157152-4-wenst@chromium.org> In-Reply-To: From: Chen-Yu Tsai Date: Mon, 4 Dec 2023 15:24:42 +0800 Message-ID: Subject: Re: [RFC PATCH v3 3/5] platform/chrome: Introduce device tree hardware prober To: Doug Anderson Cc: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Wolfram Sang , Benson Leung , Tzung-Bi Shih , chrome-platform@lists.linux.dev, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold , Hsin-Yi Wang , Dmitry Torokhov , andriy.shevchenko@linux.intel.com, Jiri Kosina , linus.walleij@linaro.org, broonie@kernel.org, gregkh@linuxfoundation.org, hdegoede@redhat.com, james.clark@arm.com, james@equiv.tech, keescook@chromium.org, rafael@kernel.org, tglx@linutronix.de, Jeff LaBundy , linux-input@vger.kernel.org, linux-i2c@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,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 howler.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 (howler.vger.email [0.0.0.0]); Sun, 03 Dec 2023 23:26:12 -0800 (PST) On Sat, Dec 2, 2023 at 8:58=E2=80=AFAM Doug Anderson wrote: > > Hi, > > On Tue, Nov 28, 2023 at 12:45=E2=80=AFAM Chen-Yu Tsai wrote: > > > > @@ -61,6 +61,17 @@ config CHROMEOS_TBMC > > To compile this driver as a module, choose M here: the > > module will be called chromeos_tbmc. > > > > +config CHROMEOS_OF_HW_PROBER > > + bool "ChromeOS Device Tree Hardware Prober" > > Any reason that it can't be a module? No technical one. However if it's a module, the user has to manually load it. So I think it's more of a usability thing. OOTH I think this needs to be a module if I2C is built as a module. Somehow I had thought of it at one point but then it slipped my mind. > > + depends on OF > > + depends on I2C > > + select OF_DYNAMIC > > + default OF > > You probably don't want "default OF". This means that everyone will > automatically get this new driver enabled which is unlikely to be > right. I thought this whole section was guarded behind KCONFIG_CHROME_PLATFORMS. So if the user has CHROME_PLATFORMS enabled and has OF enabled, they likely need the prober. > > +static int chromeos_of_hw_prober_probe(struct platform_device *pdev) > > +{ > > + for (size_t i =3D 0; i < ARRAY_SIZE(hw_prober_platforms); i++) > > + if (of_machine_is_compatible(hw_prober_platforms[i].com= patible)) { > > + int ret; > > + > > + ret =3D hw_prober_platforms[i].prober(&pdev->de= v, > > + hw_prober_p= latforms[i].data); > > + if (ret) > > Should it only check for -EPROBE_DEFER here? ...and then maybe warn > for other cases and go through the loop? If there's some error > enabling the touchscreen I'd still want the trackpad to probe... Makes sense. However there's no extra information to give in the warning though. > > + return ret; > > + } > > + > > + return 0; > > Random thought: once we get here, the driver is useless / just wasting > memory. Any way to have it freed? ;-) I don't think there is a good way to do that, except maybe marking all the functions as __init? But that likely doesn't work in combination with deferred probing (say the i2c driver is a module). ChenYu