Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2446505pxb; Tue, 13 Apr 2021 01:59:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZEryFVDFo63B4n6Ccj8bBxlOh0iuEuw5irk7Neg+8APOH52DJKZMQAaTD2T1btrJjW4Kt X-Received: by 2002:a17:902:bd41:b029:e6:933a:f3ef with SMTP id b1-20020a170902bd41b02900e6933af3efmr30814217plx.19.1618304359459; Tue, 13 Apr 2021 01:59:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618304359; cv=none; d=google.com; s=arc-20160816; b=wzKWJ+cADF7VbfkeJcgPNXMSBmLC/+p4iYav+CADK7XL0/gTn+5RiDCAnlTUuWuySr IJTaYdgYKWRhDg+qqqS+hILntDw4iSJ3loxAagDdrwLwv1FkBUJSXTT2+jGehEDHmZL7 oDb5Dzj3JYH2ibGaQCAhlSCVvWDrpL2pxWSBlRPhd4Zx2O/QiSQkNdPSU6fMT33l+HqZ zqT0dH4jHMPf8S6o+Ap+sJwzMRkVH4CLo2mVGqfMfpfLSl/3iMRDviT/sIP0/jKiv+1n yl/FGGCNWkU7uHZIfNNJQB4k+ibRHpi9QiWHfs7lwBOdstED8ohfzk+tDuzusCJWA5Ec yDCw== 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:date:subject:cc:to:from :dkim-signature; bh=FtKBAsvc7cP/9k3yGtb2tbU5XcFAujb/4U8g9ZMjXlc=; b=rdg7C6NpymTPl/482Bsx1LdtkeOSDX3q89VZSXcu9GKRR78sknIayvhRoJn3M2F2be auDJEvDKOu56//qqtfrAA1scR+EycZn9dzc31uf0IAJygs3lh+FlxMpOIuh/WtqLENHm hWJP9+1X4+n/tInZphrDErEfwKj6XjrNr0k6/dRJF9uZJu3t7y4JY4Q9MLvZArQ5vAhd 2s3s08yYsZMzsbJ0ncRBoIPW9m7DFNOi3JoFGjXrkOiUf0nDMl4rKw487i6FYFwVlwky 5hCiw/q39UWKVxMqSAL2OrwOatBpSdQaf3RAlG7qlH4d7kcGWTvyZSSOd1SRSgr0KcI2 MoRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YZ3upqSW; 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 w1si2380329pjq.100.2021.04.13.01.59.07; Tue, 13 Apr 2021 01:59:19 -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=YZ3upqSW; 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 S1344975AbhDMGW2 (ORCPT + 99 others); Tue, 13 Apr 2021 02:22:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344965AbhDMGW0 (ORCPT ); Tue, 13 Apr 2021 02:22:26 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 358BAC061756; Mon, 12 Apr 2021 23:22:07 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id i4so7928205pjk.1; Mon, 12 Apr 2021 23:22:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FtKBAsvc7cP/9k3yGtb2tbU5XcFAujb/4U8g9ZMjXlc=; b=YZ3upqSWzBebTRthDEIPNBTcOnRSB9M7m5Ojkb4A3SuvRLMFSVJ+wfZG7i20LQmjcI IYPrkiecnpC29BCtWvsim39EE6VcyQyyKOvY1/sETJ1ua/9Hci0diqRw2jKu6WDVpBof 0QE4++NYYlWSKBojOAUx7BDtls6bkyneAwpiYRJCWzraoxnzyD29saKVqosTKe4WKwSN PWdwPNog+pqjiTKB0dO4Z0bno8L0IHQb3CktgqyxcXG6J0dK72uMF7RY64gjeWA5B6Uz kxIB0USKLJnPB4o0fug6OWW4+8e4b2WB8ZXNfNGFK1tVxsgqw21e8G7anlZCD3N2780/ Zwgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FtKBAsvc7cP/9k3yGtb2tbU5XcFAujb/4U8g9ZMjXlc=; b=eobuS5KMk52ImhcNHfKQN/3ktsNVlBnUUIYmSWA4WRHRrA2epqXwYwPg3kzXQsW8j9 lx5XTyWySZ1RRBie2pAnaQQZrDn/NiPp+m5Kg3FrwEYzQYES6wrfKe1J4df6Ah2m0WRw /hIIFIYkdOx3oXhxHzAW+kAOsUDS9A8loul92hL02drzIDhhTq1H1ilV9LD4ng/2w5Q9 tO/YljMy0CcAU19/0iMvmF/YUbqz+zaVqj2bfv7BOIwFh5RrfdpDM7IwGIYJ79ywZKdT GBJo7CU42q8eFh94ZFAkbcl6Q5D69X7e3UrNp/KHkq8dMisuilwe/ZyK12IbXEXTMf1j sCmg== X-Gm-Message-State: AOAM530V4+kysyuz0ug6ZheXz3LRGOShaYQ/4M1FzZezWZUDuPSl1ihx OhV6GqKTBab1kkwdqnDJVGw= X-Received: by 2002:a17:90a:e28b:: with SMTP id d11mr3198895pjz.53.1618294926838; Mon, 12 Apr 2021 23:22:06 -0700 (PDT) Received: from z640-arch.lan ([2602:61:7344:f100::678]) by smtp.gmail.com with ESMTPSA id e190sm11453326pfe.3.2021.04.12.23.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Apr 2021 23:22:06 -0700 (PDT) From: Ilya Lipnitskiy To: Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ilya Lipnitskiy , Sergey Ryazanov Subject: [PATCH 2/8] MIPS: pci-rt2880: remove unneeded locks Date: Mon, 12 Apr 2021 23:21:40 -0700 Message-Id: <20210413062146.389690-3-ilya.lipnitskiy@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210413062146.389690-1-ilya.lipnitskiy@gmail.com> References: <20210413062146.389690-1-ilya.lipnitskiy@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mirror pci-rt3883 fix from commit e5067c718b3a ("MIPS: pci-rt3883: Remove odd locking in PCI config space access code"). pci-rt2880 shares the driver layout with pci-rt3883 and the same reasons apply. Caller (generic PCI code) already does proper locking, so no need to add another one here. Local PCI read/write functions are never called simultaneously, also they do not require synchronization with the PCI controller ops, since they are used before the controller registration. Suggested-by: Sergey Ryazanov Signed-off-by: Ilya Lipnitskiy --- arch/mips/pci/pci-rt2880.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/arch/mips/pci/pci-rt2880.c b/arch/mips/pci/pci-rt2880.c index 19f7860fb28b..b4ee07cbcf2a 100644 --- a/arch/mips/pci/pci-rt2880.c +++ b/arch/mips/pci/pci-rt2880.c @@ -41,7 +41,6 @@ #define RT2880_PCI_REG_ARBCTL 0x80 static void __iomem *rt2880_pci_base; -static DEFINE_SPINLOCK(rt2880_pci_lock); static u32 rt2880_pci_reg_read(u32 reg) { @@ -63,7 +62,6 @@ static inline u32 rt2880_pci_get_cfgaddr(unsigned int bus, unsigned int slot, static int rt2880_pci_config_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val) { - unsigned long flags; u32 address; u32 data; int busn = 0; @@ -74,10 +72,8 @@ static int rt2880_pci_config_read(struct pci_bus *bus, unsigned int devfn, address = rt2880_pci_get_cfgaddr(busn, PCI_SLOT(devfn), PCI_FUNC(devfn), where); - spin_lock_irqsave(&rt2880_pci_lock, flags); rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); data = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA); - spin_unlock_irqrestore(&rt2880_pci_lock, flags); switch (size) { case 1: @@ -97,7 +93,6 @@ static int rt2880_pci_config_read(struct pci_bus *bus, unsigned int devfn, static int rt2880_pci_config_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val) { - unsigned long flags; u32 address; u32 data; int busn = 0; @@ -108,7 +103,6 @@ static int rt2880_pci_config_write(struct pci_bus *bus, unsigned int devfn, address = rt2880_pci_get_cfgaddr(busn, PCI_SLOT(devfn), PCI_FUNC(devfn), where); - spin_lock_irqsave(&rt2880_pci_lock, flags); rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); data = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA); @@ -127,7 +121,6 @@ static int rt2880_pci_config_write(struct pci_bus *bus, unsigned int devfn, } rt2880_pci_reg_write(data, RT2880_PCI_REG_CONFIG_DATA); - spin_unlock_irqrestore(&rt2880_pci_lock, flags); return PCIBIOS_SUCCESSFUL; } @@ -159,31 +152,25 @@ static struct pci_controller rt2880_pci_controller = { static inline u32 rt2880_pci_read_u32(unsigned long reg) { - unsigned long flags; u32 address; u32 ret; address = rt2880_pci_get_cfgaddr(0, 0, 0, reg); - spin_lock_irqsave(&rt2880_pci_lock, flags); rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); ret = rt2880_pci_reg_read(RT2880_PCI_REG_CONFIG_DATA); - spin_unlock_irqrestore(&rt2880_pci_lock, flags); return ret; } static inline void rt2880_pci_write_u32(unsigned long reg, u32 val) { - unsigned long flags; u32 address; address = rt2880_pci_get_cfgaddr(0, 0, 0, reg); - spin_lock_irqsave(&rt2880_pci_lock, flags); rt2880_pci_reg_write(address, RT2880_PCI_REG_CONFIG_ADDR); rt2880_pci_reg_write(val, RT2880_PCI_REG_CONFIG_DATA); - spin_unlock_irqrestore(&rt2880_pci_lock, flags); } int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) -- 2.31.1