@@ -394,9 +394,7 @@ static int eeh_phb_check_failure(struct eeh_pe *pe)
394
394
/* Check PHB state */
395
395
ret = eeh_ops -> get_state (phb_pe , NULL );
396
396
if ((ret < 0 ) ||
397
- (ret == EEH_STATE_NOT_SUPPORT ) ||
398
- (ret & (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE )) ==
399
- (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE )) {
397
+ (ret == EEH_STATE_NOT_SUPPORT ) || eeh_state_active (ret )) {
400
398
ret = 0 ;
401
399
goto out ;
402
400
}
@@ -433,7 +431,6 @@ static int eeh_phb_check_failure(struct eeh_pe *pe)
433
431
int eeh_dev_check_failure (struct eeh_dev * edev )
434
432
{
435
433
int ret ;
436
- int active_flags = (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE );
437
434
unsigned long flags ;
438
435
struct device_node * dn ;
439
436
struct pci_dev * dev ;
@@ -525,8 +522,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
525
522
* state, PE is in good state.
526
523
*/
527
524
if ((ret < 0 ) ||
528
- (ret == EEH_STATE_NOT_SUPPORT ) ||
529
- ((ret & active_flags ) == active_flags )) {
525
+ (ret == EEH_STATE_NOT_SUPPORT ) || eeh_state_active (ret )) {
530
526
eeh_stats .false_positives ++ ;
531
527
pe -> false_positives ++ ;
532
528
rc = 0 ;
@@ -546,8 +542,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
546
542
547
543
/* Frozen parent PE ? */
548
544
ret = eeh_ops -> get_state (parent_pe , NULL );
549
- if (ret > 0 &&
550
- (ret & active_flags ) != active_flags )
545
+ if (ret > 0 && !eeh_state_active (ret ))
551
546
pe = parent_pe ;
552
547
553
548
/* Next parent level */
@@ -888,7 +883,6 @@ static void *eeh_set_dev_freset(void *data, void *flag)
888
883
*/
889
884
int eeh_pe_reset_full (struct eeh_pe * pe )
890
885
{
891
- int active_flags = (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE );
892
886
int reset_state = (EEH_PE_RESET | EEH_PE_CFG_BLOCKED );
893
887
int type = EEH_RESET_HOT ;
894
888
unsigned int freset = 0 ;
@@ -919,7 +913,7 @@ int eeh_pe_reset_full(struct eeh_pe *pe)
919
913
920
914
/* Wait until the PE is in a functioning state */
921
915
state = eeh_ops -> wait_state (pe , PCI_BUS_RESET_WAIT_MSEC );
922
- if ((state & active_flags ) == active_flags )
916
+ if (eeh_state_active (state ) )
923
917
break ;
924
918
925
919
if (state < 0 ) {
@@ -1352,16 +1346,15 @@ static int eeh_pe_change_owner(struct eeh_pe *pe)
1352
1346
struct eeh_dev * edev , * tmp ;
1353
1347
struct pci_dev * pdev ;
1354
1348
struct pci_device_id * id ;
1355
- int flags , ret ;
1349
+ int ret ;
1356
1350
1357
1351
/* Check PE state */
1358
- flags = (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE );
1359
1352
ret = eeh_ops -> get_state (pe , NULL );
1360
1353
if (ret < 0 || ret == EEH_STATE_NOT_SUPPORT )
1361
1354
return 0 ;
1362
1355
1363
1356
/* Unfrozen PE, nothing to do */
1364
- if ((ret & flags ) == flags )
1357
+ if (eeh_state_active (ret ) )
1365
1358
return 0 ;
1366
1359
1367
1360
/* Frozen PE, check if it needs PE level reset */
0 commit comments