Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3185642rdb; Wed, 13 Sep 2023 05:02:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFRw5hXXsAPXiHCBi27aTC4I+TABC1ma0sXRB3m5AMaJhuRDOvWTAuW/PhWaOUspb4u9/61 X-Received: by 2002:a17:902:e546:b0:1c3:bc7c:e14c with SMTP id n6-20020a170902e54600b001c3bc7ce14cmr2967507plf.32.1694606541711; Wed, 13 Sep 2023 05:02:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694606541; cv=none; d=google.com; s=arc-20160816; b=iDOXTiCIYUvxEeBjo7r/KxIEeDFN1kfwyq9uvOz4aVV971BYNLy///b6BzvXFCp69E Ns++FQos0xr3TbmsXieLDu2Ptp+qFoHz7K/dAeGFZGN0yaCg/0q7bHkqvnKeybP3IgWe Aqn/VRgkCGohc9NygLXje/mktLbkTs15cvL3cPdLjmVh+VT2nhoBniWHzBy8wtGLrYGa 9e92x2sVrDBT8nWIEc+5kXdicWLR7grXe1rFPUBCypgoFTKihGeMNSp4vZs86SMdJg1O +LbInojlJg5lmyaUzR4hR9BAxjyzt3oErSZMFXj18Jpk3Nn6k+/zz1Mea+o7HH/MpYJI Q8aA== 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 :dkim-signature; bh=0R5nXHAIKv7HSGwuYMOhGMeaFhFrQSOqtUwPLxaW79U=; fh=Y2IfAqdjkYQAx7XZcGq/8JceY1atOOwfX771vvMvH7o=; b=ucdlF6tkg/Pf2UCVgRRIg3XKpHehCB3mepeeE2ecOpMgZ0Xyowf3Q4ggxiVSIafA0N RM6aBjMft7HaeEFg0govErqv2JM7lq3oMWEM/LfYZIFeVHoJuSHsLD2oA2a/CxFOMfsb hBSXvDSMaw98timdQqboivW5P/SCcwL7jPYYlS1g57LzmD1kKQsFHWa5PPCoxhXXynDq vA/0/LKhA1igANXh4/g3jCFYacroAdveyD0fNMpFeUYJzJUl32bcFMaHDEhq7uqdWPRZ VrCMNTridwzF9KlVlhzQptaR3dvfzbvI1ptc0Gejd8VVcYxTMwYj9ABtVmOOPvVVuQ6I Nbcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eThrzop2; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id kf11-20020a17090305cb00b001bc553d16e0si9655845plb.507.2023.09.13.05.02.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 05:02:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eThrzop2; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id EBA86807C744; Wed, 13 Sep 2023 04:57:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240538AbjIML5N (ORCPT + 56 others); Wed, 13 Sep 2023 07:57:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231334AbjIML5M (ORCPT ); Wed, 13 Sep 2023 07:57:12 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76B8B1996 for ; Wed, 13 Sep 2023 04:57:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694606228; x=1726142228; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JIESgcHWBEA280p/KwYfRuT9N7lr2wPGJ6vVOH4uY08=; b=eThrzop24C75hghNtmVYRMHO5Aackup2QvTo2jgKDLhTqfowaEYkM71N LvXqTVUMJOnn9dMnKcHLbmbEA7XXTrKLrxZVMt/A62bYPJlo9jyKZoACA uplHF3l5OIS+lvRx/ETpJPSt2Ufyw8Bc/JOCBIg/NSBsm7SMIralNUekl pBgFkJWa94lMR3IhGj3+MymERJRanJxzBP+UhHSI73ljW6S2Hh3CzLU+Z gaCcpvYMG7hW05+JXR7PEapqtnaxvoZ52KVCKM4FOfJytqpcDLgOan49h rU0wCyUtfjt6+QcZ0ek45aEQxkoLXgksO7qPR++wVRVr+OtufiktR51sq g==; X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="368902967" X-IronPort-AV: E=Sophos;i="6.02,143,1688454000"; d="scan'208";a="368902967" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2023 04:57:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="737470920" X-IronPort-AV: E=Sophos;i="6.02,143,1688454000"; d="scan'208";a="737470920" Received: from ggreenma-mobl2.jer.intel.com ([10.13.17.40]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2023 04:57:06 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg , Gregory Greenman Subject: [PATCH 01/15] wifi: iwlwifi: pcie: rescan bus if no parent Date: Wed, 13 Sep 2023 14:56:37 +0300 Message-Id: <20230913145231.f7795a1ccdab.I2b84810a743469a1bcabf3628262cf54311593f4@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230913115651.190558-1-gregory.greenman@intel.com> References: <20230913115651.190558-1-gregory.greenman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 13 Sep 2023 04:57:15 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email From: Johannes Berg If the bus has no parent due to the topology, platform level device reset (PLDR) wouldn't work. On the other hand, some platforms appear to require scanning the parent, though it's not clear why. However if there's no parent, then we skip the rescan, which isn't a good idea. Change the code to go to the parent only if that exists, and rescan the bus itself where it doesn't. Signed-off-by: Johannes Berg Signed-off-by: Gregory Greenman --- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c index a9e00a2cd9ba..51012435e39b 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c @@ -2112,8 +2112,11 @@ static void iwl_trans_pcie_removal_wk(struct work_struct *wk) pci_lock_rescan_remove(); pci_dev_put(pdev); pci_stop_and_remove_bus_device(pdev); - if (removal->rescan) - pci_rescan_bus(bus->parent); + if (removal->rescan && bus) { + if (bus->parent) + bus = bus->parent; + pci_rescan_bus(bus); + } pci_unlock_rescan_remove(); kfree(removal); -- 2.38.1