Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753359AbdGNIf1 (ORCPT ); Fri, 14 Jul 2017 04:35:27 -0400 Received: from mail7.pr.hu ([87.242.0.7]:58988 "EHLO mail7.pr.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751190AbdGNIfX (ORCPT ); Fri, 14 Jul 2017 04:35:23 -0400 Subject: Re: [PATCH 3/5 v4] usb: pci-quirks: Protect the I/O port pair of SB800 To: linux-kernel@vger.kernel.org Cc: linux-usb@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-i2c@vger.kernel.org, Paul Menzel , Christian Fetzer , Jean Delvare , Nehal Shah , Tim Small , Guenter Roeck , kernel@ekass.net, wim@iguana.be, jlayton@poochiereds.net, marc.2377@gmail.com, cshorler@googlemail.com, wsa@the-dreams.de, regressions@leemhuis.info, Alex Williamson , Linus Torvalds , Bjorn Helgaas , Toshi Kani , Jiang Liu , Jakub Sitnicki , Thierry Reding , Vivek Goyal , Ingo Molnar , Simon Guinot , Dan Williams , Mike Travis , Daeseok Youn , Huang Rui , Andiry Xu , Greg Kroah-Hartman , Alan Cox , David Howells , Ricardo Ribalda Delgado , Alexandre Desnoyers , Andy Shevchenko , Grygorii Strashko , Mika Westerberg , Wan ZongShun , Ulf Hansson , Lucas Stach , Denis Turischev References: <20170621035349.4125-1-zboszor@pr.hu> <20170622132134.7200-1-zboszor@pr.hu> <20170622132134.7200-4-zboszor@pr.hu> From: Boszormenyi Zoltan Message-ID: Date: Fri, 14 Jul 2017 10:34:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170622132134.7200-4-zboszor@pr.hu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.3 (/) X-Scan-Signature: 3473fb74e7ad808e6fbe21f69ada951e X-Spam-Tracer: backend.mail.pr.hu 0.3 20170714083425Z Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2011 Lines: 53 2017-06-22 15:21 keltezéssel, Zoltán Böszörményi írta: > 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 > --- > 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)); >