diff options
author | Christian Fetzer <fetzer.ch@gmail.com> | 2015-11-19 20:13:47 +0100 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2015-11-30 14:31:23 +0100 |
commit | ca2061e1283b787b49e3f6817645b9f0a2151671 (patch) | |
tree | 1482740f429c9519c3a40a50d21245080d54abef /drivers/i2c/busses/i2c-piix4.c | |
parent | e49865d10ad563fda56bfe3c385948f88b41b1af (diff) | |
download | op-kernel-dev-ca2061e1283b787b49e3f6817645b9f0a2151671.zip op-kernel-dev-ca2061e1283b787b49e3f6817645b9f0a2151671.tar.gz |
i2c: piix4: Convert piix4_main_adapter to array
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@gmail.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-piix4.c')
-rw-r--r-- | drivers/i2c/busses/i2c-piix4.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 630bce6..9c32eb1 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; @@ -674,9 +677,13 @@ static void piix4_adap_remove(struct i2c_adapter *adap) static void piix4_remove(struct pci_dev *dev) { - if (piix4_main_adapter) { - piix4_adap_remove(piix4_main_adapter); - piix4_main_adapter = NULL; + int port = PIIX4_MAX_ADAPTERS; + + while (--port >= 0) { + if (piix4_main_adapters[port]) { + piix4_adap_remove(piix4_main_adapters[port]); + piix4_main_adapters[port] = NULL; + } } if (piix4_aux_adapter) { |