netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@savoirfairelinux.com,
	"David S. Miller" <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Neil Armstrong <narmstrong@baylibre.com>
Subject: Re: [PATCH net-next] net: dsa: mv88e6xxx: assert SMI lock
Date: Fri, 30 Oct 2015 22:01:46 +0100	[thread overview]
Message-ID: <20151030210146.GD10053@lunn.ch> (raw)
In-Reply-To: <20151030205048.GA6658@ketchup.mtl.sfl>

> > >  static int _mv88e6xxx_reg_read(struct dsa_switch *ds, int addr, int reg)
> > >  {
> > > -	struct mii_bus *bus = dsa_host_dev_to_mii_bus(ds->master_dev);
> > > +	struct mii_bus *bus;
> > >  	int ret;
> > >  
> > > +	assert_smi_lock(ds);
> > > +
> > > +	bus = dsa_host_dev_to_mii_bus(ds->master_dev);
> > 
> > Is this change of when bus is assigned actually required?
> 
> No, but I found not necessary to issue this "mdio_bus" lookup if the
> lock is not held (see net/dsa/dsa.c:555). Do you prefer not to do that?

You are optimising for an error condition. If this optimisation saves
anything, it means we have a locking bug!

As a separate patch, i would do this lookup once in a setup function
and save it away in ps. We just need to watch out for the probe
register accesses.
 
> Also are you OK with removing all the "Must be called with..." comments,

Yes, it will become a lot more clear when the kernel outputs a stack dump!

     Andrew

  reply	other threads:[~2015-10-30 21:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-30 20:35 [PATCH net-next] net: dsa: mv88e6xxx: assert SMI lock Vivien Didelot
2015-10-30 20:41 ` Andrew Lunn
2015-10-30 20:50   ` Vivien Didelot
2015-10-30 21:01     ` Andrew Lunn [this message]
2015-10-30 21:11       ` Vivien Didelot

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=20151030210146.GD10053@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kernel@savoirfairelinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=narmstrong@baylibre.com \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.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).