netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herve Codina <herve.codina@bootlin.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Vadim Fedorenko <vadim.fedorenko@linux.dev>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Yury Norov <yury.norov@gmail.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, Andrew Lunn <andrew@lunn.ch>,
	Mark Brown <broonie@kernel.org>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v4 5/5] net: wan: fsl_qmc_hdlc: Add framer support
Date: Thu, 29 Feb 2024 13:56:05 +0100	[thread overview]
Message-ID: <20240229135605.6454052f@bootlin.com> (raw)
In-Reply-To: <ZddtFG4bvCX-lsn3@smile.fi.intel.com>

Hi Andy,

On Thu, 22 Feb 2024 17:49:40 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Thu, Feb 22, 2024 at 03:22:18PM +0100, Herve Codina wrote:
> > Add framer support in the fsl_qmc_hdlc driver in order to be able to
> > signal carrier changes to the network stack based on the framer status
> > Also use this framer to provide information related to the E1/T1 line
> > interface on IF_GET_IFACE and configure the line interface according to
> > IF_IFACE_{E1,T1} information.  
> 
> ...
> 
> > +static int qmc_hdlc_framer_set_carrier(struct qmc_hdlc *qmc_hdlc)
> > +{
> > +	struct framer_status framer_status;
> > +	unsigned long flags;
> > +	int ret;
> > +
> > +	if (!qmc_hdlc->framer)
> > +		return 0;  
> 
> > +	spin_lock_irqsave(&qmc_hdlc->carrier_lock, flags);  
> 
> cleanup.h ?
> 
> > +	ret = framer_get_status(qmc_hdlc->framer, &framer_status);
> > +	if (ret) {
> > +		dev_err(qmc_hdlc->dev, "get framer status failed (%d)\n", ret);
> > +		goto end;
> > +	}
> > +	if (framer_status.link_is_on)
> > +		netif_carrier_on(qmc_hdlc->netdev);
> > +	else
> > +		netif_carrier_off(qmc_hdlc->netdev);
> > +
> > +end:
> > +	spin_unlock_irqrestore(&qmc_hdlc->carrier_lock, flags);
> > +	return ret;
> > +}  
> 

I've got an issue with guard(spinlock_irqsave).

I changed this code to:
--- 8< ---
static int qmc_hdlc_framer_set_carrier(struct qmc_hdlc *qmc_hdlc)
{
	struct framer_status framer_status;
	int ret;

	if (!qmc_hdlc->framer)
		return 0;

	guard(spinlock_irqsave)(&qmc_hdlc->carrier_lock);

	ret = framer_get_status(qmc_hdlc->framer, &framer_status);
	if (ret) {
		dev_err(qmc_hdlc->dev, "get framer status failed (%d)\n", ret);
		return ret;
	}
	if (framer_status.link_is_on)
		netif_carrier_on(qmc_hdlc->netdev);
	else
		netif_carrier_off(qmc_hdlc->netdev);

	return 0;
}
--- 8< ---

I have the following warning (make C=1):
drivers/net/wan/fsl_qmc_hdlc.c:49:12: warning: context imbalance in 'qmc_hdlc_framer_set_carrier' - wrong count at exit

I also tried to call guard(spinlock_irqsave) before 'if (!qmc_hdlc->framer)'
but it does not change anything.

Did I miss something in the guard(spinlock_irqsave) usage ?

Best regards,
Hervé

  reply	other threads:[~2024-02-29 12:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22 14:22 [PATCH v4 0/5] Add support for QMC HDLC Herve Codina
2024-02-22 14:22 ` [PATCH v4 1/5] net: wan: " Herve Codina
2024-02-22 15:29   ` Andy Shevchenko
2024-02-22 16:45     ` Herve Codina
2024-02-22 16:56       ` Andy Shevchenko
2024-02-22 17:45         ` Herve Codina
2024-02-22 14:22 ` [PATCH v4 2/5] MAINTAINERS: Add the Freescale QMC HDLC driver entry Herve Codina
2024-02-22 14:22 ` [PATCH v4 3/5] lib/bitmap: Introduce bitmap_scatter() and bitmap_gather() helpers Herve Codina
2024-02-22 15:39   ` Andy Shevchenko
2024-02-22 15:40     ` Andy Shevchenko
2024-02-22 16:49     ` Herve Codina
2024-02-22 21:50       ` Yury Norov
2024-02-23 10:07         ` Herve Codina
2024-02-22 14:22 ` [PATCH v4 4/5] net: wan: fsl_qmc_hdlc: Add runtime timeslots changes support Herve Codina
2024-02-22 15:47   ` Andy Shevchenko
2024-02-23 16:46     ` Herve Codina
2024-02-22 14:22 ` [PATCH v4 5/5] net: wan: fsl_qmc_hdlc: Add framer support Herve Codina
2024-02-22 15:49   ` Andy Shevchenko
2024-02-29 12:56     ` Herve Codina [this message]
2024-02-29 13:58       ` Andy Shevchenko
2024-02-29 14:15         ` Herve Codina
2024-02-22 15:50 ` [PATCH v4 0/5] Add support for QMC HDLC Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240229135605.6454052f@bootlin.com \
    --to=herve.codina@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vadim.fedorenko@linux.dev \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).