Date: Wed, 15 Apr 2020 13:02:14 +0000 (UTC) From: Emmanuel Vadot <manu@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359965 - head/sys/dev/mmc Message-ID: <202004151302.03FD2ESM020060@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: manu Date: Wed Apr 15 13:02:13 2020 New Revision: 359965 URL: https://svnweb.freebsd.org/changeset/base/359965 Log: mmc_fdt_helpers: Do not schedule a card detection is there is no cd gpio If the fdt node doesn't have a cd-gpios properties or if the node is set as non-removable we do not init the card detection timeout task as it is useless so don't schedule it too. MFC after: 1 month X-MFC-With: r359924 Modified: head/sys/dev/mmc/mmc_fdt_helpers.c Modified: head/sys/dev/mmc/mmc_fdt_helpers.c ============================================================================== --- head/sys/dev/mmc/mmc_fdt_helpers.c Wed Apr 15 13:00:48 2020 (r359964) +++ head/sys/dev/mmc/mmc_fdt_helpers.c Wed Apr 15 13:02:13 2020 (r359965) @@ -217,7 +217,7 @@ cd_card_task(void *arg, int pending __unused) /* * Card detect setup. */ -static void +static bool cd_setup(struct mmc_fdt_helper *helper, phandle_t node) { int pincaps; @@ -233,7 +233,7 @@ cd_setup(struct mmc_fdt_helper *helper, phandle_t node helper->cd_disabled = true; if (bootverbose) device_printf(dev, "Non-removable media\n"); - return; + return (false); } /* @@ -246,14 +246,14 @@ cd_setup(struct mmc_fdt_helper *helper, phandle_t node */ if (gpio_pin_get_by_ofw_property(dev, node, "cd-gpios", &helper->cd_pin)) - return; + return (false); if (gpio_pin_getcaps(helper->cd_pin, &pincaps) != 0 || !(pincaps & GPIO_PIN_INPUT)) { device_printf(dev, "Cannot read card-detect gpio pin; " "setting card-always-present flag.\n"); helper->cd_disabled = true; - return; + return (false); } /* @@ -313,6 +313,8 @@ without_interrupts: device_get_nameunit(helper->cd_pin->dev), helper->cd_pin->pin, cd_mode_str); } + + return (true); } /* @@ -354,14 +356,16 @@ mmc_fdt_gpio_setup(device_t dev, phandle_t node, struc helper->dev = dev; helper->cd_handler = handler; - cd_setup(helper, node); wp_setup(helper, node); - /* - * Schedule a card detection - */ - taskqueue_enqueue_timeout_sbt(taskqueue_swi_giant, - &helper->cd_delayed_task, mstosbt(500), 0, C_PREL(2)); + if (cd_setup(helper, node)) { + /* + * Schedule a card detection + */ + taskqueue_enqueue_timeout_sbt(taskqueue_swi_giant, + &helper->cd_delayed_task, mstosbt(500), 0, C_PREL(2)); + } + return (0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004151302.03FD2ESM020060>