Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: core: Move public functions from host.h to private headers

A significant amount of functions are available through the public mmc
host.h header file. Let's slim down this public mmc interface, as to
prevent users from abusing it, by moving some of the functions to private
mmc host.h header file.

This change concentrates on moving the functions into private mmc headers,
following changes may continue with additional clean-ups.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>

+56 -47
+1
drivers/mmc/core/block.c
··· 49 49 #include "block.h" 50 50 #include "core.h" 51 51 #include "card.h" 52 + #include "host.h" 52 53 #include "bus.h" 53 54 #include "mmc_ops.h" 54 55 #include "sd_ops.h"
+1
drivers/mmc/core/bus.c
··· 24 24 25 25 #include "core.h" 26 26 #include "card.h" 27 + #include "host.h" 27 28 #include "sdio_cis.h" 28 29 #include "bus.h" 29 30
+1
drivers/mmc/core/debugfs.c
··· 21 21 22 22 #include "core.h" 23 23 #include "card.h" 24 + #include "host.h" 24 25 #include "mmc_ops.h" 25 26 26 27 #ifdef CONFIG_FAIL_MMC_REQUEST
+48 -1
drivers/mmc/core/host.h
··· 11 11 #ifndef _MMC_CORE_HOST_H 12 12 #define _MMC_CORE_HOST_H 13 13 14 - struct mmc_host; 14 + #include <linux/mmc/host.h> 15 15 16 16 int mmc_register_host_class(void); 17 17 void mmc_unregister_host_class(void); ··· 21 21 void mmc_retune_hold(struct mmc_host *host); 22 22 void mmc_retune_release(struct mmc_host *host); 23 23 int mmc_retune(struct mmc_host *host); 24 + void mmc_retune_pause(struct mmc_host *host); 25 + void mmc_retune_unpause(struct mmc_host *host); 26 + 27 + static inline void mmc_retune_recheck(struct mmc_host *host) 28 + { 29 + if (host->hold_retune <= 1) 30 + host->retune_now = 1; 31 + } 32 + 33 + static inline int mmc_host_cmd23(struct mmc_host *host) 34 + { 35 + return host->caps & MMC_CAP_CMD23; 36 + } 37 + 38 + static inline int mmc_boot_partition_access(struct mmc_host *host) 39 + { 40 + return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC); 41 + } 42 + 43 + static inline int mmc_host_uhs(struct mmc_host *host) 44 + { 45 + return host->caps & 46 + (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | 47 + MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | 48 + MMC_CAP_UHS_DDR50); 49 + } 50 + 51 + static inline bool mmc_card_hs200(struct mmc_card *card) 52 + { 53 + return card->host->ios.timing == MMC_TIMING_MMC_HS200; 54 + } 55 + 56 + static inline bool mmc_card_ddr52(struct mmc_card *card) 57 + { 58 + return card->host->ios.timing == MMC_TIMING_MMC_DDR52; 59 + } 60 + 61 + static inline bool mmc_card_hs400(struct mmc_card *card) 62 + { 63 + return card->host->ios.timing == MMC_TIMING_MMC_HS400; 64 + } 65 + 66 + static inline bool mmc_card_hs400es(struct mmc_card *card) 67 + { 68 + return card->host->ios.enhanced_strobe; 69 + } 70 + 24 71 25 72 #endif 26 73
+1
drivers/mmc/core/mmc_test.c
··· 24 24 25 25 #include "core.h" 26 26 #include "card.h" 27 + #include "host.h" 27 28 #include "bus.h" 28 29 29 30 #define RESULT_OK 0
+1
drivers/mmc/core/sd.c
··· 23 23 24 24 #include "core.h" 25 25 #include "card.h" 26 + #include "host.h" 26 27 #include "bus.h" 27 28 #include "mmc_ops.h" 28 29 #include "sd.h"
+1
drivers/mmc/core/sdio.c
··· 21 21 22 22 #include "core.h" 23 23 #include "card.h" 24 + #include "host.h" 24 25 #include "bus.h" 25 26 #include "sd.h" 26 27 #include "sdio_bus.h"
+2 -46
include/linux/mmc/host.h
··· 473 473 return host->pm_flags & MMC_PM_WAKE_SDIO_IRQ; 474 474 } 475 475 476 - static inline int mmc_host_cmd23(struct mmc_host *host) 477 - { 478 - return host->caps & MMC_CAP_CMD23; 479 - } 480 - 481 - static inline int mmc_boot_partition_access(struct mmc_host *host) 482 - { 483 - return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC); 484 - } 485 - 486 - static inline int mmc_host_uhs(struct mmc_host *host) 487 - { 488 - return host->caps & 489 - (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | 490 - MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | 491 - MMC_CAP_UHS_DDR50); 492 - } 493 - 476 + /* TODO: Move to private header */ 494 477 static inline int mmc_card_hs(struct mmc_card *card) 495 478 { 496 479 return card->host->ios.timing == MMC_TIMING_SD_HS || 497 480 card->host->ios.timing == MMC_TIMING_MMC_HS; 498 481 } 499 482 483 + /* TODO: Move to private header */ 500 484 static inline int mmc_card_uhs(struct mmc_card *card) 501 485 { 502 486 return card->host->ios.timing >= MMC_TIMING_UHS_SDR12 && 503 487 card->host->ios.timing <= MMC_TIMING_UHS_DDR50; 504 - } 505 - 506 - static inline bool mmc_card_hs200(struct mmc_card *card) 507 - { 508 - return card->host->ios.timing == MMC_TIMING_MMC_HS200; 509 - } 510 - 511 - static inline bool mmc_card_ddr52(struct mmc_card *card) 512 - { 513 - return card->host->ios.timing == MMC_TIMING_MMC_DDR52; 514 - } 515 - 516 - static inline bool mmc_card_hs400(struct mmc_card *card) 517 - { 518 - return card->host->ios.timing == MMC_TIMING_MMC_HS400; 519 - } 520 - 521 - static inline bool mmc_card_hs400es(struct mmc_card *card) 522 - { 523 - return card->host->ios.enhanced_strobe; 524 488 } 525 489 526 490 void mmc_retune_timer_stop(struct mmc_host *host); ··· 495 531 host->need_retune = 1; 496 532 } 497 533 498 - static inline void mmc_retune_recheck(struct mmc_host *host) 499 - { 500 - if (host->hold_retune <= 1) 501 - host->retune_now = 1; 502 - } 503 - 504 534 static inline bool mmc_can_retune(struct mmc_host *host) 505 535 { 506 536 return host->can_retune == 1; ··· 502 544 503 545 int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error); 504 546 int mmc_abort_tuning(struct mmc_host *host, u32 opcode); 505 - void mmc_retune_pause(struct mmc_host *host); 506 - void mmc_retune_unpause(struct mmc_host *host); 507 547 508 548 #endif /* LINUX_MMC_HOST_H */