Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp415496pxm; Tue, 22 Feb 2022 13:43:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdIt2yU5XF+30RHsCbWS1JPX6Q+C7Z9rv+ExlIzUVYCKr20RTjZJgTuoGlpl4ZWMI+S15r X-Received: by 2002:a17:907:2bc4:b0:6cc:e4b7:dcf8 with SMTP id gv4-20020a1709072bc400b006cce4b7dcf8mr20712702ejc.596.1645566179781; Tue, 22 Feb 2022 13:42:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645566179; cv=none; d=google.com; s=arc-20160816; b=JaFLbMqe0wcqxtSMz/IqGG5CBA1CcAfDjjtMJIIYJMPP+oCtQwCe/fXsr3oBGPWRnH J5TlgsWZ4dbJsCvykw6pDCAPoF16NARk4wT5QFVJ6qzMxA+WCOiJhDtS6x/DnRrTqtOr dp0gIA+fju2nSuopG0obZtAAKAHr6sqsZo094iha4eWZSBzDWa+RQ2AgAmPUsYmtCNWY jQNBjO5ff1zqmXVefTgjLXQtk1ClIvqyxX5L97Uj4sngdkmEPau4u5PNIjomy+O/T23D yBHatvSITgnFGlPwHRXi0+xsvXhfCKlGRhzWdGzkaJMAd+0ALJJqvu9vspmE8J7Ea1I1 1A2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=zmCeeSDeWIGoUBqFrflWkKCssPnRrke23Kp6y4cCbj8=; b=OlncbWlx8pgHDmq7nqde7JRU9HBPLUAiCFb5abH2uJCbYUB/Y+C4IPF2ijRqxxl/Iy qxGHWUCZMl+l+eNFQaRtdhqtlf1ieLyjwOWfDtRgz+rT6GMyDxBCbyFo24wCfU5QFCYo V1QGtbUd11HOFJutnAQxDeV4Xv32NsvkQhBagV1f+OtsPmRCuPeSlxinuRNx46SAjEvS ftkforFapEdKPhatnLgrOFVrKPcDgwc3Rdnv9Dx9bNB+HofF/MezgdIZ/vDf2OAIMt5A ANbh0C9F23bQIAGVDBBr9Ww0LvA+5dmkSpouIj2K1y9p6SeENNV9+oDWqYY4Q7BG1hDN M4uA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w6si11526989edv.513.2022.02.22.13.42.36; Tue, 22 Feb 2022 13:42:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234954AbiBVTwT (ORCPT + 99 others); Tue, 22 Feb 2022 14:52:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231892AbiBVTwQ (ORCPT ); Tue, 22 Feb 2022 14:52:16 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C48CDBA773; Tue, 22 Feb 2022 11:51:47 -0800 (PST) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 4.0.0) id cf53e28505fb3333; Tue, 22 Feb 2022 20:51:45 +0100 Received: from kreacher.localnet (unknown [213.134.162.33]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id C49C666B786; Tue, 22 Feb 2022 20:51:43 +0100 (CET) From: "Rafael J. Wysocki" To: Linux ACPI Cc: Heikki Krogerus , Greg Kroah-Hartman , linux-usb@vger.kernel.org, LKML Subject: [PATCH v1] ACPI: bus: Introduce acpi_bus_for_each_dev() Date: Tue, 22 Feb 2022 20:51:42 +0100 Message-ID: <11943345.O9o76ZdvQC@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.162.33 X-CLIENT-HOSTNAME: 213.134.162.33 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvvddrkeekgdduvdejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpefhgedtffejheekgeeljeevvedtuefgffeiieejuddutdekgfejvdehueejjeetvdenucfkphepvddufedrudefgedrudeivddrfeefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvddufedrudefgedrudeivddrfeefpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeehpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohephhgvihhkkhhirdhkrhhoghgvrhhusheslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhrghdprhgtphhtthhopehlihhnuhigqdhushgssehvghgvrhdrkhgvrhhnvghlrdhorhhg pdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki In order to avoid exposing acpi_bus_type to modules, introduce an acpi_bus_for_each_dev() helper for iterating over all ACPI device objects and make typec_link_ports() use it instead of the raw bus_for_each_dev() along with acpi_bus_type. Having done that, drop the acpi_bus_type export. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/bus.c | 7 ++++++- drivers/usb/typec/port-mapper.c | 2 +- include/acpi/acpi_bus.h | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) Index: linux-pm/drivers/acpi/bus.c =================================================================== --- linux-pm.orig/drivers/acpi/bus.c +++ linux-pm/drivers/acpi/bus.c @@ -1043,7 +1043,12 @@ struct bus_type acpi_bus_type = { .remove = acpi_device_remove, .uevent = acpi_device_uevent, }; -EXPORT_SYMBOL_GPL(acpi_bus_type); + +int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data) +{ + return bus_for_each_dev(&acpi_bus_type, NULL, data, fn); +} +EXPORT_SYMBOL_GPL(acpi_bus_for_each_dev); /* -------------------------------------------------------------------------- Initialization/Cleanup Index: linux-pm/include/acpi/acpi_bus.h =================================================================== --- linux-pm.orig/include/acpi/acpi_bus.h +++ linux-pm/include/acpi/acpi_bus.h @@ -480,6 +480,8 @@ void acpi_initialize_hp_context(struct a /* acpi_device.dev.bus == &acpi_bus_type */ extern struct bus_type acpi_bus_type; +int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data); + /* * Events * ------ Index: linux-pm/drivers/usb/typec/port-mapper.c =================================================================== --- linux-pm.orig/drivers/usb/typec/port-mapper.c +++ linux-pm/drivers/usb/typec/port-mapper.c @@ -59,7 +59,7 @@ int typec_link_ports(struct typec_port * if (!has_acpi_companion(&con->dev)) return 0; - bus_for_each_dev(&acpi_bus_type, NULL, &arg, typec_port_match); + acpi_bus_for_each_dev(typec_port_match, &arg); if (!arg.match) return 0;