Skip to content

Commit 4c0a6a0

Browse files
Chanwoo Leestorulf
authored andcommitted
mmc: core: Replace the argument of mmc_sd_switch() with defines
Replace with already defined values for readability. While at it, let's also change the mode-parameter from an int to bool, as the only used values are 0 or 1. Signed-off-by: Chanwoo Lee <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 73abb1f commit 4c0a6a0

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

drivers/mmc/core/sd.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ static int mmc_read_switch(struct mmc_card *card)
346346
* The argument does not matter, as the support bits do not
347347
* change with the arguments.
348348
*/
349-
err = mmc_sd_switch(card, 0, 0, 0, status);
349+
err = mmc_sd_switch(card, SD_SWITCH_CHECK, 0, 0, status);
350350
if (err) {
351351
/*
352352
* If the host or the card can't do the switch,
@@ -402,7 +402,8 @@ int mmc_sd_switch_hs(struct mmc_card *card)
402402
if (!status)
403403
return -ENOMEM;
404404

405-
err = mmc_sd_switch(card, 1, 0, HIGH_SPEED_BUS_SPEED, status);
405+
err = mmc_sd_switch(card, SD_SWITCH_SET, 0,
406+
HIGH_SPEED_BUS_SPEED, status);
406407
if (err)
407408
goto out;
408409

@@ -434,7 +435,8 @@ static int sd_select_driver_type(struct mmc_card *card, u8 *status)
434435
card_drv_type, &drv_type);
435436

436437
if (drive_strength) {
437-
err = mmc_sd_switch(card, 1, 2, drive_strength, status);
438+
err = mmc_sd_switch(card, SD_SWITCH_SET, 2,
439+
drive_strength, status);
438440
if (err)
439441
return err;
440442
if ((status[15] & 0xF) != drive_strength) {
@@ -514,7 +516,7 @@ static int sd_set_bus_speed_mode(struct mmc_card *card, u8 *status)
514516
return 0;
515517
}
516518

517-
err = mmc_sd_switch(card, 1, 0, card->sd_bus_speed, status);
519+
err = mmc_sd_switch(card, SD_SWITCH_SET, 0, card->sd_bus_speed, status);
518520
if (err)
519521
return err;
520522

@@ -605,7 +607,8 @@ static int sd_set_current_limit(struct mmc_card *card, u8 *status)
605607
current_limit = SD_SET_CURRENT_LIMIT_200;
606608

607609
if (current_limit != SD_SET_CURRENT_NO_CHANGE) {
608-
err = mmc_sd_switch(card, 1, 3, current_limit, status);
610+
err = mmc_sd_switch(card, SD_SWITCH_SET, 3,
611+
current_limit, status);
609612
if (err)
610613
return err;
611614

drivers/mmc/core/sd_ops.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,14 +336,13 @@ int mmc_app_send_scr(struct mmc_card *card)
336336
return 0;
337337
}
338338

339-
int mmc_sd_switch(struct mmc_card *card, int mode, int group,
339+
int mmc_sd_switch(struct mmc_card *card, bool mode, int group,
340340
u8 value, u8 *resp)
341341
{
342342
u32 cmd_args;
343343

344344
/* NOTE: caller guarantees resp is heap-allocated */
345345

346-
mode = !!mode;
347346
value &= 0xF;
348347
cmd_args = mode << 31 | 0x00FFFFFF;
349348
cmd_args &= ~(0xF << (group * 4));

include/linux/mmc/host.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,8 @@ static inline void mmc_debugfs_err_stats_inc(struct mmc_host *host,
648648
host->err_stats[stat] += 1;
649649
}
650650

651-
int mmc_sd_switch(struct mmc_card *card, int mode, int group, u8 value, u8 *resp);
651+
int mmc_sd_switch(struct mmc_card *card, bool mode, int group,
652+
u8 value, u8 *resp);
652653
int mmc_send_status(struct mmc_card *card, u32 *status);
653654
int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error);
654655
int mmc_send_abort_tuning(struct mmc_host *host, u32 opcode);

0 commit comments

Comments
 (0)