From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754202AbdEQIVh (ORCPT ); Wed, 17 May 2017 04:21:37 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34703 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752300AbdEQIVd (ORCPT ); Wed, 17 May 2017 04:21:33 -0400 Date: Wed, 17 May 2017 10:21:29 +0200 From: Corentin Labbe To: Florian Fainelli Cc: peppe.cavallaro@st.com, alexandre.torgue@st.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] net-next: stmmac: add adjust_link function Message-ID: <20170517082129.GB19202@Red> References: <20170515114140.1676-1-clabbe.montjoie@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 16, 2017 at 09:43:04AM -0700, Florian Fainelli wrote: > On 05/15/2017 04:41 AM, Corentin Labbe wrote: > > My dwmac-sun8i serie will add some if (has_sun8i) to > > stmmac_adjust_link() > > Since the current stmmac_adjust_link() alreaady have lots of if (has_gmac/gmac4), > > It is now better to create an adjust_link() function for each dwmac. > > Is it really, because the diffstat really seems to indicate otherwise > and by looking at the code, I am definitively not convinced this is an > improvement other the current code. > > > > > So this patch add an adjust_link() function pointer, and move code out > > of stmmac_adjust_link to it. > > Can't we keep the existing adjust_link() function and just have a > different one for dwmac-sun8i that either re-uses portions of the > existing, or duplicate just what it needs? > I found another way, removing port/speed variable and use new struct links member speed10/speed100/speed1000/speedmask I will make the current adjust_link function simplier. (and no if has_xxx for any dwmac type) I will send that try soon.