Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp38203pxb; Mon, 8 Feb 2021 14:29:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwF0AorwJOfYuBUX4cpomT9a8er0D3uvKzgI97xfcDMXS2DzcdUNxfU/KZaHtK29QERWBdz X-Received: by 2002:a17:906:c0c9:: with SMTP id bn9mr19475596ejb.318.1612823394226; Mon, 08 Feb 2021 14:29:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612823394; cv=none; d=google.com; s=arc-20160816; b=OV96ywvIOfoVnn7cW3QN4KHn0l+L5JeTqLdIchY09Hxa+qmyX4pK1R8KsS/ptupDzo yeZ/EQSJXpbbeqKAE1fWKI+ZsXZNkn/YRLXleG+Y4Fx7VCI5Hdz5n5M2WNJ+mIXSi16P rQmftDaOEgkiQm3HIk+wiYS2uuN2xQCmzhoO1CCNpB3+qkZk8fv9l4uOyPYleYTCrX8O 2AmlPVMrO6Qk+ul+/sLBqy4/aJq4/a96PIz9ZwY+mOOyGtMhSaz6v42n+KXwZEZBUqVM +Xj9ayGrPkczMz0Ub0OgZOHmKR+nmimPBCGiiyMJLwnpxfZFvZRYKqbXlVdyZ0orjAHP OYWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=Tin4Sd7DJNkzghJU1LXwjQQLP/oDBGFHtKH0e+hx6Xs=; b=tp8jLK/2GywtKejUqdIBbjFZtWDFvnEEZCQFac/sfNbd+MuqihRgFYoIrUgoca3+0f WKhrPtqMQ0Sbh8P8OEQfLi2MdQd6s2p09lVKfUgHTSwKUO3uPqu2rK1cXyBUtpmRZBGv vEsM9Tj5vFS2tjSMqc4c1911N+ly4eKOJvXqqsK/Ds8tw340bCoqhjzJY1/JaiFaOGzU EPDYRA1t0TZzxXYpVWJDgRLoRtAN9oos0bLlobiyS2ZvpKxYLT0/lRRSxDr83ff/oPw0 MeDkv4ThtHNvo+UdLalB3xNOI7QZP/21Fb4mAd4WLY10/gPCnZrfoR0Ms3lFCX18xbF+ Te9Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kq16si12695590ejb.120.2021.02.08.14.29.30; Mon, 08 Feb 2021 14:29:54 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231778AbhBHW2H (ORCPT + 99 others); Mon, 8 Feb 2021 17:28:07 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:52711 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231271AbhBHWYz (ORCPT ); Mon, 8 Feb 2021 17:24:55 -0500 Received: from orion.localdomain ([95.115.15.83]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N2VGj-1luhmR3RJ1-013sEY; Mon, 08 Feb 2021 23:22:16 +0100 From: "Enrico Weigelt, metux IT consult" To: linux-kernel@vger.kernel.org Cc: rafael@kernel.org, info@metux.net, linus.walleij@linaro.org, bgolaszewski@baylibre.com, robh+dt@kernel.org, frowand.list@gmail.com, pantelis.antoniou@konsulko.com, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org Subject: [RFC PATCH 09/12] drivers: base: reintroduce find_bus() Date: Mon, 8 Feb 2021 23:22:00 +0100 Message-Id: <20210208222203.22335-10-info@metux.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210208222203.22335-1-info@metux.net> References: <20210208222203.22335-1-info@metux.net> X-Provags-ID: V03:K1:rzHVi5GoHivXWlnfqQmxW9ROEO3dTvvCGJjkmHY1rYU58qOtQdB BWExFeO+Lo7FQnJw4FivMBV8vVs5qdqC8Daz5Q4ov4Da0LJhOvhFlR2siSolW392MDgY9cH 8XXxJ+Jsbc1T1eAY/QQvG6JTPj2JQU031dT6WF7IOT1GkP5PSJ/eJ5zfvyp2hkFU/FXNikO 2tQpzN1WMr8i6gawh2pSQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:3jDwSQW1sfw=:S+k5ohg/fvN1L6nK+an5kA +R/OSvwPagPSZlWc9jBeQRyCOsKSYmcnZ6bF0GFMGDOmdX8fJtZJp1GS3sOshQtcqou/bjxDV qdNYObRRD4gTkYQOGao7jMJzlMiH/Ac2uM4LBRda23m8yqNhnCPEk5/Loq96ANivz4m8CCcbj /s+VFTolH9CbObyDG2qp+fF8tJrl/H0GwmVkxxV8NyVFHHHDHVXoyoDVsLqZVovSt7T1tTS6t BMJQmQBWcjVricSiOzaFEpI+OgXkx1n4vG78rHYOe1xEXcm7gr85UmUGQloXjulge/oKPFkKj vPAE5uZex4dZ9T+qQ6PLsHnt2nL01nQp67LXPvksmkPXP5n8/xzMIPYQFdcW2HereIzUKBRru jjB4jWNWlZrcXptDCJjplCphEmEPyr9eMjg9IMJVdaFFGJ9xGkFyjo0GKfVOB Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --- drivers/base/bus.c | 14 ++++++++++---- include/linux/device/bus.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 450d3ed6cf1f..a06ae2786092 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -754,13 +754,19 @@ EXPORT_SYMBOL_GPL(device_reprobe); * * Note that kset_find_obj increments bus' reference count. */ -#if 0 -struct bus_type *find_bus(char *name) +struct bus_type *find_bus(const char *name) { struct kobject *k = kset_find_obj(bus_kset, name); - return k ? to_bus(k) : NULL; + struct subsys_private *subsys_priv; + + if (!k) + return NULL; + + subsys_priv = container_of(to_kset(k), struct subsys_private, subsys); + + return subsys_priv->bus; } -#endif /* 0 */ +EXPORT_SYMBOL_GPL(find_bus); static int bus_add_groups(struct bus_type *bus, const struct attribute_group **groups) diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h index 36a1dae26c95..b4cbcfe176c5 100644 --- a/include/linux/device/bus.h +++ b/include/linux/device/bus.h @@ -254,6 +254,8 @@ void bus_sort_breadthfirst(struct bus_type *bus, int (*compare)(const struct device *a, const struct device *b)); +struct bus_type *find_bus(const char *name); + /** * bus_unregister_device_by_name - remove device by bus id from specific bus * and unregister it from device core -- 2.11.0