Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1405918pxb; Thu, 21 Oct 2021 23:41:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGSng6Ou2B3onSPkeHEcwjIaKPRqfE+9569xg8nkb8qurA79E+Luzen2mxda1MPnbA+KEX X-Received: by 2002:a05:6a00:26dd:b0:44d:2531:9f46 with SMTP id p29-20020a056a0026dd00b0044d25319f46mr10488676pfw.46.1634884884992; Thu, 21 Oct 2021 23:41:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634884884; cv=none; d=google.com; s=arc-20160816; b=FNyYYZnB/GL7R8KcrDtga1hEJIngbOWxz+DkVu5SSPbuU5QonCMkPFSyVGISdH3Cjs rBym7WNNY3mRTr+8qJPsf2uGjlQX97Kfex6bGDcPPJR9NyKpAphQrTQmsWYlYwbWU3WB ahiNfrQXOK84n2BVtp9EaJFLE7yNMV/23mRAXXyf28yCaaXDOXSO5FLf338CKp516SA8 0kXWNUmgk+ZcONMndsiR0C5Ji4Kfj+6JdZzn7wvxLuRNC1QnpTkRyRsUqKV09lOZGQFd Iry7jnpxzM+bwGs6kQb8KZWpM2RZZi7AGUOAqD+0UQBNO+itVfJTI0FPqspPmFEFOR/V P+Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:mime-version:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=GgRKhJImcsOAtS3q4YtTz2oA+8fQnxgrL56dGAuTdp4=; b=YVW/y7eXnBDccxcFGdO1ip0tPZBch/F98hzVkKuBQdMYaGAtVQ0nzU7yHE8H1bYCh8 5u6eYzCELwLkKlEo3gjmjcpIyT64j5vVZOZYBLUl1N9QdAe9IKLsBGGkFdYnBWqolJJ4 HyHS6B9jFxj/15kR13TR5tKRA0D+/mGr+C+ZnK1lbYe8sD7V22FyxQMhotqzvjL2KlBj w2xraRzk8NhRubwbSFyJM8CaHj1bLlpxturhjxsGrh/EE83e31w4f13caaWKI7cFaOuz 885QvpjmHpHOossYVZLB3Ia7cazfsPGDRdbCgG+nIQo5en1Oz2DYFSpm8le46OBI0RjX zeDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=HqAwT1jF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d12si11619335pgv.167.2021.10.21.23.41.11; Thu, 21 Oct 2021 23:41:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=HqAwT1jF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231761AbhJVGmB (ORCPT + 99 others); Fri, 22 Oct 2021 02:42:01 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:33111 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231846AbhJVGmA (ORCPT ); Fri, 22 Oct 2021 02:42:00 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20211022063941epoutp02a9456ee7301c1a73cb30011282378d6d~wRwv0Kjtd0915009150epoutp02D for ; Fri, 22 Oct 2021 06:39:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20211022063941epoutp02a9456ee7301c1a73cb30011282378d6d~wRwv0Kjtd0915009150epoutp02D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1634884781; bh=GgRKhJImcsOAtS3q4YtTz2oA+8fQnxgrL56dGAuTdp4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HqAwT1jFEFSkYauVnTbGfMPk+PhO2E4xMk13JkjqGHD3jMTUcSsWvhtdZXCMHeNoG ATHd948rbx7LJR7SPeeKxho6qak160fNpUA8OghFLAAYscf7X36Uhrb0nYAE3Cr0WO uP0anKwgKPiA7O4LmvM+5CnQjjfyb37ht61/SEpU= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20211022063941epcas1p2ef8e3070840abaaae103bcbfb6216ade~wRwvkM6-81437314373epcas1p22; Fri, 22 Oct 2021 06:39:41 +0000 (GMT) Received: from epsmges1p1.samsung.com (unknown [182.195.38.242]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4HbF7v1c5rz4x9QP; Fri, 22 Oct 2021 06:39:39 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id B7.33.09574.5AC52716; Fri, 22 Oct 2021 15:39:33 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p2.samsung.com (KnoxPortal) with ESMTPA id 20211022063932epcas1p2016e6cff9b171f9a6fedfb1e48ee8695~wRwn21_tN1434414344epcas1p2G; Fri, 22 Oct 2021 06:39:32 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20211022063932epsmtrp11cb2646f33facc3be831e2e78d2f544c~wRwn2HtMz0354103541epsmtrp1C; Fri, 22 Oct 2021 06:39:32 +0000 (GMT) X-AuditID: b6c32a35-1abff70000002566-9a-61725ca54767 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 47.9D.08738.4AC52716; Fri, 22 Oct 2021 15:39:32 +0900 (KST) Received: from localhost.localdomain (unknown [10.88.98.193]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20211022063932epsmtip1be7b3cd49607ff5ca6982b6772659c6d~wRwnsTJi51607316073epsmtip1h; Fri, 22 Oct 2021 06:39:32 +0000 (GMT) From: Huijin Park To: Ulf Hansson Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Huijin Park , Huijin Park Subject: [PATCH 2/2] mmc: core: use jiffies to checking timeout for CMD1 Date: Fri, 22 Oct 2021 15:39:20 +0900 Message-Id: <20211022063920.2145-2-huijin.park@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211022063920.2145-1-huijin.park@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOKsWRmVeSWpSXmKPExsWy7bCmru7SmKJEg41rxSxe7j3EbNFx0cXi 8q45bBZH/vczWhxfG+7A6rFz1l12jzvX9rB59G1ZxejxeZNcAEtUtk1GamJKapFCal5yfkpm XrqtkndwvHO8qZmBoa6hpYW5kkJeYm6qrZKLT4CuW2YO0FYlhbLEnFKgUEBicbGSvp1NUX5p SapCRn5xia1SakFKToFZgV5xYm5xaV66Xl5qiZWhgYGRKVBhQnbGwU8/mAsmc1e87dVtYHzO 0cXIySEhYCKx7HgvaxcjF4eQwA5GiYtzJrBDOJ8YJf5cnA2V+cwocbjvBFCGA6xlV58CRHwX o8ScGZvY4Dr+z9rMDDKXTUBb4vrarYwgtoiAhsSeh+dZQWxmgS5GiZu3HEAGCQt4SKye5A9i sgioSlz6awxSwStgLXHw2EUmiOvkJWZe+s4OYnMK2EhsfvaODaJGUOLkzCcsEBPlJZq3zmaG qD/HLrHhqjeE7SLxr38SG4QtLPHq+BZ2CFtK4mV/G5RdLrFrwlVmkPM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AVi urxE89bZzBMYBWYhSc1CklrAyLSKUTK1oDg3PbfYsMAoL7Vcrzgxt7g0L10vOT93EyM4VLW0 djDuWfVB7xAjEwfjIUYJDmYlEd7dFfmJQrwpiZVVqUX58UWlOanFhxilOViUxHkvdJ2MFxJI TyxJzU5NLUgtgskycXBKNTDJNfnM9yg9Opu/SmQmS22hvcaOZd9arBf7x0Yvq1HRVG5SOvru E0MO47ulS46/qDmyiMNe3NEy5Vu64I3DqsELHno7Nm2+71wYyrCH+T7P/ZAirps8y1Me7Xsl lWOS/2U6h7WszNTuxwbetikZG+xaMjnE+D+fe/Nw+0fpWfVvvj2qCpez5xVzk995e7uGdlMR /8fZv3kU5F4eOuXYIRmUv3DbocnN9dpz86erby64UWJ0f48G58eVa7pt/MKDPh72779uUFXm a/r4eGpS1pXLThb3F3EcPJVUfm3PCevnUpcX589b+F7Y/XbruZPMlee/flY5MCsg6cIV0Vml 6tKOho4Btd8tXvUtE71w85cSS3FGoqEWc1FxIgDQ2e69xAIAAA== X-CMS-MailID: 20211022063932epcas1p2016e6cff9b171f9a6fedfb1e48ee8695 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20211022063932epcas1p2016e6cff9b171f9a6fedfb1e48ee8695 References: <20211022063920.2145-1-huijin.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch uses jiffies for checking timeout instead of loop count. Because the previous patch which is adjusting interval time changes the timeout value. Besides using jiffies is more clearly for checking timeout instead of counting loop. Signed-off-by: Huijin Park diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 61b4ffdc89ce..f48216d65d2c 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -176,14 +176,16 @@ int mmc_go_idle(struct mmc_host *host) int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) { struct mmc_command cmd = {}; - int i, err = 0; + int err = 0; int interval = 1, interval_max = 10; + unsigned long timeout; cmd.opcode = MMC_SEND_OP_COND; cmd.arg = mmc_host_is_spi(host) ? 0 : ocr; cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R3 | MMC_CMD_BCR; - for (i = 100; i; i--) { + timeout = jiffies + msecs_to_jiffies(1000); + while (true) { err = mmc_wait_for_cmd(host, &cmd, 0); if (err) break; @@ -197,7 +199,12 @@ int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) break; } - err = -ETIMEDOUT; + if (time_after(jiffies, timeout)) { + pr_err("%s: Card stuck being busy! %s\n", + mmc_hostname(host), __func__); + err = -ETIMEDOUT; + break; + } mmc_delay(interval); if (interval < interval_max) -- 2.17.1