From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753515AbdBDCng (ORCPT ); Fri, 3 Feb 2017 21:43:36 -0500 Received: from mail-oi0-f67.google.com ([209.85.218.67]:33417 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753332AbdBDCne (ORCPT ); Fri, 3 Feb 2017 21:43:34 -0500 Subject: Re: [PATCH net-next 2/6] net: dsa: simplify netdevice events handling To: Vivien Didelot , netdev@vger.kernel.org References: <20170203182021.14246-1-vivien.didelot@savoirfairelinux.com> <20170203182021.14246-3-vivien.didelot@savoirfairelinux.com> Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, "David S. Miller" , Andrew Lunn , cphealy@gmail.com From: Florian Fainelli Message-ID: Date: Fri, 3 Feb 2017 18:43:35 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170203182021.14246-3-vivien.didelot@savoirfairelinux.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/03/2017 10:20 AM, Vivien Didelot wrote: > Simplify the code handling the slave netdevice notifier call by > providing a dsa_slave_changeupper helper for NETDEV_CHANGEUPPER, and so > on (only this event is supported at the moment.) > > Return NOTIFY_DONE when we did not care about an event, and NOTIFY_OK > when we were concerned but no error occurred, as the API suggests. > > Signed-off-by: Vivien Didelot > --- > static int dsa_slave_netdevice_event(struct notifier_block *nb, > @@ -1529,8 +1514,11 @@ static int dsa_slave_netdevice_event(struct notifier_block *nb, > { > struct net_device *dev = netdev_notifier_info_to_dev(ptr); > > - if (dsa_slave_dev_check(dev)) > - return dsa_slave_port_event(dev, event, ptr); > + if (dev->netdev_ops != &dsa_slave_netdev_ops) > + return NOTIFY_DONE; Why not keep the dsa_slave_dev_check() here? -- Florian