[{"id":1773784,"web_url":"http://patchwork.ozlabs.org/comment/1773784/","msgid":"<f8d74c3c-bd7f-8a84-2d57-c37250ff25f8@gmail.com>","list_archive_url":null,"date":"2017-09-22T17:14:54","subject":"Re: [PATCH net-next 2/4] net: dsa: remove phy arg from port\n\tenable/disable","submitter":{"id":2800,"url":"http://patchwork.ozlabs.org/api/people/2800/","name":"Florian Fainelli","email":"f.fainelli@gmail.com"},"content":"On 09/22/2017 09:17 AM, Vivien Didelot wrote:\n> The .port_enable and .port_disable functions are meant to deal with the\n> switch ports only, and no driver is using the phy argument anyway.\n> Remove it.\n\nI don't think this makes sense, there are perfectly legit reasons why a\nswitch driver may have something to do with the PHY device attached to\nits per-port network interface, we should definitively keep that around,\nunless you think we should be accessing the PHY within the switch\ndrivers by doing:\n\nstruct phy_device *phydev = ds->ports[port].netdev->phydev?\n\n> \n> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>\n> ---\n>  drivers/net/dsa/b53/b53_common.c       |  6 +++---\n>  drivers/net/dsa/b53/b53_priv.h         |  4 ++--\n>  drivers/net/dsa/bcm_sf2.c              | 16 +++++++---------\n>  drivers/net/dsa/lan9303-core.c         |  6 ++----\n>  drivers/net/dsa/microchip/ksz_common.c |  6 ++----\n>  drivers/net/dsa/mt7530.c               |  8 +++-----\n>  drivers/net/dsa/mv88e6xxx/chip.c       |  6 ++----\n>  drivers/net/dsa/qca8k.c                |  6 ++----\n>  include/net/dsa.h                      |  6 ++----\n>  net/dsa/slave.c                        |  4 ++--\n>  10 files changed, 27 insertions(+), 41 deletions(-)\n> \n> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c\n> index d4ce092def83..e46eb29d29f0 100644\n> --- a/drivers/net/dsa/b53/b53_common.c\n> +++ b/drivers/net/dsa/b53/b53_common.c\n> @@ -502,7 +502,7 @@ void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)\n>  }\n>  EXPORT_SYMBOL(b53_imp_vlan_setup);\n>  \n> -int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy)\n> +int b53_enable_port(struct dsa_switch *ds, int port)\n>  {\n>  \tstruct b53_device *dev = ds->priv;\n>  \tunsigned int cpu_port = dev->cpu_port;\n> @@ -531,7 +531,7 @@ int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy)\n>  }\n>  EXPORT_SYMBOL(b53_enable_port);\n>  \n> -void b53_disable_port(struct dsa_switch *ds, int port, struct phy_device *phy)\n> +void b53_disable_port(struct dsa_switch *ds, int port)\n>  {\n>  \tstruct b53_device *dev = ds->priv;\n>  \tu8 reg;\n> @@ -874,7 +874,7 @@ static int b53_setup(struct dsa_switch *ds)\n>  \t\tif (dsa_is_cpu_port(ds, port))\n>  \t\t\tb53_enable_cpu_port(dev, port);\n>  \t\telse if (!(BIT(port) & ds->enabled_port_mask))\n> -\t\t\tb53_disable_port(ds, port, NULL);\n> +\t\t\tb53_disable_port(ds, port);\n>  \t}\n>  \n>  \treturn ret;\n> diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h\n> index 603c66d240d8..688d02ee6155 100644\n> --- a/drivers/net/dsa/b53/b53_priv.h\n> +++ b/drivers/net/dsa/b53/b53_priv.h\n> @@ -311,8 +311,8 @@ int b53_mirror_add(struct dsa_switch *ds, int port,\n>  \t\t   struct dsa_mall_mirror_tc_entry *mirror, bool ingress);\n>  void b53_mirror_del(struct dsa_switch *ds, int port,\n>  \t\t    struct dsa_mall_mirror_tc_entry *mirror);\n> -int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy);\n> -void b53_disable_port(struct dsa_switch *ds, int port, struct phy_device *phy);\n> +int b53_enable_port(struct dsa_switch *ds, int port);\n> +void b53_disable_port(struct dsa_switch *ds, int port);\n>  void b53_brcm_hdr_setup(struct dsa_switch *ds, int port);\n>  void b53_eee_enable_set(struct dsa_switch *ds, int port, bool enable);\n>  int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy);\n> diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c\n> index ad96b9725a2c..77e0c43f973b 100644\n> --- a/drivers/net/dsa/bcm_sf2.c\n> +++ b/drivers/net/dsa/bcm_sf2.c\n> @@ -159,8 +159,7 @@ static inline void bcm_sf2_port_intr_disable(struct bcm_sf2_priv *priv,\n>  \tintrl2_1_writel(priv, P_IRQ_MASK(off), INTRL2_CPU_CLEAR);\n>  }\n>  \n> -static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,\n> -\t\t\t      struct phy_device *phy)\n> +static int bcm_sf2_port_setup(struct dsa_switch *ds, int port)\n>  {\n>  \tstruct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);\n>  \tunsigned int i;\n> @@ -191,11 +190,10 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,\n>  \tif (port == priv->moca_port)\n>  \t\tbcm_sf2_port_intr_enable(priv, port);\n>  \n> -\treturn b53_enable_port(ds, port, phy);\n> +\treturn b53_enable_port(ds, port);\n>  }\n>  \n> -static void bcm_sf2_port_disable(struct dsa_switch *ds, int port,\n> -\t\t\t\t struct phy_device *phy)\n> +static void bcm_sf2_port_disable(struct dsa_switch *ds, int port)\n>  {\n>  \tstruct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);\n>  \tu32 off, reg;\n> @@ -214,7 +212,7 @@ static void bcm_sf2_port_disable(struct dsa_switch *ds, int port,\n>  \telse\n>  \t\toff = CORE_G_PCTL_PORT(port);\n>  \n> -\tb53_disable_port(ds, port, phy);\n> +\tb53_disable_port(ds, port);\n>  \n>  \t/* Power down the port memory */\n>  \treg = core_readl(priv, CORE_MEM_PSM_VDD_CTRL);\n> @@ -613,7 +611,7 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds)\n>  \tfor (port = 0; port < DSA_MAX_PORTS; port++) {\n>  \t\tif ((1 << port) & ds->enabled_port_mask ||\n>  \t\t    dsa_is_cpu_port(ds, port))\n> -\t\t\tbcm_sf2_port_disable(ds, port, NULL);\n> +\t\t\tbcm_sf2_port_disable(ds, port);\n>  \t}\n>  \n>  \treturn 0;\n> @@ -636,7 +634,7 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds)\n>  \n>  \tfor (port = 0; port < DSA_MAX_PORTS; port++) {\n>  \t\tif ((1 << port) & ds->enabled_port_mask)\n> -\t\t\tbcm_sf2_port_setup(ds, port, NULL);\n> +\t\t\tbcm_sf2_port_setup(ds, port);\n>  \t\telse if (dsa_is_cpu_port(ds, port))\n>  \t\t\tbcm_sf2_imp_setup(ds, port);\n>  \t}\n> @@ -745,7 +743,7 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)\n>  \t\tif (dsa_is_cpu_port(ds, port))\n>  \t\t\tbcm_sf2_imp_setup(ds, port);\n>  \t\telse if (!((1 << port) & ds->enabled_port_mask))\n> -\t\t\tbcm_sf2_port_disable(ds, port, NULL);\n> +\t\t\tbcm_sf2_port_disable(ds, port);\n>  \t}\n>  \n>  \tbcm_sf2_sw_configure_vlan(ds);\n> diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c\n> index 07355db2ad81..0c33b02562dc 100644\n> --- a/drivers/net/dsa/lan9303-core.c\n> +++ b/drivers/net/dsa/lan9303-core.c\n> @@ -799,8 +799,7 @@ static void lan9303_adjust_link(struct dsa_switch *ds, int port,\n>  \t}\n>  }\n>  \n> -static int lan9303_port_enable(struct dsa_switch *ds, int port,\n> -\t\t\t       struct phy_device *phy)\n> +static int lan9303_port_enable(struct dsa_switch *ds, int port)\n>  {\n>  \tstruct lan9303 *chip = ds->priv;\n>  \n> @@ -817,8 +816,7 @@ static int lan9303_port_enable(struct dsa_switch *ds, int port,\n>  \treturn -ENODEV;\n>  }\n>  \n> -static void lan9303_port_disable(struct dsa_switch *ds, int port,\n> -\t\t\t\t struct phy_device *phy)\n> +static void lan9303_port_disable(struct dsa_switch *ds, int port)\n>  {\n>  \tstruct lan9303 *chip = ds->priv;\n>  \n> diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c\n> index 56cd6d365352..4095c50ae111 100644\n> --- a/drivers/net/dsa/microchip/ksz_common.c\n> +++ b/drivers/net/dsa/microchip/ksz_common.c\n> @@ -418,8 +418,7 @@ static int ksz_phy_write16(struct dsa_switch *ds, int addr, int reg, u16 val)\n>  \treturn 0;\n>  }\n>  \n> -static int ksz_enable_port(struct dsa_switch *ds, int port,\n> -\t\t\t   struct phy_device *phy)\n> +static int ksz_enable_port(struct dsa_switch *ds, int port)\n>  {\n>  \tstruct ksz_device *dev = ds->priv;\n>  \n> @@ -429,8 +428,7 @@ static int ksz_enable_port(struct dsa_switch *ds, int port,\n>  \treturn 0;\n>  }\n>  \n> -static void ksz_disable_port(struct dsa_switch *ds, int port,\n> -\t\t\t     struct phy_device *phy)\n> +static void ksz_disable_port(struct dsa_switch *ds, int port)\n>  {\n>  \tstruct ksz_device *dev = ds->priv;\n>  \n> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c\n> index faa3b88d2206..0a7f6209767f 100644\n> --- a/drivers/net/dsa/mt7530.c\n> +++ b/drivers/net/dsa/mt7530.c\n> @@ -693,8 +693,7 @@ mt7530_cpu_port_enable(struct mt7530_priv *priv,\n>  }\n>  \n>  static int\n> -mt7530_port_enable(struct dsa_switch *ds, int port,\n> -\t\t   struct phy_device *phy)\n> +mt7530_port_enable(struct dsa_switch *ds, int port)\n>  {\n>  \tstruct mt7530_priv *priv = ds->priv;\n>  \n> @@ -719,8 +718,7 @@ mt7530_port_enable(struct dsa_switch *ds, int port,\n>  }\n>  \n>  static void\n> -mt7530_port_disable(struct dsa_switch *ds, int port,\n> -\t\t    struct phy_device *phy)\n> +mt7530_port_disable(struct dsa_switch *ds, int port)\n>  {\n>  \tstruct mt7530_priv *priv = ds->priv;\n>  \n> @@ -1006,7 +1004,7 @@ mt7530_setup(struct dsa_switch *ds)\n>  \t\tif (dsa_is_cpu_port(ds, i))\n>  \t\t\tmt7530_cpu_port_enable(priv, i);\n>  \t\telse\n> -\t\t\tmt7530_port_disable(ds, i, NULL);\n> +\t\t\tmt7530_port_disable(ds, i);\n>  \t}\n>  \n>  \t/* Flush the FDB table */\n> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c\n> index c6678aa9b4ef..e47898fb7dbc 100644\n> --- a/drivers/net/dsa/mv88e6xxx/chip.c\n> +++ b/drivers/net/dsa/mv88e6xxx/chip.c\n> @@ -1862,8 +1862,7 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)\n>  \treturn mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_DEFAULT_VLAN, 0);\n>  }\n>  \n> -static int mv88e6xxx_port_enable(struct dsa_switch *ds, int port,\n> -\t\t\t\t struct phy_device *phydev)\n> +static int mv88e6xxx_port_enable(struct dsa_switch *ds, int port)\n>  {\n>  \tstruct mv88e6xxx_chip *chip = ds->priv;\n>  \tint err;\n> @@ -1875,8 +1874,7 @@ static int mv88e6xxx_port_enable(struct dsa_switch *ds, int port,\n>  \treturn err;\n>  }\n>  \n> -static void mv88e6xxx_port_disable(struct dsa_switch *ds, int port,\n> -\t\t\t\t   struct phy_device *phydev)\n> +static void mv88e6xxx_port_disable(struct dsa_switch *ds, int port)\n>  {\n>  \tstruct mv88e6xxx_chip *chip = ds->priv;\n>  \n> diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c\n> index 82f09711ac1a..622ee9b8e72b 100644\n> --- a/drivers/net/dsa/qca8k.c\n> +++ b/drivers/net/dsa/qca8k.c\n> @@ -743,8 +743,7 @@ qca8k_port_bridge_leave(struct dsa_switch *ds, int port, struct net_device *br)\n>  }\n>  \n>  static int\n> -qca8k_port_enable(struct dsa_switch *ds, int port,\n> -\t\t  struct phy_device *phy)\n> +qca8k_port_enable(struct dsa_switch *ds, int port)\n>  {\n>  \tstruct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;\n>  \n> @@ -755,8 +754,7 @@ qca8k_port_enable(struct dsa_switch *ds, int port,\n>  }\n>  \n>  static void\n> -qca8k_port_disable(struct dsa_switch *ds, int port,\n> -\t\t   struct phy_device *phy)\n> +qca8k_port_disable(struct dsa_switch *ds, int port)\n>  {\n>  \tstruct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;\n>  \n> diff --git a/include/net/dsa.h b/include/net/dsa.h\n> index 8dee216a5a9b..65b031a69c19 100644\n> --- a/include/net/dsa.h\n> +++ b/include/net/dsa.h\n> @@ -337,10 +337,8 @@ struct dsa_switch_ops {\n>  \t/*\n>  \t * Port enable/disable\n>  \t */\n> -\tint\t(*port_enable)(struct dsa_switch *ds, int port,\n> -\t\t\t       struct phy_device *phy);\n> -\tvoid\t(*port_disable)(struct dsa_switch *ds, int port,\n> -\t\t\t\tstruct phy_device *phy);\n> +\tint\t(*port_enable)(struct dsa_switch *ds, int port);\n> +\tvoid\t(*port_disable)(struct dsa_switch *ds, int port);\n>  \n>  \t/*\n>  \t * Port's MAC EEE settings\n> diff --git a/net/dsa/slave.c b/net/dsa/slave.c\n> index 606812160fd5..6290741e496a 100644\n> --- a/net/dsa/slave.c\n> +++ b/net/dsa/slave.c\n> @@ -100,7 +100,7 @@ static int dsa_slave_open(struct net_device *dev)\n>  \t}\n>  \n>  \tif (ds->ops->port_enable) {\n> -\t\terr = ds->ops->port_enable(ds, p->dp->index, p->phy);\n> +\t\terr = ds->ops->port_enable(ds, p->dp->index);\n>  \t\tif (err)\n>  \t\t\tgoto clear_promisc;\n>  \t}\n> @@ -155,7 +155,7 @@ static int dsa_slave_close(struct net_device *dev)\n>  \t\tdev_uc_del(master, dev->dev_addr);\n>  \n>  \tif (ds->ops->port_disable)\n> -\t\tds->ops->port_disable(ds, p->dp->index, p->phy);\n> +\t\tds->ops->port_disable(ds, p->dp->index);\n>  \n>  \tdsa_port_set_state_now(p->dp, BR_STATE_DISABLED);\n>  \n>","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"rrMcHKhT\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xzKqV6wLXz9t3Z\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 23 Sep 2017 03:15:18 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752380AbdIVRPF (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 22 Sep 2017 13:15:05 -0400","from mail-qk0-f196.google.com ([209.85.220.196]:34836 \"EHLO\n\tmail-qk0-f196.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751875AbdIVRPD (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 22 Sep 2017 13:15:03 -0400","by mail-qk0-f196.google.com with SMTP id o77so1027000qke.2;\n\tFri, 22 Sep 2017 10:15:03 -0700 (PDT)","from [10.112.156.244] ([192.19.255.250])\n\tby smtp.googlemail.com with ESMTPSA id\n\tg132sm239539qke.11.2017.09.22.10.14.55\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 22 Sep 2017 10:14:56 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=yluG2Ys+tzajCFkJEuZS82B6nX1eec5/YR6YwBmUvKs=;\n\tb=rrMcHKhT8+YT6URuzvqZMfITNxrlXgMK0ONW/Ry8cdcUyLIURLejJGxusts1A0DFnw\n\ts1/6bKkpnV91Tx5mEzQPXwWLeoZ7B2P7RxVrS7ASnxh3kfNceZA74+yCQyMX3Pz4+RA9\n\tHyYXz440yQWWdvFaAm11uniguKYhPdkXAEjH0yFb0Smmcw3mgPC1yLIqgL4WDHlNHFHU\n\t8X13LFIVi2QjciPooo5Q3fsHJuoJbBD/kJEKA+wsGwAl04cxb/yoGnbPQHuyptMJS+ML\n\tz48GoPZlup0wP/2I7qHqzddEcVjRcMyToWwXHm+iGww4yebT6+um5pCVRAwHViZTrEbm\n\tj0OA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:subject:to:cc:references:from:message-id:date\n\t:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=yluG2Ys+tzajCFkJEuZS82B6nX1eec5/YR6YwBmUvKs=;\n\tb=jkdKA9KEnR5bpIvS8fcsOS562JTeGZZMnpSTs7gKj82j1wlCpo5ytbMagD9N5liLO/\n\tXSQAUXCexipm+oriGH+e79bbbF4mrfyQgeLv8gMHEqz6Jr/0stmFqZ+N//dW//ODE8Bg\n\tnnqw8c1YHGwazqlefWudDAV/Dx8eNydiC9IaL4ds7usodaz+BACxatz7dG8HyByX1kmF\n\tOSjf/ffdMk1Rx0UdEWHWX9OtJb1lgAIBEEdcgn5uHJhcwAlT/3flJibyrpDh15GAsonv\n\t4WgFjSSNvoevP6y1+CGddsXTdp+WrZCIlcIcyXDLt2DdUEiyZd64tW/qu3c8kulp0pW8\n\tqIXA==","X-Gm-Message-State":"AHPjjUgFNYD8/+mnVkPcnPy+kO7Ii6K1lqK47nzsZOV4BErAMgSEXOmk\n\t50fDUkXuaG+mKZhy4HoCIbs=","X-Google-Smtp-Source":"AOwi7QBK+RRaHrLSzQ+2Yt+SLc2jJWu7CImikxnmgQOF9VQTHV6NJL3voe6hwemCP8GVpO9+R088qA==","X-Received":"by 10.55.7.1 with SMTP id 1mr8956880qkh.175.1506100502724;\n\tFri, 22 Sep 2017 10:15:02 -0700 (PDT)","Subject":"Re: [PATCH net-next 2/4] net: dsa: remove phy arg from port\n\tenable/disable","To":"Vivien Didelot <vivien.didelot@savoirfairelinux.com>,\n\tnetdev@vger.kernel.org","Cc":"linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,\n\t\"David S. Miller\" <davem@davemloft.net>, Andrew Lunn <andrew@lunn.ch>","References":"<20170922161753.19563-1-vivien.didelot@savoirfairelinux.com>\n\t<20170922161753.19563-3-vivien.didelot@savoirfairelinux.com>","From":"Florian Fainelli <f.fainelli@gmail.com>","Message-ID":"<f8d74c3c-bd7f-8a84-2d57-c37250ff25f8@gmail.com>","Date":"Fri, 22 Sep 2017 10:14:54 -0700","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<20170922161753.19563-3-vivien.didelot@savoirfairelinux.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}},{"id":1773815,"web_url":"http://patchwork.ozlabs.org/comment/1773815/","msgid":"<87377eob5t.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>","list_archive_url":null,"date":"2017-09-22T18:12:14","subject":"Re: [PATCH net-next 2/4] net: dsa: remove phy arg from port\n\tenable/disable","submitter":{"id":15889,"url":"http://patchwork.ozlabs.org/api/people/15889/","name":"Vivien Didelot","email":"vivien.didelot@savoirfairelinux.com"},"content":"Hi Florian,\n\nFlorian Fainelli <f.fainelli@gmail.com> writes:\n\n> On 09/22/2017 09:17 AM, Vivien Didelot wrote:\n>> The .port_enable and .port_disable functions are meant to deal with the\n>> switch ports only, and no driver is using the phy argument anyway.\n>> Remove it.\n>\n> I don't think this makes sense, there are perfectly legit reasons why a\n> switch driver may have something to do with the PHY device attached to\n> its per-port network interface, we should definitively keep that around,\n> unless you think we should be accessing the PHY within the switch\n> drivers by doing:\n>\n> struct phy_device *phydev = ds->ports[port].netdev->phydev?\n\nbcm_sf2 is the only user for this phy argument right now. The reason I'm\ndoing this is because I prefer to discourage switch drivers to dig into\nthe phy device themselves while as you said there must be a cleaner\nsolution. This must be handled somehow elsewhere in the stack.\n\nIn the meantime, moving the PHY device up to the dsa_port structure is a\ngood solution, in order not to expose it in switch ops, but still make\nit available to more complex drivers.\n\nDo you know if netdev->phydev is usable? Why do DSA has its own copy in\ndsa_slave_priv then?\n\n\nI'll respin, thanks.\n\n    Vivien","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xzM9b3RzDz9sxR\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 23 Sep 2017 04:16:03 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752521AbdIVSPu (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 22 Sep 2017 14:15:50 -0400","from mail.savoirfairelinux.com ([208.88.110.44]:47562 \"EHLO\n\tmail.savoirfairelinux.com\" rhost-flags-OK-OK-OK-OK) by\n\tvger.kernel.org with ESMTP id S1751980AbdIVSPt (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 22 Sep 2017 14:15:49 -0400","from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id 146639C2C4A;\n\tFri, 22 Sep 2017 14:15:49 -0400 (EDT)","from mail.savoirfairelinux.com ([127.0.0.1])\n\tby localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new,\n\tport 10032)\n\twith ESMTP id sSStJbNlk-AW; Fri, 22 Sep 2017 14:15:48 -0400 (EDT)","from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id AA3329C2D0B;\n\tFri, 22 Sep 2017 14:15:48 -0400 (EDT)","from mail.savoirfairelinux.com ([127.0.0.1])\n\tby localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new,\n\tport 10026)\n\twith ESMTP id X5cxHSz9Jt94; Fri, 22 Sep 2017 14:15:48 -0400 (EDT)","from localhost (unknown [192.168.49.104])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTPSA id 7F68E9C2C4A;\n\tFri, 22 Sep 2017 14:15:48 -0400 (EDT)"],"X-Virus-Scanned":"amavisd-new at mail.savoirfairelinux.com","From":"Vivien Didelot <vivien.didelot@savoirfairelinux.com>","To":"Florian Fainelli <f.fainelli@gmail.com>, netdev@vger.kernel.org","Cc":"linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,\n\t\"David S. Miller\" <davem@davemloft.net>, Andrew Lunn <andrew@lunn.ch>","Subject":"Re: [PATCH net-next 2/4] net: dsa: remove phy arg from port\n\tenable/disable","In-Reply-To":"<f8d74c3c-bd7f-8a84-2d57-c37250ff25f8@gmail.com>","References":"<20170922161753.19563-1-vivien.didelot@savoirfairelinux.com>\n\t<20170922161753.19563-3-vivien.didelot@savoirfairelinux.com>\n\t<f8d74c3c-bd7f-8a84-2d57-c37250ff25f8@gmail.com>","Date":"Fri, 22 Sep 2017 14:12:14 -0400","Message-ID":"<87377eob5t.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>","MIME-Version":"1.0","Content-Type":"text/plain","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}},{"id":1773820,"web_url":"http://patchwork.ozlabs.org/comment/1773820/","msgid":"<6d7799bb-2b33-0696-1805-63cea5e52667@gmail.com>","list_archive_url":null,"date":"2017-09-22T18:23:57","subject":"Re: [PATCH net-next 2/4] net: dsa: remove phy arg from port\n\tenable/disable","submitter":{"id":2800,"url":"http://patchwork.ozlabs.org/api/people/2800/","name":"Florian Fainelli","email":"f.fainelli@gmail.com"},"content":"On 09/22/2017 11:12 AM, Vivien Didelot wrote:\n> Hi Florian,\n> \n> Florian Fainelli <f.fainelli@gmail.com> writes:\n> \n>> On 09/22/2017 09:17 AM, Vivien Didelot wrote:\n>>> The .port_enable and .port_disable functions are meant to deal with the\n>>> switch ports only, and no driver is using the phy argument anyway.\n>>> Remove it.\n>>\n>> I don't think this makes sense, there are perfectly legit reasons why a\n>> switch driver may have something to do with the PHY device attached to\n>> its per-port network interface, we should definitively keep that around,\n>> unless you think we should be accessing the PHY within the switch\n>> drivers by doing:\n>>\n>> struct phy_device *phydev = ds->ports[port].netdev->phydev?\n> \n> bcm_sf2 is the only user for this phy argument right now. The reason I'm\n> doing this is because I prefer to discourage switch drivers to dig into\n> the phy device themselves while as you said there must be a cleaner\n> solution. This must be handled somehow elsewhere in the stack.\n\nThe current approach of passing the phy_device reference as an argument\nis certainly a cleaner way then. The port_enable caller can provide the\ncorrect phy_device and that lifts the switch driver from having to dig\nit itself from its per-port netdev.\n\n> \n> In the meantime, moving the PHY device up to the dsa_port structure is a\n> good solution, in order not to expose it in switch ops, but still make\n> it available to more complex drivers.\n> \n> Do you know if netdev->phydev is usable? Why do DSA has its own copy in\n> dsa_slave_priv then?\n\nHistorical reasons mostly. Considering the complexity of\ndsa_slave_phy_setup(), I would certainly be extremely careful in\nchanging any of this, the potential for breakage is pretty big. At first\nglance, I would say that this is a safe conversion to do, and I can test\nthis on the HW I have here anyway.","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"tEJc0l4w\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xzMM51Xdkz9t32\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 23 Sep 2017 04:24:17 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751861AbdIVSYF (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 22 Sep 2017 14:24:05 -0400","from mail-qk0-f194.google.com ([209.85.220.194]:33898 \"EHLO\n\tmail-qk0-f194.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751795AbdIVSYD (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 22 Sep 2017 14:24:03 -0400","by mail-qk0-f194.google.com with SMTP id d70so1147407qkc.1;\n\tFri, 22 Sep 2017 11:24:03 -0700 (PDT)","from [10.112.156.244] ([192.19.255.250])\n\tby smtp.googlemail.com with ESMTPSA id\n\tz195sm335193qkz.42.2017.09.22.11.23.59\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 22 Sep 2017 11:24:01 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=Gv5GVyf+kMHNVsc7NQv3YPoNwRpaKvTHvcQcrRR+E4A=;\n\tb=tEJc0l4wAGBY3uOXjg/77dLBjGoq3mofokAGU6fc4PoXULW4q2ZwOQqfjYIg1/AtgE\n\tjoXr6IuwijAa2kUZkhLwliJNpawc9s24RW/DDIiIuc5/BfKVWbuyJRR23q2AgiVyppzF\n\tZKJip0qrbzW+Al2Ln579ZMKh033Y40oq8CkfctcfiYjmcf5IpunKpHkbSqk4ouwvs+Xv\n\tR9xuGxizX+rfIerYiC87t1m4Y7Wj/iOwIacv/JMsWmGKHP3SfiRTaL/2uvnx9rPjgNpS\n\tli806ZDu/ynzvsc+awKjMVaQK2WFNeXn074hZkRfcKr5twjRBuXPvPbxTJFyXN2TTZRn\n\tA/cQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:subject:to:cc:references:from:message-id:date\n\t:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=Gv5GVyf+kMHNVsc7NQv3YPoNwRpaKvTHvcQcrRR+E4A=;\n\tb=gBN2XgVRIkLLsuinUCcFXVDG4yYr5leEhrOAjCz6FehoKcbLREMDbn7vwY+yPECsP1\n\tZRXBuS1LtH7Ir/tsVVF/3+KLKvLKV5Cavyq1FktMr9BqhPLRoGX7X6gXoHhJVMPy0Lk/\n\tlqxp/UP68o2Jxkol2jJxmOXstPGgSCE7D9S0BRfkJkWb4uTZ+khVaDG30qvqlX7HaWNm\n\tQ8n6HXGYQLGL0RVaxRf37ycC7ZBhXdF+12GfvlZTvTxoxLfn+klhjcp7YXgOC/RT9BzC\n\twqa1UxyF+yiIyLm192guqV4NR8IbncJPU+GwIIK7mT4nODJNDGoqNGy6vJwmrEVbryNm\n\tfcfQ==","X-Gm-Message-State":"AHPjjUgkJYffTm0exDKNqSD50tsCNctF6hMgzptUNsgDOZZwC2w3kiUr\n\te3Rv5cc/ogrshq0/gGLpcy7XTgNs","X-Google-Smtp-Source":"AOwi7QA0IPg01zyGrLgfkJZ1ipzluAxd60rPvjz+CrLUs8pmsUP8jvin8/EI0PbESLb0nDk9J2SheQ==","X-Received":"by 10.55.178.68 with SMTP id b65mr55859qkf.155.1506104642712;\n\tFri, 22 Sep 2017 11:24:02 -0700 (PDT)","Subject":"Re: [PATCH net-next 2/4] net: dsa: remove phy arg from port\n\tenable/disable","To":"Vivien Didelot <vivien.didelot@savoirfairelinux.com>,\n\tnetdev@vger.kernel.org","Cc":"linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,\n\t\"David S. Miller\" <davem@davemloft.net>, Andrew Lunn <andrew@lunn.ch>","References":"<20170922161753.19563-1-vivien.didelot@savoirfairelinux.com>\n\t<20170922161753.19563-3-vivien.didelot@savoirfairelinux.com>\n\t<f8d74c3c-bd7f-8a84-2d57-c37250ff25f8@gmail.com>\n\t<87377eob5t.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>","From":"Florian Fainelli <f.fainelli@gmail.com>","Message-ID":"<6d7799bb-2b33-0696-1805-63cea5e52667@gmail.com>","Date":"Fri, 22 Sep 2017 11:23:57 -0700","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<87377eob5t.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"8bit","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}},{"id":1773834,"web_url":"http://patchwork.ozlabs.org/comment/1773834/","msgid":"<20170922191105.GF3470@lunn.ch>","list_archive_url":null,"date":"2017-09-22T19:11:05","subject":"Re: [PATCH net-next 2/4] net: dsa: remove phy arg from port\n\tenable/disable","submitter":{"id":13608,"url":"http://patchwork.ozlabs.org/api/people/13608/","name":"Andrew Lunn","email":"andrew@lunn.ch"},"content":"> Historical reasons mostly. Considering the complexity of\n> dsa_slave_phy_setup(), I would certainly be extremely careful in\n> changing any of this, the potential for breakage is pretty big.\n\nYes, i took a look at this, wondering how to convert to phylink. I\nwent away and got a stiff drink :-)\n\n     Andrew","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xzNT44fvKz9sNw\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 23 Sep 2017 05:14:29 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751911AbdIVTLK (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 22 Sep 2017 15:11:10 -0400","from vps0.lunn.ch ([185.16.172.187]:52816 \"EHLO vps0.lunn.ch\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751795AbdIVTLJ (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tFri, 22 Sep 2017 15:11:09 -0400","from andrew by vps0.lunn.ch with local (Exim 4.84_2)\n\t(envelope-from <andrew@lunn.ch>)\n\tid 1dvTLt-00027O-PA; Fri, 22 Sep 2017 21:11:05 +0200"],"Date":"Fri, 22 Sep 2017 21:11:05 +0200","From":"Andrew Lunn <andrew@lunn.ch>","To":"Florian Fainelli <f.fainelli@gmail.com>","Cc":"Vivien Didelot <vivien.didelot@savoirfairelinux.com>,\n\tnetdev@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tkernel@savoirfairelinux.com, \"David S. Miller\" <davem@davemloft.net>","Subject":"Re: [PATCH net-next 2/4] net: dsa: remove phy arg from port\n\tenable/disable","Message-ID":"<20170922191105.GF3470@lunn.ch>","References":"<20170922161753.19563-1-vivien.didelot@savoirfairelinux.com>\n\t<20170922161753.19563-3-vivien.didelot@savoirfairelinux.com>\n\t<f8d74c3c-bd7f-8a84-2d57-c37250ff25f8@gmail.com>\n\t<87377eob5t.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>\n\t<6d7799bb-2b33-0696-1805-63cea5e52667@gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<6d7799bb-2b33-0696-1805-63cea5e52667@gmail.com>","User-Agent":"Mutt/1.5.23 (2014-03-12)","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}}]