recently, i just understand the driver/mmc/core/core.c, but i find some functions are hard to understand, the thought of the design of that function is so strange to me.

the kernel i am studying is version 4.10.3.
for this function:
int _mmc_detect_card_removed(struct mmc_host *host)
int ret;

if (!host->card || mmc_card_removed(host->card))
return 1;

ret = host->bus_ops->alive(host);

* Card detect status and alive check may be out of sync if card is
* removed slowly, when card detect switch changes while card/slot
* pads are still contacted in hardware (refer to "SD Card Mechanical
* Addendum, Appendix C: Card Detection Switch"). So reschedule a
* detect work 200ms later for this case.
if (!ret && host->ops->get_cd && !host->ops->get_cd(host)) {
mmc_detect_change(host, msecs_to_jiffies(200));
pr_debug("%s: card removed too slowly\n", mmc_hostname(host));

if (ret) {
pr_debug("%s: card remove detected\n", mmc_hostname(host));

return ret;

why returning when the information in ram says "disconnected". like:
if (!host->card || mmc_card_removed(host->card))
return 1;
why not simply check all the possible cases by just communicating with the hardware~?

there are lots of questions i want to ask, but i don't have time to write them all, so i would simply ask that if there is anyone who could explain in every detail that what every step means of functions:

int _mmc_detect_card_removed(struct mmc_host *host)
int mmc_detect_card_removed(struct mmc_host *host)

i will be very thankful if someone could explain to me.

i try to understand the kernel by OOP way, and i think the designer of the kernel design by this way.