Return-Path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cumulusnetworks.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Ta8oz1fbvaerH5A/X0TFTtxjW5L9oeCcWqi65Orht20=; b=AgbneLOHwr+ltseE91JSrh6UZVFVTzRe/ObKcZKmqIrirut8VovvSG4418gnuXXCGy ElYWnmghul+08oeKp8vMlp56fMXK3BHJ4wiqnY7eKZ38dgtE5JJBjtAsVAJyBIfWBsdj ZeJkOR3A5bhTNDJhPdJhnyLRzU1Tr/YQjfoiE= References: From: Nikolay Aleksandrov Message-ID: Date: Fri, 25 May 2018 15:04:37 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Bridge] [PATCH net-next 1/7] net: bridge: Extract boilerplate around switchdev_port_obj_*() List-Id: Linux Ethernet Bridging List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Petr Machata , netdev@vger.kernel.org, devel@driverdev.osuosl.org, bridge@lists.linux-foundation.org Cc: f.fainelli@gmail.com, andrew@lunn.ch, gregkh@linuxfoundation.org, vivien.didelot@savoirfairelinux.com, idosch@mellanox.com, jiri@mellanox.com, razvan.stefanescu@nxp.com, davem@davemloft.net 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