From patchwork Fri Dec 28 07:31:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Feng X-Patchwork-Id: 1914441 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D8038DF25A for ; Fri, 28 Dec 2012 07:32:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751289Ab2L1Hcf (ORCPT ); Fri, 28 Dec 2012 02:32:35 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:43130 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751280Ab2L1Hce (ORCPT ); Fri, 28 Dec 2012 02:32:34 -0500 X-IronPort-AV: E=Sophos;i="4.84,367,1355068800"; d="scan'208";a="6492408" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 28 Dec 2012 15:30:33 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id qBS7Wwtt019194; Fri, 28 Dec 2012 15:32:58 +0800 Received: from linfeng-fedora.fnst.cn.fujitsu.com ([10.167.225.247]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2012122815321286-655556 ; Fri, 28 Dec 2012 15:32:12 +0800 From: Lin Feng To: bhelgaas@google.com, linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org, yinghai@kernel.org, tangchen@cn.fujitsu.com, Lin Feng Subject: [PATCH] pci: remove redundant function calls in pci_reassigndev_resource_alignment() Date: Fri, 28 Dec 2012 15:31:42 +0800 Message-Id: <1356679902-4266-1-git-send-email-linfeng@cn.fujitsu.com> X-Mailer: git-send-email 1.7.11.7 X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/12/28 15:32:12, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/12/28 15:32:15, Serialize complete at 2012/12/28 15:32:15 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org pci_reassigndev_resource_alignment() potentially calls pci_specified_resource_alignment() twice, which is redundant. pci_is_reassigndev() is only called in pci_reassigndev_resource_alignment(), and from sematic/functionality aspects pci_specified_resource_alignment() is sufficient to substitute, so also make some cleanup. Signed-off-by: Lin Feng Cc: Yinghai Lu --- drivers/pci/pci.c | 16 ++-------------- 1 files changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 5cb5820..789f401 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -3766,18 +3766,6 @@ resource_size_t pci_specified_resource_alignment(struct pci_dev *dev) return align; } -/** - * pci_is_reassigndev - check if specified PCI is target device to reassign - * @dev: the PCI device to check - * - * RETURNS: non-zero for PCI device is a target device to reassign, - * or zero is not. - */ -int pci_is_reassigndev(struct pci_dev *dev) -{ - return (pci_specified_resource_alignment(dev) != 0); -} - /* * This function disables memory decoding and releases memory resources * of the device specified by kernel's boot parameter 'pci=resource_alignment='. @@ -3792,7 +3780,8 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev) resource_size_t align, size; u16 command; - if (!pci_is_reassigndev(dev)) + align = pci_specified_resource_alignment(dev); + if (!align) return; if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL && @@ -3808,7 +3797,6 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev) command &= ~PCI_COMMAND_MEMORY; pci_write_config_word(dev, PCI_COMMAND, command); - align = pci_specified_resource_alignment(dev); for (i = 0; i < PCI_BRIDGE_RESOURCES; i++) { r = &dev->resource[i]; if (!(r->flags & IORESOURCE_MEM))