Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1672626

[PATCH 3/5 v4] usb: pci-quirks: Protect the I/O port pair of SB800

From Zoltán Böszörményi <zboszor@pr.hu>
Newsgroups linux.kernel
Subject [PATCH 3/5 v4] usb: pci-quirks: Protect the I/O port pair of SB800
Date 2017-06-22 15:30 +0200
Message-ID <tValk-5i5-25@gated-at.bofh.it> (permalink)
References <tUF7P-16O-1@gated-at.bofh.it> <tValj-5i5-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This patch uses the previously introduced macro called
request_declared_muxed_region() to synchronize access to
the I/O port pair 0xcd6 / 0xcd7 on SB800.

These I/O ports are also used by i2c-piix4 and sp5100_tco,
so synchronization is necessary. The other drivers will also
be modified to use the new macro in subsequest patched.

v1: Started with a common mutex in a C source file.

v2: Declared the common mutex in drivers/usb/host/pci-quirks.c
    instead of in a common C file.

v3: Switched to using the new request_declared_muxed_region
    macro.

v4: Fixed checkpatch.pl warnings and use the new
    release_declared_region() macro.

Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
---
 drivers/usb/host/pci-quirks.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index a9a1e4c..593942a 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -279,6 +279,8 @@ bool usb_amd_prefetch_quirk(void)
 }
 EXPORT_SYMBOL_GPL(usb_amd_prefetch_quirk);
 
+static struct resource sb800_res = DEFINE_RES_IO_NAMED(0xcd6, 2, "SB800 USB");
+
 /*
  * The hardware normally enables the A-link power management feature, which
  * lets the system lower the power consumption in idle states.
@@ -314,11 +316,13 @@ static void usb_amd_quirk_pll(int disable)
 	if (amd_chipset.sb_type.gen == AMD_CHIPSET_SB800 ||
 			amd_chipset.sb_type.gen == AMD_CHIPSET_HUDSON2 ||
 			amd_chipset.sb_type.gen == AMD_CHIPSET_BOLTON) {
+		request_declared_muxed_region(&sb800_res);
 		outb_p(AB_REG_BAR_LOW, 0xcd6);
 		addr_low = inb_p(0xcd7);
 		outb_p(AB_REG_BAR_HIGH, 0xcd6);
 		addr_high = inb_p(0xcd7);
 		addr = addr_high << 8 | addr_low;
+		release_declared_region(&sb800_res);
 
 		outl_p(0x30, AB_INDX(addr));
 		outl_p(0x40, AB_DATA(addr));
-- 
2.9.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5 v3] Fix sp5100_tco watchdog driver regression Zoltán Böszörményi          <zboszor@pr.hu> - 2017-06-21 06:10 +0200
  [PATCH 3/5] usb: pci-quirks: Protect the I/O port pair of SB800 Zoltán Böszörményi          <zboszor@pr.hu> - 2017-06-21 06:10 +0200
  [PATCH 2/5] Modify behaviour of request_*muxed_region() Zoltán Böszörményi          <zboszor@pr.hu> - 2017-06-21 06:10 +0200
  [PATCH 5/5] watchdog: sp5100_tco: Use request_declared_muxed_region() Zoltán Böszörményi          <zboszor@pr.hu> - 2017-06-21 06:10 +0200
    Re: [PATCH 5/5] watchdog: sp5100_tco: Use  request_declared_muxed_region() Guenter Roeck <linux@roeck-us.net> - 2017-06-21 17:10 +0200
  [PATCH 1/5] Extend the request_region() infrastructure Zoltán Böszörményi          <zboszor@pr.hu> - 2017-06-21 06:10 +0200
  [PATCH 4/5] i2c: i2c-piix4: Use request_declared_muxed_region() Zoltán Böszörményi          <zboszor@pr.hu> - 2017-06-21 06:10 +0200
  [PATCH 1/5 v2] Extend the request_region() infrastructure Zoltán Böszörményi          <zboszor@pr.hu> - 2017-06-22 15:30 +0200
  [PATCH 0/5 v4] Fix sp5100_tco watchdog driver regression Zoltán Böszörményi          <zboszor@pr.hu> - 2017-06-22 15:30 +0200
    [PATCH 2/5 v2] Modify behaviour of request_*muxed_region() Zoltán Böszörményi          <zboszor@pr.hu> - 2017-06-22 15:30 +0200
    [PATCH 3/5 v4] usb: pci-quirks: Protect the I/O port pair of SB800 Zoltán Böszörményi          <zboszor@pr.hu> - 2017-06-22 15:30 +0200
    [PATCH 4/5 v4] i2c: i2c-piix4: Use request_declared_muxed_region() Zoltán Böszörményi          <zboszor@pr.hu> - 2017-06-22 15:30 +0200
    [PATCH 5/5 v4] watchdog: sp5100_tco: Use request_declared_muxed_region() Zoltán Böszörményi          <zboszor@pr.hu> - 2017-06-22 15:30 +0200

csiph-web