From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli Subject: Re: [PATCH net-next 2/5] net: dsa: b53: Make SRAB driver manage port interrupts Date: Tue, 4 Sep 2018 16:46:59 -0700 Message-ID: <1ad537ab-ebe5-8745-c907-aea684fee56c@gmail.com> References: <20180904221120.13018-1-f.fainelli@gmail.com> <20180904221120.13018-3-f.fainelli@gmail.com> <20180904225955.GH29121@lunn.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: netdev@vger.kernel.org, vivien.didelot@savoirfairelinux.com, davem@davemloft.net To: Andrew Lunn Return-path: Received: from mail-wr1-f65.google.com ([209.85.221.65]:37982 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725763AbeIEEOg (ORCPT ); Wed, 5 Sep 2018 00:14:36 -0400 Received: by mail-wr1-f65.google.com with SMTP id w11-v6so5666922wrc.5 for ; Tue, 04 Sep 2018 16:47:10 -0700 (PDT) In-Reply-To: <20180904225955.GH29121@lunn.ch> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 09/04/2018 03:59 PM, Andrew Lunn wrote: >> +static irqreturn_t b53_srab_port_isr(int irq, void *dev_id) >> +{ >> + struct b53_srab_port_priv *port = dev_id; >> + struct b53_device *dev = port->dev; >> + struct b53_srab_priv *priv = dev->priv; >> + >> + /* Acknowledge the interrupt */ >> + writel(BIT(port->num), priv->regs + B53_SRAB_INTR); >> + >> + schedule_work(&port->irq_work); >> + >> + return IRQ_HANDLED; >> +} >> + >> +static int b53_srab_irq_enable(struct b53_device *dev, int port) >> +{ >> + struct b53_srab_priv *priv = dev->priv; >> + struct b53_srab_port_priv *p = &priv->port_intrs[port]; >> + int ret; >> + >> + ret = request_irq(p->irq, b53_srab_port_isr, 0, >> + dev_name(dev->dev), p); > > Hi Florian > > Could you use a threaded interrupt? Save you from having to implement > your own work queue. I think you can have a function called in both > interrupt context in order to acknowledged the interrupt, and thread > context to do the remaining work. Indeed, this works nicely actually, thanks for the suggestion. -- Florian