From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753649AbbJNM4W (ORCPT ); Wed, 14 Oct 2015 08:56:22 -0400 Received: from shards.monkeyblade.net ([149.20.54.216]:59851 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752276AbbJNM4R (ORCPT ); Wed, 14 Oct 2015 08:56:17 -0400 Date: Wed, 14 Oct 2015 06:12:20 -0700 (PDT) Message-Id: <20151014.061220.710919703136753197.davem@davemloft.net> To: vivien.didelot@savoirfairelinux.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, sfeldma@gmail.com, jiri@resnulli.us, f.fainelli@gmail.com, andrew@lunn.ch Subject: Re: [PATCH net-next v2 1/6] net: dsa: add port_fdb_dump function From: David Miller In-Reply-To: <1444754783-26975-2-git-send-email-vivien.didelot@savoirfairelinux.com> References: <1444754783-26975-1-git-send-email-vivien.didelot@savoirfairelinux.com> <1444754783-26975-2-git-send-email-vivien.didelot@savoirfairelinux.com> X-Mailer: Mew version 6.4 on Emacs 23.4 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 14 Oct 2015 05:56:17 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vivien Didelot Date: Tue, 13 Oct 2015 12:46:18 -0400 > @@ -198,7 +198,9 @@ static inline u8 dsa_upstream_port(struct dsa_switch *ds) > } > > struct switchdev_trans; > +struct switchdev_obj; > struct switchdev_obj_port_fdb; > +typedef int switchdev_obj_dump_cb_t(struct switchdev_obj *obj); > > struct dsa_switch_driver { > struct list_head list; ... > @@ -382,6 +382,9 @@ static int dsa_slave_port_fdb_dump(struct net_device *dev, > u16 vid = 0; > int ret; > > + if (ds->drv->port_fdb_dump) > + return ds->drv->port_fdb_dump(ds, p->port, fdb, cb); > + > if (!ds->drv->port_fdb_getnext) I realize you're fighting include file dependency issues, but this is rediculous. Now you're using two different typedefs for this callback function pointer. This is why typedef's suck. We should just opencode "int (*cb)(struct switchdev_obj *)" everywhere and kill these typedefs which are obviously just getting in the way and making us do silly things.