From patchwork Tue Sep 29 20:25:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 259898 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.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 14C24C55166 for ; Tue, 29 Sep 2020 20:40:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B9D42206B5 for ; Tue, 29 Sep 2020 20:40:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ygGWo2pd"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="GL+HPAY/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730199AbgI2Ukq (ORCPT ); Tue, 29 Sep 2020 16:40:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729295AbgI2Ufo (ORCPT ); Tue, 29 Sep 2020 16:35:44 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8D6AC0613D0; Tue, 29 Sep 2020 13:35:44 -0700 (PDT) Message-Id: <20200929203459.868970918@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1601411743; 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=AS1ZWbd5j+0/hCYbIZhY/JE+IutzJSfGLOpp28YBBig=; b=ygGWo2pdfir7qDPK1e2kUnQc+7bNFcaKkPRyQIwZqh0hU9fhP2LpLZZ94RsBEdcJp3dqGf fhjKniHfQmW1i/6Hf3s2krwxZlqsOYkmsRXSvq4OfGO0QdqqCA+9aSis60+H9KoKX2bX29 /QOr7UAGJJE1Ah+ZS+hQ7PXlGs18DiT9vmwi8txtLrtbS75Hs5SrNqKcKRRyX5SWQNP60s q1XK8abAp2RPiCVHSibAn8bUG2bE+qp/KWkjhjvIoE9l7Uvz5Sh6/t28A2nTK2Pjb3J5oM MHgWerc1wd4gjdfk1CXutmLAYNxxX6BoP6XHcBjwq0LhsW/+8gm/0An1+Pp3IQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1601411743; 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=AS1ZWbd5j+0/hCYbIZhY/JE+IutzJSfGLOpp28YBBig=; b=GL+HPAY/AW2UtlqVOo/4HOHWBUAdf47RXLQpvs61rL0Ab5me01y9HTgbPdkzwZVtHlzMa1 JK2bUj1GWaqnruBQ== Date: Tue, 29 Sep 2020 22:25:13 +0200 From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Paul McKenney , Matthew Wilcox , Christian Benvenuti , Govindarajulu Varadarajan <_govind@gmx.com>, Dave Miller , Jakub Kicinski , netdev@vger.kernel.org, Jonathan Corbet , Mauro Carvalho Chehab , linux-doc@vger.kernel.org, Sebastian Andrzej Siewior , Luc Van Oostenryck , Jay Cliburn , Chris Snook , Vishal Kulkarni , Jeff Kirsher , intel-wired-lan@lists.osuosl.org, Shannon Nelson , Pensando Drivers , Andrew Lunn , Heiner Kallweit , Russell King , Thomas Bogendoerfer , Solarflare linux maintainers , Edward Cree , Martin Habets , Jon Mason , Daniel Drake , Ulrich Kunitz , Kalle Valo , linux-wireless@vger.kernel.org, linux-usb@vger.kernel.org, Greg Kroah-Hartman , Arend van Spriel , Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, Stanislav Yakovlev , Stanislaw Gruszka , Johannes Berg , Emmanuel Grumbach , Luca Coelho , Intel Linux Wireless , Jouni Malinen , Amitkumar Karwar , Ganapathi Bhat , Xinming Hu , libertas-dev@lists.infradead.org, Pascal Terjan , Ping-Ke Shih Subject: [patch V2 04/36] net: caif: Use netif_rx_any_context() References: <20200929202509.673358734@linutronix.de> MIME-Version: 1.0 Content-transfer-encoding: 8-bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Sebastian Andrzej Siewior The usage of in_interrupt() in non-core code is phased out. Ideally the information of the calling context should be passed by the callers or the functions be split as appropriate. cfhsi_rx_desc() and cfhsi_rx_pld() use in_interrupt() to distinguish if they should use netif_rx() or netif_rx_ni() for receiving packets. The attempt to consolidate the code by passing an arguemnt or by distangling it failed due lack of knowledge about this driver and because the call chains are hard to follow. As a stop gap use netif_rx_any_context() which invokes the correct code path depending on context and confines the in_interrupt() usage to core code. Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner --- drivers/net/caif/caif_hsi.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) --- a/drivers/net/caif/caif_hsi.c +++ b/drivers/net/caif/caif_hsi.c @@ -458,15 +458,7 @@ static int cfhsi_rx_desc(struct cfhsi_de skb_reset_mac_header(skb); skb->dev = cfhsi->ndev; - /* - * We are in a callback handler and - * unfortunately we don't know what context we're - * running in. - */ - if (in_interrupt()) - netif_rx(skb); - else - netif_rx_ni(skb); + netif_rx_any_context(skb); /* Update network statistics. */ cfhsi->ndev->stats.rx_packets++; @@ -587,14 +579,7 @@ static int cfhsi_rx_pld(struct cfhsi_des skb_reset_mac_header(skb); skb->dev = cfhsi->ndev; - /* - * We're called in callback from HSI - * and don't know the context we're running in. - */ - if (in_interrupt()) - netif_rx(skb); - else - netif_rx_ni(skb); + netif_rx_any_context(skb); /* Update network statistics. */ cfhsi->ndev->stats.rx_packets++;