Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2188852pxk; Sat, 26 Sep 2020 21:23:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweMeq0xGn7B6e/fOJ24xRYjiv2+Q2JAyB03e9pE+eOkh9T/odUg/+pN6Fn+xMYi5eudFgx X-Received: by 2002:a50:cc9a:: with SMTP id q26mr9678155edi.64.1601180631683; Sat, 26 Sep 2020 21:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601180631; cv=none; d=google.com; s=arc-20160816; b=ox+xqK10ZssFMWlOZaPYzjgIg03aZAhn3NdTua7oRjgKet9qCE9U+PIPgRvHWrFSj0 8ytVoGa8fqo2Gbc6OWl2/asTVpbQ1zElHAGMsGMFx18yta/gobTuM95oQKEAjUo7OuZA QGovEaxsCZmCKzdjSht2zVsFXX/S0iLcQKNxPFPAxsf+ZxQqzI85if3fzsErFm6PoUB+ RogRG3IrQibtzOKNHmHg6xQxqqHZ3s0Hb1UVVthT7GAQ22Ct6F07B/WnnLrJyyfK4EPf x1pQfYHMhWG/fMAJI7cE+MGVG6mp1/ICz6cQ7Mz6IB0Cyu6vDaiM/OwRDqT4NLvRZhYM 6mmA== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=EeR138akeFDDBss1CZ2Bku3j6lSFR1NRFW/tLjk9eIw=; b=pqIqIp8muL+1NySRUcslF3l1JyMraSie1NQC+ygSFMLZCc3eDqW+nh/XNE7KkrGhoc 54dHr9m5SRw4y/Sf0BB0RW9pUk1l8y5Y4pzSqdWQI9poBc9ZoUAofQmIyMprB0hXy4qy AR5adiJQ2+ytFwsTbLnrH5/zcN0p3e78U54lK3A91gs7FDqUxalRQQDWyec/7Vs3WyEs 0wcQWywyEs/0cCjh4U1NjVbEK3twgKrSx7iH8X45e4PUoQsr/SY9Boh8Or3337H1vdss uXPw1JIpk3BuZ1TjQbZ7PlB8B2CEg53gDW2Hn3ElwMvPHv+/KF+pfGhJOxDZ3lhPLB9o Nr+Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gj3si5254329ejb.728.2020.09.26.21.23.01; Sat, 26 Sep 2020 21:23:51 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730250AbgI0EQh (ORCPT + 99 others); Sun, 27 Sep 2020 00:16:37 -0400 Received: from smtprelay0206.hostedemail.com ([216.40.44.206]:44786 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726478AbgI0EQh (ORCPT ); Sun, 27 Sep 2020 00:16:37 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id C0D3C181D330D; Sun, 27 Sep 2020 04:16:35 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,,RULES_HIT:41:355:379:599:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1539:1593:1594:1711:1714:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3351:3622:3865:3867:3871:4321:5007:10004:10400:10848:11026:11658:11914:12048:12296:12297:12438:12740:12760:12895:13069:13311:13357:13439:14659:14721:21080:21627:21990:30045:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: cart93_150a0df27176 X-Filterd-Recvd-Size: 1792 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf02.hostedemail.com (Postfix) with ESMTPA; Sun, 27 Sep 2020 04:16:33 +0000 (UTC) Message-ID: <5e22dba6543b4fc09c5c18c839eab42bd31b18f6.camel@perches.com> Subject: Re: [PATCH 4/5 V2] PCI: only return true when dev io state is really changed From: Joe Perches To: Ethan Zhao , bhelgaas@google.com, oohall@gmail.com, ruscur@russell.cc, lukas@wunner.de, andriy.shevchenko@linux.intel.com, stuart.w.hayes@gmail.com, mr.nuke.me@gmail.com, mika.westerberg@linux.intel.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, pei.p.jia@intel.com, ashok.raj@linux.intel.com, sathyanarayanan.kuppuswamy@intel.com Date: Sat, 26 Sep 2020 21:16:32 -0700 In-Reply-To: <20200927032829.11321-5-haifeng.zhao@intel.com> References: <20200927032829.11321-1-haifeng.zhao@intel.com> <20200927032829.11321-5-haifeng.zhao@intel.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.36.4-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2020-09-26 at 23:28 -0400, Ethan Zhao wrote: > simplify the pci_dev_set_io_state() function to only return true > when dev->error_state is changed. [] > diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h [] > @@ -362,35 +362,11 @@ static inline bool pci_dev_set_io_state(struct pci_dev *dev, > bool changed = false; [] > + if (dev->error_state == new) > + return changed; > + > + dev->error_state = new; > + changed = true; > return changed; > } This would be simpler removing the unnecessary changed automatic ... if (dev->error_state == new) return false; dev->error_state = new; return true; }