Received: by 10.223.176.5 with SMTP id f5csp397962wra; Wed, 7 Feb 2018 00:57:08 -0800 (PST) X-Google-Smtp-Source: AH8x227Vg5wKNHfIW6vH4/a3R+0cUQjDNxu/eYYOyqTgIa16ZQEMqp+WMA0yXnA4IZWb1YM+K5LV X-Received: by 10.99.114.15 with SMTP id n15mr4374698pgc.8.1517993828716; Wed, 07 Feb 2018 00:57:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517993828; cv=none; d=google.com; s=arc-20160816; b=ALKlXYxDu384AqVZX/p1AkdIKQv1C1E0NpJD7K/iyHEc7UBuqBjd09Jnobli4Ydi+l S97+lwfRxVHPTWOQLdoWO1qpMrgPMTwydRF+LY0gdC75jkkWGZKTiTLXNWfkS6tpDVXu kOgfnxpRbeRaFT9loHbKjuGqaNoLRijwX2G0XVDKSJ7ceLPE/bC6weZMm9UG1F35/DW8 rShgfXLJKv8hd33/cbJJZnuW9P9ycO9BRV8ubKkNO6eV/qQuEEmpIz+7S8phd5STvJq+ JkJ5QGi9B4z8xVvxwdklYS+6DF9wMUrCRqBb3Ks5myaasXbvXP+4ltRXGEB8NhqOvYwp v3gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:arc-authentication-results; bh=fX7rqSnVygWOmk71VWykTU2AT6K2dwRK2woIGEhzBcI=; b=olX+Es7WdEsmHnbXZdA7JaDYl9vLInLpggVZ/iVi8ZhR6kltEa8eXYxIcLZGNbltk1 Y+NhDiOM8pyMbro7IRclsDuf13OZqMkFd50iX5SRacbHLtxERXXY5bWM+80ZjFk8ptIB uwpztioifHDshufBXDEmeOGMlkR5hiZfey3zTO30oBNZVvbi4gP7Zwnz0JriQn1OPfAY PfbxVPBkubcDnQVulnVUmiRsVWmEBmLczqeouqxyZiLCZboIiVJV6pm8/s39G4YDW+qA cxu+po9WC+RZmpjgE4bS6l/PejRN711mAUEMJg+FTTTSnGs9X9PWCc9rUIJijbzdNNar GMzQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j61-v6si790516plb.108.2018.02.07.00.56.55; Wed, 07 Feb 2018 00:57:08 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753551AbeBGIzv (ORCPT + 99 others); Wed, 7 Feb 2018 03:55:51 -0500 Received: from coyote.holtmann.net ([212.227.132.17]:57207 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753483AbeBGIzt (ORCPT ); Wed, 7 Feb 2018 03:55:49 -0500 Received: from marcel-macpro.fritz.box (p5B3D2E4B.dip0.t-ipconnect.de [91.61.46.75]) by mail.holtmann.org (Postfix) with ESMTPSA id 304E7CF2C6; Wed, 7 Feb 2018 10:01:54 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: [PATCH] bluetooth: hci_ll: Replace mdelay with msleep in download_firmware From: Marcel Holtmann In-Reply-To: <1517047432-23420-1-git-send-email-baijiaju1990@gmail.com> Date: Wed, 7 Feb 2018 09:55:46 +0100 Cc: "Gustavo F. Padovan" , Johan Hedberg , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 7bit Message-Id: <4991CEBC-8298-4AE5-86FD-686261E16BA6@holtmann.org> References: <1517047432-23420-1-git-send-email-baijiaju1990@gmail.com> To: Jia-Ju Bai X-Mailer: Apple Mail (2.3445.5.20) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jia-Ju, > download_firmware() is never called from atomic context. > > It is only called by ll_setup() that is called only via function pointer > "->setup" used in hci_uart_setup() in drivers/bluetooth/hci_serdev.c and > drivers/bluetooth/hci_ldisc.c. hci_uart_setup() is called only > via function pointer "->setup" used in hci_dev_do_open() > in net/bluetooth/hci_core.c. > All of the above functions do not enter atomic context. > > Besides, ll_setup() calls msleep() and hci_dev_do_open calls mutex_lock(). > So it indicates that all the above functions call functions that can sleep. > > Despite never getting called from atomic context, download_firmware() > 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_ll.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) patch has been applied to bluetooth-next tree. Regards Marcel