Received: by 10.223.176.5 with SMTP id f5csp401865wra; Sat, 27 Jan 2018 02:13:58 -0800 (PST) X-Google-Smtp-Source: AH8x226RZfYPzvE9UgCgoo5ppynAnDi3o3d9RO+gDeAdnd3VmHRte5CJpkuDLvSNtF8mm6cywMaT X-Received: by 10.98.32.93 with SMTP id g90mr8791401pfg.17.1517048038893; Sat, 27 Jan 2018 02:13:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517048038; cv=none; d=google.com; s=arc-20160816; b=BB33mvaW5b4W6IXQkn8TON4wywlsEZHN4KA3k1E1aHqoEgQBhFTO3FSGGnLQvewjMn edmQyzYKwnmKUzfN0UMCnrWmJeoZdSW101KTWmH9WwWsgNVsriX/M5F6Fd9kKm7/0yaA cVRyBYHoQ2LfIMCHJ4XsLi91+fKl/UwUxnOLmOeVN4G07XZjSxMul9Qk20NRlK99CUnH FfEEXqr+8ekd7H+iLee3m7TgV4UDFj1mG+tMSpunNmuIYtVnXKs3CEL+8WWdQSDPdqId 0a3KhGMQyiQE7Sjr9Qj+JgFejFDmDbORs66LCIrVSereFAU56sTX/+7LPJqamzMx2BiI avYg== 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=NMHHaCXKOkKJN5ESpi/VXCWKfebxGiz6LYUY5W6lo/M=; b=gpGQDrM5vXCf7akHHQrnf2iTe9q7yVBsDA/AUJ+zyHRxeL2792TxdzMZsrXbaqWJ3b zLv9asCdseCC9uVf09t0VpYNjmNxVVxAMQiKZMXaNzugf6WtH7RPkJGVSNY7g4zussy4 qN0iDIEXxzQ+woyt5fdCOxYpWQrAGyb/XH96acAVn8qpHOlo0McaDagPYOqFEAQ+sTi2 EjicqVl4f7thEBJei1++8u1tYgEmgQZTcRQK5bBOJQ+ZWsmX3LNtAuzVSkXqs1D7CVaG zXrSCgRxmoByNnfCdHa0LQ1u1sciXXUnUcbzWf9OsJzwne8tnedyGpkI/Qf2m8M+s4Td +MaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tu7u2gcc; 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=NONE 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 m72si4268716pga.376.2018.01.27.02.13.35; Sat, 27 Jan 2018 02:13: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=@gmail.com header.s=20161025 header.b=tu7u2gcc; 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=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752490AbeA0KNC (ORCPT + 99 others); Sat, 27 Jan 2018 05:13:02 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:40586 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752078AbeA0KNA (ORCPT ); Sat, 27 Jan 2018 05:13:00 -0500 Received: by mail-pf0-f196.google.com with SMTP id i66so1707186pfd.7; Sat, 27 Jan 2018 02:13:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=NMHHaCXKOkKJN5ESpi/VXCWKfebxGiz6LYUY5W6lo/M=; b=tu7u2gcc1KdEfnrGWpPC37uDeTclZwh5oKfFVaGM9kVRein4Bi3Nls8vkMfkIf/gGL lwq3HrMlr7SEMOvMhPTcfkR7IrvW74RAINRilNM8sSvJsUlFNovk3NcqrKVq0hKydc16 1hYvoxvCXZz1XHpWUXKy4uhMdLsqUvzn/jwFxAefyK5rXaiFCjCIXjVC5lvUgPkJXNHK n8ghVwIhrzRSnVXl+JnJwmXGU94VeiqH7g85NmS45Wpj3q58g6tUw45MV6HFrhLbv5+N 3a8gJ8sIhmAMqbXQ5jrpT5z+LQqI4l05TTOAVTHw5TAV1ROmbBy2aOiFXk/2+Z0gtx14 yxdA== 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=NMHHaCXKOkKJN5ESpi/VXCWKfebxGiz6LYUY5W6lo/M=; b=fqVC58qZOe+hJWSPdEdZFHlRHjs7lyfdOmpaRbFfiQcY8uR8Fmj6YpD/k5fKyqn3aw sZlYeWybnZ2rz2UplbDFqJUhVIeZOrAUeQWDP98o7Ad/d4fUe+7sWknqfhF/JnF+flTX uV8ozJ7cgO9cZk1XKDeoz51DpJNrbFgS+drANaAQPMDOUTvpm17IME2wnGGm8FOfcmQD 8onwtMidJ/LqrC1XvDxL9k0mfwYgb/w80hBgywNse7+xvTdy77laJ4TVLnXZThiXF/7u kh+P2C2lqC+OtA8UbPOfbj6nHKdlUWYrnmj/AO0+I4cNznpgJoAoF0hVfAhqaWOyXFBz u1Og== X-Gm-Message-State: AKwxytcK2tkcQCejU/tos7k0wBMfqMXVr7bhhnulZZZcs58r6frKtLvL dbGc50AXsQaiQTjR1hSUXncBvg== X-Received: by 10.98.66.67 with SMTP id p64mr21538795pfa.227.1517047980417; Sat, 27 Jan 2018 02:13:00 -0800 (PST) Received: from bai-oslab.tsinghua.edu.cn ([2402:f000:1:4413:c943:4098:9a43:1e52]) by smtp.gmail.com with ESMTPSA id v9sm22205136pfj.88.2018.01.27.02.12.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Jan 2018 02:12:59 -0800 (PST) From: Jia-Ju Bai To: marcel@holtmann.org, gustavo@padovan.org, johan.hedberg@gmail.com Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] bluetooth: hci_ath: Replace mdelay with msleep in ath_wakeup_ar3k Date: Sat, 27 Jan 2018 18:17:38 +0800 Message-Id: <1517048258-23798-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ath_wakeup_ar3k() is never called from atomic context. It is only called by ath_hci_uart_work() that is only called in ath_open() via INIT_WORK(). All of the above functions do not enter atomic context along the way. Despite never getting called from atomic context, ath_wakeup_ar3k() calls mdelay() for busy wait. That is not necessary and can be replaced with msleep to avoid busy wait. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/bluetooth/hci_ath.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/bluetooth/hci_ath.c b/drivers/bluetooth/hci_ath.c index 14ae7ee..d568fbd 100644 --- a/drivers/bluetooth/hci_ath.c +++ b/drivers/bluetooth/hci_ath.c @@ -71,12 +71,12 @@ static int ath_wakeup_ar3k(struct tty_struct *tty) /* Clear RTS first */ tty->driver->ops->tiocmget(tty); tty->driver->ops->tiocmset(tty, 0x00, TIOCM_RTS); - mdelay(20); + msleep(20); /* Set RTS, wake up board */ tty->driver->ops->tiocmget(tty); tty->driver->ops->tiocmset(tty, TIOCM_RTS, 0x00); - mdelay(20); + msleep(20); status = tty->driver->ops->tiocmget(tty); return status; -- 1.7.9.5