From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nikolay Aleksandrov Subject: Re: [PATCH net-next 1/7] net: bridge: Extract boilerplate around switchdev_port_obj_*() Date: Fri, 25 May 2018 15:04:37 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: jiri@mellanox.com, idosch@mellanox.com, davem@davemloft.net, razvan.stefanescu@nxp.com, gregkh@linuxfoundation.org, stephen@networkplumber.org, andrew@lunn.ch, vivien.didelot@savoirfairelinux.com, f.fainelli@gmail.com To: Petr Machata , netdev@vger.kernel.org, devel@driverdev.osuosl.org, bridge@lists.linux-foundation.org Return-path: Received: from mail-wr0-f194.google.com ([209.85.128.194]:41489 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966243AbeEYMEl (ORCPT ); Fri, 25 May 2018 08:04:41 -0400 Received: by mail-wr0-f194.google.com with SMTP id u12-v6so8785842wrn.8 for ; Fri, 25 May 2018 05:04:40 -0700 (PDT) In-Reply-To: Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 24/05/18 18:10, Petr Machata wrote: > A call to switchdev_port_obj_add() or switchdev_port_obj_del() involves > initializing a struct switchdev_obj_port_vlan, a piece of code that > repeats on each call site almost verbatim. While in the current codebase > there is just one duplicated add call, the follow-up patches add more of > both add and del calls. > > Thus to remove the duplication, extract the repetition into named > functions and reuse. > > Signed-off-by: Petr Machata > --- > net/bridge/br_vlan.c | 44 +++++++++++++++++++++++--------------------- > 1 file changed, 23 insertions(+), 21 deletions(-) > Reviewed-by: Nikolay Aleksandrov