diff options
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/mtip32xx/mtip32xx.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 36f3d34f2156..aee94f260725 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -1030,6 +1030,22 @@ static bool mtip_pause_ncq(struct mtip_port *port, | |||
1030 | return false; | 1030 | return false; |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | static bool mtip_commands_active(struct mtip_port *port) | ||
1034 | { | ||
1035 | unsigned int active; | ||
1036 | unsigned int n; | ||
1037 | |||
1038 | /* | ||
1039 | * Ignore s_active bit 0 of array element 0. | ||
1040 | * This bit will always be set | ||
1041 | */ | ||
1042 | active = readl(port->s_active[0]) & 0xFFFFFFFE; | ||
1043 | for (n = 1; n < port->dd->slot_groups; n++) | ||
1044 | active |= readl(port->s_active[n]); | ||
1045 | |||
1046 | return active != 0; | ||
1047 | } | ||
1048 | |||
1033 | /* | 1049 | /* |
1034 | * Wait for port to quiesce | 1050 | * Wait for port to quiesce |
1035 | * | 1051 | * |
@@ -1043,8 +1059,7 @@ static bool mtip_pause_ncq(struct mtip_port *port, | |||
1043 | static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout) | 1059 | static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout) |
1044 | { | 1060 | { |
1045 | unsigned long to; | 1061 | unsigned long to; |
1046 | unsigned int n; | 1062 | bool active = true; |
1047 | unsigned int active = 1; | ||
1048 | 1063 | ||
1049 | blk_mq_stop_hw_queues(port->dd->queue); | 1064 | blk_mq_stop_hw_queues(port->dd->queue); |
1050 | 1065 | ||
@@ -1061,14 +1076,7 @@ static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout) | |||
1061 | if (mtip_check_surprise_removal(port->dd->pdev)) | 1076 | if (mtip_check_surprise_removal(port->dd->pdev)) |
1062 | goto err_fault; | 1077 | goto err_fault; |
1063 | 1078 | ||
1064 | /* | 1079 | active = mtip_commands_active(port); |
1065 | * Ignore s_active bit 0 of array element 0. | ||
1066 | * This bit will always be set | ||
1067 | */ | ||
1068 | active = readl(port->s_active[0]) & 0xFFFFFFFE; | ||
1069 | for (n = 1; n < port->dd->slot_groups; n++) | ||
1070 | active |= readl(port->s_active[n]); | ||
1071 | |||
1072 | if (!active) | 1080 | if (!active) |
1073 | break; | 1081 | break; |
1074 | } while (time_before(jiffies, to)); | 1082 | } while (time_before(jiffies, to)); |