Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp521173pxt; Thu, 12 Aug 2021 03:58:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzCxidtM3AmBr1fpxEmE2Gj/pKIDuHeXskkooMLtka/g9NuTDz+1LcEx1xUhlX/NfOAFTg X-Received: by 2002:a17:906:eda3:: with SMTP id sa3mr3087906ejb.451.1628765893472; Thu, 12 Aug 2021 03:58:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628765893; cv=none; d=google.com; s=arc-20160816; b=a/Ba3NZJA2AnqU0b/zyMV00xwNZ1iSvEHikySiyOZjgvUgZ2vSGHYjZ0AQQWHLxduV 76nXM+3JGD4DuG5cEM92KnKthqT5qpWQfmD0f4GXxFDILXoo4n9ZgavWR3NGr7vA62hd PaiqSMcK4JguHtgn8hIPCgKM/cJbHP4iIMsGj9Ic2emsrIISBLd5uCFa46WCccn4u4KR jGg8jyowq++FdbeCk48kjYDiZ2Xk6cV1pFzJriWA3Xi0OUt0F8OgfNZps9XoFCPeoqVy gxQ4WrdEzi7w12WuYZbLiBRbiK/gsK9ahtzXvsIX3nGTjRcry9QpYhSkdWbVmQ3NsgAK PZJQ== 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=eq9Xh1F7xdY3qhY4IzprUVHF5yW7bLehYY5/rO8uEeA=; b=h1slYwCkWp1JAwPSR65ocNlJnVRmUSNJwE3tJWSGYFrMGjychA5RiQ4EpD+9rC2Wfl rubDNkf4vFXoFMv+UcVjcsXEpYXvEnNhg+tfC7oOZtIsiKAdXaNbkvoaFB/562FKoE5P 5CUv/daG6G2cxeW8OpItjxK1p9TzZdaDPnEIkPzroTOKX7dAQVVDPGEpZGuN6eXKUBrS f+3qH8TmDHCT0VyNAP0b2ugiE4kZZH8i1axkVuK40cObVJq00dlSeWELwg5WHtETmMCm UpA1UbQuZByZZJXYPL5bsCVuGxZmve4/42y51ugQClqvyFBL0A6z+SNNyzj8QmJDLQeE CVKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GJOkBGon; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y4si2480030eda.90.2021.08.12.03.57.49; Thu, 12 Aug 2021 03:58:13 -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=@gmail.com header.s=20161025 header.b=GJOkBGon; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236609AbhHLK4R (ORCPT + 99 others); Thu, 12 Aug 2021 06:56:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236442AbhHLK4O (ORCPT ); Thu, 12 Aug 2021 06:56:14 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 052C9C061765; Thu, 12 Aug 2021 03:55:50 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id e19so6748921pla.10; Thu, 12 Aug 2021 03:55:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=eq9Xh1F7xdY3qhY4IzprUVHF5yW7bLehYY5/rO8uEeA=; b=GJOkBGonE+ybwwOlKpANl+y0qg5PXXeou55G7E5sGB25X97XoOQ54LoA0xAFS2XrFC kY2LA0BtFa1QII2X6O8kmiuleMpLKt7ZG+ABldp3wLqx7gDKO+IOg+TwxZ5fz9zm2GU/ rpGNu1dVjC115xDXeTe3zAKYLpHiySWQod3s4pcIBxvaeoq/DB7rjcgVcDhsFAuFk4UA ix0yacAO1vOLUllzUvR4aRHLEgW9bFxzz6tYtqRrEpQXizwYkW+/uw+ygQvsC6W7Mkd6 ACo1KAebCYYIcgxHraY6s1qTf8mhVDcroXpkRvK2EwWTNJzdYPXYVcEbtbYxlge/7dsJ LdYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eq9Xh1F7xdY3qhY4IzprUVHF5yW7bLehYY5/rO8uEeA=; b=rDzlDexZZbX9Kag22EzlCuFPgpjNaF2/Ivo6B2Wl7kQTyZyu+zcoNUGob4jSFbL9at tEcT9g4ao6fjVfwm26hCAPsqCwM8pn+DD2B91Y+b8bStQQ7tx7Of91j007PKjS5fHdJg kwaQJ/q1pvq3OwaIjtPJSeh2dJsXTEasDTcb230iB0ua2wP2fHG3j7f/qr3SOuxwmcrQ 3A0HPZtkkbkhREc9ugr9Wctb1KM1bAlqNwByIkqkkjj4wgBIBFI2clICLVRaTREEJflG DrPdzbvk3fw5oshyPNQ/zPS7KwlKMOmi07YlCzcgCVnth7V3LkY9DoIMPeCZyiyCADbv R36Q== X-Gm-Message-State: AOAM531/9iMYIKtNP0knIDGPJRofGpu54HernopKOz0laPymxxGKPxAG npTFi/IX0ddPUCVRjNColnwgFUa+Ze/Xs4fL5hA= X-Received: by 2002:a17:902:bf48:b0:12d:8409:48ca with SMTP id u8-20020a170902bf4800b0012d840948camr680721pls.9.1628765749254; Thu, 12 Aug 2021 03:55:49 -0700 (PDT) Received: from uver-laptop ([2405:201:6006:a148:da50:248a:1651:e22d]) by smtp.gmail.com with ESMTPSA id j5sm3219757pgg.41.2021.08.12.03.55.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Aug 2021 03:55:48 -0700 (PDT) Date: Thu, 12 Aug 2021 16:25:37 +0530 From: Utkarsh Verma To: Greg KH Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Bjorn Helgaas , Shuah Khan Subject: Re: [PATCH] PCI: Remove duplicate #ifdef in pci_try_set_mwi() Message-ID: <20210812105537.GA9541@uver-laptop> References: <20210811234601.341947-1-utkarshverma294@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 12, 2021 at 08:49:21AM +0200, Greg KH wrote: > On Thu, Aug 12, 2021 at 05:16:01AM +0530, Utkarsh Verma wrote: > > Remove the unnecessary #ifdef PCI_DISABLE_MWI, because pci_set_mwi() > > performs the same check. > > > > Signed-off-by: Utkarsh Verma > > --- > > drivers/pci/pci.c | 4 ---- > > 1 file changed, 4 deletions(-) > > > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > > index aacf575c15cf..7d4c7c294ef2 100644 > > --- a/drivers/pci/pci.c > > +++ b/drivers/pci/pci.c > > @@ -4456,11 +4456,7 @@ EXPORT_SYMBOL(pcim_set_mwi); > > */ > > int pci_try_set_mwi(struct pci_dev *dev) > > { > > -#ifdef PCI_DISABLE_MWI > > - return 0; > > -#else > > return pci_set_mwi(dev); > > -#endif > > } > > EXPORT_SYMBOL(pci_try_set_mwi); > > If this is the case, why do we even need pci_try_set_mwi()? Why not > just replace it with calls to pci_set_mwi() and then delete this one? The only difference between the pci_set_mwi() and pci_try_set_mwi() is that, pci_set_mwi() is declared as __must_check which forces return value checking. The reason why pci_try_set_mwi() was introduced in the first place was because it gives the drivers both options: (1) most of the drivers don't require checking the return value, and they can safely ignore the errors values returned if any, so pci_try_set_mwi() can be used. (2) But for some of the drivers it is nice to check the return values, and generate proper warnings for error handling. By using the pci_set_mwi(), we force the driver for proper error checking. So both the functions are similar but have different purposes, and it seems a more appropriate design. The whole argument about adding this function: https://lore.kernel.org/linux-ide/20070404213704.224128ec.randy.dunlap@oracle.com/ Also earlier there was a patch that removed the pci_try_set_mwi() and __must_check attribute from pci_set_mwi(), just like you wanted, https://lore.kernel.org/linux-pci/4d535d35-6c8c-2bd8-812b-2b53194ce0ec@gmail.com/ But it was not accepted because Bjorn wasn't convinced and he also gave the above argument and that we should not break something in the name of cleaning it up. But it is safe to only remove the duplicate #ifdef block inside the pci_try_set_mwi(). Best Regards, Utkarsh Verma