From: Christian Fetzer <fetzer.ch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: tbrandonau-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
eddi-soWH+0lSOSbR7s880joybQ@public.gmane.org,
galandilias-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
Christian Fetzer
<fetzer.ch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 2/4] i2c-piix4: Convert piix4_main_adapter to array
Date: Tue, 25 Aug 2015 13:05:03 +0200 [thread overview]
Message-ID: <1440500705-2288-3-git-send-email-fetzer.ch@gmail.com> (raw)
In-Reply-To: <1440500705-2288-1-git-send-email-fetzer.ch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
The SB800 chipset supports a multiplexed main SMBus controller with
four ports. Therefore the static variable piix4_main_adapter is
converted into a piix4_main_adapters array that can hold one
i2c_adapter for each multiplexed port.
The auxiliary adapter remains unchanged since it represents the second
(not multiplexed) SMBus controller on the SB800 chipset.
Signed-off-by: Christian Fetzer <fetzer.ch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/i2c/busses/i2c-piix4.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index 97d2165..8934a32 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -75,6 +75,9 @@
#define PIIX4_WORD_DATA 0x0C
#define PIIX4_BLOCK_DATA 0x14
+/* Multi-port constants */
+#define PIIX4_MAX_ADAPTERS 4
+
/* insmod parameters */
/* If force is set to anything different from 0, we forcibly enable the
@@ -561,7 +564,7 @@ static const struct pci_device_id piix4_ids[] = {
MODULE_DEVICE_TABLE (pci, piix4_ids);
-static struct i2c_adapter *piix4_main_adapter;
+static struct i2c_adapter *piix4_main_adapters[PIIX4_MAX_ADAPTERS];
static struct i2c_adapter *piix4_aux_adapter;
static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba,
@@ -629,7 +632,7 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
return retval;
/* Try to register main SMBus adapter, give up if we can't */
- retval = piix4_add_adapter(dev, retval, &piix4_main_adapter);
+ retval = piix4_add_adapter(dev, retval, &piix4_main_adapters[0]);
if (retval < 0)
return retval;
@@ -675,9 +678,14 @@ static void piix4_adap_remove(struct i2c_adapter *adap, int free_smba)
static void piix4_remove(struct pci_dev *dev)
{
- if (piix4_main_adapter) {
- piix4_adap_remove(piix4_main_adapter, 1);
- piix4_main_adapter = NULL;
+ int port;
+
+ for (port = 0; port < PIIX4_MAX_ADAPTERS; port++) {
+ if (piix4_main_adapters[port]) {
+ piix4_adap_remove(piix4_main_adapters[port],
+ port == 0);
+ piix4_main_adapters[port] = NULL;
+ }
}
if (piix4_aux_adapter) {
--
1.9.1
next prev parent reply other threads:[~2015-08-25 11:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-25 11:05 [PATCH 0/4] Support multiplexed main SMBus interface on SB800 Christian Fetzer
[not found] ` <1440500705-2288-1-git-send-email-fetzer.ch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-08-25 11:05 ` [PATCH 1/4] i2c-piix4: Optionally release smba in piix4_adap_remove Christian Fetzer
2015-08-25 11:05 ` Christian Fetzer [this message]
2015-08-25 11:05 ` [PATCH 3/4] i2c-piix4: Add support for multiplexed main adapter in SB800 Christian Fetzer
2015-08-25 11:05 ` [PATCH 4/4] i2c-piix4: Add adapter port name support for SB800 chipset Christian Fetzer
2015-10-10 7:45 ` [PATCH 0/4] Support multiplexed main SMBus interface on SB800 Wolfram Sang
2016-01-21 14:12 ` Jean Delvare
2015-10-20 15:19 ` Wolfram Sang
2015-10-22 8:27 ` Mika Westerberg
2015-10-22 11:03 ` Wolfram Sang
2015-10-22 11:43 ` Mika Westerberg
2015-11-01 16:38 ` fetzerch
2016-01-22 12:07 ` Jean Delvare
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=1440500705-2288-3-git-send-email-fetzer.ch@gmail.com \
--to=fetzer.ch-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=eddi-soWH+0lSOSbR7s880joybQ@public.gmane.org \
--cc=galandilias-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tbrandonau-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/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).