Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2279073imb; Mon, 4 Mar 2019 00:35:58 -0800 (PST) X-Google-Smtp-Source: APXvYqypipAcahSJ7+pAT3Ff94dndvm4UQ57vwn6ShI1c09HL8Hxfby/m/jjWfGoniLRQyx0v/sx X-Received: by 2002:a17:902:8b83:: with SMTP id ay3mr18339976plb.1.1551688558215; Mon, 04 Mar 2019 00:35:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551688558; cv=none; d=google.com; s=arc-20160816; b=d2i1ZHSNtG8DOov5N5X2yC2ydnNLKJmFfIF18RPQaWCL5ElG7NClDKZHBtDccLSfhM E0cD7VV9wBRSGonE54BiIUDeoziCL0S/S+ecC+Bhwp0x3WxFyeNmVMrTPUBwsR+9oT3i S6fOmwRf8Sybj8PBvbbbdIglS37A9vFO/fwBlgdsKxv6sKAeUJg3DF0WmNNlHIndEqSe jDIr6hobTHTopEAL2gah8rBRezy/4C5HoShXKepjwBCs63dAdyryYQik2/TaLo4URPVo 62WxgX9naNM8Ai6MUThbrptlTgp0+U4xaWMWksGm+NfKuTX6UDabDZYhy8QmmgzHFNcO ix9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QhevYzQ17nulPDun8gN8zTaFFLGojsjt5t5668uuuFI=; b=pG7+Tz/EDFWa7khK9vVYAIR7gOGLdnPom7h0hX5AkCNRNdMm+6x7+hbJVUeD9+JO6G TwktbXt5NiqLlAu5JDYR1SYgQCup6/JO0LEz45VgAFnOJbzk2oKGTIUXx8Mq7rriAtLD dvuBC6esJOfvRLDQ5CJptnLetvANA5h3IriVQqa5pzg1X3quHgqId7TnZKfVFV8/ssqo sv/eNhtAm5t2pWMygLPZsC8xUEGQkikltaJoP5sEbtbDI7kfVT2ld5B76N7ZircaD2HV 1hB7XLkTPZVB8GWfFiYy/tG8+KxV55pGtRdHIcmRQLUUCgqZjCJOGGnAT237wuVC+163 u67Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QmhG10sX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u18si2380344pfm.84.2019.03.04.00.35.40; Mon, 04 Mar 2019 00:35:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QmhG10sX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728429AbfCDIfS (ORCPT + 99 others); Mon, 4 Mar 2019 03:35:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:42980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728420AbfCDIfO (ORCPT ); Mon, 4 Mar 2019 03:35:14 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 313A820823; Mon, 4 Mar 2019 08:35:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551688513; bh=yL2Q3l60xl5BmYnVHu0yFtTvrT0nM5oidQ0ewOEKIgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QmhG10sX31I4c7/e1bGuwSEarWnlLGIDH7x0qeF+oosgTZ7PwcI6OVLVFeyMjZZKU u4zujAvtnCcxjdkQh1IhpRtg5TXIoxN6RyiFDdW58/8byVAmFoMyuEeVUFCuZQjzya VtjNBLynZawQmtftz4z7lIkNjuEMjWfdt77T7Ujs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= , Linus Walleij , Ulf Hansson Subject: [PATCH 4.20 68/88] mmc: spi: Fix card detection during probe Date: Mon, 4 Mar 2019 09:22:51 +0100 Message-Id: <20190304081633.282031167@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190304081630.610632175@linuxfoundation.org> References: <20190304081630.610632175@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jonathan Neuschäfer commit c9bd505dbd9d3dc80c496f88eafe70affdcf1ba6 upstream. When using the mmc_spi driver with a card-detect pin, I noticed that the card was not detected immediately after probe, but only after it was unplugged and plugged back in (and the CD IRQ fired). The call tree looks something like this: mmc_spi_probe mmc_add_host mmc_start_host _mmc_detect_change mmc_schedule_delayed_work(&host->detect, 0) mmc_rescan host->bus_ops->detect(host) mmc_detect _mmc_detect_card_removed host->ops->get_cd(host) mmc_gpio_get_cd -> -ENOSYS (ctx->cd_gpio not set) mmc_gpiod_request_cd ctx->cd_gpio = desc To fix this issue, call mmc_detect_change after the card-detect GPIO/IRQ is registered. Signed-off-by: Jonathan Neuschäfer Reviewed-by: Linus Walleij Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/mmc_spi.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c @@ -1447,6 +1447,7 @@ static int mmc_spi_probe(struct spi_devi mmc->caps &= ~MMC_CAP_NEEDS_POLL; mmc_gpiod_request_cd_irq(mmc); } + mmc_detect_change(mmc, 0); if (host->pdata && host->pdata->flags & MMC_SPI_USE_RO_GPIO) { has_ro = true;