Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1039236iob; Fri, 13 May 2022 20:39:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztRpem7mZuWpRY2eRSGNsLculc/ow4TGgAlfovHSMa/t2zvs3eB6HvIJBkYMIMYbVcgtVW X-Received: by 2002:a05:600c:1c84:b0:394:5de0:2475 with SMTP id k4-20020a05600c1c8400b003945de02475mr7173831wms.27.1652499578538; Fri, 13 May 2022 20:39:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652499578; cv=none; d=google.com; s=arc-20160816; b=on3mwGj7un8HapfnGbOGAUHtuifWotDZh67zR2YodHEAeN3Zf9vgovyDrivPAf2rqF jG7x1rcc7MOsaJ7j93x8PfaiEhijQJ/6kTUMTmmGmfrXoUOJYLTXw+a8bBNxPl33GUnT m60Pjiam77qGkJUn72YT1OrOpuJLqc6Z9dWis4itgbNrbRFil4OljzuKbmeqb5VB1YAZ XfMn/VY/5W6hW1cotsrafJM57bOCyvZPvdyr/WEsaa0iH10lsXOV6vGl5grId+t/2X0u 4/W6GsQOuC5dpV/qDXqoZABSnteKei6NrEaMqmejKK1ThWjhDWifq8YSiIhqGVI5Ymk4 KY5Q== 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:date:cc:to:from:subject:message-id :dkim-signature; bh=OMTehq1XmIz0jvyyrlNCokWf0qJnSvtY2n6I6yV8cJU=; b=n/i05HfmNVYa2V+AAfD5nVIzc05a6AsI0A0VQQ0BB2A0qgnfS1LF+SYfITCmDmBbiy kvg26EpDK/6+Fu7ca7n+ZcwS62Uf3kS+jKgBF1i7XBZbP1fVbCDUT7QHwI7NDhvm+W5M pqUKUyU+PGR8mty9PVWsOfsL8moa3rcDv4oPlg8XLcq8e/rqoYxNwzJZSsMsXbbcpJlB uBfyUoZknT8F+qrFqTTyZ9jXGv8BLgmHPhjy2ApYSfjaPDFVQAenZhnuJgLSpMBA4aUR kMJw7pmhdqIYV2YYyXv8eZTwV3B7jI0komTrykZEwuueYLULNo9SqutptGnjzhU5zF8F wXUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=NCTUgIcB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n7-20020a1c2707000000b00394038b5b48si7750870wmn.2.2022.05.13.20.39.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 20:39:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=NCTUgIcB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A7CF144C602; Fri, 13 May 2022 17:14:56 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355002AbiELO5L (ORCPT + 99 others); Thu, 12 May 2022 10:57:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355261AbiELO46 (ORCPT ); Thu, 12 May 2022 10:56:58 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7F5C62110; Thu, 12 May 2022 07:56:54 -0700 (PDT) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24CDEieF013709; Thu, 12 May 2022 14:56:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=OMTehq1XmIz0jvyyrlNCokWf0qJnSvtY2n6I6yV8cJU=; b=NCTUgIcBSMWOc7AaVGbIEUo6PV5zTQvVZ+74j7YKZaPgFzNz/WPkC8zumY/vxFaWuz8G uJUKseaWoMzbGLjzF5zPTK46VFvbynTDjs3dnsMhy1di8NjbE2VuXVFTioIHdmPcRDtX bjr8mUaMCPjHz7q6cmBtJ4KmDyi7TipfQ3Qfxpk3GahiqOQXR/aVO3Hs7UtHrPbi4pVL NdUQucyBR6Hg/XcvTI/ickt4bF89EwwN5khFPVDcDozThdtJphafNiHIHXyfleGkUWj4 fo7JcpokzedK+t0kK7CczxAwLLjLOmJqd6pqlwerucEzG6F1KntfIjKVgwexe+XyOYws 5Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g12xytts5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 14:56:50 +0000 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24CEmPGL016086; Thu, 12 May 2022 14:56:50 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g12xyttrc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 14:56:50 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24CEnoCX013435; Thu, 12 May 2022 14:56:47 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04fra.de.ibm.com with ESMTP id 3g0ma1gyjg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 14:56:47 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24CEuijo47776016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 May 2022 14:56:44 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6440611C04C; Thu, 12 May 2022 14:56:44 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E7E1B11C04A; Thu, 12 May 2022 14:56:43 +0000 (GMT) Received: from sig-9-145-9-18.uk.ibm.com (unknown [9.145.9.18]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 12 May 2022 14:56:43 +0000 (GMT) Message-ID: Subject: Re: [PATCH RESEND v5 1/4] PCI: Clean up pci_scan_slot() From: Niklas Schnelle To: Bjorn Helgaas , Jan Kiszka , Matthew Rosato , Pierre Morel Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-s390@vger.kernel.org, linux-pci@vger.kernel.org Date: Thu, 12 May 2022 16:56:42 +0200 In-Reply-To: <20220505083839.1315705-2-schnelle@linux.ibm.com> References: <20220505083839.1315705-1-schnelle@linux.ibm.com> <20220505083839.1315705-2-schnelle@linux.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: fOs3S_ad3T-Zy_kK72KB4445G0h2S1dR X-Proofpoint-ORIG-GUID: e6GeGN562Lkekf1wksfaStG8ZKiR2OpF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-12_10,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=473 spamscore=0 malwarescore=0 clxscore=1015 mlxscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205120067 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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, 2022-05-05 at 10:38 +0200, Niklas Schnelle wrote: > While determining the next PCI function is factored out of > pci_scan_slot() into next_fn() the former still handles the first > function as a special case. This duplicates the code from the scan loop. > > Furthermore the non ARI branch of next_fn() is generally hard to > understand and especially the check for multifunction devices is hidden > in the handling of NULL devices for non-contiguous multifunction. It > also signals that no further functions need to be scanned by returning > 0 via wraparound and this is a valid function number. > > Improve upon this by transforming the conditions in next_fn() to be > easier to understand. > > By changing next_fn() to return -ENODEV instead of 0 when there is no > next function we can then handle the initial function inside the loop > and deduplicate the shared handling. This also makes it more explicit > that only function 0 must exist. > > No functional change is intended. > > Cc: Jan Kiszka > Signed-off-by: Niklas Schnelle > --- Friendly ping :-)