Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp703529pxf; Thu, 1 Apr 2021 11:18:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGsAMv4T+rAlZisdmNX7GOLyp/GhOS6NQff2W3J0D9d+EnxlBrqk+7qbPwgX0Jh/0n+K/1 X-Received: by 2002:a17:906:38da:: with SMTP id r26mr10754006ejd.251.1617301085592; Thu, 01 Apr 2021 11:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617301085; cv=none; d=google.com; s=arc-20160816; b=GD2Oa7JpJSXUoboXnXbRTHEXvMI7RricvukJ8ZzjEUr6vZ6U4oUa9s1z46XoXjqJq5 JX6K5InGXeAhSr3QUXsyTK6Y6Dfxw2YYHumfIlV4v83mAwMz6tAq5CjGilqVKaFeNNcY Enz2q3UhBfVC956uuQtJz0Uy9+hNSqk5SA3ETaXDbwsOg7ZFsc996WOA3Yffk1UPpgOj pbqENU7pfqdfCxF50E04sooHBTfYivt5N//nlCvZhcpkRSV8u7q3XOJY9tH7CGCOZREe EF5wuyQBcW7mV2Z3X+iW68mBdycWU5VbfqqwI9jrXxuekEMB2zVnG3NAVmPU+i/6ynyM KDRw== 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:subject:cc:to:from:date :dkim-signature; bh=QIKK3VZ5wPeLTNPPED7wrhhBskYELwzoCKx6AQcmW3w=; b=lbeCLuo5R/BZZ3Wrz51YP8Zm1Hb9zAybVgshuN1RRalt/zzrTUJf68sQWxMa4wl3rK A2iLg3EQO6Vd1GN8z9hLrnAUbNFLtllr1GoBo/hWif2UOOpbrFMk8JimzUs5NxB2mbn5 2CIqCwFKi8KC3cq+xpG6Snhj8dp4HbC9wnj/dxY7nk2NtQirsTlvdaZJg6P257K7S7Ym 1sREK2jexFj9ehZYYzU0QMfNoJocbtbRJ7PJOEjZgMA3eteOi52qUF3vivcgPy7pFlk1 ar0hb+mP87h747xW+tb/B9ABwXZSObfl8Ef+esPKNf539U5X9oZ/KeWDeFvZkcO+dGR+ 4vOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R18OfuZC; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w8si4484620ejv.37.2021.04.01.11.17.42; Thu, 01 Apr 2021 11:18:05 -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=@redhat.com header.s=mimecast20190719 header.b=R18OfuZC; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238606AbhDASOu (ORCPT + 99 others); Thu, 1 Apr 2021 14:14:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38915 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234791AbhDAR5C (ORCPT ); Thu, 1 Apr 2021 13:57:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617299821; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QIKK3VZ5wPeLTNPPED7wrhhBskYELwzoCKx6AQcmW3w=; b=R18OfuZC/iYvnAXNsAMUia7ihoaWH7JVNX1R3SDFc/RKKbUOV979f3G9xzP2/VQzdkUzlr WSzktbIVjGnK/s+ef0zhXmiPc2m81RGJ3Q+iL7OxZwerPtZqR6QRP1/NuwbCQMqVotsV9n 5wT3i9YepOIBOJ3WFzucqZWc2TQ+WoU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-150-p5fM_ziwNSKp583x5rEgPw-1; Thu, 01 Apr 2021 12:56:18 -0400 X-MC-Unique: p5fM_ziwNSKp583x5rEgPw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2B7541084D77; Thu, 1 Apr 2021 16:56:17 +0000 (UTC) Received: from omen (ovpn-112-85.phx2.redhat.com [10.3.112.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF96E18A77; Thu, 1 Apr 2021 16:56:16 +0000 (UTC) Date: Thu, 1 Apr 2021 10:56:16 -0600 From: Alex Williamson To: Leon Romanovsky 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: <20210401105616.71156d08@omen> In-Reply-To: References: <20210401053656.16065-1-raphael.norwitz@nutanix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, Alex