Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/2] mtip32xx: minor PCI cleanups
@ 2021-01-26 20:04 Bjorn Helgaas
  2021-01-26 20:04 ` [PATCH 1/2] mtip32xx: use PCI #defines instead of numbers Bjorn Helgaas
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2021-01-26 20:04 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, linux-kernel, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

Use PCI #defines and the special accessors for the PCIe capability.

Bjorn Helgaas (2):
  mtip32xx: use PCI #defines instead of numbers
  mtip32xx: prefer pcie_capability_read_word()

 drivers/block/mtip32xx/mtip32xx.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] mtip32xx: use PCI #defines instead of numbers
  2021-01-26 20:04 [PATCH 0/2] mtip32xx: minor PCI cleanups Bjorn Helgaas
@ 2021-01-26 20:04 ` Bjorn Helgaas
  2021-01-26 23:32   ` Chaitanya Kulkarni
  2021-01-26 20:04 ` [PATCH 2/2] mtip32xx: prefer pcie_capability_read_word() Bjorn Helgaas
  2021-01-26 20:09 ` [PATCH 0/2] mtip32xx: minor PCI cleanups Jens Axboe
  2 siblings, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2021-01-26 20:04 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, linux-kernel, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

Use PCI #defines for PCIe Device Control register values instead of
hard-coding bit positions.  No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/block/mtip32xx/mtip32xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 53ac59d19ae5..543eb30a3bc0 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -3932,8 +3932,8 @@ static void mtip_disable_link_opts(struct driver_data *dd, struct pci_dev *pdev)
 		pci_read_config_word(pdev,
 			pos + PCI_EXP_DEVCTL,
 			&pcie_dev_ctrl);
-		if (pcie_dev_ctrl & (1 << 11) ||
-		    pcie_dev_ctrl & (1 << 4)) {
+		if (pcie_dev_ctrl & PCI_EXP_DEVCTL_NOSNOOP_EN ||
+		    pcie_dev_ctrl & PCI_EXP_DEVCTL_RELAX_EN) {
 			dev_info(&dd->pdev->dev,
 				"Disabling ERO/No-Snoop on bridge device %04x:%04x\n",
 					pdev->vendor, pdev->device);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] mtip32xx: prefer pcie_capability_read_word()
  2021-01-26 20:04 [PATCH 0/2] mtip32xx: minor PCI cleanups Bjorn Helgaas
  2021-01-26 20:04 ` [PATCH 1/2] mtip32xx: use PCI #defines instead of numbers Bjorn Helgaas
@ 2021-01-26 20:04 ` Bjorn Helgaas
  2021-01-26 20:09 ` [PATCH 0/2] mtip32xx: minor PCI cleanups Jens Axboe
  2 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2021-01-26 20:04 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, linux-kernel, Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

Replace pci_read_config_word() with pcie_capability_read_word().

pcie_capability_read_word() takes care of a few special cases when reading
the PCIe capability.  See 8c0d3a02c130 ("PCI: Add accessors for PCI Express
Capability").

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/block/mtip32xx/mtip32xx.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 543eb30a3bc0..a0f9bf152ddc 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -3924,14 +3924,10 @@ static DEFINE_HANDLER(7);
 
 static void mtip_disable_link_opts(struct driver_data *dd, struct pci_dev *pdev)
 {
-	int pos;
 	unsigned short pcie_dev_ctrl;
 
-	pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
-	if (pos) {
-		pci_read_config_word(pdev,
-			pos + PCI_EXP_DEVCTL,
-			&pcie_dev_ctrl);
+	if (pci_is_pcie(pdev)) {
+		pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &pcie_dev_ctrl);
 		if (pcie_dev_ctrl & PCI_EXP_DEVCTL_NOSNOOP_EN ||
 		    pcie_dev_ctrl & PCI_EXP_DEVCTL_RELAX_EN) {
 			dev_info(&dd->pdev->dev,
@@ -3939,8 +3935,7 @@ static void mtip_disable_link_opts(struct driver_data *dd, struct pci_dev *pdev)
 					pdev->vendor, pdev->device);
 			pcie_dev_ctrl &= ~(PCI_EXP_DEVCTL_NOSNOOP_EN |
 						PCI_EXP_DEVCTL_RELAX_EN);
-			pci_write_config_word(pdev,
-				pos + PCI_EXP_DEVCTL,
+			pcie_capability_write_word(pdev, PCI_EXP_DEVCTL,
 				pcie_dev_ctrl);
 		}
 	}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] mtip32xx: minor PCI cleanups
  2021-01-26 20:04 [PATCH 0/2] mtip32xx: minor PCI cleanups Bjorn Helgaas
  2021-01-26 20:04 ` [PATCH 1/2] mtip32xx: use PCI #defines instead of numbers Bjorn Helgaas
  2021-01-26 20:04 ` [PATCH 2/2] mtip32xx: prefer pcie_capability_read_word() Bjorn Helgaas
@ 2021-01-26 20:09 ` Jens Axboe
  2 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2021-01-26 20:09 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-block, linux-kernel, Bjorn Helgaas

On 1/26/21 1:04 PM, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> Use PCI #defines and the special accessors for the PCIe capability.
> 
> Bjorn Helgaas (2):
>   mtip32xx: use PCI #defines instead of numbers
>   mtip32xx: prefer pcie_capability_read_word()
> 
>  drivers/block/mtip32xx/mtip32xx.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] mtip32xx: use PCI #defines instead of numbers
  2021-01-26 20:04 ` [PATCH 1/2] mtip32xx: use PCI #defines instead of numbers Bjorn Helgaas
@ 2021-01-26 23:32   ` Chaitanya Kulkarni
  2021-01-27  7:58     ` Chaitanya Kulkarni
  0 siblings, 1 reply; 7+ messages in thread
From: Chaitanya Kulkarni @ 2021-01-26 23:32 UTC (permalink / raw)
  To: Bjorn Helgaas, Jens Axboe; +Cc: linux-block, linux-kernel, Bjorn Helgaas

On 1/26/21 14:14, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> Use PCI #defines for PCIe Device Control register values instead of
> hard-coding bit positions.  No functional change intended.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

I've verified the values present in the include/uapi/linux/pci_regs.h
matches open coded bit shift values. LGTM.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] mtip32xx: use PCI #defines instead of numbers
  2021-01-26 23:32   ` Chaitanya Kulkarni
@ 2021-01-27  7:58     ` Chaitanya Kulkarni
  2021-01-27 15:18       ` Bjorn Helgaas
  0 siblings, 1 reply; 7+ messages in thread
From: Chaitanya Kulkarni @ 2021-01-27  7:58 UTC (permalink / raw)
  To: Bjorn Helgaas, Jens Axboe; +Cc: linux-block, linux-kernel, Bjorn Helgaas



> On Jan 26, 2021, at 11:41 PM, Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com> wrote:
> 
> On 1/26/21 14:14, Bjorn Helgaas wrote:
>> From: Bjorn Helgaas <bhelgaas@google.com>
>> 
>> Use PCI #defines for PCIe Device Control register values instead of
>> hard-coding bit positions.  No functional change intended.
>> 
>> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> 
> I've verified the values present in the include/uapi/linux/pci_regs.h
> matches open coded bit shift values. LGTM.
> 
> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> 
Something is seriously wrong. I sent out this in the morning and it got delivered right now. 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] mtip32xx: use PCI #defines instead of numbers
  2021-01-27  7:58     ` Chaitanya Kulkarni
@ 2021-01-27 15:18       ` Bjorn Helgaas
  0 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2021-01-27 15:18 UTC (permalink / raw)
  To: Chaitanya Kulkarni; +Cc: Jens Axboe, linux-block, linux-kernel, Bjorn Helgaas

On Wed, Jan 27, 2021 at 07:58:26AM +0000, Chaitanya Kulkarni wrote:
> > On Jan 26, 2021, at 11:41 PM, Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com> wrote:
> > On 1/26/21 14:14, Bjorn Helgaas wrote:
> >> From: Bjorn Helgaas <bhelgaas@google.com>
> >> 
> >> Use PCI #defines for PCIe Device Control register values instead of
> >> hard-coding bit positions.  No functional change intended.
> >> 
> >> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> > 
> > I've verified the values present in the include/uapi/linux/pci_regs.h
> > matches open coded bit shift values. LGTM.
> > 
> > Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> > 
> Something is seriously wrong. I sent out this in the morning and it
> got delivered right now. 

I noticed that, too.  Seems like the mailing list is really backed up.
Thanks a lot for taking a look at this!

Bjorn

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26 20:04 [PATCH 0/2] mtip32xx: minor PCI cleanups Bjorn Helgaas
2021-01-26 20:04 ` [PATCH 1/2] mtip32xx: use PCI #defines instead of numbers Bjorn Helgaas
2021-01-26 23:32   ` Chaitanya Kulkarni
2021-01-27  7:58     ` Chaitanya Kulkarni
2021-01-27 15:18       ` Bjorn Helgaas
2021-01-26 20:04 ` [PATCH 2/2] mtip32xx: prefer pcie_capability_read_word() Bjorn Helgaas
2021-01-26 20:09 ` [PATCH 0/2] mtip32xx: minor PCI cleanups Jens Axboe

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org
	public-inbox-index linux-block

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git