Received: by 10.213.65.68 with SMTP id h4csp3633306imn; Tue, 10 Apr 2018 02:02:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/94dCeR8R4TppUeTg6fFyYYwFjVcdgXk3/PzAFewM9s+CZaBegG8isq4yseGF9YxmIqpKX X-Received: by 2002:a17:902:7b81:: with SMTP id w1-v6mr21339901pll.235.1523350960414; Tue, 10 Apr 2018 02:02:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523350960; cv=none; d=google.com; s=arc-20160816; b=aNAR8u9SbjWXLYkvK9rwi6WI9Si9qXDvRGWysG67ie8ZBzMSSrfiVVW+XxIPue3llc 67ARxe1KT4C57KC7AKl/FR/fFCWKEgdNcOSp3D0agifzbEI5DJT5qwe6qJhxjnrneZNe M+66ftD19ckEbVNOMlJYfsvM4M7UoSK9dgfDY4Gzo1kMmEqgM00dxAKQUcLsL3fwfxTq Jc2ZFyGzWrexDom41L40V4jW7eopjB0vQmr1APMWXo3uTPWB+FEoABaWH1mYkSCdNv/o 36LzhXvqnQlLJuzkUkftfJXMhay7P98dLE78yV2ZwjsUu7lfnekQ9Zl/0MbESMYcD0Wy cmsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=DF0neRQQv9y2FNCQF3XxcSDPKU9wzCezYAxhVAR57dQ=; b=MWk+tfmGGt2k+NmcJmew8r507kXHpG1XdSpxc8jPLSlvuYYd4LL+Em1ARn8ISBKCHh yEbLxQ+StRlTXtgBwGvBPXi6SM3cxb5d1la/0LnqBhNuFqkUAWgLDrgpXraUZLB/MExF S5wGxowJH/yg3el9V7iuBpX074/CImQ87Fa3Z9RQiNUKKxZs5oZ82njcX4cbaFFbXFWJ dvmwN5g1PPjh1JDC919JkT1/64Cs493xI3cxI+p7XptqoWK9jjShUh6o5uXQndG+I5B5 He6P355wjwqa8YJieLBgRcuc834x/JNjsnQDneJqbSHyJdGRGFWlZ0mX37RwUVdo4aCt gRXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=o1oCCQid; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p86si1739510pfi.223.2018.04.10.02.02.02; Tue, 10 Apr 2018 02:02:40 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=o1oCCQid; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752442AbeDJI7F (ORCPT + 99 others); Tue, 10 Apr 2018 04:59:05 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:34897 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752211AbeDJI7E (ORCPT ); Tue, 10 Apr 2018 04:59:04 -0400 Received: by mail-it0-f67.google.com with SMTP id q85-v6so1342488itc.0 for ; Tue, 10 Apr 2018 01:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=DF0neRQQv9y2FNCQF3XxcSDPKU9wzCezYAxhVAR57dQ=; b=o1oCCQidSrSok5rTCTvBiTKSNwlY3SWnGlLENBErE4B4Fc9VKPuZVIM+BGc08a9uv1 0YvriOlL7svb4tXG+zfh6MdKws4PXc+F/MHn9PyXjV47rffqjnPAaLCEc9m4dguHZd7C LP1qz+M+7sBYKYqWtWVtVx46njPZd3jno56sW3ilIIw1i1WvLc1UcUxzhU1VNuxC3pi4 XDIcHr+gUEv1ukswMLxQDfs5HJNPD5GrqzfePDUHIgFwpmmNwACw+RK6fLc7mAvl4zIA uj43rE5oRsIYJgtf6j8i3fSzVVSeaO0x04FPZ03EIhoU/4YtRl6G+frBEYaK6zDfuYIL JBYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=DF0neRQQv9y2FNCQF3XxcSDPKU9wzCezYAxhVAR57dQ=; b=bSRqycgDj3eL5z05TOFtG5jrMEWsSirgFyqPd3mIFCnxQhBcGuyrqhLl1WdmNdWWFL eIkU/JOFURly3hSzwzNV+BBHMY52qMILzT7wpxTcWjsOiuGceAuoxf2YQ774iw0N8Ez1 crRginqfKkUixQcZk819G8cbLCYxSnNufny3AidOq2z+UO0i4v9pKatk2KqaaM1lSvU2 NhDrxXlqVsoFMhLu3rq6sJRuBqcB29lLNbTJPk4g5964nWjKGkKNT5gp4k/PZiNksXqQ AM6/gxntGLmCj+gTzpbA3zhh9iz4FeRTqmtUgrumFeOov9vnC9ji5k/9w+vYbz10puJm QX4g== X-Gm-Message-State: ALQs6tDzMZS12DAuubbx9aSfN2gLtANfKOyBbaVxG49ahMn9uLHHRiBy iyfVQIQX7Ld28xZuslVV+xc= X-Received: by 2002:a24:1889:: with SMTP id 131-v6mr1371035itr.104.1523350743601; Tue, 10 Apr 2018 01:59:03 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id x79sm1156586ioe.17.2018.04.10.01.58.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 01:59:03 -0700 (PDT) From: Jia-Ju Bai To: gregkh@linuxfoundation.org, me@tobin.cc Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] staging: ks7010: Replace mdelay with usleep_range in ks7010_upload_firmware Date: Tue, 10 Apr 2018 16:58:54 +0800 Message-Id: <1523350734-29664-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ks7010_upload_firmware() is never called in atomic context. The call chain ending up at ks7010_upload_firmware() is: [1] ks7010_upload_firmware() <- ks7010_sdio_probe() ks7010_sdio_probe() is set as ".probe" in struct sdio_driver. This function is not called in atomic context. Despite never getting called from atomic context, ks7010_upload_firmware() calls mdelay() to busily wait. This is not necessary and can be replaced with usleep_range() to avoid busy waiting. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- drivers/staging/ks7010/ks7010_sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index 8cfdff1..8d7bc26 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -719,7 +719,7 @@ static int ks7010_upload_firmware(struct ks_sdio_card *card) /* Firmware running check */ for (n = 0; n < 50; ++n) { - mdelay(10); /* wait_ms(10); */ + usleep_range(10000, 11000); /* wait_ms(10); */ ret = ks7010_sdio_readb(priv, GCR_A, &byte); if (ret) goto release_firmware; -- 1.9.1