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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy

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



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux