Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3733241imm; Mon, 30 Jul 2018 02:26:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdcjwK7iwmdd6agZ4FrMLYe1YeJYWxi1OnNicR3EUpqoY/fEvwak3cMgM/K2pz3qQzHjTsm X-Received: by 2002:a17:902:d716:: with SMTP id w22-v6mr15568772ply.98.1532942776010; Mon, 30 Jul 2018 02:26:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532942775; cv=none; d=google.com; s=arc-20160816; b=J9yEQItYl/usBpDKaHzN8gFuMXb2Jvev5XPOxp3gZwgwmx644lp3p/GabPe7qctHa8 iHLxNw2eOufOxEY0KGD4wirwaXW2gjB3GuI82BBaQzdAESanpB+/zKbVb/+eRhLwRwBl PJHIQQGi7EUwRg735Xibr3n/UxlRXo5dyeB9vGl3ctoeOqnRrweODIwQehuh0gwAZ6aE hXdFJZqmPzyozYzT5Bz/iMb71NE9nAF+jmNeUg4aReUTHAmsxVF/+4ZTWBGh81ydmPI2 pkEn9pPrpniEBr8xHCSGjjzKsqsRzzAlS8aXf9AnE0foXqnyFj7oUt0g7CC+Kywj2FfC MsXA== 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=pvBmAOvXm54SsGN8KhTiaSDPeHZFYKBxD2lIOwMg75g=; b=F3e1wCojJnlAp3AOlhFWM9LOMpBb9ZnAzhYgiLZ+EqHwAMkGc0yIKocYp8GK4YB+fh RVdLWaMeDI0IKIhI5QmnjLaHOHsckndiSihjqD2+XsNLKmgXHajNDb9TSwrWoUPfjXI6 2muHZhK6SAZTx+jhiswJz6RGZahO2vE7N7oNe9l9bpXb7UAE7ec5PISF1uLzV8U/10En 5D0yuVHFbOSOfos6zZlo49CEcbnRIjcNPhfwGyI0Alk4xsP8zjphpSZrAbFw0bL5c+wo x5eKyP1aQYRb0y7QEsxmH6waY/5c35xhCe6a/agdkvx0D5Mnth9e3EXCtpY6UTrdrsxu +i+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UbdTyfHC; 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 a16-v6si10822230pga.168.2018.07.30.02.26.02; Mon, 30 Jul 2018 02:26:15 -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=UbdTyfHC; 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 S1727509AbeG3K7K (ORCPT + 99 others); Mon, 30 Jul 2018 06:59:10 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:33495 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726758AbeG3K7K (ORCPT ); Mon, 30 Jul 2018 06:59:10 -0400 Received: by mail-pg1-f195.google.com with SMTP id r5-v6so6937075pgv.0; Mon, 30 Jul 2018 02:25:05 -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=pvBmAOvXm54SsGN8KhTiaSDPeHZFYKBxD2lIOwMg75g=; b=UbdTyfHCiahVwQ/v1xD33EQYe2jfAM31fRy8D3KXQKvdM+J76LZyGX6X+74RZJUNcN qYXwuhqQRXRB40vr0gVITZQkY/wUfojvphVFXbS+xTS4xpALvjssvQF7gxajW6hLtaJz QFKlhRmpsUvhL0kGWEhCszyQsVfQ7HwPPGWyEilId5rEKAtyEmKctvUUTIlbhkI+ZPxx fUMNV0BQi3gw+RdSPLdeAZ2W+EiXbXiXb9GxcshffDzzVui6oUWXJ+ik7piG5ACPq8Zh 4UTTAy5KxDNd2KitGSC8j+YCRK94s4vkhQCbjZFsAx3cXHXOUm2VjfaWJ0T21NPSUd+c D6wQ== 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=pvBmAOvXm54SsGN8KhTiaSDPeHZFYKBxD2lIOwMg75g=; b=t7q0aR/RFB+h5dkv3kEALXckymg72bQowTrACXblkLoFvHN2jDZdsE9gvH0Tox7Aez XV54+E/vZ9Wdm34diVK5Bbwg4uCo2/VbW8rXbj5VERg2rOwL1ocUqrqWkb9nCzNzbjZo X2soA4vGaIOj6K8LedhGOa7TvcX+yYjjbZlJnIWrLbWaqAM9iTI3NTTs5JiQ9izANf08 aHEl/Szxx8WpmfFzdZwm2OPXGc508lH+rzvieCJNvvjtRAHufkD51vicrBtTjRKPLwzH z8zLJUfbcLJfRtaCgNV57Y6JmpuXwEDR72cw7wpnzMkEW+jKH9a/WovLBcLeMNZvzzmR zihw== X-Gm-Message-State: AOUpUlH1qqAbnKdSNOZHwifcdchCJ10blSlJ+kbEpdGNOcW62fofWZos qqAqkaygbrf8IK/EGCrGdeY= X-Received: by 2002:a62:d10b:: with SMTP id z11-v6mr17134499pfg.255.1532942704907; Mon, 30 Jul 2018 02:25:04 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:4550:ab75:cee3:d6c1]) by smtp.gmail.com with ESMTPSA id f67-v6sm18975558pfe.75.2018.07.30.02.25.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jul 2018 02:25:04 -0700 (PDT) From: Jia-Ju Bai To: mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 2/3] media: usb: em28xx: Replace mdelay() with msleep() in em28xx_pre_card_setup() Date: Mon, 30 Jul 2018 17:24:59 +0800 Message-Id: <20180730092459.7848-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 em28xx_pre_card_setup() is never called in atomic context. It calls mdelay() to busily wait, which is not necessary. mdelay() can be replaced with msleep(). This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/media/usb/em28xx/em28xx-cards.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index 6e0e67d23876..24ac257fd421 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -2825,13 +2825,13 @@ static void em28xx_pre_card_setup(struct em28xx *dev) em28xx_write_reg(dev, EM2880_R04_GPO, 0x01); usleep_range(10000, 11000); em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xfd); - mdelay(70); + msleep(70); em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xfc); - mdelay(70); + msleep(70); em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xdc); - mdelay(70); + msleep(70); em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xfc); - mdelay(70); + msleep(70); break; case EM2870_BOARD_TERRATEC_XS_MT2060: /* @@ -2839,11 +2839,11 @@ static void em28xx_pre_card_setup(struct em28xx *dev) * demod work */ em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xfe); - mdelay(70); + msleep(70); em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xde); - mdelay(70); + msleep(70); em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xfe); - mdelay(70); + msleep(70); break; case EM2870_BOARD_PINNACLE_PCTV_DVB: /* @@ -2851,11 +2851,11 @@ static void em28xx_pre_card_setup(struct em28xx *dev) * DVB-T demod work */ em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xfe); - mdelay(70); + msleep(70); em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xde); - mdelay(70); + msleep(70); em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xfe); - mdelay(70); + msleep(70); break; case EM2820_BOARD_GADMEI_UTV310: case EM2820_BOARD_MSI_VOX_USB_2: -- 2.17.0