Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2428527pxf; Sun, 4 Apr 2021 01:07:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRody4cigKzGa2eQzkDzkyC7HjsgOaAiX7yTryaGpI6jnlaSfmCmX92BdjSxXrwAPgR+nu X-Received: by 2002:a05:6638:2603:: with SMTP id m3mr19124581jat.64.1617523676679; Sun, 04 Apr 2021 01:07:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617523676; cv=none; d=google.com; s=arc-20160816; b=TN5bbpdKNNrB4AZ6z8l38QBmH4AXLbvkwXzruTLDfcj29rC1OrYdJ/32kgaxl2Wg46 Z2VQKwW/AazzqFaEnbG4Uiae2lfsGySfu06j8pJx1u/pLo7j/p1udljlkR3NVZ0+KvIG 3FXBz6CMQQWh7CzJrJZCEyiszv8bMY2QxKhAyojAZ0vpCx7ba9dcTdWNikEOrQRS69Bh 9fzOqiQ9sj/ck4TaR5+P/zRX3eAafGnCMvcQ1Q9QQscjpDPigw76ErPwCnyjlxuNtiRa MyZYKv3i9JRp6D7CSy1kZKnlcs+x+JJ5SUxLq1DxV6W/rx5LIYX+J0cBE7yK07gbd95B IUeQ== 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=mVowHr1+OgTqZCkEdBcxnvdSpM3qtCFB6tmFetrXGf4=; b=X67uQCmBAx7TX6ibGBP/swu0/esMSfSkRPGx+4d9xnD0l3kzvMrr2hrhGuPjCZOcHZ lZLds6Zjke/kLoxFtwtClba0yzXcVaudrweWZWosggrNXQiy8vLcm6Z/uyK9skdjwiSs 3kpIK6VElNpMIlMp+Nu3Y2Pn9GYfQR3WJ8EKNdLJf9JnLqLNtCU1uYQSfgYoBVnjMWPk KRV5mlrDyWgVwJ7mw/uYENl+8NohaB8Z0DD8FqWv6VVg//bEkXtXu8GMTKruS4eGzECw zCCo1QYe70VkZpKfrDNEkLN3h9FzvxliBsJIRXsBsrX8wAjvBk+3uElu/p0HNB6koQq8 eEeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nqOq9Bqy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w9si12767383jad.47.2021.04.04.01.07.21; Sun, 04 Apr 2021 01:07:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nqOq9Bqy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229550AbhDDIEl (ORCPT + 99 others); Sun, 4 Apr 2021 04:04:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:52206 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbhDDIEk (ORCPT ); Sun, 4 Apr 2021 04:04:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A89CC61364; Sun, 4 Apr 2021 08:04:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617523476; bh=QwQ84hqpcIgiF2zv4DdJwrZZPEsHfSUejq2MMXbuMi4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nqOq9BqyLhdUAACGv5fJaNRjeuYco+pQJaQsPFwYJNVZZMRbQs7YpAoL2S1Dydpns JYyBFMDPqrinBiIucuHcgNypsTRUuSRFpdiS5KrJ4pA89JWn5LIyorKJj3ErUt56Rk SGibGiK/VBXHEodyyCd0jyMxnuQ9UMUEh9QCfIZpff5PnVVejPWp5E0AVFGurDDYHJ 9gz9Abiqlr6mcsiA1M82frTeoP+PdiwqOU4cv+vn2RPrEd/0Zg9NjS7FBBPZC3pOCz ZhJ2sTA+UrlfVpWwixo6VE7DAfF72VsuJL2ednQVTW2H50s5bsn09igD1wk8WoBmrQ 1YpkFS0Z/LmRA== Date: Sun, 4 Apr 2021 11:04:32 +0300 From: Leon Romanovsky To: Alex Williamson Cc: Raphael Norwitz , "bhelgaas@google.com" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "ameynarkhede03@gmail.com" Subject: Re: [PATCH] PCI: merge slot and bus reset implementations Message-ID: References: <20210401053656.16065-1-raphael.norwitz@nutanix.com> <20210401105616.71156d08@omen> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210401105616.71156d08@omen> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 01, 2021 at 10:56:16AM -0600, Alex Williamson wrote: > On Thu, 1 Apr 2021 15:27:37 +0300 > Leon Romanovsky wrote: > > > On Thu, Apr 01, 2021 at 05:37:16AM +0000, Raphael Norwitz wrote: > > > Slot resets are bus resets with additional logic to prevent a device > > > from being removed during the reset. Currently slot and bus resets have > > > separate implementations in pci.c, complicating higher level logic. As > > > discussed on the mailing list, they should be combined into a generic > > > function which performs an SBR. This change adds a function, > > > pci_reset_bus_function(), which first attempts a slot reset and then > > > attempts a bus reset if -ENOTTY is returned, such that there is now a > > > single device agnostic function to perform an SBR. > > > > > > This new function is also needed to add SBR reset quirks and therefore > > > is exposed in pci.h. > > > > > > Link: https://lkml.org/lkml/2021/3/23/911 > > > > > > Suggested-by: Alex Williamson > > > Signed-off-by: Amey Narkhede > > > Signed-off-by: Raphael Norwitz > > > --- > > > drivers/pci/pci.c | 17 +++++++++-------- > > > include/linux/pci.h | 1 + > > > 2 files changed, 10 insertions(+), 8 deletions(-) > > > > > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > > > index 16a17215f633..12a91af2ade4 100644 > > > --- a/drivers/pci/pci.c > > > +++ b/drivers/pci/pci.c > > > @@ -4982,6 +4982,13 @@ static int pci_dev_reset_slot_function(struct pci_dev *dev, int probe) > > > return pci_reset_hotplug_slot(dev->slot->hotplug, probe); > > > } > > > > > > +int pci_reset_bus_function(struct pci_dev *dev, int probe) > > > +{ > > > + int rc = pci_dev_reset_slot_function(dev, probe); > > > + > > > + return (rc == -ENOTTY) ? pci_parent_bus_reset(dev, probe) : rc; > > > > The previous coding style is preferable one in the Linux kernel. > > int rc = pci_dev_reset_slot_function(dev, probe); > > if (rc != -ENOTTY) > > return rc; > > return pci_parent_bus_reset(dev, probe); > > > That'd be news to me, do you have a reference? I've never seen > complaints for ternaries previously. Thanks, The complaint is not to ternaries, but to the function call as one of the parameters, that makes it harder to read. Thanks > > Alex >