{"id":818835,"url":"http://patchwork.ozlabs.org/api/patches/818835/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170926211535.21273-2-vivien.didelot@savoirfairelinux.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/projects/7/?format=json","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-2-vivien.didelot@savoirfairelinux.com>","list_archive_url":null,"date":"2017-09-26T21:15:31","name":"[net-next,1/5] net: dsa: return -ENODEV is there is no slave PHY","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"b8db8de78ea382b1c9e5a7ecb5e8d7cebf68bd04","submitter":{"id":15889,"url":"http://patchwork.ozlabs.org/api/people/15889/?format=json","name":"Vivien Didelot","email":"vivien.didelot@savoirfairelinux.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170926211535.21273-2-vivien.didelot@savoirfairelinux.com/mbox/","series":[{"id":5231,"url":"http://patchwork.ozlabs.org/api/series/5231/?format=json","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/818835/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/818835/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 3y1v5S2Tpbz9sRq\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 27 Sep 2017 07:21:16 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S937492AbdIZVVF (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 26 Sep 2017 17:21:05 -0400","from mail.savoirfairelinux.com ([208.88.110.44]:41238 \"EHLO\n\tmail.savoirfairelinux.com\" rhost-flags-OK-OK-OK-OK) by\n\tvger.kernel.org with ESMTP id S937313AbdIZVT0 (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Tue, 26 Sep 2017 17:19:26 -0400","from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id C406F9C2DA4;\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 MedWutz5Vkux; 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 0AAFF9C2DAB;\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 HlLOv-IwSpsi; 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 D90709C2D89;\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 1/5] net: dsa: return -ENODEV is there is no slave\n\tPHY","Date":"Tue, 26 Sep 2017 17:15:31 -0400","Message-Id":"<20170926211535.21273-2-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":"Instead of returning -EOPNOTSUPP when a slave device has no PHY,\ndirectly return -ENODEV as ethtool and phylib do.\n\nSigned-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>\n---\n net/dsa/slave.c | 30 +++++++++++++++---------------\n 1 file changed, 15 insertions(+), 15 deletions(-)","diff":"diff --git a/net/dsa/slave.c b/net/dsa/slave.c\nindex bd51ef56ec5b..79c5a0cd9923 100644\n--- a/net/dsa/slave.c\n+++ b/net/dsa/slave.c\n@@ -266,10 +266,10 @@ 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 != NULL)\n-\t\treturn phy_mii_ioctl(p->phy, ifr, cmd);\n+\tif (!p->phy)\n+\t\treturn -ENODEV;\n \n-\treturn -EOPNOTSUPP;\n+\treturn phy_mii_ioctl(p->phy, ifr, cmd);\n }\n \n static int dsa_slave_port_attr_set(struct net_device *dev,\n@@ -429,7 +429,7 @@ dsa_slave_get_link_ksettings(struct net_device *dev,\n \tstruct dsa_slave_priv *p = netdev_priv(dev);\n \n \tif (!p->phy)\n-\t\treturn -EOPNOTSUPP;\n+\t\treturn -ENODEV;\n \n \tphy_ethtool_ksettings_get(p->phy, cmd);\n \n@@ -442,10 +442,10 @@ dsa_slave_set_link_ksettings(struct net_device *dev,\n {\n \tstruct dsa_slave_priv *p = netdev_priv(dev);\n \n-\tif (p->phy != NULL)\n-\t\treturn phy_ethtool_ksettings_set(p->phy, cmd);\n+\tif (!p->phy)\n+\t\treturn -ENODEV;\n \n-\treturn -EOPNOTSUPP;\n+\treturn phy_ethtool_ksettings_set(p->phy, cmd);\n }\n \n static void dsa_slave_get_drvinfo(struct net_device *dev,\n@@ -481,22 +481,22 @@ 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 != NULL)\n-\t\treturn genphy_restart_aneg(p->phy);\n+\tif (!p->phy)\n+\t\treturn -ENODEV;\n \n-\treturn -EOPNOTSUPP;\n+\treturn genphy_restart_aneg(p->phy);\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 != NULL) {\n-\t\tgenphy_update_link(p->phy);\n-\t\treturn p->phy->link;\n-\t}\n+\tif (!p->phy)\n+\t\treturn -ENODEV;\n \n-\treturn -EOPNOTSUPP;\n+\tgenphy_update_link(p->phy);\n+\n+\treturn p->phy->link;\n }\n \n static int dsa_slave_get_eeprom_len(struct net_device *dev)\n","prefixes":["net-next","1/5"]}