Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1127390iol; Fri, 10 Jun 2022 00:22:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4BCOtr64r65sGCMtGEOdBneSiqidvBi6yqF99TbYF9nvqVLPwR/kJt17OvlH5L+gLoXoa X-Received: by 2002:a17:906:d9d9:b0:710:f2ae:b455 with SMTP id qk25-20020a170906d9d900b00710f2aeb455mr28206709ejb.77.1654845753411; Fri, 10 Jun 2022 00:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654845753; cv=none; d=google.com; s=arc-20160816; b=FfiKLUVGHTMlMSV7Fj+WZ9y6Ag+RB3vwzKN2OgGLYTfjOZUQVCL7Xkz4ZU5Ptq+Bfd SbNHG2M+xRYLWrVh9GP4p7TVVh2QiHz7GMieCOuwonPL7o8TSDK9vpCWBXbL9m7GL1Yj oyU1y1yCYWwf6xP/81oqa5C0/Apb3O30XJaaXRYf0MXOZhiEkvneKi06wpzIifZ0F3WK 5k0GMOwFuKvOJnbV/FTo2Cz+zEUTgfsM0RUoaRXPxfm4BRrAqq+glGujZ30t/3SmOBCn Eo2kUh4vJ8D7o4TnVcs1/OZGX/ivnnNg9O83Eo1+r+jLPfD4HpHXgpnGH1u/ocujeqeY IR3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rP9WEnzoW90JEWP5hcTn7X8kZtgKn+28XP47QpnwO3I=; b=WF/7jpARdam6go/vJz3ozjKU5m3O3c1GNauHUyTHNlGbrtEAk8wSUXTJnScj3RKfea P4VpCCHqKMmR2S7mdB2CSq4A+Xm5ASG/C6OprsS0qeJ2qPeT718SFFLajswfaOuCEizj V3wR077gkOT9DZr+P+72LoncEtxwpORtiKXZzx9GQELLzXg+H40JdCEmgebBcJBL2Uo8 LMtz8Uz+OXLUWrKLmXcI7DqSdNzn7M9LNYM5tos0TJVNqiWmV8GxpzuB1rPxGpKAKH2d 8tT3ItcBkXQsXScJn9RdSHXl1MS1tlZnKb0MIABHXj6HUeCIRb4M1/9QXe/uF438rCoy Pyag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="n5n/0j+Q"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd2-20020a170907628200b006ff0f87f566si30926357ejc.563.2022.06.10.00.22.06; Fri, 10 Jun 2022 00:22:33 -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; dkim=pass header.i=@intel.com header.s=Intel header.b="n5n/0j+Q"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346557AbiFJGqg (ORCPT + 99 others); Fri, 10 Jun 2022 02:46:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234950AbiFJGqd (ORCPT ); Fri, 10 Jun 2022 02:46:33 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 377235A5BC; Thu, 9 Jun 2022 23:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654843592; x=1686379592; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=bak+PaguLlGs0EMkmOjZv7d+/b+qyh+9qIl37rSGwWQ=; b=n5n/0j+QM4D+bU9C+wo+Nhrvo/4md9X+DLqor+o1kRt+3DVxNYDMfj8y TyMwNs2N52NnLJ9AUhQoUmAoLi6BWoX7ri7HcKv0hh3etgE0PsCPef2hT iecNbJO+Wr5cbLrKMUsaYXnTWUkhqinbx4gTVt8r+tp7YwlEZZOY7AEUO jqDix+Xdq70/2c+v8qzUWFOpap/uAtECC3e25psmnd2/WGx5d0AdnhOOn NYTJsR//i9cX0CiR+GcCno0UdToKa6XhLtndVt2a9fleIWR7BNKBR1r5E HiFUNfGmv2QssCOEJegwz3fqSYGhWiZzkta16vSf11ELW2+vF3nyHILqp g==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="339289554" X-IronPort-AV: E=Sophos;i="5.91,288,1647327600"; d="scan'208";a="339289554" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 23:46:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,288,1647327600"; d="scan'208";a="724822105" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 09 Jun 2022 23:46:27 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 10 Jun 2022 09:46:26 +0300 Date: Fri, 10 Jun 2022 09:46:26 +0300 From: Heikki Krogerus To: "Rafael J. Wysocki" Cc: Linux ACPI , LKML , Linux PM , Andy Shevchenko , Mika Westerberg , Hans de Goede , Sakari Ailus , Andreas Noever , Michael Jamet , Yehezkel Bernat , linux-usb@vger.kernel.org Subject: Re: [PATCH v1 04/16] thunderbolt: ACPI: Use acpi_find_child_by_adr() Message-ID: References: <1843211.tdWV9SEqCh@kreacher> <7414189.EvYhyI6sBW@kreacher> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7414189.EvYhyI6sBW@kreacher> X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Thu, Jun 09, 2022 at 03:54:40PM +0200, Rafael J. Wysocki wrote: > 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/thunderbolt/acpi.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > Index: linux-pm/drivers/thunderbolt/acpi.c > =================================================================== > --- linux-pm.orig/drivers/thunderbolt/acpi.c > +++ linux-pm/drivers/thunderbolt/acpi.c > @@ -304,8 +304,6 @@ static bool tb_acpi_bus_match(struct dev > static struct acpi_device *tb_acpi_find_port(struct acpi_device *adev, > const struct tb_port *port) > { > - struct acpi_device *port_adev; > - > if (!adev) > return NULL; > > @@ -313,12 +311,7 @@ static struct acpi_device *tb_acpi_find_ > * Device routers exists under the downstream facing USB4 port > * of the parent router. Their _ADR is always 0. > */ > - list_for_each_entry(port_adev, &adev->children, node) { > - if (acpi_device_adr(port_adev) == port->port) > - return port_adev; > - } > - > - return NULL; > + return acpi_find_child_by_adr(adev, port->port); > } > > static struct acpi_device *tb_acpi_switch_find_companion(struct tb_switch *sw) I don't think you need tb_acpi_find_port() anymore. You can just call acpi_find_child_by_ard(ACPI_COMPANION(...), port->port) directly, no? thanks, -- heikki