Re: [PATCH v2 2/5] i2c-piix4: Convert piix4_main_adapter to array

2015-11-02 Thread Andy Shevchenko
On Sun, 2015-11-01 at 17:32 +0100, Christian Fetzer wrote:
> 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.


> @@ -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 = PIIX4_MAX_ADAPTERS - 1; port >= 0; port--) {
> + if (piix4_main_adapters[port]) {
> + piix4_adap_remove(piix4_main_adapters[port],
> +   port == 0);
> + piix4_main_adapters[port] = NULL;
> + }
>   }

Would it be

int port = PIIX4_MAX_ADAPTERS;

while (--port) {
 if (…) {…}
}

?

-- 
Andy Shevchenko 
Intel Finland Oy

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/5] i2c-piix4: Convert piix4_main_adapter to array

2015-11-02 Thread Mika Westerberg
On Sun, Nov 01, 2015 at 05:32:06PM +0100, Christian Fetzer wrote:
> 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 

Looks good to me,

Reviewed-by: Mika Westerberg 
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html