From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752534AbdI2Paw (ORCPT ); Fri, 29 Sep 2017 11:30:52 -0400 Received: from mx0a-00010702.pphosted.com ([148.163.156.75]:49556 "EHLO mx0b-00010702.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752258AbdI2Pau (ORCPT ); Fri, 29 Sep 2017 11:30:50 -0400 From: Brandon Streiff To: Andrew Lunn , Florian Fainelli CC: "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "David S. Miller" , Vivien Didelot , Richard Cochran , Erik Hons Subject: RE: [PATCH net-next RFC 3/9] net: dsa: mv88e6xxx: add support for GPIO configuration Thread-Topic: [PATCH net-next RFC 3/9] net: dsa: mv88e6xxx: add support for GPIO configuration Thread-Index: AQHTOG5iabjYjiIcrk2p4WuXGExKhqLKkimAgAAEgoCAAT+o4A== Date: Fri, 29 Sep 2017 15:30:08 +0000 Message-ID: References: <1506612341-18061-1-git-send-email-brandon.streiff@ni.com> <1506612341-18061-4-git-send-email-brandon.streiff@ni.com> <659c4254-d0b7-52dc-dd9b-3921cd2f20c0@gmail.com> <20170928180111.GF14940@lunn.ch> In-Reply-To: <20170928180111.GF14940@lunn.ch> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [130.164.62.183] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CY4PR04MB1257;6:reE2qHBX4VtxvzRxV3fQq/rHIBPcx9C+Sr9JaJCkXp9/EPhNB9Z7G02OZC9C1l8zAaZG/Lnry56s59tQBR3w+ZZ9r8wYlys1o/b7PMZbuk35GBqObtv1NpX3kQSC+AigirSuBUzJdqm4z2T2Kwnn3RWk4uEvhQiRug2G7FsQg3Qu6u2MbvJGESrRhNpWMqy0mccblk8QKKVn90rzO5wyafmB0I3c5CcuuBBu2jnEPxXzR45DiIPbNOKZ2MKbMQZGFq/Le/H3vU3imzepPLM07w8n2rWgTiSaBqlB0tx6neaBHrNW2gyhpv2NDkngyXJT+E22mc6jLQ6YIhwIrDNV2Q==;5:34+xUiue+MJkbIku4qH/LrQYglB3jzq2gIKsknNOxGp+EY/tzDPvg4cdgIU91x8ZYu9eiqYmYjeLqLmJ3dPE250FnoBx6PZfMbPorMu+FnnDjiLcKQ4th+S72U9gacum6CFl/yZbEt+W0NSk7plt2Q==;24:0vWgOt9qws5lveEbJLrS21iwn5iKT4pmHrXyWW4x5wYwRzFHYw+h7IyLR4/43nbA5YdmslErzcqFgTP0ncFAupvmj8YeP1sUXFuvdY76Xds=;7:9KCJR42of3fbnFi+BbMbtZ79gjFC+rLnnP+Rh2Ce3VBQpA9t2I28LIa0Jj4nVR10E/e9eYjh6RCTAwHmFNvS3amCBEGPqJuyvdXcDKAQl6IYm4DisIzg05NX0y30szyKYXotRVRWw2xPwV4qULrv3Bs39ou0X/BHxBi+gncRdDnreK4ejDz+cxcrlLMvuLkcu3aGY1fpog32qcdHIvYwe1bHRe4NtJWb9zpAlQlecQE= x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10019020)(6009001)(376002)(346002)(377454003)(189002)(199003)(6436002)(2950100002)(74316002)(305945005)(93886005)(81166006)(5660300001)(229853002)(39060400002)(81156014)(7696004)(3280700002)(316002)(3846002)(54906003)(97736004)(189998001)(102836003)(55016002)(66066001)(9686003)(99286003)(53936002)(110136005)(8676002)(8936002)(6116002)(478600001)(105586002)(86362001)(2906002)(7736002)(68736007)(106356001)(6506006)(76176999)(14454004)(6246003)(54356999)(101416001)(2900100001)(77096006)(33656002)(50986999)(25786009)(4326008)(3660700001);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR04MB1257;H:CO2PR04MB2184.namprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; x-ms-office365-filtering-correlation-id: 807778f5-0255-40f0-afd2-08d5074ef778 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075);SRVR:CY4PR04MB1257; x-ms-traffictypediagnostic: CY4PR04MB1257: x-exchange-antispam-report-test: UriScan:; x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6041248)(20161123560025)(20161123555025)(20161123564025)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY4PR04MB1257;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY4PR04MB1257; x-forefront-prvs: 0445A82F82 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: ni.com X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Sep 2017 15:30:08.1487 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 87ba1f9a-44cd-43a6-b008-6fdb45a5204e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR04MB1257 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-09-29_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_policy_notspam policy=outbound_policy score=30 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=30 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709290222 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v8TFUwSG029247 > From: Andrew Lunn [mailto:andrew@lunn.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