Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp468296iol; Thu, 9 Jun 2022 07:23:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9rifuFmQrEAqq3msUcVQBQeiACUnNJ0JivCNIxqRZMVl1JsVajC0atLsDcCWCmvA9Afm3 X-Received: by 2002:a17:90a:f2cb:b0:1e8:8ac2:bcdd with SMTP id gt11-20020a17090af2cb00b001e88ac2bcddmr3648829pjb.219.1654784615420; Thu, 09 Jun 2022 07:23:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654784615; cv=none; d=google.com; s=arc-20160816; b=Jqcop3/S+pNfGJ8Z9O7aU+vlwCBLdFNPQ6aABAD3eowhLiaCASbuHP4PEpzxCRK4b4 1LtWTpoQBjw6vL40p1VvY5fqeVAHM62gDhf5X8ufL218iw3Lmo60Kk442H4bs7xHupK7 klu2N/v7lZeWFn8jlveuUk1ol6l8fgHOlY0y4ALhSTSi5+eJ9cqfsgFeGne+AGiweZDa bicmoAGYwxC9DVfFLVih086BOxlSPfUV9k4fWh5HJhEPKkaBUbWCer5ift0cSvbjWsfR eSyoj8vx3SE1vs7Sv/gzsw/V+JjYhXYhQB0dXDdVUvTOIW9DrYH1IWqcJdWjMppE3o2y VKyg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=y/MHN73u6JTblFsVFy65Qq6nt+ICx9kIDmNSMhQRzvc=; b=yYG0kdFDDUu5NZK2PynBnpa/Cnres1XJLCPwDwh3uedo52sFRXAGm75Hqxxrz9jRRH zyC1jVZpypI+peN3FieAextGCVdWYRPIQnxmrdvPZe3w/ubT8gNpWcGD8IWUlEjGL/ex Hqyg8IIuzUxSjmxV040pOiJlWPlLr6hALp6WYWHG8BSsoJ9BKnOMHsimVclX99GPJpTA gGAeCW0drclbkDoLlaBQZW1gE9xXTRFGPoPA/dOem5vYSHubJL8Q4BdiT3j09XJGYS1m Zs1GvpxeqwHi2Y5nxBS6ZSUdkP6gJjBNZNIkBmzqj/LV1P79DHCoQmDtw1QSrLfN6jIv 6JAg== 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 a1-20020a056a000c8100b0051bbbc5f0aasi32745395pfv.261.2022.06.09.07.23.22; Thu, 09 Jun 2022 07:23:35 -0700 (PDT) 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 S244100AbiFIOWJ (ORCPT + 99 others); Thu, 9 Jun 2022 10:22:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245384AbiFIOU6 (ORCPT ); Thu, 9 Jun 2022 10:20:58 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 619442DC23B; Thu, 9 Jun 2022 07:20:55 -0700 (PDT) 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 5.0.0) id 330dda50aaa89be6; Thu, 9 Jun 2022 16:20:53 +0200 Received: from kreacher.localnet (unknown [213.134.186.232]) (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 DA8F066C7CA; Thu, 9 Jun 2022 16:20:51 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Linux PM , Andy Shevchenko , Mika Westerberg , Hans de Goede , Sakari Ailus , Greg Kroah-Hartman , Heikki Krogerus , linux-usb@vger.kernel.org Subject: [PATCH v1 05/16] USB: ACPI: Use acpi_find_child_by_adr() Date: Thu, 09 Jun 2022 15:56:42 +0200 Message-ID: <3459925.iIbC2pHGDl@kreacher> In-Reply-To: <1843211.tdWV9SEqCh@kreacher> References: <1843211.tdWV9SEqCh@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.186.232 X-CLIENT-HOSTNAME: 213.134.186.232 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedruddtledgjedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppedvudefrddufeegrddukeeirddvfedvnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehinhgvthepvddufedrudefgedrudekiedrvdefvddphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepuddtpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprghnughrihihrdhshhgvvhgthhgvnhhkoheslhhinhhugidr ihhnthgvlhdrtghomhdprhgtphhtthhopehmihhkrgdrfigvshhtvghrsggvrhhgsehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohephhguvghgohgvuggvsehrvgguhhgrthdrtghomhdprhgtphhtthhopehsrghkrghrihdrrghilhhusheslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhrghdprhgtphhtthhopehhvghikhhkihdrkhhrohhgvghruhhssehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidquhhssgesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=10 Fuz1=10 Fuz2=10 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 Instead of walking the list of children of an ACPI device directly in order to find the child matching a given bus address, use acpi_find_child_by_adr() for this purpose. Apart from simplifying the code, this will help to eliminate the children list head from struct acpi_device as it is redundant and it is used in questionable ways in some places (in particular, locking is needed for walking the list pointed to it safely, but it is often missing). Signed-off-by: Rafael J. Wysocki --- drivers/usb/core/usb-acpi.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) Index: linux-pm/drivers/usb/core/usb-acpi.c =================================================================== --- linux-pm.orig/drivers/usb/core/usb-acpi.c +++ linux-pm/drivers/usb/core/usb-acpi.c @@ -127,17 +127,10 @@ out: static struct acpi_device *usb_acpi_find_port(struct acpi_device *parent, int raw) { - struct acpi_device *adev; - if (!parent) return NULL; - list_for_each_entry(adev, &parent->children, node) { - if (acpi_device_adr(adev) == raw) - return adev; - } - - return acpi_find_child_device(parent, raw, false); + return acpi_find_child_by_adr(parent, raw); } static struct acpi_device *