From: Greg KH <greg@kroah.com>
To: Zoltan Boszormenyi <zboszor@pr.hu>
Cc: linux-usb@vger.kernel.org, linux-watchdog@vger.kernel.org,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] usb: pci-quirks: Add a header for SB800 I/O ports and mutex for locking
Date: Sat, 1 Apr 2017 15:59:57 +0200 [thread overview]
Message-ID: <20170401135957.GA9493@kroah.com> (raw)
In-Reply-To: <20170401110223.12056-2-zboszor@pr.hu>
On Sat, Apr 01, 2017 at 01:02:21PM +0200, Zoltan Boszormenyi wrote:
> From: Böszörményi Zoltán <zboszor@pr.hu>
>
> This patch adds:
> * a mutex in the USB PCI quirks code for synchronizing access to
> the I/O ports on SB800
> * a new header that contains symbols for the index and data I/O ports
> and wrappers for locking and unlocking the mutex.
> * locking around the I/O port access for SB800
>
> Signed-off-by: Zoltan Boszormenyi <zboszor@pr.hu>
> ---
> drivers/usb/host/pci-quirks.c | 14 ++++++++++----
> include/linux/sb800.h | 15 +++++++++++++++
> 2 files changed, 25 insertions(+), 4 deletions(-)
> create mode 100644 include/linux/sb800.h
>
> diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
> index a9a1e4c..9b0445c 100644
> --- a/drivers/usb/host/pci-quirks.c
> +++ b/drivers/usb/host/pci-quirks.c
> @@ -15,6 +15,7 @@
> #include <linux/export.h>
> #include <linux/acpi.h>
> #include <linux/dmi.h>
> +#include <linux/sb800.h>
> #include "pci-quirks.h"
> #include "xhci-ext-caps.h"
>
> @@ -279,6 +280,9 @@ bool usb_amd_prefetch_quirk(void)
> }
> EXPORT_SYMBOL_GPL(usb_amd_prefetch_quirk);
>
> +DEFINE_MUTEX(sb800_mutex);
> +EXPORT_SYMBOL_GPL(sb800_mutex);
> +
> /*
> * The hardware normally enables the A-link power management feature, which
> * lets the system lower the power consumption in idle states.
> @@ -314,11 +318,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) {
> - outb_p(AB_REG_BAR_LOW, 0xcd6);
> - addr_low = inb_p(0xcd7);
> - outb_p(AB_REG_BAR_HIGH, 0xcd6);
> - addr_high = inb_p(0xcd7);
> + enter_sb800();
> + outb_p(AB_REG_BAR_LOW, SB800_PIIX4_SMB_IDX);
> + addr_low = inb_p(SB800_PIIX4_SMB_DATA);
> + outb_p(AB_REG_BAR_HIGH, SB800_PIIX4_SMB_IDX);
> + addr_high = inb_p(SB800_PIIX4_SMB_DATA);
> addr = addr_high << 8 | addr_low;
> + leave_sb800();
>
> outl_p(0x30, AB_INDX(addr));
> outl_p(0x40, AB_DATA(addr));
> diff --git a/include/linux/sb800.h b/include/linux/sb800.h
> new file mode 100644
> index 0000000..5650b7d
> --- /dev/null
> +++ b/include/linux/sb800.h
> @@ -0,0 +1,15 @@
> +
> +#ifndef SB800_H
> +#define SB800_H
> +
> +#include <linux/mutex.h>
> +
> +#define SB800_PIIX4_SMB_IDX 0xcd6
> +#define SB800_PIIX4_SMB_DATA 0xcd7
> +
> +extern struct mutex sb800_mutex;
> +
> +#define enter_sb800() mutex_lock(&sb800_mutex)
> +#define leave_sb800() mutex_unlock(&sb800_mutex)
Don't hide the mutex, just spell it out in the code itself. No need for
these defines at all.
thanks,
greg k-h
next prev parent reply other threads:[~2017-04-01 14:16 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-01 10:06 [PATCH 0/3] Fix sp5100_tco watchdog driver regression Zoltán Böszörményi
2017-04-01 10:06 ` [PATCH 1/3] usb: pci-quirks: Add a header for SB800 I/O ports and mutex for locking Zoltán Böszörményi
2017-04-01 10:06 ` [PATCH 3/3] watchdog: sp5100_tco: Synchronize I/O port accesses Zoltán Böszörményi
2017-04-01 11:02 ` [PATCH 0/3, resend] Fix sp5100_tco watchdog driver regression Zoltan Boszormenyi
2017-04-01 11:02 ` [PATCH 1/3] usb: pci-quirks: Add a header for SB800 I/O ports and mutex for locking Zoltan Boszormenyi
2017-04-01 13:59 ` Greg KH [this message]
2017-04-01 14:40 ` Alan Stern
2017-04-01 15:09 ` Boszormenyi Zoltan
2017-04-01 15:07 ` Boszormenyi Zoltan
2017-04-01 11:02 ` [PATCH 3/3] watchdog: sp5100_tco: Synchronize I/O port accesses Zoltan Boszormenyi
[not found] ` <20170401100609.9054-1-zboszor-v1d7l9VOqKc@public.gmane.org>
2017-04-01 11:08 ` [PATCH 2/3] i2c: i2c-piix4: Synchronize I/O port accesses with the SB800 USB quirk Zoltan Boszormenyi
[not found] <<20170401110223.12056-1-zboszor@pr.hu>
2017-04-03 7:51 ` [PATCH 0/3 v2] Fix regression in the sp5100_tco driver Zoltan Boszormenyi
2017-04-03 7:51 ` [PATCH 1/3 v2] usb: pci-quirks: Add a common mutex for the I/O port pair of SB800 Zoltan Boszormenyi
2017-06-20 14:12 ` [1/3, " Guenter Roeck
[not found] ` <20170403075133.12343-1-zboszor-v1d7l9VOqKc@public.gmane.org>
2017-04-03 7:51 ` [PATCH 2/3 v2] i2c: i2c-piix4: Use the common mutex Zoltan Boszormenyi
2017-04-19 18:43 ` Wolfram Sang
2017-04-03 7:51 ` [PATCH 3/3 v2] watchdog: sp5100_tco: " Zoltan Boszormenyi
2017-06-21 3:53 ` [PATCH 0/5 v3] Fix sp5100_tco watchdog driver regression Zoltán Böszörményi
2017-06-21 3:53 ` [PATCH 1/5] Extend the request_region() infrastructure Zoltán Böszörményi
2017-06-21 3:53 ` [PATCH 2/5] Modify behaviour of request_*muxed_region() Zoltán Böszörményi
2017-06-21 3:53 ` [PATCH 3/5] usb: pci-quirks: Protect the I/O port pair of SB800 Zoltán Böszörményi
2017-06-21 3:53 ` [PATCH 4/5] i2c: i2c-piix4: Use request_declared_muxed_region() Zoltán Böszörményi
[not found] ` <20170621035349.4125-1-zboszor-v1d7l9VOqKc@public.gmane.org>
2017-06-21 3:53 ` [PATCH 5/5] watchdog: sp5100_tco: " Zoltán Böszörményi
2017-06-21 15:09 ` Guenter Roeck
2017-06-22 13:21 ` [PATCH 0/5 v4] Fix sp5100_tco watchdog driver regression Zoltán Böszörményi
2017-06-22 13:21 ` [PATCH 1/5 v2] Extend the request_region() infrastructure Zoltán Böszörményi
[not found] ` <20170622132134.7200-2-zboszor-v1d7l9VOqKc@public.gmane.org>
2017-07-14 8:33 ` Boszormenyi Zoltan
2017-06-22 13:21 ` [PATCH 2/5 v2] Modify behaviour of request_*muxed_region() Zoltán Böszörményi
[not found] ` <20170622132134.7200-3-zboszor-v1d7l9VOqKc@public.gmane.org>
2017-07-08 15:37 ` [2/5,v2] " Guenter Roeck
2017-06-22 13:21 ` [PATCH 4/5 v4] i2c: i2c-piix4: Use request_declared_muxed_region() Zoltán Böszörményi
2017-06-22 13:21 ` [PATCH 5/5 v4] watchdog: sp5100_tco: " Zoltán Böszörményi
[not found] ` <20170622132134.7200-6-zboszor-v1d7l9VOqKc@public.gmane.org>
2017-07-14 8:34 ` Boszormenyi Zoltan
[not found] ` <20170622132134.7200-1-zboszor-v1d7l9VOqKc@public.gmane.org>
2017-06-22 13:21 ` [PATCH 3/5 v4] usb: pci-quirks: Protect the I/O port pair of SB800 Zoltán Böszörményi
2017-07-14 8:34 ` Boszormenyi Zoltan
2017-07-14 11:36 ` Greg Kroah-Hartman
2017-07-06 7:50 ` [PATCH 0/5 v4] Fix sp5100_tco watchdog driver regression Boszormenyi Zoltan
[not found] ` <CAETC-g-0ZYiD=j_sAtYpfr0t-rciiTx3ruvpGuwEud+nbbpiBg@mail.gmail.com>
[not found] ` <CAETC-g_YF7TWv+LNrNQrX9AY_-iepCeE0EmCKWYF4VyQzRY+UQ@mail.gmail.com>
2017-07-07 2:26 ` Marcelo "Marc" Ranolfi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170401135957.GA9493@kroah.com \
--to=greg@kroah.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=zboszor@pr.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).