RFC: complete rewrite of i2c-i801 for 2.6.x

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

 



Hello Mark,

On Mon, 29 Nov 2004, Mark M. Hoffman wrote:

> I.e. the way I wrote it was correct but non-optimal?  How about this?
> It compiles & runs at least, and it looks correct to me.

Yes, the datum being protected can be accessed atomically without 
spinlocks.

> +	return xchg(&algo_data->status,0);
>  }
>  
>  static int i801_transaction(struct i2c_adapter *adap, int smbcmd)
> @@ -246,11 +237,8 @@ static irqreturn_t i801_isr(int irq, voi
>  	if (likely(status & I801_HST_STS_MASK_NORM)) {
>  		struct i2c_adapter *adap = dev_id;
>  		struct i2c_i801_algo_data *algo_data = adap->algo_data;
> -		unsigned long flags;
>  
> -		spin_lock_irqsave(&algo_data->lock, flags);
>  		algo_data->status = status;
> -		spin_unlock_irqrestore(&algo_data->lock, flags);
>  		wake_up_interruptible(&algo_data->waitq);

This needs to be done atomically via xchg too.

Thanks,
	Zwane



[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux