[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CO2PR04MB2184CC589E0ED269A34279959F7E0@CO2PR04MB2184.namprd04.prod.outlook.com>
Date: Fri, 29 Sep 2017 15:30:08 +0000
From: Brandon Streiff <brandon.streiff@...com>
To: Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Vivien Didelot <vivien.didelot@...oirfairelinux.com>,
Richard Cochran <richardcochran@...il.com>,
Erik Hons <erik.hons@...com>
Subject: RE: [PATCH net-next RFC 3/9] net: dsa: mv88e6xxx: add support for
GPIO configuration
> From: Andrew Lunn [mailto:andrew@...n.ch]
> Sent: Thursday, September 28, 2017 1:01 PM
>
> > With the write and read acquiring and then releasing the lock
> > immediately, is no there room for this sequence to be interrupted in the
> > middle and end-up returning inconsistent reads?
>
> The general pattern in this code is that the lock chip->reg_lock is
> taken at a higher level. That protects against other threads. The
> driver tends to do that at the highest levels, at the entry points
> into the driver. I've not yet checked this code follows the pattern
> yet. However, we have a check in the low level to ensure the lock has
> been taken. So it seems likely the lock is held.
Yes, the expectation here is that an upper layer takes the reg_lock. All the functions in ptp.c that call this function do that. If they did not, then assert_reg_lock() gets very angry. :)
Perhaps using __must_hold() and similar annotations would also help document the requirements, but we don't seem to use those in this driver today.
-- brandon
Powered by blists - more mailing lists