Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp416524pxb; Thu, 9 Sep 2021 04:04:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOiAkm/kVDACC4CgV8OTbTZpgBqpWyRnqe8a5OTufCaSJVveEDlxk1/djadvGGwk105vnD X-Received: by 2002:aa7:de85:: with SMTP id j5mr2536566edv.147.1631185492357; Thu, 09 Sep 2021 04:04:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631185492; cv=none; d=google.com; s=arc-20160816; b=onS52aAHe4lck8y0bTkJSsuq+lyWx0N5C3nZfSYcNonBOTy+FNgPaBnl9u7LbpLp5c PI3JxLxw8cgGhw4MEFish9CRXcHRvzDKziX7GLTPFXBlAeBWOj4kPjb7spaeSATjf4Qw UUbzVIQmk5wPh2Kxc1FptvTFSX5+bE/Mu62GO9t+wgCSZi8e3qtSGIaH2txCR85ig2Kd 4dS/vUZUk1z6DmkDrYsKhVRomeDyU4OL/RMYqLdAtK/JjgHZr+rheIWOxVUfmqoJJqp3 WMqQFxZcQK1rPKCJqjUlQJsuAgxfVRBkRIiq7EUCsm+HrHDGCb4x4GjAmGUigRqLVEw6 5p+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=HqMw/0l1kESubu2uMBYTCMZr+nbcPkWmEaa8w30Z3Ss=; b=ZzKQlAkwkittyEd5qeFFoEjg6Lbi50cDUzRkdInzNQNppCBLzgLzaZKC3zRhII2mYA GnNdiPgcVkyJk79dj1h113aeV9MhNyUfqoqApwWhAV2/1NhYZFYBmkxGxjEromwQ7kaU erJqgLFVT1shEP5Nw8Wrz+esrgHEEpqT0P4mVOl7avMAyV59bTjEKcsbX91US9VXkOl2 Z6Vhl/vz8pHFc4Pw9SXXy/2g8nncTH3hoY5S+CbS0RPUqcVCMS3Q0yR3mGpC8B6AsSbr pv5LRa+66YCVik2P00MLmADuFDy0rO3/B4RLIjVzTMZVGN3OvEM6298hBIHoYt0eZyaA VlDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xIwstDFq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 18si1420555ejj.476.2021.09.09.04.04.10; Thu, 09 Sep 2021 04:04:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=xIwstDFq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S234216AbhIILDe (ORCPT + 99 others); Thu, 9 Sep 2021 07:03:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234550AbhIILDd (ORCPT ); Thu, 9 Sep 2021 07:03:33 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28CBDC061757 for ; Thu, 9 Sep 2021 04:02:24 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id h1so2332922ljl.9 for ; Thu, 09 Sep 2021 04:02:24 -0700 (PDT) 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; bh=HqMw/0l1kESubu2uMBYTCMZr+nbcPkWmEaa8w30Z3Ss=; b=xIwstDFqbjVnFK3QnzRTMN0EG2JKgfszQq2XLDgslizPmY4v6dP8UJZjjqlxKby6Mp 0KJgvLrdmrGWirG868pOOPdsvJJ3wvQn4HkuNGkCKL+5AK09jt8kwULq/1fFgbNj/zJh DgiUwA+I9ht71YaJwD+/egwug7iP8l3WAL3uG8+63AzTHLyqAsK0emCtbiYDpHZ5RD8o nXPP9ukAOMaLrge7iHJSN6pNxYP5rBChKHGsoNSvRzI8QMOaOhwGoS8IK0ywKlKMSqpt Krk1MSkR/EWsz7PKnjgqn+kK5tJouOKWILi/kPWt0Bj3Mh1o2vgfuhf0SU8aRz5NPaNQ j4AA== 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; bh=HqMw/0l1kESubu2uMBYTCMZr+nbcPkWmEaa8w30Z3Ss=; b=FieOvZv3MXTRtbKjmfLVKz6J1lPive4HN5ILfZsms44WX95heMWeT0pfXw+mfNt0Cu aXFPukCn4v2jE+qy0x3tzeLwkW2x4dnNgbW5doyiNgc7lUBv1AnxVysRgFgAp0qIDa3s RM6UTXOWJ7h87nLeYSKO8fppDQ1kcd/kEONsDW1nK/nDpW4fytBaEmSHz5foa2NVXFjR Ew0EL/7C+b675RfV0YGWAUfwxDTt5RKiv7005iHxOmRbSc5XS608mU/oOiLfrrXo5ydp /R3VdgliQ98UI0OiZuFDjwlwMAPafCYHwBxC+3N75sfxUwTXIj3xBwV7gxFrnfD0zEbj tagQ== X-Gm-Message-State: AOAM532XY0Pk53O1pFjUdPNGdV/xN9XlxIu4iUbEB+1+IH2/97WuOW6l E1YfCMp18CgPatXdLUQIBOf0qkNNdvAD27Wf6GNQPQ== X-Received: by 2002:a2e:b610:: with SMTP id r16mr1746946ljn.367.1631185342288; Thu, 09 Sep 2021 04:02:22 -0700 (PDT) MIME-Version: 1.0 References: <20210904000543.2019010-1-saravanak@google.com> <20210904000543.2019010-2-saravanak@google.com> In-Reply-To: <20210904000543.2019010-2-saravanak@google.com> From: Ulf Hansson Date: Thu, 9 Sep 2021 13:01:42 +0200 Message-ID: Subject: Re: [PATCH v3 1/2] drivers: bus: simple-pm-bus: Add support for probing simple bus only devices To: Saravana Kannan Cc: Russell King , Neil Armstrong , Geert Uytterhoeven , Magnus Damm , Tony Lindgren , Catalin Marinas , Will Deacon , Damien Le Moal , Rob Herring , Android Kernel Team , Linux ARM , Linux Kernel Mailing List , linux-oxnas@groups.io, Linux-Renesas , linux-omap , linux-riscv Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 4 Sept 2021 at 02:05, Saravana Kannan wrote: > > fw_devlink could end up creating device links for bus only devices. > However, bus only devices don't get probed and can block probe() or > sync_state() [1] call backs of other devices. To avoid this, probe these > devices using the simple-pm-bus driver. > > However, there are instances of devices that are not simple buses (they > get probed by their specific drivers) that also list the "simple-bus" > (or other bus only compatible strings) in their compatible property to > automatically populate their child devices. We still want these devices > to get probed by their specific drivers. So, we make sure this driver > only probes devices that are only buses. > > [1] - https://lore.kernel.org/lkml/CAPDyKFo9Bxremkb1dDrr4OcXSpE0keVze94Cm=zrkOVxHHxBmQ@mail.gmail.com/ > Signed-off-by: Saravana Kannan > Tested-by: Saravana Kannan Tested-by: Ulf Hansson Kind regards Uffe > --- > drivers/bus/simple-pm-bus.c | 32 +++++++++++++++++++++++++++++--- > 1 file changed, 29 insertions(+), 3 deletions(-) > > diff --git a/drivers/bus/simple-pm-bus.c b/drivers/bus/simple-pm-bus.c > index 01a3d0cd08ed..3e086a9f34cb 100644 > --- a/drivers/bus/simple-pm-bus.c > +++ b/drivers/bus/simple-pm-bus.c > @@ -13,11 +13,26 @@ > #include > #include > > - > static int simple_pm_bus_probe(struct platform_device *pdev) > { > - const struct of_dev_auxdata *lookup = dev_get_platdata(&pdev->dev); > - struct device_node *np = pdev->dev.of_node; > + const struct device *dev = &pdev->dev; > + const struct of_dev_auxdata *lookup = dev_get_platdata(dev); > + struct device_node *np = dev->of_node; > + const struct of_device_id *match; > + > + match = of_match_device(dev->driver->of_match_table, dev); > + > + /* > + * These are transparent bus devices (not simple-pm-bus matches) that > + * have their child nodes populated automatically. So, don't need to > + * do anything more. > + */ > + if (match && match->data) { > + if (of_property_match_string(np, "compatible", match->compatible) == 0) > + return 0; > + else > + return -ENODEV; > + } > > dev_dbg(&pdev->dev, "%s\n", __func__); > > @@ -31,14 +46,25 @@ static int simple_pm_bus_probe(struct platform_device *pdev) > > static int simple_pm_bus_remove(struct platform_device *pdev) > { > + const void *data = of_device_get_match_data(&pdev->dev); > + > + if (data) > + return 0; > + > dev_dbg(&pdev->dev, "%s\n", __func__); > > pm_runtime_disable(&pdev->dev); > return 0; > } > > +#define ONLY_BUS ((void *) 1) /* Match if the device is only a bus. */ > + > static const struct of_device_id simple_pm_bus_of_match[] = { > { .compatible = "simple-pm-bus", }, > + { .compatible = "simple-bus", .data = ONLY_BUS }, > + { .compatible = "simple-mfd", .data = ONLY_BUS }, > + { .compatible = "isa", .data = ONLY_BUS }, > + { .compatible = "arm,amba-bus", .data = ONLY_BUS }, > { /* sentinel */ } > }; > MODULE_DEVICE_TABLE(of, simple_pm_bus_of_match); > -- > 2.33.0.153.gba50c8fa24-goog >