Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/818831/?format=api
{ "id": 818831, "url": "http://patchwork.ozlabs.org/api/patches/818831/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170926211535.21273-3-vivien.didelot@savoirfairelinux.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170926211535.21273-3-vivien.didelot@savoirfairelinux.com>", "list_archive_url": null, "date": "2017-09-26T21:15:32", "name": "[net-next,2/5] net: dsa: use slave device phydev", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "cc68ed05cca7a068105bceab09adc206981088c7", "submitter": { "id": 15889, "url": "http://patchwork.ozlabs.org/api/people/15889/?format=api", "name": "Vivien Didelot", "email": "vivien.didelot@savoirfairelinux.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170926211535.21273-3-vivien.didelot@savoirfairelinux.com/mbox/", "series": [ { "id": 5231, "url": "http://patchwork.ozlabs.org/api/series/5231/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=5231", "date": "2017-09-26T21:15:33", "name": "net: dsa: use generic slave phydev", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/5231/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/818831/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/818831/checks/", "tags": {}, "related": [], "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 3y1v3S6dlPz9sRq\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 27 Sep 2017 07:19:32 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S937440AbdIZVTa (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 26 Sep 2017 17:19:30 -0400", "from mail.savoirfairelinux.com ([208.88.110.44]:41230 \"EHLO\n\tmail.savoirfairelinux.com\" rhost-flags-OK-OK-OK-OK) by\n\tvger.kernel.org with ESMTP id S937274AbdIZVTZ (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Tue, 26 Sep 2017 17:19:25 -0400", "from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id 3BDFC9C2D89;\n\tTue, 26 Sep 2017 17:19:25 -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 vAIT5pbb3YyE; Tue, 26 Sep 2017 17:19:23 -0400 (EDT)", "from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id 250AA9C2DAC;\n\tTue, 26 Sep 2017 17:19:23 -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 FYH9KkrcNuxF; Tue, 26 Sep 2017 17:19:22 -0400 (EDT)", "from weeman.mtl.sfl (unknown [192.168.49.104])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTPSA id DF3A79C2D9C;\n\tTue, 26 Sep 2017 17:19:22 -0400 (EDT)" ], "X-Virus-Scanned": "amavisd-new at mail.savoirfairelinux.com", "From": "Vivien Didelot <vivien.didelot@savoirfairelinux.com>", "To": "netdev@vger.kernel.org", "Cc": "linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,\n\t\"David S. Miller\" <davem@davemloft.net>,\n\tFlorian Fainelli <f.fainelli@gmail.com>, Andrew Lunn <andrew@lunn.ch>,\n\tVivien Didelot <vivien.didelot@savoirfairelinux.com>", "Subject": "[PATCH net-next 2/5] net: dsa: use slave device phydev", "Date": "Tue, 26 Sep 2017 17:15:32 -0400", "Message-Id": "<20170926211535.21273-3-vivien.didelot@savoirfairelinux.com>", "X-Mailer": "git-send-email 2.14.1", "In-Reply-To": "<20170926211535.21273-1-vivien.didelot@savoirfairelinux.com>", "References": "<20170926211535.21273-1-vivien.didelot@savoirfairelinux.com>", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "There is no need to store a phy_device in dsa_slave_priv since\nnet_device already provides one. Simply s/p->phy/dev->phydev/.\n\nSigned-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>\n---\n net/dsa/dsa_priv.h | 1 -\n net/dsa/slave.c | 116 ++++++++++++++++++++++++-----------------------------\n 2 files changed, 53 insertions(+), 64 deletions(-)", "diff": "diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h\nindex 0298a0f6a349..eccc62776283 100644\n--- a/net/dsa/dsa_priv.h\n+++ b/net/dsa/dsa_priv.h\n@@ -79,7 +79,6 @@ struct dsa_slave_priv {\n \t * The phylib phy_device pointer for the PHY connected\n \t * to this port.\n \t */\n-\tstruct phy_device\t*phy;\n \tphy_interface_t\t\tphy_interface;\n \tint\t\t\told_link;\n \tint\t\t\told_pause;\ndiff --git a/net/dsa/slave.c b/net/dsa/slave.c\nindex 79c5a0cd9923..4ea1c6eb0da8 100644\n--- a/net/dsa/slave.c\n+++ b/net/dsa/slave.c\n@@ -96,12 +96,12 @@ static int dsa_slave_open(struct net_device *dev)\n \t\t\tgoto clear_allmulti;\n \t}\n \n-\terr = dsa_port_enable(dp, p->phy);\n+\terr = dsa_port_enable(dp, dev->phydev);\n \tif (err)\n \t\tgoto clear_promisc;\n \n-\tif (p->phy)\n-\t\tphy_start(p->phy);\n+\tif (dev->phydev)\n+\t\tphy_start(dev->phydev);\n \n \treturn 0;\n \n@@ -124,10 +124,10 @@ static int dsa_slave_close(struct net_device *dev)\n \tstruct net_device *master = dsa_master_netdev(p);\n \tstruct dsa_port *dp = p->dp;\n \n-\tif (p->phy)\n-\t\tphy_stop(p->phy);\n+\tif (dev->phydev)\n+\t\tphy_stop(dev->phydev);\n \n-\tdsa_port_disable(dp, p->phy);\n+\tdsa_port_disable(dp, dev->phydev);\n \n \tdev_mc_unsync(master, dev);\n \tdev_uc_unsync(master, dev);\n@@ -264,12 +264,10 @@ dsa_slave_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb,\n \n static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)\n {\n-\tstruct dsa_slave_priv *p = netdev_priv(dev);\n-\n-\tif (!p->phy)\n+\tif (!dev->phydev)\n \t\treturn -ENODEV;\n \n-\treturn phy_mii_ioctl(p->phy, ifr, cmd);\n+\treturn phy_mii_ioctl(dev->phydev, ifr, cmd);\n }\n \n static int dsa_slave_port_attr_set(struct net_device *dev,\n@@ -426,12 +424,10 @@ static int\n dsa_slave_get_link_ksettings(struct net_device *dev,\n \t\t\t struct ethtool_link_ksettings *cmd)\n {\n-\tstruct dsa_slave_priv *p = netdev_priv(dev);\n-\n-\tif (!p->phy)\n+\tif (!dev->phydev)\n \t\treturn -ENODEV;\n \n-\tphy_ethtool_ksettings_get(p->phy, cmd);\n+\tphy_ethtool_ksettings_get(dev->phydev, cmd);\n \n \treturn 0;\n }\n@@ -440,12 +436,10 @@ static int\n dsa_slave_set_link_ksettings(struct net_device *dev,\n \t\t\t const struct ethtool_link_ksettings *cmd)\n {\n-\tstruct dsa_slave_priv *p = netdev_priv(dev);\n-\n-\tif (!p->phy)\n+\tif (!dev->phydev)\n \t\treturn -ENODEV;\n \n-\treturn phy_ethtool_ksettings_set(p->phy, cmd);\n+\treturn phy_ethtool_ksettings_set(dev->phydev, cmd);\n }\n \n static void dsa_slave_get_drvinfo(struct net_device *dev,\n@@ -479,24 +473,20 @@ dsa_slave_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *_p)\n \n static int dsa_slave_nway_reset(struct net_device *dev)\n {\n-\tstruct dsa_slave_priv *p = netdev_priv(dev);\n-\n-\tif (!p->phy)\n+\tif (!dev->phydev)\n \t\treturn -ENODEV;\n \n-\treturn genphy_restart_aneg(p->phy);\n+\treturn genphy_restart_aneg(dev->phydev);\n }\n \n static u32 dsa_slave_get_link(struct net_device *dev)\n {\n-\tstruct dsa_slave_priv *p = netdev_priv(dev);\n-\n-\tif (!p->phy)\n+\tif (!dev->phydev)\n \t\treturn -ENODEV;\n \n-\tgenphy_update_link(p->phy);\n+\tgenphy_update_link(dev->phydev);\n \n-\treturn p->phy->link;\n+\treturn dev->phydev->link;\n }\n \n static int dsa_slave_get_eeprom_len(struct net_device *dev)\n@@ -631,7 +621,7 @@ static int dsa_slave_set_eee(struct net_device *dev, struct ethtool_eee *e)\n \tint ret;\n \n \t/* Port's PHY and MAC both need to be EEE capable */\n-\tif (!p->phy)\n+\tif (!dev->phydev)\n \t\treturn -ENODEV;\n \n \tif (!ds->ops->set_mac_eee)\n@@ -642,12 +632,12 @@ static int dsa_slave_set_eee(struct net_device *dev, struct ethtool_eee *e)\n \t\treturn ret;\n \n \tif (e->eee_enabled) {\n-\t\tret = phy_init_eee(p->phy, 0);\n+\t\tret = phy_init_eee(dev->phydev, 0);\n \t\tif (ret)\n \t\t\treturn ret;\n \t}\n \n-\treturn phy_ethtool_set_eee(p->phy, e);\n+\treturn phy_ethtool_set_eee(dev->phydev, e);\n }\n \n static int dsa_slave_get_eee(struct net_device *dev, struct ethtool_eee *e)\n@@ -657,7 +647,7 @@ static int dsa_slave_get_eee(struct net_device *dev, struct ethtool_eee *e)\n \tint ret;\n \n \t/* Port's PHY and MAC both need to be EEE capable */\n-\tif (!p->phy)\n+\tif (!dev->phydev)\n \t\treturn -ENODEV;\n \n \tif (!ds->ops->get_mac_eee)\n@@ -667,7 +657,7 @@ static int dsa_slave_get_eee(struct net_device *dev, struct ethtool_eee *e)\n \tif (ret)\n \t\treturn ret;\n \n-\treturn phy_ethtool_get_eee(p->phy, e);\n+\treturn phy_ethtool_get_eee(dev->phydev, e);\n }\n \n #ifdef CONFIG_NET_POLL_CONTROLLER\n@@ -976,26 +966,26 @@ static void dsa_slave_adjust_link(struct net_device *dev)\n \tstruct dsa_switch *ds = p->dp->ds;\n \tunsigned int status_changed = 0;\n \n-\tif (p->old_link != p->phy->link) {\n+\tif (p->old_link != dev->phydev->link) {\n \t\tstatus_changed = 1;\n-\t\tp->old_link = p->phy->link;\n+\t\tp->old_link = dev->phydev->link;\n \t}\n \n-\tif (p->old_duplex != p->phy->duplex) {\n+\tif (p->old_duplex != dev->phydev->duplex) {\n \t\tstatus_changed = 1;\n-\t\tp->old_duplex = p->phy->duplex;\n+\t\tp->old_duplex = dev->phydev->duplex;\n \t}\n \n-\tif (p->old_pause != p->phy->pause) {\n+\tif (p->old_pause != dev->phydev->pause) {\n \t\tstatus_changed = 1;\n-\t\tp->old_pause = p->phy->pause;\n+\t\tp->old_pause = dev->phydev->pause;\n \t}\n \n \tif (ds->ops->adjust_link && status_changed)\n-\t\tds->ops->adjust_link(ds, p->dp->index, p->phy);\n+\t\tds->ops->adjust_link(ds, p->dp->index, dev->phydev);\n \n \tif (status_changed)\n-\t\tphy_print_status(p->phy);\n+\t\tphy_print_status(dev->phydev);\n }\n \n static int dsa_slave_fixed_link_update(struct net_device *dev,\n@@ -1020,17 +1010,18 @@ static int dsa_slave_phy_connect(struct net_device *slave_dev, int addr)\n \tstruct dsa_slave_priv *p = netdev_priv(slave_dev);\n \tstruct dsa_switch *ds = p->dp->ds;\n \n-\tp->phy = mdiobus_get_phy(ds->slave_mii_bus, addr);\n-\tif (!p->phy) {\n+\tslave_dev->phydev = mdiobus_get_phy(ds->slave_mii_bus, addr);\n+\tif (!slave_dev->phydev) {\n \t\tnetdev_err(slave_dev, \"no phy at %d\\n\", addr);\n \t\treturn -ENODEV;\n \t}\n \n \t/* Use already configured phy mode */\n \tif (p->phy_interface == PHY_INTERFACE_MODE_NA)\n-\t\tp->phy_interface = p->phy->interface;\n-\treturn phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link,\n-\t\t\t\t p->phy_interface);\n+\t\tp->phy_interface = slave_dev->phydev->interface;\n+\n+\treturn phy_connect_direct(slave_dev, slave_dev->phydev,\n+\t\t\t\t dsa_slave_adjust_link, p->phy_interface);\n }\n \n static int dsa_slave_phy_setup(struct net_device *slave_dev)\n@@ -1082,22 +1073,23 @@ static int dsa_slave_phy_setup(struct net_device *slave_dev)\n \t\t\t\treturn ret;\n \t\t\t}\n \t\t} else {\n-\t\t\tp->phy = of_phy_connect(slave_dev, phy_dn,\n-\t\t\t\t\t\tdsa_slave_adjust_link,\n-\t\t\t\t\t\tphy_flags,\n-\t\t\t\t\t\tp->phy_interface);\n+\t\t\tslave_dev->phydev = of_phy_connect(slave_dev, phy_dn,\n+\t\t\t\t\t\t\t dsa_slave_adjust_link,\n+\t\t\t\t\t\t\t phy_flags,\n+\t\t\t\t\t\t\t p->phy_interface);\n \t\t}\n \n \t\tof_node_put(phy_dn);\n \t}\n \n-\tif (p->phy && phy_is_fixed)\n-\t\tfixed_phy_set_link_update(p->phy, dsa_slave_fixed_link_update);\n+\tif (slave_dev->phydev && phy_is_fixed)\n+\t\tfixed_phy_set_link_update(slave_dev->phydev,\n+\t\t\t\t\t dsa_slave_fixed_link_update);\n \n \t/* We could not connect to a designated PHY, so use the switch internal\n \t * MDIO bus instead\n \t */\n-\tif (!p->phy) {\n+\tif (!slave_dev->phydev) {\n \t\tret = dsa_slave_phy_connect(slave_dev, p->dp->index);\n \t\tif (ret) {\n \t\t\tnetdev_err(slave_dev, \"failed to connect to port %d: %d\\n\",\n@@ -1108,7 +1100,7 @@ static int dsa_slave_phy_setup(struct net_device *slave_dev)\n \t\t}\n \t}\n \n-\tphy_attached_info(p->phy);\n+\tphy_attached_info(slave_dev->phydev);\n \n \treturn 0;\n }\n@@ -1128,12 +1120,12 @@ int dsa_slave_suspend(struct net_device *slave_dev)\n \n \tnetif_device_detach(slave_dev);\n \n-\tif (p->phy) {\n-\t\tphy_stop(p->phy);\n+\tif (slave_dev->phydev) {\n+\t\tphy_stop(slave_dev->phydev);\n \t\tp->old_pause = -1;\n \t\tp->old_link = -1;\n \t\tp->old_duplex = -1;\n-\t\tphy_suspend(p->phy);\n+\t\tphy_suspend(slave_dev->phydev);\n \t}\n \n \treturn 0;\n@@ -1141,13 +1133,11 @@ int dsa_slave_suspend(struct net_device *slave_dev)\n \n int dsa_slave_resume(struct net_device *slave_dev)\n {\n-\tstruct dsa_slave_priv *p = netdev_priv(slave_dev);\n-\n \tnetif_device_attach(slave_dev);\n \n-\tif (p->phy) {\n-\t\tphy_resume(p->phy);\n-\t\tphy_start(p->phy);\n+\tif (slave_dev->phydev) {\n+\t\tphy_resume(slave_dev->phydev);\n+\t\tphy_start(slave_dev->phydev);\n \t}\n \n \treturn 0;\n@@ -1240,8 +1230,8 @@ void dsa_slave_destroy(struct net_device *slave_dev)\n \tport_dn = p->dp->dn;\n \n \tnetif_carrier_off(slave_dev);\n-\tif (p->phy) {\n-\t\tphy_disconnect(p->phy);\n+\tif (slave_dev->phydev) {\n+\t\tphy_disconnect(slave_dev->phydev);\n \n \t\tif (of_phy_is_fixed_link(port_dn))\n \t\t\tof_phy_deregister_fixed_link(port_dn);\n", "prefixes": [ "net-next", "2/5" ] }