Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1115281iol; Fri, 10 Jun 2022 00:05:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxY2UZitjdxA8n3e9Lu5cdZG+gWCbTHHP+U3GnmSS8lqG9cOL3NRxctBpeL9A0OSqg/aSav X-Received: by 2002:a05:6402:274a:b0:42d:dcd1:c847 with SMTP id z10-20020a056402274a00b0042ddcd1c847mr49453134edd.169.1654844723949; Fri, 10 Jun 2022 00:05:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654844723; cv=none; d=google.com; s=arc-20160816; b=PxGS1bTxvawvhBM/fkOlC+ZHpy9DE6osiO6qu4/r+mJKA3G8PVeDg3FOd8TTMlRiZR sIlOzktv3jx7NdSxoA4xlypZ/fOcjX1RuaEBLHRSOkb1kCETvM6kkOOKaj9ZaGFhvjmU RLbDlUy1+iW9sNn7lvWbKcHewt5KKVSe4OFu+E7yR4GdqOEpkOpy8//V2Nj/QJJT8ieY XqzfnAekogcT57n3aq8WUbN1r8BHiEEOKId+mpp4oY+FjhmUF/r26OD297JXLmcce8JZ DlNdbvORuwku6pQjIaK41bjYdpgxVHEX+UxZ8nsOzvAzbyjuOjuC+iTAzNyW40rFud4M lMXg== 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=UGrF/rEu8LXXhXBMR2/3usTMokm+I13lFJNvqfbwZq8=; b=tJSwOxoT3h0sjmxBCW/wZlDIxIzqGl0VrW54aOp4P10vHdpLjAmg9AX2h2JoxoiQvj KcKwlOoMIljJ4H1GeKl/T4NwBuheOUphkdoRem1UYC36kaqcYoh5WUpja0XpnHq68pLZ zApSuHBmgXH9ycLygbguFu/bBKTklxnXuW6CW14RVTT+7OdwyozLRGagN8yywsA+UVgP 8Sc1o3G/WW53krbiF+HyXMibKuE3Gez+B2z1jaq5JQxcYAF8cZFTX8vCJPj687FQkFBd h0yG5Ar9xmLQD3hdewFp8niudFPeTGjuFTLloruwbhPgx2INhjnjjmKF5KZ+fUIWOGFT Jzyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=H2REd8vv; 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 qb30-20020a1709077e9e00b006fef110c5a4si16972226ejc.968.2022.06.10.00.04.58; Fri, 10 Jun 2022 00:05:23 -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=H2REd8vv; 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 S1346590AbiFJGro (ORCPT + 99 others); Fri, 10 Jun 2022 02:47:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346578AbiFJGrm (ORCPT ); Fri, 10 Jun 2022 02:47:42 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6E2563BD6; Thu, 9 Jun 2022 23:47:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654843659; x=1686379659; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=gdZIHA1wyCczBRKn7aGbyGkKbJ8yyoLB/kKHMoVwUgo=; b=H2REd8vvOrtv9iIowuAZDjFSXNBCsFDdvwt0CeInumQxc6zbH3/Sxi5Z HdC2e8rHjo1zsFtoyKV4RKHPTUve30gokGQjMf+ydFMrx38F7JG+QQeza BVDM/vYcbpRbvCe65v3z4LVr7mo1Mp31Za6GGI+12ShpL0VaZE4Y+0mAv vRr2kvxRLo4Se+Kof/PCHjo3GtZOy3xqQxb0r1+t2VXvYHLYeQqOnHbA7 E7TJf5hvU8S5ktZS+i/xLXrIHJaDCQCNo1cLrWYZA022clgzp79NjpXTy vIUCMw2hqhs3/VKPetH6w37F307lIt7KqexOq3ZitWVS2V6pnEUMa90Ps Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="363864975" X-IronPort-AV: E=Sophos;i="5.91,288,1647327600"; d="scan'208";a="363864975" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 23:47:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,288,1647327600"; d="scan'208";a="724822524" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 09 Jun 2022 23:47:35 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 10 Jun 2022 09:47:34 +0300 Date: Fri, 10 Jun 2022 09:47:34 +0300 From: Heikki Krogerus To: "Rafael J. Wysocki" Cc: Linux ACPI , LKML , Linux PM , Andy Shevchenko , Mika Westerberg , Hans de Goede , Sakari Ailus , Greg Kroah-Hartman , linux-usb@vger.kernel.org Subject: Re: [PATCH v1 05/16] USB: ACPI: Use acpi_find_child_by_adr() Message-ID: References: <1843211.tdWV9SEqCh@kreacher> <3459925.iIbC2pHGDl@kreacher> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3459925.iIbC2pHGDl@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:56:42PM +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/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 * I think usb_acpi_find_port() can also be dropped now. thanks, -- heikki