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

mmc: core: refactor debugfs code

Now, CONFIG_DEBUG_FS is scattered in various functions, to make code
clean centralized processing CONFIG_DEBUG_FS in mmc debugfs module.

Signed-off-by: Ye Bin <yebin10@huawei.com>
Link: https://lore.kernel.org/r/20221126102520.2824574-1-yebin@huaweicloud.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Ye Bin and committed by
Ulf Hansson
5c5301a1 b98e7e8d

+15 -8
-4
drivers/mmc/core/bus.c
··· 359 359 uhs_bus_speed_mode, type, card->rca); 360 360 } 361 361 362 - #ifdef CONFIG_DEBUG_FS 363 362 mmc_add_card_debugfs(card); 364 - #endif 365 363 card->dev.of_node = mmc_of_find_child_device(card->host, 0); 366 364 367 365 device_enable_async_suspend(&card->dev); ··· 381 383 { 382 384 struct mmc_host *host = card->host; 383 385 384 - #ifdef CONFIG_DEBUG_FS 385 386 mmc_remove_card_debugfs(card); 386 - #endif 387 387 388 388 if (mmc_card_present(card)) { 389 389 if (mmc_host_is_spi(card->host)) {
+15
drivers/mmc/core/core.h
··· 86 86 extern bool use_spi_crc; 87 87 88 88 /* Debugfs information for hosts and cards */ 89 + #ifdef CONFIG_DEBUG_FS 89 90 void mmc_add_host_debugfs(struct mmc_host *host); 90 91 void mmc_remove_host_debugfs(struct mmc_host *host); 91 92 92 93 void mmc_add_card_debugfs(struct mmc_card *card); 93 94 void mmc_remove_card_debugfs(struct mmc_card *card); 95 + #else 96 + static inline void mmc_add_host_debugfs(struct mmc_host *host) 97 + { 98 + } 99 + static inline void mmc_remove_host_debugfs(struct mmc_host *host) 100 + { 101 + } 102 + static inline void mmc_add_card_debugfs(struct mmc_card *card) 103 + { 104 + } 105 + static inline void mmc_remove_card_debugfs(struct mmc_card *card) 106 + { 107 + } 108 + #endif 94 109 95 110 int mmc_execute_tuning(struct mmc_card *card); 96 111 int mmc_hs200_to_hs400(struct mmc_card *card);
-4
drivers/mmc/core/host.c
··· 629 629 630 630 led_trigger_register_simple(dev_name(&host->class_dev), &host->led); 631 631 632 - #ifdef CONFIG_DEBUG_FS 633 632 mmc_add_host_debugfs(host); 634 - #endif 635 633 636 634 mmc_start_host(host); 637 635 return 0; ··· 649 651 { 650 652 mmc_stop_host(host); 651 653 652 - #ifdef CONFIG_DEBUG_FS 653 654 mmc_remove_host_debugfs(host); 654 - #endif 655 655 656 656 device_del(&host->class_dev); 657 657