Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11625660rwl; Tue, 3 Jan 2023 02:09:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXsj+MVaDa9JubUhwo1AjArVXQLJqKx7BQvNotJZzK9r6eUBGnlNrEh+61xAeOmBLRtPU+4S X-Received: by 2002:a17:90a:d990:b0:225:cc1e:fc8c with SMTP id d16-20020a17090ad99000b00225cc1efc8cmr36288133pjv.49.1672740562902; Tue, 03 Jan 2023 02:09:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672740562; cv=none; d=google.com; s=arc-20160816; b=B8wabXrOS4JDopXxiV4uXe/hTq+T9aBE9kGwoEqyK0rG5Fa/wA7dBxA44qMI7W/W8e yZnHVuyo44WBApRWixTZFsaaG3aXU4A1UYqsZHdJxhTJQMfd68plL/hvv3q/y/1LJteS 2J+jNQlhDi0jQt7aL97XRCLuQt9QuVFRSwYaSTv7S6+FJFLwgXSb/o+0E+596dqQ5pNI 71Tt8knPfL9yIM2Q10lkJMcGa+RhfGtgFLY2lPfGLbhu57jetMxigwGiMuEZQTHgTpTW lQFAocTfMdz385ivRpBELYeUxtdpLWnmi+p8Owc2y7HTp3Cj4BOwlNOxvNKsBvrwT1eF f/0A== 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=KzoDcU1+INcWMm6UMoYuA5kMpsMg3uLrqLw2E0W+2mU=; b=j7MAD3AKj9tp5HdrIGsWKjbzwzhG+x5lpXDVUtmNV9YoofP7gJ5Snnpe088o2Ioon3 0ThVDVP0DPn1TNBwSZKs2kzs8tlYqIZUHYVCGanTWweatwJinGB3oLKR9gdzcAiXcMEU +H9yxQJK/S06s9xfcH8U2H3/K+E1IOncR35VPB4FTqkF9G2YHMSVRIiJCwLLVMZ3Z2SK dnIBCqv+hLsWO3wq4u1FtNlTBzCT1p9UxOfpCT94gjEgW/olfharo3/7GGbVb8nriPE8 b3bxEXdxJksx9lhf1EOYRGJRShEWxS0rPevThxn/Y0ijFi/aAOkco4495qdsJU5hQ7up cjLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jWfu2WDX; 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 ng10-20020a17090b1a8a00b002233c2053c8si33795941pjb.78.2023.01.03.02.09.14; Tue, 03 Jan 2023 02:09:22 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=jWfu2WDX; 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 S237226AbjACJbq (ORCPT + 62 others); Tue, 3 Jan 2023 04:31:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230380AbjACJbk (ORCPT ); Tue, 3 Jan 2023 04:31:40 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38C1A2B2; Tue, 3 Jan 2023 01:31:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672738300; x=1704274300; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=q7GYie6ztkC/m0OEhrktbGz9gHldom1EYLxQR6sG4Ps=; b=jWfu2WDXH0Vai4F48IH5z2786fbsPr+vHwhWTg7ftcyzVx3dEA53XeNT 2YT6aPzGdBPubQWpbvIKDH4b8Q0QbW5LaLfpdH2z6iqR34XRiT0YOUzPT 4IbdFmYw42/8vxJEqbftRvtrCmOIoJUAJ7a2gpgGBA5hm03JcJw7Rpk7u B2pR8WEDkUEjzZQeIL/qaDfnbL06cEUOyIHeKWUOD/nAr7j6rVeTqWmqa Ui22ereOXztZCbc8A+zrF/ENrWQuLUnwCJ7Bn9fbXb9vC39ScgbjyfLKa DrGPR3xFJleelzZImQyuk/1lOIx93gnMlpXEMJzxIg8m0xdAX2V74AYkq A==; X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="383921007" X-IronPort-AV: E=Sophos;i="5.96,296,1665471600"; d="scan'208";a="383921007" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2023 01:29:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10578"; a="797131086" X-IronPort-AV: E=Sophos;i="5.96,296,1665471600"; d="scan'208";a="797131086" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 03 Jan 2023 01:29:24 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Tue, 03 Jan 2023 11:29:23 +0200 Date: Tue, 3 Jan 2023 11:29:23 +0200 From: Heikki Krogerus To: Andy Shevchenko Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [PATCH v1 2/2] usb: typec: intel_pmc_mux: Deduplicate ACPI matching in probe Message-ID: References: <20230102202933.15968-1-andriy.shevchenko@linux.intel.com> <20230102202933.15968-2-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230102202933.15968-2-andriy.shevchenko@linux.intel.com> X-Spam-Status: No, score=-4.3 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 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 Mon, Jan 02, 2023 at 10:29:33PM +0200, Andy Shevchenko wrote: > There is no need to call acpi_dev_present() followed by > acpi_dev_get_first_match_dev() as they both do the same > with only difference in the returning value. Instead, > call the latter and check its result. > > Signed-off-by: Andy Shevchenko Reviewed-by: Heikki Krogerus > --- > drivers/usb/typec/mux/intel_pmc_mux.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c > index 87e2c9130607..34e4188a40ff 100644 > --- a/drivers/usb/typec/mux/intel_pmc_mux.c > +++ b/drivers/usb/typec/mux/intel_pmc_mux.c > @@ -602,16 +602,15 @@ static int pmc_usb_probe_iom(struct pmc_usb *pmc) > int ret; > > for (dev_id = &iom_acpi_ids[0]; dev_id->id[0]; dev_id++) { > - if (acpi_dev_present(dev_id->id, NULL, -1)) { > - pmc->iom_port_status_offset = (u32)dev_id->driver_data; > - adev = acpi_dev_get_first_match_dev(dev_id->id, NULL, -1); > + adev = acpi_dev_get_first_match_dev(dev_id->id, NULL, -1); > + if (adev) > break; > - } > } > - > if (!adev) > return -ENODEV; > > + pmc->iom_port_status_offset = (u32)dev_id->driver_data; > + > INIT_LIST_HEAD(&resource_list); > ret = acpi_dev_get_memory_resources(adev, &resource_list); > if (ret < 0) { > -- > 2.35.1 -- heikki