Date: Mon, 9 Jan 2017 17:10:50 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r311797 - head/sys/dev/sdhci Message-ID: <201701091710.v09HAo4j083509@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ian Date: Mon Jan 9 17:10:50 2017 New Revision: 311797 URL: https://svnweb.freebsd.org/changeset/base/311797 Log: Add sdhci_handle_card_present_locked() that can be called from the interrupt handler which already holds the mutex, and have sdhci_handle_card_present() be just a tiny wrapper that does the locking for external callers. This should fix the recursive locking panics seen on rpi3. Reported by: Shawn Webb Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Mon Jan 9 17:09:53 2017 (r311796) +++ head/sys/dev/sdhci/sdhci.c Mon Jan 9 17:10:50 2017 (r311797) @@ -521,8 +521,8 @@ sdhci_card_task(void *arg, int pending) } } -void -sdhci_handle_card_present(struct sdhci_slot *slot, bool is_present) +static void +sdhci_handle_card_present_locked(struct sdhci_slot *slot, bool is_present) { bool was_present; @@ -537,7 +537,6 @@ sdhci_handle_card_present(struct sdhci_s * because once power is removed, a full card re-init is needed, and * that happens by deleting and recreating the child device. */ - SDHCI_LOCK(slot); was_present = slot->dev != NULL; if (!was_present && is_present) { taskqueue_enqueue_timeout(taskqueue_swi_giant, @@ -545,6 +544,14 @@ sdhci_handle_card_present(struct sdhci_s } else if (was_present && !is_present) { taskqueue_enqueue(taskqueue_swi_giant, &slot->card_task); } +} + +void +sdhci_handle_card_present(struct sdhci_slot *slot, bool is_present) +{ + + SDHCI_LOCK(slot); + sdhci_handle_card_present_locked(slot, is_present); SDHCI_UNLOCK(slot); } @@ -1402,7 +1409,7 @@ sdhci_generic_intr(struct sdhci_slot *sl WR4(slot, SDHCI_SIGNAL_ENABLE, slot->intmask); WR4(slot, SDHCI_INT_STATUS, intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)); - sdhci_handle_card_present(slot, present); + sdhci_handle_card_present_locked(slot, present); intmask &= ~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE); } /* Handle command interrupts. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701091710.v09HAo4j083509>