From patchwork Mon Oct 19 10:06:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11844023 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90672C433DF for ; Mon, 19 Oct 2020 10:20:06 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0898622263 for ; Mon, 19 Oct 2020 10:20:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="L/PpQTGm"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="tl5wef45"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="mFdIWnSa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0898622263 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From:Date: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=N8TcZiMtV3C7n+iHd8A4IEO0VhxxeEy4PoAevdyOlfQ=; b=L/PpQTGmXhC3QwCHzrefrcpMm zUq4UqbxNwnLQvxuAqm2anisjuOghNrTJFZPQRnVE2yFedirDH3nMTx2TYi5MpT9gbfrIrQgNUxom UGzEeYVbZEhmMez2y3NTVJnzfKKFtivLDsG81ky6GgbcbzT8m4Dv9VeHyMc6g/A7wtGasgIRKCH+v TAIyUJlv/XwRdUdasoroEbNM5vgetx2eWkE9x9XyynfhWy67L3QXr53SfdQAYjkRKa0BV6DNXDTFi LDTMRdKN/YXRsmYzhWzLnU0WE1k/p3xY97s3IQbIMy6t63cBto5t3PNYxGT6vOXd/MNNpzTC2NVP9 dMsmDZv+g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSFB-0002wf-SF; Mon, 19 Oct 2020 10:18:21 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSEv-0002nG-MF for linux-arm-kernel@lists.infradead.org; Mon, 19 Oct 2020 10:18:08 +0000 Message-Id: <20201019101109.603244207@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603102683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=ZKsj80ymynJu9n+vKl8hANyFjBXKxoMgZSnkilPgmtg=; b=tl5wef45fNGo5qqku0RXIq+k+/4W5Q5pAIFBbYg5gHeiLz+rmzsYUbEI3sumMndcKnV617 MFFwqK5RIs3GufNia1xUXF+YC1q1ts4jwtlb7Ua/wwMSvgy7787t31DxiRtl3cCt4/uhKK AyYnqXDkGUNL71Ex1qyWaW7moaGiflTzGR9pI75Xrvato+85LDRsR/1vSjNVORVpri1nLK kn/ZmQGgHXECgIAq45Z18bsJnOSfgf++dbm9svkITC3qP9gnqllazKhtNB2KZXVIJPxUDO oGKr0anhSRYMnEKTbl/+mqUgWEDKmzjj9foPm959CshuqF2iw/vNmXcRd1bVhg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603102683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=ZKsj80ymynJu9n+vKl8hANyFjBXKxoMgZSnkilPgmtg=; b=mFdIWnSa3Q+Zc90yiD08Wh2Z/poUmlh/UuAiBa7jk0GT1OVt+U/ksI8/JfrThIju7Jh6Tn sviYJm2vlKfOSvDA== Date: Mon, 19 Oct 2020 12:06:30 +0200 From: Thomas Gleixner To: LKML Subject: [patch V2 01/13] USB: sisusbvga: Make console support depend on BROKEN References: <20201019100629.419020859@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201019_061805_884583_8197AC56 X-CRM114-Status: GOOD ( 14.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , linux-usb@vger.kernel.org, Mathias Nyman , Peter Zijlstra , Greg Kroah-Hartman , Sebastian Andrzej Siewior , Thomas Winischhofer , Johan Hovold , stable@vger.kernel.org, Valentina Manea , linux-samsung-soc@vger.kernel.org, Kukjin Kim , Alan Stern , Krzysztof Kozlowski , Duncan Sands , "Ahmed S. Darwish" , linux-omap@vger.kernel.org, Shuah Khan , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The console part of sisusbvga is broken vs. printk(). It uses in_atomic() to detect contexts in which it cannot sleep despite the big fat comment in preempt.h which says: Do not use in_atomic() in driver code. in_atomic() does not work on kernels with CONFIG_PREEMPT_COUNT=n which means that spin/rw_lock held regions are not detected by it. There is no way to make this work by handing context information through to the driver and this only can be solved once the core printk infrastructure supports sleepable console drivers. Make it depend on BROKEN for now. Fixes: 1bbb4f2035d9 ("[PATCH] USB: sisusb[vga] update") Signed-off-by: Thomas Gleixner Cc: Thomas Winischhofer Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org Cc: stable@vger.kernel.org --- drivers/usb/misc/sisusbvga/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/misc/sisusbvga/Kconfig +++ b/drivers/usb/misc/sisusbvga/Kconfig @@ -16,7 +16,7 @@ config USB_SISUSBVGA config USB_SISUSBVGA_CON bool "Text console and mode switching support" if USB_SISUSBVGA - depends on VT + depends on VT && BROKEN select FONT_8x16 help Say Y here if you want a VGA text console via the USB dongle or From patchwork Mon Oct 19 10:06:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11844025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FA7EC43467 for ; Mon, 19 Oct 2020 10:20:03 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 885AD22263 for ; Mon, 19 Oct 2020 10:20:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qCsM/QZv"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="1y/pZhJx"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="EpF5wNFf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 885AD22263 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From:Date: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=NZd1wqoLK2ASED0O5XykZ9r5GM+HprL3Ox7O3NXqCAc=; b=qCsM/QZv00BLzOUofbgC6H0Nj DflRrVl7gfBnwbx/JTBJtFb61qiQv3omtsSt0PW2vC5lsakAANnXyZSBe/JNcs3BYre2YLxV+ESgx 1MGw7twKvzE4sHugdXKO7Z0U9afboCZmaPPj00ffq6ZaxuzGIzJJ8p7IzgEVc2ui5I3sUfqmPwOcq tBXPC4v9W3/cQxT0JRsFgp6ZdPnVsHmmSWt+vJ7lf8liFHEFdToHhF0HcBSX/OGquBUBIJ00JT1fO kNSaWuAzVj4RKY16PjTm8heHqpthBTvmIzw34wD2wDoWXekUVxki9HqZa3ni/DyChJPYChHuqqqIZ NrUv2SlAw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSF5-0002tC-7d; Mon, 19 Oct 2020 10:18:15 +0000 Received: from galois.linutronix.de ([193.142.43.55]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSEv-0002na-7V for linux-arm-kernel@lists.infradead.org; Mon, 19 Oct 2020 10:18:06 +0000 Message-Id: <20201019101109.753597069@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603102684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=j+vN9MgqREoIPGzBU7B1IaC3gna3kE7EN539Nh0ClUU=; b=1y/pZhJxP37rV0rJYULPo5TQOwi6HefvUHI6uFl3VyOzD/l9uItuaHM5eXK388fs3OFUXW hSALKKpI69M2O4c+bSYlejPpYC6pICFSdC9DdfpTR/WtEqHVmyWlGZ+GOOBhf/+1M2nn29 K9Ga9SNsF0iu3YuoJ8ieIZOcFDNbs7crX5QWXNnnL8OkI9EqFafV4MUDr09pVBNkgyaTYq lMqXxV5G1EGaMcFJEjIZDV+CwcdjhGM+KvQa1oyHADBQYrm2SkHPH1DvvUHpNr+AqEDlbz kkjpapE1LHCy0rvx+yyCA+R3G4M6QCC3WbG4xLKPNBSZX+OXtuvTiN7HxJfL8Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603102684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=j+vN9MgqREoIPGzBU7B1IaC3gna3kE7EN539Nh0ClUU=; b=EpF5wNFfU2q3Hnqoz5MF6cC6OkRPZavOxiE1H65l6nfC8pvMxSVoO1CNGgrw1X764TZuoK DwpXwGIMneJN/sAQ== Date: Mon, 19 Oct 2020 12:06:31 +0200 From: Thomas Gleixner To: LKML Subject: [patch V2 02/13] USB: serial: keyspan_pda: Replace in_interrupt() usage References: <20201019100629.419020859@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201019_061805_378005_725B033B X-CRM114-Status: GOOD ( 18.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Thomas Winischhofer , Mathias Nyman , Peter Zijlstra , Greg Kroah-Hartman , Sebastian Andrzej Siewior , linux-usb@vger.kernel.org, Johan Hovold , Krzysztof Kozlowski , Valentina Manea , linux-samsung-soc@vger.kernel.org, Kukjin Kim , Alan Stern , Duncan Sands , "Ahmed S. Darwish" , linux-omap@vger.kernel.org, Shuah Khan , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org keyspan_pda_write() uses in_interrupt() to check whether it is safe to invoke functions which might sleep. The usage of in_interrupt() in drivers is phased out and Linus clearly requested that code which changes behaviour depending on context should either be seperated or the context be conveyed in an argument passed by the caller, which usually knows the context. Aside of that it does not cover all contexts which cannot sleep, e.g. preempt disabled regions which cannot be reliably detected on all kernel configurations. With the current printk() implementation console->write() can be invoked from almost any context. The upcoming rework of the console core will provide thread context for console drivers which require to sleep. For now, restrict the room query which can sleep to tty writes which happen from preemptible task context. The usability for dmesg output is limited anyway because it's almost guaranteed to drop the 'LF' which is submitted after the dmesg line because the device supports only one transfer on flight. Same for any printk() which is coming in before the previous transfer has been done. This new restriction does not make it worse than before, but it makes the condition correct under all circumstances. Signed-off-by: Ahmed S. Darwish Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Cc: Johan Hovold Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org --- drivers/usb/serial/keyspan_pda.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -477,10 +477,12 @@ static int keyspan_pda_write(struct tty_ count = (count > port->bulk_out_size) ? port->bulk_out_size : count; - /* Check if we might overrun the Tx buffer. If so, ask the - device how much room it really has. This is done only on - scheduler time, since usb_control_msg() sleeps. */ - if (count > priv->tx_room && !in_interrupt()) { + /* + * Check if we might overrun the Tx buffer. If so, ask the device + * how much room it really has. This can only be invoked for tty + * usage because the console write can't sleep. + */ + if (count > priv->tx_room && tty) { u8 *room; room = kmalloc(1, GFP_KERNEL); From patchwork Mon Oct 19 10:06:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11844027 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09D5AC433E7 for ; Mon, 19 Oct 2020 10:20:34 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2023A22263 for ; Mon, 19 Oct 2020 10:20:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ISt9Z2qz"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="WK/KUF9n"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="x8rtyLqc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2023A22263 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From:Date: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=mfYnZll9YmIKyy+ogl5VjZXgKKjN/L5i7WhK0DcPc9c=; b=ISt9Z2qzHjztqSDxDHUwTPSEZ YsUQQYuKbCt30YgVQ4udF8thvHBhM4W1pKAzNHJ/IU/sr14oWP8aEst6Zdrj8ZkiVZs2E1qy9Q9qE 7zPMkCRJ04G2Av1+rE1kQqZjDxjTS7YWEVhzEA93tVjOxaR++CkF69CEtGIWxhUSxJNsMKC4qCT/D V4p7KwoWDVMyToG1UfH10lRoQ2EQGaeVsF3272sH5VTJYrGlx0ci79dbIRqWZUJdGvdCF/oTTNezf ZUNOiX5KqoMQngEmv+gaW5VMKSUQBx4qjb9R/1Kl/lzB4Z91uJZLkoFaLV5os1ZyYlmb6R7H6z583 EH9IVamoA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSFV-000331-U3; Mon, 19 Oct 2020 10:18:42 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSEw-0002oX-IX for linux-arm-kernel@lists.infradead.org; Mon, 19 Oct 2020 10:18:10 +0000 Message-Id: <20201019101109.903651690@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603102685; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=GspGZAgtTq6gMYfmmkZzHxj2wK5gwCFO/dMv4c+qGNg=; b=WK/KUF9nx+OzfrXpW6AZP63Mk3FL/cEjZl3mU1F9QJ+O6FJ7qFDBgNIs/DFAFqo32p+kRL wd5kaaQ3IHlGruoBf+Rn4HWEy/upe3XziU6BeSZv4kqnKeCytgoMKdNx04mw/kuVTUsi7/ PYSOi/w361WypClc90JwGEnpGTOftBHhyjUjPjTSY2BTbxsTTpxQ5+n0W7qFt+i/X6h3Vb cXkJdxA60UzvFfPnepVkhrjd0HmQQD2yVv8bBmMjy8rEm00gd3dGvgMv8DKmKFb7xE8ttZ W8fcjFZdNQinRYMJy79YUEA9tvaulgCmIKr+DDzUp3pjRz/N51+z8dGvgR3vng== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603102685; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=GspGZAgtTq6gMYfmmkZzHxj2wK5gwCFO/dMv4c+qGNg=; b=x8rtyLqc8Pja+okYr4ByLhKQBeW2Ox67gJGffT2WLFy/CoG/rB/9qGuafa5FJRoM3ny9Di GdMrkcGxm7OgQlDg== Date: Mon, 19 Oct 2020 12:06:32 +0200 From: Thomas Gleixner To: LKML Subject: [patch V2 03/13] USB: serial: keyspan_pda: Consolidate room query References: <20201019100629.419020859@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201019_061806_863914_8B7ECBF3 X-CRM114-Status: GOOD ( 22.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Thomas Winischhofer , Mathias Nyman , Peter Zijlstra , Greg Kroah-Hartman , Sebastian Andrzej Siewior , linux-usb@vger.kernel.org, Johan Hovold , Krzysztof Kozlowski , Valentina Manea , linux-samsung-soc@vger.kernel.org, Kukjin Kim , Alan Stern , Duncan Sands , "Ahmed S. Darwish" , linux-omap@vger.kernel.org, Shuah Khan , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Sebastian Andrzej Siewior Having two copies of the same code doesn't make the code more readable and allocating a buffer of 1 byte for a synchronous operation is a pointless exercise. Allocate a byte buffer at init which can be used instead. The buffer is only used in open() and tty->write(). Console writes are not calling into the query. open() obviously happens before write() and the writes are serialized by bit 0 of port->write_urbs_free which protects also the transaction itself. Move the actual query into a helper function and cleanup the usage sites in keyspan_pda_write() and keyspan_pda_open(). Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Cc: Johan Hovold Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org --- V2; Allocate a real buffer (Alan) --- drivers/usb/serial/keyspan_pda.c | 108 +++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 59 deletions(-) --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -47,6 +47,7 @@ struct keyspan_pda_private { struct work_struct unthrottle_work; struct usb_serial *serial; struct usb_serial_port *port; + u8 *query_buf; }; @@ -436,6 +437,31 @@ static int keyspan_pda_tiocmset(struct t return rc; } +/* + * Using priv->query_buf is safe here because this is only called for TTY + * operations open() and write(). write() comes post open() obviously and + * write() itself is serialized via bit 0 of port->write_urbs_free. Console + * writes are never calling into this. + */ +static int keyspan_pda_query_room(struct usb_serial *serial, + struct keyspan_pda_private *priv) +{ + int res; + + res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), + 6, /* write_room */ + USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_IN, + 0, /* value */ + 0, /* index */ + priv->query_buf, + 1, + 2000); + if (res != 1) + return res < 0 ? res : -EIO; + + return (unsigned int)*priv->query_buf; +} + static int keyspan_pda_write(struct tty_struct *tty, struct usb_serial_port *port, const unsigned char *buf, int count) { @@ -483,39 +509,16 @@ static int keyspan_pda_write(struct tty_ * usage because the console write can't sleep. */ if (count > priv->tx_room && tty) { - u8 *room; - - room = kmalloc(1, GFP_KERNEL); - if (!room) { - rc = -ENOMEM; - goto exit; - } - - rc = usb_control_msg(serial->dev, - usb_rcvctrlpipe(serial->dev, 0), - 6, /* write_room */ - USB_TYPE_VENDOR | USB_RECIP_INTERFACE - | USB_DIR_IN, - 0, /* value: 0 means "remaining room" */ - 0, /* index */ - room, - 1, - 2000); - if (rc > 0) { - dev_dbg(&port->dev, "roomquery says %d\n", *room); - priv->tx_room = *room; - } - kfree(room); + rc = keyspan_pda_query_room(serial, priv); if (rc < 0) { - dev_dbg(&port->dev, "roomquery failed\n"); - goto exit; - } - if (rc == 0) { - dev_dbg(&port->dev, "roomquery returned 0 bytes\n"); - rc = -EIO; /* device didn't return any data */ + dev_dbg(&port->dev, "roomquery failed %d\n", rc); goto exit; } + + dev_dbg(&port->dev, "roomquery says %d\n", rc); + priv->tx_room = rc; } + if (count > priv->tx_room) { /* we're about to completely fill the Tx buffer, so we'll be throttled afterwards. */ @@ -615,45 +618,26 @@ static int keyspan_pda_open(struct tty_s struct usb_serial_port *port) { struct usb_serial *serial = port->serial; - u8 *room; - int rc = 0; struct keyspan_pda_private *priv; + int rc; - /* find out how much room is in the Tx ring */ - room = kmalloc(1, GFP_KERNEL); - if (!room) - return -ENOMEM; + priv = usb_get_serial_port_data(port); - rc = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), - 6, /* write_room */ - USB_TYPE_VENDOR | USB_RECIP_INTERFACE - | USB_DIR_IN, - 0, /* value */ - 0, /* index */ - room, - 1, - 2000); + /* find out how much room is in the Tx ring */ + rc = keyspan_pda_query_room(serial, priv); if (rc < 0) { - dev_dbg(&port->dev, "%s - roomquery failed\n", __func__); - goto error; - } - if (rc == 0) { - dev_dbg(&port->dev, "%s - roomquery returned 0 bytes\n", __func__); - rc = -EIO; - goto error; + dev_dbg(&port->dev, "roomquery failed %d\n", rc); + return rc; } - priv = usb_get_serial_port_data(port); - priv->tx_room = *room; - priv->tx_throttled = *room ? 0 : 1; + + priv->tx_room = rc; + priv->tx_throttled = rc ? 0 : 1; /*Start reading from the device*/ rc = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); - if (rc) { + if (rc) dev_dbg(&port->dev, "%s - usb_submit_urb(read int) failed\n", __func__); - goto error; - } -error: - kfree(room); + return rc; } static void keyspan_pda_close(struct usb_serial_port *port) @@ -715,6 +699,11 @@ static int keyspan_pda_port_probe(struct priv = kmalloc(sizeof(struct keyspan_pda_private), GFP_KERNEL); if (!priv) return -ENOMEM; + priv->query_buf = kmalloc(1, GFP_KERNEL); + if (!priv->query_buf) { + kfree(priv); + return -ENOMEM; + } INIT_WORK(&priv->wakeup_work, keyspan_pda_wakeup_write); INIT_WORK(&priv->unthrottle_work, keyspan_pda_request_unthrottle); @@ -731,6 +720,7 @@ static int keyspan_pda_port_remove(struc struct keyspan_pda_private *priv; priv = usb_get_serial_port_data(port); + kfree(priv->query_buf); kfree(priv); return 0; From patchwork Mon Oct 19 10:06:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11844029 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B2ECC43457 for ; Mon, 19 Oct 2020 10:20:06 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0B0DD22268 for ; Mon, 19 Oct 2020 10:20:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="yGD06rpJ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="iwIXTF3e"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="2C+WiHFJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B0DD22268 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From:Date: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=xEIlegQi+bSgJSMB0jPyIytiP4YHqddKP1w3mvrga/c=; b=yGD06rpJbPVgfN3Q6XMPdkXnd tOVCOItGBj6pBUwZem0n2a019AhbBaol0ky87AWcci2TR/9SI8qH7WlnzPt49S7yiOCWdqNoMWvj5 BoSmi2I6ZY4u9h6IAFw5lpHuoF5Jh/ovIwPx7QJHN/TyUIA8auhOsPu0i2x2IlM2JE/JcDslGcolS KwLSgiSIxks/6t57blZCrrmoNGl82xaNiNGnHu572i05NT/rKxp2B59dd6hmxgAmnIm8e+iyjoIC8 qSJb3hHhJoP00VIIEICKFLUXEW+Jg6YAiDJnNJTE7tIdniQV3bB71/3j/He21MDfUO6j73zE7LkRU OSlddhv9Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSFL-0002zP-LN; Mon, 19 Oct 2020 10:18:31 +0000 Received: from galois.linutronix.de ([193.142.43.55]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSEx-0002pM-P9 for linux-arm-kernel@lists.infradead.org; Mon, 19 Oct 2020 10:18:11 +0000 Message-Id: <20201019101110.019266389@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603102686; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=MXv/cC90NGLd0gAyhvd77yXM/kdP4dV075keyekfnPQ=; b=iwIXTF3enn1fKti5Wyc96yx4QPfU+KLydyWLL0v9XCmX93au8n+PY7KafwO6IdMWfyujqV uODhQfVFgnk8XBnleRHsnd93BKSgI1gKCozA4aXlXg8L+KUVbI9K1ugQ7bE7J5vtFv+kSC uhkRoqqLG+BL/mfNGhNdQsiqYPGaF+qubBeaXj5TEZX96E7p5w18kzSbxLDWkNEKfHxk79 RlDbTflSduUm49CPm+yZnOaAY0Ne5qKTL18u2daxeMIA+rX1k/wm1kt1WWDuUNZxO5G/j/ OSvklQqcZ0OP4b9om2XFCeqkBPn8IAAe25qYyINN0Mpm0xrQh4Me68mqQogqMg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603102686; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=MXv/cC90NGLd0gAyhvd77yXM/kdP4dV075keyekfnPQ=; b=2C+WiHFJBXgPiWdy7C84FEdn66zJ0B0CnSRlJ3KIL25PgSmN+pU25mZ09jWn1ED1ug6tnA GQ4nIpFut1OqP1BQ== Date: Mon, 19 Oct 2020 12:06:33 +0200 From: Thomas Gleixner To: LKML Subject: [patch V2 04/13] USB: serial: digi_acceleport: Remove in_interrupt() usage References: <20201019100629.419020859@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201019_061808_010122_BBA10195 X-CRM114-Status: GOOD ( 12.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Thomas Winischhofer , Mathias Nyman , Peter Zijlstra , Greg Kroah-Hartman , Sebastian Andrzej Siewior , linux-usb@vger.kernel.org, Johan Hovold , Krzysztof Kozlowski , Valentina Manea , linux-samsung-soc@vger.kernel.org, Kukjin Kim , Alan Stern , Duncan Sands , "Ahmed S. Darwish" , linux-omap@vger.kernel.org, Shuah Khan , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ahmed S. Darwish The usage of in_interrupt() in drivers is phased out and Linus clearly requested that code which changes behaviour depending on context should either be separated or the context be conveyed in an argument passed by the caller, which usually knows the context. The debug printk() in digi_write() prints in_interrupt() as context information. TTY writes happen always in preemptible task context and console writes can happen from almost any context, so in_interrupt() is not really helpful. Aside of that issuing a printk() from a console->write() callback is not a really brilliant idea for obvious reasons. Remove the in_interrupt() printout and make the printk() depend on tty. Signed-off-by: Ahmed S. Darwish Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Cc: Johan Hovold Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org --- drivers/usb/serial/digi_acceleport.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c @@ -911,9 +911,10 @@ static int digi_write(struct tty_struct unsigned char *data = port->write_urb->transfer_buffer; unsigned long flags = 0; - dev_dbg(&port->dev, - "digi_write: TOP: port=%d, count=%d, in_interrupt=%ld\n", - priv->dp_port_num, count, in_interrupt()); + if (tty) { + dev_dbg(&port->dev, "digi_write: TOP: port=%d, count=%d\n", + priv->dp_port_num, count); + } /* copy user data (which can sleep) before getting spin lock */ count = min(count, port->bulk_out_size-2); From patchwork Mon Oct 19 10:06:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11844031 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7871EC433E7 for ; Mon, 19 Oct 2020 10:20:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CEB4A2225A for ; Mon, 19 Oct 2020 10:20:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WwbAKfcW"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Er+PWHFh"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="FJr22QDO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CEB4A2225A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From:Date: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=u/Hlun2Sto0JDCIan67j/LrISE7bay/Nxi0doPcpYN8=; b=WwbAKfcWZnFN47/wO++jQBqLo iq41/agw2aSd4O5S1yVVY9ZJxGOAOnnwFkxLrcAd3kQUYUPWOi/XPt3+hLjvJiO9PM5HJdt4gpX7T Q2m8wEp6Iq5nceu2LuXhDn1hxf3R/peYF9Mn6vEu3IVFe9icTwbou+ttPcUnlp/rV6ZmS99yHumz2 LtLZElYAi9T3vzyDmLAfIe7fmtSzE/9ggSV3gUS/2wLOfHnnIV1TZ/3qwtOG3OeIeAWrZu0500/O7 4YsYTGXtSK4QWcAQt1uMioyL/ma6qFWGp6W+paUya7h8MXsYBF/Gkcg70mPb89Quu4yCzSoS9hBSN cRYKlJ4KQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSFk-00037m-Ct; Mon, 19 Oct 2020 10:18:56 +0000 Received: from galois.linutronix.de ([193.142.43.55]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSEz-0002qB-9K for linux-arm-kernel@lists.infradead.org; Mon, 19 Oct 2020 10:18:11 +0000 Message-Id: <20201019101110.148631116@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603102688; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=Pe8CFmf0/CnRVhPeaGPKSnnUTmz8AJUU7taQJPbdbP8=; b=Er+PWHFh2XhU2mRAPNNosWvUF3EK+wzX+2LAJgVyV0ju89RHA84spDu+zn4M3crzNSUFEU NKSH3TS7s03F9XbXnoYUD/jzDdTB2RZaLV8d9AehueGw6+Z+xaP6gDSn2Dm9jVSH92erSQ Um2zLnLMv0mN1w1rVYxoaQgst7iuKIsnfvaFiw5RNpYee14xKDwzVnro/0jviGYKBrN1+a CJzMt9mpfmLpOb87dsgdAZdcGzyxa7dgC/4erhH81shqCKhFF0R/FLqLZYvFxNsHW+oCm0 550nGFrM83486LxByGE5+rIpmVA2E6jCZ9IOHFbTmVY0glelxuzDtjHleI3CoA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603102688; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=Pe8CFmf0/CnRVhPeaGPKSnnUTmz8AJUU7taQJPbdbP8=; b=FJr22QDOzYwi+B9T9ZCc7LH0Grzvr7ZKTdDRMuC3HFO/93A24i5o/PmAPDhV1HSrHurI0s lMM4DJ8Q9Df5n6CQ== Date: Mon, 19 Oct 2020 12:06:34 +0200 From: Thomas Gleixner To: LKML Subject: [patch V2 05/13] usb: xhci: Remove in_interrupt() checks References: <20201019100629.419020859@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201019_061809_495571_AE15DAED X-CRM114-Status: GOOD ( 14.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Thomas Winischhofer , Mathias Nyman , Peter Zijlstra , Greg Kroah-Hartman , Sebastian Andrzej Siewior , linux-usb@vger.kernel.org, Johan Hovold , Krzysztof Kozlowski , Valentina Manea , linux-samsung-soc@vger.kernel.org, Kukjin Kim , Alan Stern , Duncan Sands , "Ahmed S. Darwish" , linux-omap@vger.kernel.org, Shuah Khan , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ahmed S. Darwish The usage of in_interrupt() in drivers is phased out for various reasons. xhci_set_hc_event_deq() has an !in_interrupt() check which is pointless because the function is only invoked from xhci_mem_init() which is clearly task context as it does GFP_KERNEL allocations. Remove it. xhci_urb_enqueue() prints a debug message if an URB is submitted after the underlying hardware was suspended. But that warning is only issued when in_interrupt() is true, which makes no sense. Simply return -ESHUTDOWN and be done with it. Signed-off-by: Ahmed S. Darwish Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Cc: Mathias Nyman Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org --- drivers/usb/host/xhci-mem.c | 2 +- drivers/usb/host/xhci.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -2110,7 +2110,7 @@ static void xhci_set_hc_event_deq(struct deq = xhci_trb_virt_to_dma(xhci->event_ring->deq_seg, xhci->event_ring->dequeue); - if (deq == 0 && !in_interrupt()) + if (!deq) xhci_warn(xhci, "WARN something wrong with SW event ring " "dequeue ptr.\n"); /* Update HC event ring dequeue pointer */ --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1473,11 +1473,9 @@ static int xhci_urb_enqueue(struct usb_h ep_index = xhci_get_endpoint_index(&urb->ep->desc); ep_state = &xhci->devs[slot_id]->eps[ep_index].ep_state; - if (!HCD_HW_ACCESSIBLE(hcd)) { - if (!in_interrupt()) - xhci_dbg(xhci, "urb submitted during PCI suspend\n"); + if (!HCD_HW_ACCESSIBLE(hcd)) return -ESHUTDOWN; - } + if (xhci->devs[slot_id]->flags & VDEV_PORT_ERROR) { xhci_dbg(xhci, "Can't queue urb, port error, link inactive\n"); return -ENODEV; From patchwork Mon Oct 19 10:06:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11844035 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77616C433E7 for ; Mon, 19 Oct 2020 10:21:15 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 02AE822276 for ; Mon, 19 Oct 2020 10:21:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="H5BKIsPN"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Ay5afY3n"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Bwy/LQ9S" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02AE822276 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From:Date: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=Rz1SP3p6tXMeZuHU3WqqtGS6NQYzz+a76tRh0FFMj7Y=; b=H5BKIsPNudrPGQpRitC4myfGs P9DfnKHs0l5CiH5FKYyVByZy2tdxvTbAYjed0H0nlx8A18ZF+ZXbm45IDp9pKfNvQaGdl7mHxWyE5 4lVod4xQPVMVBmcMo/6vjDVqJ91IgRzQB5cDzOzUyZ/wmtmn0DHcoTJ4r2tuUVm20dtRZgPpyktK4 qR4HBxbVyzUxH47gkzn48xSHma1JchCCrDcTI/R2LpvjxNqQjXNj/I8iNP1rNBiA3BxOfmKI2hEbt YLeh2nY+AhNS3aSvLCDbHYRJMGWdu9eZL7/m3P00cqDYbJS3N1XmsNgcdWF7oveB8UZfLbAYvzSv1 xNCDXPLvA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSG2-0003DH-Ub; Mon, 19 Oct 2020 10:19:15 +0000 Received: from galois.linutronix.de ([193.142.43.55]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSF0-0002qo-Cy for linux-arm-kernel@lists.infradead.org; Mon, 19 Oct 2020 10:18:13 +0000 Message-Id: <20201019101110.240285929@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603102689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=WngfxKCbiTKE9erlSaLbB4MmoQbLDSkUgvyXSrV+/VI=; b=Ay5afY3nWqWdPkkzJsp41vh5O+dD2nd/0fG7RPbP5DUH92jHLqP6Kx+3E+AHYac364F9Mo A2bpcoj3jwogNqL3dtlf2Szc3PgPAu6ewzrYCOYGLMss1il8aDMVLdwRhDvVduzPmijOUx bYyr58hIlLaMiCjqfoG7PA5U4avgF10+lL9DkkA4pBxuqxXEV++cJrBhuREFpO56yA46XI qaOv8WbByE5HGmV28mYtJpVk4afPWMXE2eXAgiOo7srHiNb4bX+BPVXnlTTKFTEJUEynxY NEMYP+tMNTl6fRPX9Y3Stq50xgCoi3m8zzsXrAgZ8gDIX2ivJINECVsfzcWlQg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603102689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=WngfxKCbiTKE9erlSaLbB4MmoQbLDSkUgvyXSrV+/VI=; b=Bwy/LQ9S8g8N8l1iMRJCmuGn0XWiNGgBFATYWG6atDTGprcVSeTwnDFRmVJvB4kb9scCZ5 j72sHwPUxaQxxvAw== Date: Mon, 19 Oct 2020 12:06:35 +0200 From: Thomas Gleixner To: LKML Subject: [patch V2 06/13] usb: host: isp1362: Replace in_interrupt() usage References: <20201019100629.419020859@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201019_061810_616145_B47ACE8D X-CRM114-Status: GOOD ( 12.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Thomas Winischhofer , Mathias Nyman , Peter Zijlstra , Greg Kroah-Hartman , Sebastian Andrzej Siewior , linux-usb@vger.kernel.org, Johan Hovold , Krzysztof Kozlowski , Valentina Manea , linux-samsung-soc@vger.kernel.org, Kukjin Kim , Alan Stern , Duncan Sands , "Ahmed S. Darwish" , linux-omap@vger.kernel.org, Shuah Khan , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org isp1362_show_regs() is a debugging-only function, with no call sites. It prints the cached value of the HCuPINTENB register if in_interupt() is true, otherwise it reads the actual register content. The usage of in_interrupt() in drivers is phased out and Linus clearly requested that code which changes behaviour depending on context should either be separated or the context be conveyed in an argument passed by the caller, which usually knows the context. Make the conditional based on a function argument. Signed-off-by: Ahmed S. Darwish Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org --- V2: Fix silly typo --- drivers/usb/host/isp1362.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/usb/host/isp1362.h +++ b/drivers/usb/host/isp1362.h @@ -793,7 +793,8 @@ static void isp1362_write_fifo(struct is ISP1362_REG_NO(ISP1362_REG_##r), isp1362_read_reg16(d, r)); \ } -static void __attribute__((__unused__)) isp1362_show_regs(struct isp1362_hcd *isp1362_hcd) +static void __attribute__((__unused__)) +isp1362_show_regs(struct isp1362_hcd *isp1362_hcd, bool cached_inten) { isp1362_show_reg(isp1362_hcd, HCREVISION); isp1362_show_reg(isp1362_hcd, HCCONTROL); @@ -815,7 +816,7 @@ static void __attribute__((__unused__)) isp1362_show_reg(isp1362_hcd, HCXFERCTR); isp1362_show_reg(isp1362_hcd, HCuPINT); - if (in_interrupt()) + if (cached_inten) DBG(0, "%-12s[%02x]: %04x\n", "HCuPINTENB", ISP1362_REG_NO(ISP1362_REG_HCuPINTENB), isp1362_hcd->irqenb); else From patchwork Mon Oct 19 10:06:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11844033 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C0C4C433DF for ; Mon, 19 Oct 2020 10:21:29 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DF7D72225A for ; Mon, 19 Oct 2020 10:21:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ACnS+x3d"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="DkOW+oqB"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ukkqVAZW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF7D72225A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From:Date: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=+NZ6OVp8bn5chmbAPvF4qzQjmuLvfEWSpwyCx/Z+x68=; b=ACnS+x3d1iC7OupXFJzN2FY1O vbz2DpXuc+V2zy90P/nlUuJobtHfEyP8LlZ6SYHaWbrGPuDCFZB+oTHx+V9Amp9SZTzbTO/C0ElKD EQsBt4hFNQzXD7yPjQOwb1YGj4JGEZi5ZZQNzILL1AmJJj7wC1450R+mIoXGwnTB3uAbCz1dF0V1m ISGXqgzZd9gBiifjceiE7aUJV7hPY1uVUVMt30uiI6rLqxfhyrFQrwn4+3cBexOQVH6/pN4xJ/KBj kn3KETCvwvqjy1LXTu5v72AnIZZe3fk8EN8L1kJMPWvXOtddDKd25UPBzjzVFn3RUigoEcrqyl//J jeJsj0BZg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSGN-0003MI-Lm; Mon, 19 Oct 2020 10:19:35 +0000 Received: from galois.linutronix.de ([193.142.43.55]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSF1-0002rU-Cb for linux-arm-kernel@lists.infradead.org; Mon, 19 Oct 2020 10:18:14 +0000 Message-Id: <20201019101110.332963099@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603102690; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=dX7drupC9tJwDgrKaubl+xgZ5vF2h10siTohooz8pfU=; b=DkOW+oqBGph9qdl3NB+IO3bAWHEx0hDVdZQr7mdAH/mI8bWN259m/6mQ+GdfrIwwHclbSm d4KDXOrXHoqzK36EBNJ620ykBl3KV0WL3IYL2XtUe0eVwa58eo9p1PYEzmLWFoLGaxxlyi 5qDhBfX61/ubYHJJc+OIiO1q359jU7WuydYss9lTtIje80m8Xzc27wgBJlECQzEWSlQB/x 681X/NFAIpPdOUlS2uCFaNS2wL047IFr0XvrdSw5fQ6Y5ndxwteudXWqUBTCIZK/iRV9FF 9rsf0daTNDGGlgohcR5n5q7HPsbYaAKpcNqeQtmtHWlozh00S61QowhMaIVHUA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603102690; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=dX7drupC9tJwDgrKaubl+xgZ5vF2h10siTohooz8pfU=; b=ukkqVAZWUZRoaElft2syvVEMEOeTfiR51UY6hvVpXDzFz+j/0DfC10Z9+EKbw3LvamC3O+ MXG1zMeHMKUgN2Dw== Date: Mon, 19 Oct 2020 12:06:36 +0200 From: Thomas Gleixner To: LKML Subject: [patch V2 07/13] usbip: Remove in_interrupt() check References: <20201019100629.419020859@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201019_061811_590390_23A875C8 X-CRM114-Status: GOOD ( 10.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Thomas Winischhofer , Mathias Nyman , Peter Zijlstra , Greg Kroah-Hartman , Sebastian Andrzej Siewior , linux-usb@vger.kernel.org, Valentina Manea , Krzysztof Kozlowski , Johan Hovold , linux-samsung-soc@vger.kernel.org, Kukjin Kim , Alan Stern , Duncan Sands , "Ahmed S. Darwish" , linux-omap@vger.kernel.org, Shuah Khan , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ahmed S. Darwish The usage of in_interrupt() in drivers is phased out and Linus clearly requested that code which changes behaviour depending on context should either be separated or the context be conveyed in an argument passed by the caller, which usually knows the context. usbip_recv() uses in_interrupt() to conditionally print context information for debugging messages. The value is zero as the function is only called from various *_rx_loop() kthread functions. Remove it. Signed-off-by: Ahmed S. Darwish Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Acked-by: Shuah Khan Cc: Valentina Manea Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org --- drivers/usb/usbip/usbip_common.c | 5 ----- 1 file changed, 5 deletions(-) --- a/drivers/usb/usbip/usbip_common.c +++ b/drivers/usb/usbip/usbip_common.c @@ -324,11 +324,6 @@ int usbip_recv(struct socket *sock, void } while (msg_data_left(&msg)); if (usbip_dbg_flag_xmit) { - if (!in_interrupt()) - pr_debug("%-10s:", current->comm); - else - pr_debug("interrupt :"); - pr_debug("receiving....\n"); usbip_dump_buffer(buf, size); pr_debug("received, osize %d ret %d size %zd total %d\n", From patchwork Mon Oct 19 10:06:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11844039 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E0AFC43467 for ; Mon, 19 Oct 2020 10:21:48 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0FC3B2225A for ; Mon, 19 Oct 2020 10:21:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HeVZbCqx"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Z04gypyj"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Z5dFPjXX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0FC3B2225A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From:Date: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=XMsMk3hYF2umsPlWF1SvIAIwa4Viq5nxx8WCnFOcRYo=; b=HeVZbCqxRxOoKdHLmfJ64kjgg K7EbFipQoixJzVIGS0chycg8YXgeh11lX38EkTAfdF7TAYR4zgRoswogHle+ZG8W77gZjx5GHpoMq xFiDsojJKkK3j0VW7qEGB4a6lcxeVI/iXhsjWJBkAZCZVjGXroWbY9lOGV6JHOqM0kfRYPaWMBXln yWebKXX1Jl0AMkJEPMmhvTJnVSCKIOGmebBdYEm5tJvgI1oaHULRHREtPiPYqwrXzuafnDWUYXZ4E FqWowQyjGx8mYSsC2vzBQOc+ij5WGYRpkcgBPHaf9oqQEWbMwAeuke7ZiaLyptq6MpgICDCOOkLuU +2M9toTuQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSGW-0003Q3-3L; Mon, 19 Oct 2020 10:19:44 +0000 Received: from galois.linutronix.de ([193.142.43.55]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSF2-0002sV-Vv for linux-arm-kernel@lists.infradead.org; Mon, 19 Oct 2020 10:18:20 +0000 Message-Id: <20201019101110.439968251@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603102691; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=pZhgNRr9Q1w2yx0BNLRMw7Tg8cejJvtH8+Qmxb414dc=; b=Z04gypyjQuA3FHdF1W6R95FEPIsNDsh6O76OwYyiS7v0H2e+bS2GVB1prkgzic5Cj52ogb RwUOANP1CNTUU/9s54sw/aMJqefZcEbvTyc6Cx10XoQVy+dW5CBKwAw70DcF9S5crIJoWB 1CdSOBkmUhA4bLxvwOEH4BAxkLFw1xwxVkYNUzxwsuHhQIjfvG1BB6QvnLO2djVlt6FOks ji6R2xmiPKbsOnnVqVFUz+armRoKOGAlfYkR7pXl/r0r+xyOp6IG9kFjhE2Nl/Lllk268G pvk/hsnY9j/W1EUkE7zR/L8CJIk1pOwGt7H9/HK9B77/HQAcOEf2zy2iwA5f0Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603102691; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=pZhgNRr9Q1w2yx0BNLRMw7Tg8cejJvtH8+Qmxb414dc=; b=Z5dFPjXX8w9hCSdRSsg+sCd8X1Y35DrgCMy+1aehcPBP3jhDn8A56ieFgRKff9xvwJD2fX IzaKB93Zf5gurMDw== Date: Mon, 19 Oct 2020 12:06:37 +0200 From: Thomas Gleixner To: LKML Subject: [patch V2 08/13] usb: hosts: Remove in_interrupt() from comments References: <20201019100629.419020859@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201019_061813_309365_46118F73 X-CRM114-Status: GOOD ( 17.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , linux-samsung-soc@vger.kernel.org, Mathias Nyman , Peter Zijlstra , Greg Kroah-Hartman , Sebastian Andrzej Siewior , linux-usb@vger.kernel.org, Johan Hovold , Krzysztof Kozlowski , Valentina Manea , Thomas Winischhofer , Kukjin Kim , Alan Stern , Duncan Sands , "Ahmed S. Darwish" , linux-omap@vger.kernel.org, Shuah Khan , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ahmed S. Darwish The usage of in_interrupt() in drivers is phased out for various reasons. Various comments use !in_interrupt() to describe calling context for probe() and remove() functions. That's wrong because the calling context has to be preemptible task context, which is not what !in_interrupt() describes. Cleanup the comments. While at it add the missing kernel doc argument descriptors. Signed-off-by: Ahmed S. Darwish Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Acked-by: Krzysztof Kozlowski Cc: Alan Stern Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org Cc: linux-omap@vger.kernel.org Cc: Kukjin Kim Cc: linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org Acked-by: Alan Stern --- V2: Split out the static change and add a missing comment --- drivers/usb/host/ehci-fsl.c | 9 ++++----- drivers/usb/host/ehci-pmcmsp.c | 11 +++++++---- drivers/usb/host/ohci-at91.c | 11 ++++++++--- drivers/usb/host/ohci-omap.c | 9 ++++++--- drivers/usb/host/ohci-pxa27x.c | 11 ++++++----- drivers/usb/host/ohci-s3c2410.c | 12 ++++++------ 6 files changed, 37 insertions(+), 26 deletions(-) --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -39,10 +39,10 @@ static struct hc_driver __read_mostly fs /* * fsl_ehci_drv_probe - initialize FSL-based HCDs * @pdev: USB Host Controller being probed - * Context: !in_interrupt() * - * Allocates basic resources for this USB host controller. + * Context: task context, might sleep * + * Allocates basic resources for this USB host controller. */ static int fsl_ehci_drv_probe(struct platform_device *pdev) { @@ -684,12 +684,11 @@ static const struct ehci_driver_override /** * fsl_ehci_drv_remove - shutdown processing for FSL-based HCDs * @pdev: USB Host Controller being removed - * Context: !in_interrupt() * - * Reverses the effect of usb_hcd_fsl_probe(). + * Context: task context, might sleep * + * Reverses the effect of usb_hcd_fsl_probe(). */ - static int fsl_ehci_drv_remove(struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev); --- a/drivers/usb/host/ehci-pmcmsp.c +++ b/drivers/usb/host/ehci-pmcmsp.c @@ -147,12 +147,14 @@ static int usb_hcd_msp_map_regs(struct m /** * usb_hcd_msp_probe - initialize PMC MSP-based HCDs - * Context: !in_interrupt() + * @driver: Pointer to hc driver instance + * @dev: USB controller to probe + * + * Context: task context, might sleep * * Allocates basic resources for this USB host controller, and * then invokes the start() method for the HCD associated with it * through the hotplug entry's driver_data. - * */ int usb_hcd_msp_probe(const struct hc_driver *driver, struct platform_device *dev) @@ -223,8 +225,9 @@ int usb_hcd_msp_probe(const struct hc_dr /** * usb_hcd_msp_remove - shutdown processing for PMC MSP-based HCDs - * @dev: USB Host Controller being removed - * Context: !in_interrupt() + * @hcd: USB Host Controller being removed + * + * Context: task context, might sleep * * Reverses the effect of usb_hcd_msp_probe(), first invoking * the HCD's stop() method. It is always called from a thread --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -155,7 +155,10 @@ static struct regmap *at91_dt_syscon_sfr /* * usb_hcd_at91_probe - initialize AT91-based HCDs - * Context: !in_interrupt() + * @driver: Pointer to hc driver instance + * @pdev: USB controller to probe + * + * Context: task context, might sleep * * Allocates basic resources for this USB host controller, and * then invokes the start() method for the HCD associated with it @@ -246,12 +249,14 @@ static int usb_hcd_at91_probe(const stru /* * usb_hcd_at91_remove - shutdown processing for AT91-based HCDs - * Context: !in_interrupt() + * @hcd: USB controller to remove + * @pdev: Platform device required for cleanup + * + * Context: task context, might sleep * * Reverses the effect of usb_hcd_at91_probe(), first invoking * the HCD's stop() method. It is always called from a thread * context, "rmmod" or something similar. - * */ static void usb_hcd_at91_remove(struct usb_hcd *hcd, struct platform_device *pdev) --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c @@ -285,7 +285,9 @@ static int ohci_omap_reset(struct usb_hc /** * ohci_hcd_omap_probe - initialize OMAP-based HCDs - * Context: !in_interrupt() + * @pdev: USB controller to probe + * + * Context: task context, might sleep * * Allocates basic resources for this USB host controller, and * then invokes the start() method for the HCD associated with it @@ -399,8 +401,9 @@ static int ohci_hcd_omap_probe(struct pl /** * ohci_hcd_omap_remove - shutdown processing for OMAP-based HCDs - * @dev: USB Host Controller being removed - * Context: !in_interrupt() + * @pdev: USB Host Controller being removed + * + * Context: task context, might sleep * * Reverses the effect of ohci_hcd_omap_probe(), first invoking * the HCD's stop() method. It is always called from a thread --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -410,12 +410,13 @@ static int ohci_pxa_of_init(struct platf /** * ohci_hcd_pxa27x_probe - initialize pxa27x-based HCDs - * Context: !in_interrupt() + * @pdev: USB Host controller to probe + * + * Context: task context, might sleep * * Allocates basic resources for this USB host controller, and * then invokes the start() method for the HCD associated with it * through the hotplug entry's driver_data. - * */ static int ohci_hcd_pxa27x_probe(struct platform_device *pdev) { @@ -509,13 +510,13 @@ static int ohci_hcd_pxa27x_probe(struct /** * ohci_hcd_pxa27x_remove - shutdown processing for pxa27x-based HCDs - * @dev: USB Host Controller being removed - * Context: !in_interrupt() + * @pdev: USB Host Controller being removed + * + * Context: task context, might sleep * * Reverses the effect of ohci_hcd_pxa27x_probe(), first invoking * the HCD's stop() method. It is always called from a thread * context, normally "rmmod", "apmd", or something similar. - * */ static int ohci_hcd_pxa27x_remove(struct platform_device *pdev) { --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c @@ -324,14 +324,13 @@ static void s3c2410_hcd_oc(struct s3c241 /* * ohci_hcd_s3c2410_remove - shutdown processing for HCD * @dev: USB Host Controller being removed - * Context: !in_interrupt() + * + * Context: task context, might sleep * * Reverses the effect of ohci_hcd_3c2410_probe(), first invoking * the HCD's stop() method. It is always called from a thread * context, normally "rmmod", "apmd", or something similar. - * -*/ - + */ static int ohci_hcd_s3c2410_remove(struct platform_device *dev) { @@ -345,12 +344,13 @@ ohci_hcd_s3c2410_remove(struct platform_ /* * ohci_hcd_s3c2410_probe - initialize S3C2410-based HCDs - * Context: !in_interrupt() + * @dev: USB Host Controller to be probed + * + * Context: task context, might sleep * * Allocates basic resources for this USB host controller, and * then invokes the start() method for the HCD associated with it * through the hotplug entry's driver_data. - * */ static int ohci_hcd_s3c2410_probe(struct platform_device *dev) { From patchwork Mon Oct 19 10:06:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11844037 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16B11C433DF for ; Mon, 19 Oct 2020 10:21:43 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 925592225A for ; Mon, 19 Oct 2020 10:21:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="gdN8mUEb"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="rbjY26Bx"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="4vh7Lo9B" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 925592225A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From:Date: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=Hfsrmftv9usqwLnvmtWyo4kb2Ao/YAo2TOA1slmbxBs=; b=gdN8mUEbIaBS5xEITyeODDKVs 01RAYAekEoMf5Pg1KJ0g0hCCsqH0ZqsvStAQxsUP2P6prkm4dqaCbDTXScImGC1afk6sLB5wHlq8O ogolyW5TlwKMoQ7StK1w70A23MRBIuZSDaE8C91K3Ac0wJ5AGpyZ56EcHBZVMZuuiZD5cdy/bDyJb 8rOFmoz3H/TkXowzysDkMu4JdKVCjzZVi01qE5LYQu+wOd20Wp5R24QhPZ1r0+XqsPgCE89BFdb8A 2a8BEOGcQDGFQsb2GjmncQgCOaUMj/JFrR5D3vvhXgeqKslmNTywvGc4qke/Wx6yvST5dXdr+AtB0 Bpl3i4LMA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSGR-0003Nv-Tn; Mon, 19 Oct 2020 10:19:39 +0000 Received: from galois.linutronix.de ([193.142.43.55]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSF4-0002sn-1D for linux-arm-kernel@lists.infradead.org; Mon, 19 Oct 2020 10:18:19 +0000 Message-Id: <20201019101110.530302737@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603102693; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=nWQ+SrVLGuCyqRY5y8h3ERmOFe6RATVvmET6IvFN3Gk=; b=rbjY26BxpHFf5pzKY+W8poVw7dZ2luD/gEIhZFETiCcscy2I5JgMVc1SJxswsS2Vc6ncDT BacorRP7QKkKVsyP90S71atCfoj98+ppfff1konuUtSK9Y+IJHJ+SMp2tuXfrosTNlgz84 1c6TFj8Cu00la077WbK8RqAaweudQrh7S/DsRRPpcYx38lXmyjgWk7d+tZkjhUKpEL7Sdm ud+vGbc3kXXBnWxWtr1o/2QnFYt44e4osSsF/ydBO1wh1x1NMK1WgYPLr14F5jcRRIL8kU MznHHoiKyBEUSIziBvdVa+1hTF2hwu523STZiNWRWFWMOTF8XYnc77DhqreQHA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603102693; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=nWQ+SrVLGuCyqRY5y8h3ERmOFe6RATVvmET6IvFN3Gk=; b=4vh7Lo9BkFB9fjwdOV4BwIUadEs9cadEn44DOG7XZjGP0v7KkIrxqJrqOpicdvBYbJct+V Ef9gTvWk6oETzYDA== Date: Mon, 19 Oct 2020 12:06:38 +0200 From: Thomas Gleixner To: LKML Subject: [patch V2 09/13] USB: host: ehci-pmcmsp: Cleanup usb_hcd_msp_remove() References: <20201019100629.419020859@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201019_061814_239465_A5AE381F X-CRM114-Status: GOOD ( 12.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , linux-usb@vger.kernel.org, Mathias Nyman , Peter Zijlstra , Greg Kroah-Hartman , Sebastian Andrzej Siewior , Thomas Winischhofer , Johan Hovold , Krzysztof Kozlowski , Valentina Manea , linux-samsung-soc@vger.kernel.org, Kukjin Kim , Alan Stern , Duncan Sands , "Ahmed S. Darwish" , linux-omap@vger.kernel.org, Shuah Khan , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org usb_hcd_msp_remove() has a pdev argument which isn't used and the function is used only within this file. Remove pdev and make usb_hcd_msp_remove() static. Signed-off-by: Thomas Gleixner Acked-by: Alan Stern --- V2: Split out from comments patch --- drivers/usb/host/ehci-pmcmsp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/usb/host/ehci-pmcmsp.c +++ b/drivers/usb/host/ehci-pmcmsp.c @@ -236,7 +236,7 @@ int usb_hcd_msp_probe(const struct hc_dr * may be called without controller electrically present * may be called with controller, bus, and devices active */ -void usb_hcd_msp_remove(struct usb_hcd *hcd, struct platform_device *dev) +static void usb_hcd_msp_remove(struct usb_hcd *hcd) { usb_remove_hcd(hcd); iounmap(hcd->regs); @@ -309,7 +309,7 @@ static int ehci_hcd_msp_drv_remove(struc { struct usb_hcd *hcd = platform_get_drvdata(pdev); - usb_hcd_msp_remove(hcd, pdev); + usb_hcd_msp_remove(hcd); /* free TWI GPIO USB_HOST_DEV pin */ gpio_free(MSP_PIN_USB0_HOST_DEV); From patchwork Mon Oct 19 10:06:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11844041 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B29BDC433DF for ; Mon, 19 Oct 2020 10:21:57 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 371EC2225A for ; Mon, 19 Oct 2020 10:21:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UjRmXbha"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="p8UkPoox"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="RM95XFhj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 371EC2225A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From:Date: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=FSK+4CgvEh1LYqTAcsncnj7fO5r8djuMWKWcR7mLA8c=; b=UjRmXbhai0w/89RG2XuYPFMCf MdUyFZVZY6tYQJk7rKquZ7nPGI8eDDUGxnQRV8sU345a/HdYzWozfpAvZ+qT9hEPYANeiUOYAmM/N DhsUQMhIpF8LD/wIdvTJ7smr6FUZAY0m2vcwkW/UrY7+R0HECtaJFWeKP2AS7pGLv6npgdCc7wxUC lC3bVEcVWfYFySPB7yP7Dhg2IbDnE+E4adhh0/5tTeU4pRwLC77DAzFSlfrP/p1tB8z8aYwfhFKS8 doO0V+L5SxsYoytCL52S1KCuNqs3L2zp/whwKC+YtgkucYVNLATo+QFu3vpSkpMY26RFhgeJHh1KF QBJ80ZFyw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSGc-0003Tc-Ld; Mon, 19 Oct 2020 10:19:50 +0000 Received: from galois.linutronix.de ([193.142.43.55]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSF5-0002tu-Bz for linux-arm-kernel@lists.infradead.org; Mon, 19 Oct 2020 10:18:22 +0000 Message-Id: <20201019101110.636378243@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603102694; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=QjhDGznDGGQ2d/1GfncBm9+kw9614xiY5DXcI3ixa0U=; b=p8UkPooxLJi1acfHyNNh4XfSIz1Xjnz5b8cZ8R7DDqO1ZtkNFnOYHOMuntMZfQihEDkP61 NubctIQ5U5H0AjjYLYvsrLAlIfU5h86Ql8ww5RaE8tX5hy6V7s2j/xoJ6RWHMnf7o3cvY+ dtpmoTe5VrSVv+6JvB8p9U33Gr+Cj/9ItAxG26yc4vP5yO1K2qOMeGcEs5zVRvq22PEGM6 AACPCV7RvEtzZ2kcEevaH5ING929wSseTxJPRlsaIGo3r0EU81F7xxhSKGSqSo6DdEPt0l fAnDt9Dp8JELsfH/Y856HU/CzJx3AHSsvUAQu4WNKFxkM/+Y+zMJjB0YvNIQiA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603102694; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=QjhDGznDGGQ2d/1GfncBm9+kw9614xiY5DXcI3ixa0U=; b=RM95XFhjmTjUwdZrMP/uEIvuoKTORGQtX+ag/YPIKu7hGtHm0kY45CMw4u73ekeFyjLCJN R6tpCvj4/9L0ahCw== Date: Mon, 19 Oct 2020 12:06:39 +0200 From: Thomas Gleixner To: LKML Subject: [patch V2 10/13] usb: gadget: pxa27x_udc: Replace in_interrupt() usage in comments References: <20201019100629.419020859@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201019_061815_725377_BD371EAF X-CRM114-Status: GOOD ( 15.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Thomas Winischhofer , Mathias Nyman , Peter Zijlstra , Greg Kroah-Hartman , Sebastian Andrzej Siewior , linux-usb@vger.kernel.org, Johan Hovold , Krzysztof Kozlowski , Valentina Manea , linux-samsung-soc@vger.kernel.org, Kukjin Kim , Alan Stern , Duncan Sands , "Ahmed S. Darwish" , linux-omap@vger.kernel.org, Shuah Khan , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ahmed S. Darwish The usage of in_interrupt() in drivers is phased out for various reasons. Documenting calling contexts of functions with 'in_interrupt()' or '!in_interrupt()' is imprecise: For a function which might sleep the condition is preemptible task context, which is not what '!in_interrupt()' describes. Replace the context docummentation with plain text and make them match reality. Signed-off-by: Ahmed S. Darwish Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org Cc: linux-usb@vger.kernel.org --- drivers/usb/gadget/udc/pxa27x_udc.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) --- a/drivers/usb/gadget/udc/pxa27x_udc.c +++ b/drivers/usb/gadget/udc/pxa27x_udc.c @@ -304,7 +304,7 @@ static struct pxa_ep *find_pxa_ep(struct * update_pxa_ep_matches - update pxa_ep cached values in all udc_usb_ep * @udc: pxa udc * - * Context: in_interrupt() + * Context: interrupt handler * * Updates all pxa_ep fields in udc_usb_ep structures, if this field was * previously set up (and is not NULL). The update is necessary is a @@ -859,7 +859,7 @@ static int write_packet(struct pxa_ep *e * @ep: pxa physical endpoint * @req: usb request * - * Context: callable when in_interrupt() + * Context: interrupt handler * * Unload as many packets as possible from the fifo we use for usb OUT * transfers and put them into the request. Caller should have made sure @@ -997,7 +997,7 @@ static int read_ep0_fifo(struct pxa_ep * * @ep: control endpoint * @req: request * - * Context: callable when in_interrupt() + * Context: interrupt handler * * Sends a request (or a part of the request) to the control endpoint (ep0 in). * If the request doesn't fit, the remaining part will be sent from irq. @@ -1036,8 +1036,8 @@ static int write_ep0_fifo(struct pxa_ep * @_req: usb request * @gfp_flags: flags * - * Context: normally called when !in_interrupt, but callable when in_interrupt() - * in the special case of ep0 setup : + * Context: thread context or from the interrupt handler in the + * special case of ep0 setup : * (irq->handle_ep0_ctrl_req->gadget_setup->pxa_ep_queue) * * Returns 0 if succedeed, error otherwise @@ -1512,7 +1512,8 @@ static int should_disable_udc(struct pxa * pxa_udc_pullup - Offer manual D+ pullup control * @_gadget: usb gadget using the control * @is_active: 0 if disconnect, else connect D+ pullup resistor - * Context: !in_interrupt() + * + * Context: task context, might sleep * * Returns 0 if OK, -EOPNOTSUPP if udc driver doesn't handle D+ pullup */ @@ -1560,7 +1561,7 @@ static int pxa_udc_vbus_session(struct u * @_gadget: usb gadget * @mA: current drawn * - * Context: !in_interrupt() + * Context: task context, might sleep * * Called after a configuration was chosen by a USB host, to inform how much * current can be drawn by the device from VBus line. @@ -1886,7 +1887,7 @@ static void handle_ep0_ctrl_req(struct p * @fifo_irq: 1 if triggered by fifo service type irq * @opc_irq: 1 if triggered by output packet complete type irq * - * Context : when in_interrupt() or with ep->lock held + * Context : interrupt handler * * Tries to transfer all pending request data into the endpoint and/or * transfer all pending data in the endpoint into usb requests. @@ -2011,7 +2012,7 @@ static void handle_ep0(struct pxa_udc *u * Tries to transfer all pending request data into the endpoint and/or * transfer all pending data in the endpoint into usb requests. * - * Is always called when in_interrupt() and with ep->lock released. + * Is always called from the interrupt handler. ep->lock must not be held. */ static void handle_ep(struct pxa_ep *ep) { From patchwork Mon Oct 19 10:06:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11844043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0E9FC433DF for ; Mon, 19 Oct 2020 10:22:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6754A2225A for ; Mon, 19 Oct 2020 10:22:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Q3UWrlUh"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="JKowC+xz"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="u21yGgK+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6754A2225A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From:Date: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=HSwwEf0nnAi8uMrS3PFNO2l1/VlVnLgch427I6gmmgQ=; b=Q3UWrlUhj00Zk721/x1ZEBuyI PUV0YzNO8ca1H8cubv1CufyC3gfj0zENMvFsB3H/OHkb7xghCKNhg4YA/exsPzblainwZpIZVuQUk eZSX5okvgzfrdlhprZoNA3CRFfsVgCLpWmkI/+8TytGdfreUFtgHBFMU1FFoKXo3eSqHfvCHsrhsp QRNgOeVojLibSWizv6nyu+i/63i1lSgHs3ptCZ1ToN+BFClb01FqQoOnF84ohcdqvHiGVIh06V3lM Gjh2uosrssoyey537ZxhlMbpTEvwdFkCsMo96UXTSriyIV6LJm3iJZisuGYT78wBOSdHYsQYJSFDC EboeTLp1Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSGi-0003XL-MF; Mon, 19 Oct 2020 10:19:56 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSF6-0002um-La for linux-arm-kernel@lists.infradead.org; Mon, 19 Oct 2020 10:18:24 +0000 Message-Id: <20201019101110.744172050@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603102695; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=eU49tVESfPvybwx3L3Wh92XZvOJJ4zNGI0TkIeEUK1M=; b=JKowC+xz19F02CLEO24JMjrb4u0kEcj+L8t99YbWx+w5UvTUx/WsjiX23lHjEfawj8L1Ai MebzdHR9mnykV00sB05zLHuFW9/4veKDWkEkx9kzZPaz81vDGOIp1dnbjmBKpzlDo41RK0 rQdw6sMqR+l6kv313t8o5e9e2W0tlqh29gMfTPAV5RD0WA3MqD1E52hA7tRObbfCZaZpE8 2ZgdvQBM34e+Fvm3kh6wMfPTvxKazGLl/OF84W+pbbvB5RGCNTfqUorwbmPTrODOLv6ovg U6DgzsG6ChAVATvkmPznkzqWwgVurjR4EtKfILDpR9kGCbSd4sv/8wgcljhzSw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603102695; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=eU49tVESfPvybwx3L3Wh92XZvOJJ4zNGI0TkIeEUK1M=; b=u21yGgK+RD0O07+cg6Izujgy+wcxtgbrdd1zA0ikisQUXWnsPqdAxfppXCH+m5pMKOnvD+ vbuZ3HsJP3oH0yCA== Date: Mon, 19 Oct 2020 12:06:40 +0200 From: Thomas Gleixner To: LKML Subject: [patch V2 11/13] usb: gadget: udc: Remove in_interrupt()/in_irq() from comments References: <20201019100629.419020859@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201019_061816_863372_E6166F75 X-CRM114-Status: GOOD ( 12.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Thomas Winischhofer , Mathias Nyman , Peter Zijlstra , Greg Kroah-Hartman , Sebastian Andrzej Siewior , linux-usb@vger.kernel.org, Johan Hovold , Krzysztof Kozlowski , Valentina Manea , linux-samsung-soc@vger.kernel.org, Kukjin Kim , Alan Stern , Duncan Sands , "Ahmed S. Darwish" , linux-omap@vger.kernel.org, Shuah Khan , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ahmed S. Darwish The usage of in_irq()/in_interrupt() in drivers is phased out for various reasons. The context description for usb_gadget_giveback_request() is misleading as in_interupt() means: hard interrupt or soft interrupt or bottom half disabled regions. But it's also invoked from task context when endpoints are torn down. Remove it as it's more confusing than helpful. Replace also the in_irq() comment with plain text. Signed-off-by: Ahmed S. Darwish Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org Acked-by: Alan Stern --- drivers/usb/gadget/udc/core.c | 2 -- drivers/usb/gadget/udc/dummy_hcd.c | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -894,8 +894,6 @@ EXPORT_SYMBOL_GPL(usb_gadget_unmap_reque * @ep: the endpoint to be used with with the request * @req: the request being given back * - * Context: in_interrupt() - * * This is called by device controller drivers in order to return the * completed request back to the gadget layer. */ --- a/drivers/usb/gadget/udc/dummy_hcd.c +++ b/drivers/usb/gadget/udc/dummy_hcd.c @@ -1754,8 +1754,10 @@ static int handle_control_request(struct return ret_val; } -/* drive both sides of the transfers; looks like irq handlers to - * both drivers except the callbacks aren't in_irq(). +/* + * Drive both sides of the transfers; looks like irq handlers to both + * drivers except that the callbacks are invoked from soft interrupt + * context. */ static void dummy_timer(struct timer_list *t) { From patchwork Mon Oct 19 10:06:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11844047 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5111CC433E7 for ; Mon, 19 Oct 2020 10:23:04 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B7F0D22276 for ; Mon, 19 Oct 2020 10:23:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ks1DdGzB"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="id4u0jOm"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="AUtXDL7C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B7F0D22276 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From:Date: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=O8+UELt2nW0kOHTfb0UEoXpVTlgygHLPWtv5dLgXB3c=; b=ks1DdGzBX7f0B6I6cb4Puc7TT Ld68+8V09bAre8Z850Me8UR5VIhSaSM3ELjGrZBiwttQtrJ91Zq6TDOIQWlPHbTvbDTalViHpu1V6 hCUoJrJwNRVBip49tysFKmp6noR/7vlr9dTMWkJMDScSfxGMW+VOsNraJotjBWmE5RtqcxJyyFtMI zHGdtjGweZP6cWc/Boe28iTbcyp+RmNIsBa/hLhlUzFrShNkcOkF/r9XvKom3Zfp1x7AVnLbPbRiP RVT7oRcpMEYAG5yY4B/YJTCWZc/n4XvwEaQeBltmTaThro7jFN8Ia5aHUhwsn8/A2sHDcuHJqyiBo +zUwgOgww==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSHz-0004At-U1; Mon, 19 Oct 2020 10:21:15 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSF7-0002vO-Li for linux-arm-kernel@lists.infradead.org; Mon, 19 Oct 2020 10:18:29 +0000 Message-Id: <20201019101110.851821025@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603102696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=vDj3POLlE65OYJ5MWA23dfiuTv+9arU7n7S2hfU4NfM=; b=id4u0jOm7ZnFZD2vWTPwwiFPGCHHN0GNhGdEZGVx3mKjZ78wHR9BB1WcYhQvY4wuaOHe0d IaGEmf5zUGLMbJ+lqw50JUHZ4wjpugWf2UxjtIt97K51AGi8Z7oX9l5iFFjE4WmMCxbn/F dXDx1MEcEpn/zcMmfQMfUEYEKZsAM1Qp0rgZwmuhWTvrBiwa2kZwmmz4OmvIMmdOo/gsU9 hMbokbnrNeuQEV+gEKhHXnxRQNIQKdR9xlPU0B5LpWKYyIMUmMYcm/S69baXmUdd/hhjIQ 1+eJkESSzV4Wv3FLrZepxjcPUikJg90RIGgFOJqW7qL7kLGVzFBVuOsV195Xog== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603102696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=vDj3POLlE65OYJ5MWA23dfiuTv+9arU7n7S2hfU4NfM=; b=AUtXDL7CKtW36iHy6ghf3uYZxa9oFrkz7w4h1RAt9fxXZRoZlYabnFk2gaM+zHCVdQkLzF EWPT9MGs1ENYR6DQ== Date: Mon, 19 Oct 2020 12:06:41 +0200 From: Thomas Gleixner To: LKML Subject: [patch V2 12/13] usb: core: Replace in_interrupt() in comments References: <20201019100629.419020859@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201019_061817_972447_EF5E819F X-CRM114-Status: GOOD ( 28.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Thomas Winischhofer , Mathias Nyman , Peter Zijlstra , Greg Kroah-Hartman , Sebastian Andrzej Siewior , linux-usb@vger.kernel.org, Johan Hovold , Krzysztof Kozlowski , Valentina Manea , linux-samsung-soc@vger.kernel.org, Kukjin Kim , Alan Stern , Duncan Sands , "Ahmed S. Darwish" , linux-omap@vger.kernel.org, Shuah Khan , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ahmed S. Darwish The usage of in_interrupt() in drivers is phased out for various reasons. Various comments use !in_interrupt() to describe calling context for functions which might sleep. That's wrong because the calling context has to be preemptible task context, which is not what !in_interrupt() describes. Replace !in_interrupt() with more accurate plain text descriptions. The comment for usb_hcd_poll_rh_status() is misleading as this function is called from all kinds of contexts including preemptible task context. Remove it as there is obviously no restriction. Signed-off-by: Ahmed S. Darwish Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org Acked-by: Alan Stern --- V2: Fixup the comments according to review (Alan) --- drivers/usb/core/buffer.c | 6 ++++-- drivers/usb/core/hcd-pci.c | 6 ++++-- drivers/usb/core/hcd.c | 26 +++++++++++++++++--------- drivers/usb/core/hub.c | 3 ++- drivers/usb/core/message.c | 35 ++++++++++++++++++++++------------- drivers/usb/core/usb.c | 4 ++-- 6 files changed, 51 insertions(+), 29 deletions(-) --- a/drivers/usb/core/buffer.c +++ b/drivers/usb/core/buffer.c @@ -51,7 +51,8 @@ void __init usb_init_pool_max(void) /** * hcd_buffer_create - initialize buffer pools * @hcd: the bus whose buffer pools are to be initialized - * Context: !in_interrupt() + * + * Context: task context, might sleep * * Call this as part of initializing a host controller that uses the dma * memory allocators. It initializes some pools of dma-coherent memory that @@ -88,7 +89,8 @@ int hcd_buffer_create(struct usb_hcd *hc /** * hcd_buffer_destroy - deallocate buffer pools * @hcd: the bus whose buffer pools are to be destroyed - * Context: !in_interrupt() + * + * Context: task context, might sleep * * This frees the buffer pools created by hcd_buffer_create(). */ --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -160,7 +160,8 @@ static void ehci_wait_for_companions(str * @dev: USB Host Controller being probed * @id: pci hotplug id connecting controller to HCD framework * @driver: USB HC driver handle - * Context: !in_interrupt() + * + * Context: task context, might sleep * * Allocates basic PCI resources for this USB host controller, and * then invokes the start() method for the HCD associated with it @@ -304,7 +305,8 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_probe); /** * usb_hcd_pci_remove - shutdown processing for PCI-based HCDs * @dev: USB Host Controller being removed - * Context: !in_interrupt() + * + * Context: task context, might sleep * * Reverses the effect of usb_hcd_pci_probe(), first invoking * the HCD's stop() method. It is always called from a thread --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -747,8 +747,7 @@ static int rh_call_control (struct usb_h * driver requests it; otherwise the driver is responsible for * calling usb_hcd_poll_rh_status() when an event occurs. * - * Completions are called in_interrupt(), but they may or may not - * be in_irq(). + * Completion handler may not sleep. See usb_hcd_giveback_urb() for details. */ void usb_hcd_poll_rh_status(struct usb_hcd *hcd) { @@ -904,7 +903,8 @@ static void usb_bus_init (struct usb_bus /** * usb_register_bus - registers the USB host controller with the usb core * @bus: pointer to the bus to register - * Context: !in_interrupt() + * + * Context: task context, might sleep. * * Assigns a bus number, and links the controller into usbcore data * structures so that it can be seen by scanning the bus list. @@ -939,7 +939,8 @@ static int usb_register_bus(struct usb_b /** * usb_deregister_bus - deregisters the USB host controller * @bus: pointer to the bus to deregister - * Context: !in_interrupt() + * + * Context: task context, might sleep. * * Recycles the bus number, and unlinks the controller from usbcore data * structures so that it won't be seen by scanning the bus list. @@ -1691,7 +1692,11 @@ static void usb_giveback_urb_bh(unsigned * @hcd: host controller returning the URB * @urb: urb being returned to the USB device driver. * @status: completion status code for the URB. - * Context: in_interrupt() + * + * Context: atomic. The completion callback is invoked in caller's context. + * For HCDs with HCD_BH flag set, the completion callback is invoked in tasklet + * context (except for URBs submitted to the root hub which always complete in + * caller's context). * * This hands the URB from HCD to its USB device driver, using its * completion function. The HCD has freed all per-urb resources @@ -2268,7 +2273,7 @@ EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hu * usb_bus_start_enum - start immediate enumeration (for OTG) * @bus: the bus (must use hcd framework) * @port_num: 1-based number of port; usually bus->otg_port - * Context: in_interrupt() + * Context: atomic * * Starts enumeration, with an immediate reset followed later by * hub_wq identifying and possibly configuring the device. @@ -2474,7 +2479,8 @@ EXPORT_SYMBOL_GPL(__usb_create_hcd); * @bus_name: value to store in hcd->self.bus_name * @primary_hcd: a pointer to the usb_hcd structure that is sharing the * PCI device. Only allocate certain resources for the primary HCD - * Context: !in_interrupt() + * + * Context: task context, might sleep. * * Allocate a struct usb_hcd, with extra space at the end for the * HC driver's private data. Initialize the generic members of the @@ -2496,7 +2502,8 @@ EXPORT_SYMBOL_GPL(usb_create_shared_hcd) * @driver: HC driver that will use this hcd * @dev: device for this HC, stored in hcd->self.controller * @bus_name: value to store in hcd->self.bus_name - * Context: !in_interrupt() + * + * Context: task context, might sleep. * * Allocate a struct usb_hcd, with extra space at the end for the * HC driver's private data. Initialize the generic members of the @@ -2830,7 +2837,8 @@ EXPORT_SYMBOL_GPL(usb_add_hcd); /** * usb_remove_hcd - shutdown processing for generic HCDs * @hcd: the usb_hcd structure to remove - * Context: !in_interrupt() + * + * Context: task context, might sleep. * * Disconnects the root hub, then reverses the effects of usb_add_hcd(), * invoking the HCD's stop() method. --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -2171,7 +2171,8 @@ static void hub_disconnect_children(stru /** * usb_disconnect - disconnect a device (usbcore-internal) * @pdev: pointer to device being disconnected - * Context: !in_interrupt () + * + * Context: task context, might sleep * * Something got disconnected. Get rid of it and all of its children. * --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -119,7 +119,7 @@ static int usb_internal_control_msg(stru * @timeout: time in msecs to wait for the message to complete before timing * out (if 0 the wait is forever) * - * Context: !in_interrupt () + * Context: task context, might sleep. * * This function sends a simple control message to a specified endpoint and * waits for the message to complete, or timeout. @@ -173,7 +173,7 @@ EXPORT_SYMBOL_GPL(usb_control_msg); * @timeout: time in msecs to wait for the message to complete before * timing out (if 0 the wait is forever) * - * Context: !in_interrupt () + * Context: task context, might sleep. * * This function sends a simple interrupt message to a specified endpoint and * waits for the message to complete, or timeout. @@ -206,7 +206,7 @@ EXPORT_SYMBOL_GPL(usb_interrupt_msg); * @timeout: time in msecs to wait for the message to complete before * timing out (if 0 the wait is forever) * - * Context: !in_interrupt () + * Context: task context, might sleep. * * This function sends a simple bulk message to a specified endpoint * and waits for the message to complete, or timeout. @@ -473,7 +473,8 @@ EXPORT_SYMBOL_GPL(usb_sg_init); * usb_sg_wait - synchronously execute scatter/gather request * @io: request block handle, as initialized with usb_sg_init(). * some fields become accessible when this call returns. - * Context: !in_interrupt () + * + * Context: task context, might sleep. * * This function blocks until the specified I/O operation completes. It * leverages the grouping of the related I/O requests to get good transfer @@ -627,7 +628,8 @@ EXPORT_SYMBOL_GPL(usb_sg_cancel); * @index: the number of the descriptor * @buf: where to put the descriptor * @size: how big is "buf"? - * Context: !in_interrupt () + * + * Context: task context, might sleep. * * Gets a USB descriptor. Convenience functions exist to simplify * getting some types of descriptors. Use @@ -675,7 +677,8 @@ EXPORT_SYMBOL_GPL(usb_get_descriptor); * @index: the number of the descriptor * @buf: where to put the string * @size: how big is "buf"? - * Context: !in_interrupt () + * + * Context: task context, might sleep. * * Retrieves a string, encoded using UTF-16LE (Unicode, 16 bits per character, * in little-endian byte order). @@ -810,7 +813,8 @@ static int usb_get_langid(struct usb_dev * @index: the number of the descriptor * @buf: where to put the string * @size: how big is "buf"? - * Context: !in_interrupt () + * + * Context: task context, might sleep. * * This converts the UTF-16LE encoded strings returned by devices, from * usb_get_string_descriptor(), to null-terminated UTF-8 encoded ones @@ -899,7 +903,8 @@ char *usb_cache_string(struct usb_device * usb_get_device_descriptor - (re)reads the device descriptor (usbcore) * @dev: the device whose device descriptor is being updated * @size: how much of the descriptor to read - * Context: !in_interrupt () + * + * Context: task context, might sleep. * * Updates the copy of the device descriptor stored in the device structure, * which dedicates space for this purpose. @@ -934,7 +939,7 @@ int usb_get_device_descriptor(struct usb /* * usb_set_isoch_delay - informs the device of the packet transmit delay * @dev: the device whose delay is to be informed - * Context: !in_interrupt() + * Context: task context, might sleep * * Since this is an optional request, we don't bother if it fails. */ @@ -962,7 +967,8 @@ int usb_set_isoch_delay(struct usb_devic * @type: USB_STATUS_TYPE_*; for standard or PTM status types * @target: zero (for device), else interface or endpoint number * @data: pointer to two bytes of bitmap data - * Context: !in_interrupt () + * + * Context: task context, might sleep. * * Returns device, interface, or endpoint status. Normally only of * interest to see if the device is self powered, or has enabled the @@ -1039,7 +1045,8 @@ EXPORT_SYMBOL_GPL(usb_get_status); * usb_clear_halt - tells device to clear endpoint halt/stall condition * @dev: device whose endpoint is halted * @pipe: endpoint "pipe" being cleared - * Context: !in_interrupt () + * + * Context: task context, might sleep. * * This is used to clear halt conditions for bulk and interrupt endpoints, * as reported by URB completion status. Endpoints that are halted are @@ -1343,7 +1350,8 @@ void usb_enable_interface(struct usb_dev * @dev: the device whose interface is being updated * @interface: the interface being updated * @alternate: the setting being chosen. - * Context: !in_interrupt () + * + * Context: task context, might sleep. * * This is used to enable data transfers on interfaces that may not * be enabled by default. Not all devices support such configurability. @@ -1762,7 +1770,8 @@ static void __usb_queue_reset_device(str * usb_set_configuration - Makes a particular device setting be current * @dev: the device whose configuration is being updated * @configuration: the configuration being chosen. - * Context: !in_interrupt(), caller owns the device lock + * + * Context: task context, might sleep. Caller holds device lock. * * This is used to enable non-default device modes. Not all devices * use this kind of configurability; many devices only have one --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -28,7 +28,6 @@ #include #include #include -#include /* for in_interrupt() */ #include #include #include @@ -561,7 +560,8 @@ static bool usb_dev_authorized(struct us * @parent: hub to which device is connected; null to allocate a root hub * @bus: bus used to access the device * @port1: one-based index of port; ignored for root hubs - * Context: !in_interrupt() + * + * Context: task context, might sleep. * * Only hub drivers (including virtual root hub drivers for host * controllers) should ever call this. From patchwork Mon Oct 19 10:06:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 11844045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 773C0C433E7 for ; Mon, 19 Oct 2020 10:22:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F3CD62225A for ; Mon, 19 Oct 2020 10:22:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0me/FU/9"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="4lpNzGZt"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="L1BAx4Oy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3CD62225A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From:Date: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=9PoMNUGtjFmavZ4myHb7BSw18UD3P/vtdzBINg3qm1E=; b=0me/FU/9q2lRGH9hku/2woaqk kOQnMCyG8n2OXQIINtcvz6MykDTG80u9OsBIGYnB2DHjCUCGp1mHDhHaPDiOevoUGNuG+DLoh78vm Q3VQ7OtSpRlmphgG+OiN0hwN/lz9Bxol1Q9c8pzbQ/ILpeHi7v1qgKU97nlGatc2s/NnzUx1yZ0VE K08xtRHYJ94Zustgb7evrQ/MGyUrYkKi8pOIfN2uluF3e+NYqL3jAUsMsXsnPYP99BEH95PbjQzH5 KYXj8wW7JEdlWCJY+x5LtImT0f7DwLvgVegzbWU97GdjEtS3yRJQV867ZtYKCnWeireDEb5OF/qrD F7za5b7ag==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSHh-0003vd-F7; Mon, 19 Oct 2020 10:20:57 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUSF8-0002vs-Pq for linux-arm-kernel@lists.infradead.org; Mon, 19 Oct 2020 10:18:27 +0000 Message-Id: <20201019101110.944939915@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603102697; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=CglHTuol1LH6Rq9Arw6I3q0kZXSSc/D44FpLqZfI5WA=; b=4lpNzGZte+JbLXJ83VGLllmO8p7ZgJPUbn2pEj3AWBlV6Kr6kMkordF9yNYiD+J0YfMNXF WrlseHROLQU+l/lbqigi2qTk9VAJ5y929pArYCx8cDTQAbouSa8PoPonAE8JjMfp1PBvEa chWrp8n1QbIhLVdUVFfL5aSRuMaJZJS8TTFH9PSpLmIHnfKarImStpf087juZuVGvW9vpy d8B+uITbEjquNSdDef0bc5zON2rSBuX0oqlrKnMDzU69dISQhvYlJeHwTtqk2u140cDa/H 3fgsgfkIGUmNcjOiSHyfjChDmTDZqoKfiozdWtZ8cgBRXPi6/SvEdu54WiqWbQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603102697; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=CglHTuol1LH6Rq9Arw6I3q0kZXSSc/D44FpLqZfI5WA=; b=L1BAx4OybAp6bDVli4bT4V41G4OGiBnmrb1bmCjWXg2vrs6Qc4FM9XNkkoVzYxoojOoBkj 1uEPNEpJBDmssyCw== Date: Mon, 19 Oct 2020 12:06:42 +0200 From: Thomas Gleixner To: LKML Subject: [patch V2 13/13] usb: atm: Replace in_interrupt() usage in comment References: <20201019100629.419020859@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201019_061819_058612_4A2DCB1F X-CRM114-Status: GOOD ( 13.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Thomas Winischhofer , Mathias Nyman , Peter Zijlstra , Greg Kroah-Hartman , Sebastian Andrzej Siewior , linux-usb@vger.kernel.org, Johan Hovold , Krzysztof Kozlowski , Valentina Manea , linux-samsung-soc@vger.kernel.org, Kukjin Kim , Alan Stern , Duncan Sands , "Ahmed S. Darwish" , linux-omap@vger.kernel.org, Shuah Khan , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org in_interrupt() is a pretty vague context description as it means: hard interrupt, soft interrupt or bottom half disabled regions. Replace the vague comment with a proper reasoning why spin_lock_irqsave() needs to be used. Signed-off-by: Ahmed S. Darwish Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Cc: Duncan Sands Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org Signed-off-by: Duncan Sands --- drivers/usb/atm/usbatm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c @@ -249,7 +249,7 @@ static void usbatm_complete(struct urb * /* vdbg("%s: urb 0x%p, status %d, actual_length %d", __func__, urb, status, urb->actual_length); */ - /* usually in_interrupt(), but not always */ + /* Can be invoked from task context, protect against interrupts */ spin_lock_irqsave(&channel->lock, flags); /* must add to the back when receiving; doesn't matter when sending */