From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B48DBC4332F for ; Thu, 9 Sep 2021 11:02:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93E5A61100 for ; Thu, 9 Sep 2021 11:02:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234633AbhIILDf (ORCPT ); Thu, 9 Sep 2021 07:03:35 -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-Google-Smtp-Source: ABdhPJxQvRGdQcwMRyPKe/v7I+JRraf0+2CwO4dEv14CGJ8gaECBtDJTpCm9aPScDx10Jp9Ce7uZo62Ly4MHBeb1p0s= 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 >