Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp318419imm; Thu, 26 Jul 2018 20:03:50 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcnNPxnxiApVJZlx1CgZ1rF41MOQRk8eL73KeWLtA3EipcrKrPml3h5kWNoAEx3UOEr2gmi X-Received: by 2002:a17:902:1703:: with SMTP id i3-v6mr4214981pli.263.1532660630561; Thu, 26 Jul 2018 20:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532660630; cv=none; d=google.com; s=arc-20160816; b=0ZAG1D1Ts7/zbUqKUvrN7DkVhjn0EBaS4rDOT2ToVegZMj5TIQAcD4lXgL0m+++0An I5GpleYJA/l1Bb4wTPtotthnjPiyCit+U5vmFHx8VDUbTZcEsOgxhKVwKOzHNB3WoiRN 6y1oMM1vx+FBaEG+KR3Qre1umS4+0kHvUzfHb2O1KkQYMpWUb/yxYC13i64zSVFftt4A gxN8meKTd4BlPhN+GJEc+f+3N17MmRPCSMaOrIaM/NKzhS4+y7K6n3FrciV+YU60/PWH FLhgqRhI6ZdgxfUvyMZd/8vMdg8sj+Ogh1iNzVXcVFGOJ9xppwMJKzGZGJ+BWvf9GtzS J6mg== 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=Nr0HwSpQc+d2T41s0uxFH46hkeQiIdKoqj90TjbRaVQ=; b=nCYcodZC1jcYgWtiGGlNx4Dpz/Ke6jgGFdUi/MgTCe0YlbDIyZ+HL/vfG0NEYs+Jv6 ROKFI0Aos1od1r3ZfSUROwSI2EUs/P43nKadYix8Yn8CGClLIYsGmasvPZHw8M+rM8EC 3GXhhTMimluFhBWGShMVUyPYGcYjbiS8PneuLRk0T2S9Abphl/jlK3FPjjVMsJfSX6QJ 4aqoezhWUv2DTECl23F8NSNw7nmdvH8TATO70FJjq8QQsSRoUdXt6kyKUFHPzQYrBqMz v3N56EunpthT2pNto9kt0dTKLSPPH6+Syw7fKlvBZgkbKiYc8lqtWLd+wICjzQuT/P2n pbEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eulvPAYX; 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 w4-v6si3134432pfb.52.2018.07.26.20.03.35; Thu, 26 Jul 2018 20:03:50 -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=eulvPAYX; 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 S1726212AbeG0EW3 (ORCPT + 99 others); Fri, 27 Jul 2018 00:22:29 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:37668 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725829AbeG0EW3 (ORCPT ); Fri, 27 Jul 2018 00:22:29 -0400 Received: by mail-pf1-f196.google.com with SMTP id a26-v6so1230710pfo.4; Thu, 26 Jul 2018 20:02:48 -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=Nr0HwSpQc+d2T41s0uxFH46hkeQiIdKoqj90TjbRaVQ=; b=eulvPAYX0SK9FLk6lD4bHt/G/ctkGlIudAKaiGy4Yrjqsul4lHy1fDJaa2YBBRi8pj XzOC98UXFgAkf5M/MFE2Y3ZkYZ3g+jBZ2X1/SDlnUZXIlJdRSjM38qx3ibYX3kMar3EL 1khlHQyyJME3iGQOFdJ7vDqX135f7uiUozBIfPz5BYJYQX3hdIjF2CP01hZR4Lbfm7oG lrz70c9J+isX+NBBt6fmS2h7EjaA6r3wd3Q7nTmtdIDQRDyq0OuWO3Q6KhQp5POCcjqN ra03vPlusY9rVGU2Q053aLEQbZhdd+K2AJfuBKwf3zPYl/UleWnEtDkZ2Tkg7kWdMv44 BVdg== 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=Nr0HwSpQc+d2T41s0uxFH46hkeQiIdKoqj90TjbRaVQ=; b=b0Ft2GVzemsTTxfmZZf1SFqhoCC+54XHEj+SKul21GTqjMkryhhhafBTQ1T1BwfGw+ zRI49TLtjCBkU/bz26A2QgKCLMhn8DN3Gfe8ctco7R3BFq+YytTVCf+3rcxTlDZ0d1/a 9RJBIqedQd/gb03g/oWpjqLdAeCHNgNO10aJ5o/F826QpX7dgRSEcO1U05hyAMzuPmh+ +0GTtj2HU2cCyV49qRYI5js4S0YnrcbkJEEHq7deUO5+Said94MpUkr0x0MzUfpq+bts gaXJHq37Yx2bjb1BJZrPKbf4F5/ZnMZaimdCIwszaGqtpFscNkH+Tr7qudx46w5aB9m8 Su5g== X-Gm-Message-State: AOUpUlEppk37Y855UeBbFpXqlXrfvjF6Uh2QaP5KUROe3QUlJJZpV7Em geffHfbND7ERU2z8IQmM0uI= X-Received: by 2002:a62:1157:: with SMTP id z84-v6mr4792164pfi.66.1532660567999; Thu, 26 Jul 2018 20:02:47 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:6c14:7712:e625:1be4]) by smtp.gmail.com with ESMTPSA id m20-v6sm4541320pfg.61.2018.07.26.20.02.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 20:02:47 -0700 (PDT) From: Jia-Ju Bai To: mchehab@kernel.org, sakari.ailus@linux.intel.com, hans.verkuil@cisco.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] media: i2c: vs6624: Replace mdelay() with msleep() and usleep_range() in vs6624_probe() Date: Fri, 27 Jul 2018 11:02:40 +0800 Message-Id: <20180727030240.2558-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org vs6624_probe() is never called in atomic context. It calls mdelay() to busily wait, which is not necessary. mdelay() can be replaced with msleep() and usleep_range(). This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/media/i2c/vs6624.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/vs6624.c b/drivers/media/i2c/vs6624.c index 1658816a9844..bc9825f4a73d 100644 --- a/drivers/media/i2c/vs6624.c +++ b/drivers/media/i2c/vs6624.c @@ -770,7 +770,7 @@ static int vs6624_probe(struct i2c_client *client, return ret; } /* wait 100ms before any further i2c writes are performed */ - mdelay(100); + msleep(100); sensor = devm_kzalloc(&client->dev, sizeof(*sensor), GFP_KERNEL); if (sensor == NULL) @@ -782,7 +782,7 @@ static int vs6624_probe(struct i2c_client *client, vs6624_writeregs(sd, vs6624_p1); vs6624_write(sd, VS6624_MICRO_EN, 0x2); vs6624_write(sd, VS6624_DIO_EN, 0x1); - mdelay(10); + usleep_range(10000, 11000); vs6624_writeregs(sd, vs6624_p2); vs6624_writeregs(sd, vs6624_default); -- 2.17.0