@@ -337,6 +337,40 @@ MODULE_PARM_DESC(disable_features, "Disable selected driver features:\n"
337337 "\t\t 0x10 don't use interrupts\n"
338338 "\t\t 0x20 disable SMBus Host Notify " );
339339
340+ /* Wait for BUSY being cleared and either INTR or an error flag being set */
341+ static int i801_wait_intr (struct i801_priv * priv )
342+ {
343+ unsigned long timeout = jiffies + priv -> adapter .timeout ;
344+ int status , busy ;
345+
346+ do {
347+ usleep_range (250 , 500 );
348+ status = inb_p (SMBHSTSTS (priv ));
349+ busy = status & SMBHSTSTS_HOST_BUSY ;
350+ status &= STATUS_ERROR_FLAGS | SMBHSTSTS_INTR ;
351+ if (!busy && status )
352+ return status & STATUS_ERROR_FLAGS ;
353+ } while (time_is_after_eq_jiffies (timeout ));
354+
355+ return - ETIMEDOUT ;
356+ }
357+
358+ /* Wait for either BYTE_DONE or an error flag being set */
359+ static int i801_wait_byte_done (struct i801_priv * priv )
360+ {
361+ unsigned long timeout = jiffies + priv -> adapter .timeout ;
362+ int status ;
363+
364+ do {
365+ usleep_range (250 , 500 );
366+ status = inb_p (SMBHSTSTS (priv ));
367+ if (status & (STATUS_ERROR_FLAGS | SMBHSTSTS_BYTE_DONE ))
368+ return status & STATUS_ERROR_FLAGS ;
369+ } while (time_is_after_eq_jiffies (timeout ));
370+
371+ return - ETIMEDOUT ;
372+ }
373+
340374static int i801_get_block_len (struct i801_priv * priv )
341375{
342376 u8 len = inb_p (SMBHSTDAT0 (priv ));
@@ -453,40 +487,6 @@ static int i801_check_post(struct i801_priv *priv, int status)
453487 return result ;
454488}
455489
456- /* Wait for BUSY being cleared and either INTR or an error flag being set */
457- static int i801_wait_intr (struct i801_priv * priv )
458- {
459- unsigned long timeout = jiffies + priv -> adapter .timeout ;
460- int status , busy ;
461-
462- do {
463- usleep_range (250 , 500 );
464- status = inb_p (SMBHSTSTS (priv ));
465- busy = status & SMBHSTSTS_HOST_BUSY ;
466- status &= STATUS_ERROR_FLAGS | SMBHSTSTS_INTR ;
467- if (!busy && status )
468- return status & STATUS_ERROR_FLAGS ;
469- } while (time_is_after_eq_jiffies (timeout ));
470-
471- return - ETIMEDOUT ;
472- }
473-
474- /* Wait for either BYTE_DONE or an error flag being set */
475- static int i801_wait_byte_done (struct i801_priv * priv )
476- {
477- unsigned long timeout = jiffies + priv -> adapter .timeout ;
478- int status ;
479-
480- do {
481- usleep_range (250 , 500 );
482- status = inb_p (SMBHSTSTS (priv ));
483- if (status & (STATUS_ERROR_FLAGS | SMBHSTSTS_BYTE_DONE ))
484- return status & STATUS_ERROR_FLAGS ;
485- } while (time_is_after_eq_jiffies (timeout ));
486-
487- return - ETIMEDOUT ;
488- }
489-
490490static int i801_transaction (struct i801_priv * priv , int xact )
491491{
492492 unsigned long result ;
0 commit comments