From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH net-next 2/5] net: dsa: mv88e6xxx: Hold mutex while doing stats operations Date: Wed, 3 Jan 2018 16:02:07 +0100 Message-ID: <20180103150207.GA3401@lunn.ch> References: <1514988562-20079-1-git-send-email-andrew@lunn.ch> <1514988562-20079-3-git-send-email-andrew@lunn.ch> <878tdfdncl.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: David Miller , Florian Fainelli , netdev , Russell King To: Vivien Didelot Return-path: Received: from vps0.lunn.ch ([185.16.172.187]:52628 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753180AbeACPCN (ORCPT ); Wed, 3 Jan 2018 10:02:13 -0500 Content-Disposition: inline In-Reply-To: <878tdfdncl.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, Jan 03, 2018 at 09:32:42AM -0500, Vivien Didelot wrote: > Hi Andrew, > > Andrew Lunn writes: > > > -static int mv88e6xxx_get_sset_count(struct dsa_switch *ds, int port) > > +static int _mv88e6xxx_get_sset_count(struct dsa_switch *ds, int port) > > { > > struct mv88e6xxx_chip *chip = ds->priv; > > > > @@ -702,6 +706,19 @@ static int mv88e6xxx_get_sset_count(struct dsa_switch *ds, int port) > > return 0; > > } > > We worked to remove the old underscore prefix convention. Please don't > add it back... Simply rework the return statements of > mv88e6xxx_get_sset_count to lock/unlock there. Hi Vivien That makes mv88e6xxx_get_sset_count quite complex, making it error prone. Doing the locking in a separate function makes is very clear the lock is held and then correctly released. So i will just rename _mv88e6xxx_get_sset_count() to mv88e6xxx_get_sset_count_locked() Andrew