Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751522AbdG0LFD (ORCPT ); Thu, 27 Jul 2017 07:05:03 -0400 Received: from aibo.runbox.com ([91.220.196.211]:54268 "EHLO aibo.runbox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750965AbdG0LFB (ORCPT ); Thu, 27 Jul 2017 07:05:01 -0400 Subject: Re: [PATCH net-next v2 08/10] net: dsa: lan9303: Added ALR/fdb/mdb handling To: Andrew Lunn Cc: corbet@lwn.net, vivien.didelot@savoirfairelinux.com, f.fainelli@gmail.com, davem@davemloft.net, kernel@pengutronix.de, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org References: <20170725161553.30147-1-privat@egil-hjelmeland.no> <20170725161553.30147-9-privat@egil-hjelmeland.no> <20170726174154.GS12049@lunn.ch> From: Egil Hjelmeland Message-ID: <8c7c8f00-9a6a-6f68-5459-58ef59ff6c78@egil-hjelmeland.no> Date: Thu, 27 Jul 2017 13:04:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170726174154.GS12049@lunn.ch> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1198 Lines: 53 On 26. juli 2017 19:41, Andrew Lunn wrote: > Hi Egil > >> +/* This function will wait a while until mask & reg == value */ >> +/* Otherwise, return timeout */ >> +static int lan9303_csr_reg_wait(struct lan9303 *chip, int regno, >> + int mask, char value) >> +{ >> + int i; >> + >> + for (i = 0; i < 0x1000; i++) { >> + u32 reg; >> + >> + lan9303_read_switch_reg(chip, regno, ®); >> + if ((reg & mask) == value) >> + return 0; >> + } >> + return -ETIMEDOUT; > > Busy looping is probably not a good idea. Can you add a usleep()? > Yes >> +} >> + >> +static int _lan9303_alr_make_entry_raw(struct lan9303 *chip, u32 dat0, u32 dat1) > > What does the _ indicate. I could understand having it when you have > lan9303_alr_make_entry_raw() call _lan9303_alr_make_entry_raw() after > taking a lock, but i don't see anything like that here. > Just my sloppy convention for something private, deep down. I can remove the _. >> +{ >> + struct lan9303_alr_cache_entry *entr = lan9303_alr_cache_find_mac( >> + chip, mac); > > A long line like this should be split into a declaration and an > assignment. > OK > > I would probably make this a separate patch. > > Andrew > Got it.