Re: [PATCH] mmc: block: Differentiate busy and non-TRAN state

From: Christoph Hellwig
Date: Fri Jul 02 2021 - 03:44:00 EST


> + /*
> + * Cards will never return to TRAN after completing
> + * identification commands or MMC_SEND_STATUS if they are not selected.
> + */
> + return !(cmd->opcode == MMC_GO_IDLE_STATE
> + || cmd->opcode == MMC_SEND_OP_COND
> + || cmd->opcode == MMC_ALL_SEND_CID
> + || cmd->opcode == MMC_SET_RELATIVE_ADDR
> + || cmd->opcode == MMC_SET_DSR
> + || cmd->opcode == MMC_SLEEP_AWAKE
> + || cmd->opcode == MMC_SELECT_CARD
> + || cmd->opcode == MMC_SEND_CSD
> + || cmd->opcode == MMC_SEND_CID
> + || cmd->opcode == MMC_SEND_STATUS
> + || cmd->opcode == MMC_GO_INACTIVE_STATE
> + || cmd->opcode == MMC_APP_CMD);

This is not the normal kernel style, which puts operators at the end
of the line. And while a little more verbose I think a switch statement
would be a lot more readable here:

switch (cmd->opcode) {
case MMC_GO_IDLE_STATE:
case MMC_SEND_OP_COND:
case MMC_ALL_SEND_CID:
case MMC_SET_RELATIVE_ADDR:
case MMC_SET_DSR:
case MMC_SLEEP_AWAKE:
case MMC_SELECT_CARD:
case MMC_SEND_CSD:
case MMC_SEND_CID:
case MMC_SEND_STATUS:
case MMC_GO_INACTIVE_STATE:
case MMC_APP_CMD:
return false;
default:
return true;
}