Received: by 10.213.65.68 with SMTP id h4csp941431imn; Sun, 18 Mar 2018 08:10:02 -0700 (PDT) X-Google-Smtp-Source: AG47ELtVLKuEz7Y+OqQEFDgXaBh0oPF/Ugpq6e6CEn465Ho6mM7G5rElSOv7FykgcbFjnFthVlH5 X-Received: by 10.98.181.18 with SMTP id y18mr7516757pfe.115.1521385802040; Sun, 18 Mar 2018 08:10:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521385801; cv=none; d=google.com; s=arc-20160816; b=DtjeXyJAbQsbqSXrFn1DrCP5/xyQHlDGhf+EepzVy7yflH4BoVUrlE9eP0RfXyJvK1 IPo3QRbdDtw2obKBgcPR/TX8s+6HJa3cnZxb/FSkyYTgwH0e3fr++q+4xujkdbduBAXJ HgdplVSVjarNh+3C2aygzHGLfOCP1MeTJ2VTV41Ub08eeLGx9UQIIpDRnT8kN5t2GDHA v+NbMBmccan338e9c1g4M6LBqYZPWSEKx0Tb0WFr8rJObVmhZKU/bT2xwtBHx/YuT5vy hcKWwwLxgcBKQOmBNFHa6ComxmMrq4rnEZKSl2HLZlNAc4Doa2u0BUvPUHF5dDvw9Ppo j9Bw== 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=qEjg/QEKj8eru6pG/ogO1i6pseRwSv7ucby34wcqWTg=; b=PBBzqacUTBHvr6NM5L4ow31HhM0VmgA/iDPaJpFl33tdQpMfhMZE1PHDSjG34x4ybW mVUnWE5CEOlF9W6bJ4wU+HpLlyRTrB6JSAcBkHzx3bLaGkVyfyOkjcocFTW5rioKkfTb QlCbdjDboX2YtZRBoepqLfE/4MbKbkBK9RYcpekaWkG3Y34AShH6sQvhDW3sRkEQC1+0 sC2lZucTTb74rpfjyWj/SzTeE2yqs/HGa4aZZI/v/07RqHurvF4qkft+TPJynH5tcHL8 LRU19iV84KFdEHlV96NfPDoeKw6k18oDRZgjBmfGda1mGOo6IKf4AgURtoZX47RceRIj abpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Wtqs9UoD; 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 x19si8872963pfh.145.2018.03.18.08.09.47; Sun, 18 Mar 2018 08:10:01 -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=Wtqs9UoD; 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 S1754541AbeCROwB (ORCPT + 99 others); Sun, 18 Mar 2018 10:52:01 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:42330 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754528AbeCROwA (ORCPT ); Sun, 18 Mar 2018 10:52:00 -0400 Received: by mail-pg0-f66.google.com with SMTP id o14so1673078pgv.9 for ; Sun, 18 Mar 2018 07:51:59 -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=qEjg/QEKj8eru6pG/ogO1i6pseRwSv7ucby34wcqWTg=; b=Wtqs9UoDuGMPyY5DHRd5WU6gxv0D8eksJ1YVoWrjSNBM5JuEusuhoCTpPfKBeb6Kt0 JJbP+9B3Zt3bBl+uXziSqCPMPp6kP75S4MVm4A1aM+CnWhTMapKAwE4zweIpa+S3fWby jDQLp6i1ujsJbyhipdjxBJ0WPyoqTNWGv4atcARQ/JoOhAMNmckHuhUsyQQTKnheaQHo 7DH9Y7cpBTmNFUiGFREYw+PYCOvj0gejVLEGKFPJTbHBCPuTHyl9bwhye8i1OvBZxmSl chx9bFxvMTB1Nukt38RVFSz6Lm5j9KQn1FId4U/NaODyHUkURjyxWAxcp2/J3g9O+wOZ FQ0w== 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=qEjg/QEKj8eru6pG/ogO1i6pseRwSv7ucby34wcqWTg=; b=mKQhJWY2lM1PiBZIRxUdd4yC5vJDYLhepxM+3nD8089TIrKF72/HmCIHZE9L76ufI1 mMQQz7QPmkc+rWDtobDJzOTHUOwQA/HRVOemT2zDtYf1o/GLrIUsgTqUfMO4gqnSpR+8 XosIBjrOCuul9RT967diQAREP7jR+W5hW9WpWZ7BpMSIAHG4FOLWhsw5uyjNi3+xbRWs PQ60HOjHG3jL8wlBpDk+wTeCp/WpBJIs7mqOFPqHM/64hk2J5aU0Bd6sHVYdcyUVqVC4 loLC30uy2sGj/iecu01BDf4BQcC+kjYJheR8SrPajKjU9cuzzuXSQeZi0N+O3UoIbS4i Eysw== X-Gm-Message-State: AElRT7HqLy7yvFI+jhnUt8p+NKWPyJircXvaOthZF3k1IRRs93MIdZ1F vJI3h76aZaW15xXVBQ4SSGg= X-Received: by 10.99.173.79 with SMTP id y15mr6658139pgo.136.1521384719673; Sun, 18 Mar 2018 07:51:59 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:2c7e:2fdc:f812:6df0]) by smtp.gmail.com with ESMTPSA id l90sm8343807pfb.96.2018.03.18.07.51.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 18 Mar 2018 07:51:59 -0700 (PDT) From: Jia-Ju Bai To: perex@perex.cz, tiwai@suse.com Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 2/3] sound: usb: line6: Replace mdelay with msleep in line6_write_data Date: Sun, 18 Mar 2018 22:51:59 +0800 Message-Id: <1521384719-23423-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 line6_write_data() is never called in atomic context. The call chains ending up at line6_write_data() are: [1] line6_write_data() <- toneport_setup() <- toneport_init() <- line6_probe() [2] line6_write_data() <- toneport_setup() <- toneport_reset_resume() line6_probe() is called in toneport_probe(), pod_probe(), podhd_probe() and variax_probe(), which are set as ".probe" in usb_driver structure. toneport_reset_resume() is set as ".reset_resume" in usb_driver structure. These functions are not called in atomic context. Despite never getting called from atomic context, line6_write_data() calls mdelay for busy wait. That is not necessary and can be replaced with msleep to avoid busy waiting. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- sound/usb/line6/driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c index 0ff5a7d..29acd86 100644 --- a/sound/usb/line6/driver.c +++ b/sound/usb/line6/driver.c @@ -426,7 +426,7 @@ int line6_write_data(struct usb_line6 *line6, unsigned address, void *data, } for (count = 0; count < LINE6_READ_WRITE_MAX_RETRIES; count++) { - mdelay(LINE6_READ_WRITE_STATUS_DELAY); + msleep(LINE6_READ_WRITE_STATUS_DELAY); ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67, -- 1.9.1