From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756631AbdGXPng (ORCPT ); Mon, 24 Jul 2017 11:43:36 -0400 Received: from mail1.bemta3.messagelabs.com ([195.245.230.177]:52560 "EHLO mail1.bemta3.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756573AbdGXPnH (ORCPT ); Mon, 24 Jul 2017 11:43:07 -0400 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNIsWRWlGSWpSXmKPExsVyeL7SP9120bJ Ig+sHxSzO3z3EbPHkQDujxZzzLSwWv94dYbdYNXUni8XCtiUsFpd3zWGzOLZAzGLWkf1MDpwe W1beZPLYOesuu8fOHZ+ZPBb3TWb16P9r4HFl41wmj8+b5ALYo1gz85LyKxJYM3pOrGAseMNVM ffnAdYGxq2cXYxcHEICaxkl7k5bwgLhLGCUODbhA2sXIycHm4CxxK7pm5lAbBYBVYkTF9+xg9 jCAs4SvZe3sII0iAi8Z5T4MHsXWBGzgKLEqufnmUFsXgFBiZMzn7BAxCUkDr54ARV3k5jcthW sXkhARmLykslANgeHhIC8xLkDRSBhCYE4iU1rXzBPYOSdhWTSLCSTFjAyrWJUL04tKkst0jXU SyrKTM8oyU3MzNE1NDDWy00tLk5MT81JTCrWS87P3cQIDGIGINjBuPyj0yFGSQ4mJVFeIaayS CG+pPyUyozE4oz4otKc1OJDjDIcHEoSvGIiQDnBotT01Iq0zBxgPMGkJTh4lER4hUDSvMUFib nFmekQqVOMxhxT/q/5wsTRMePnNyYhlrz8vFQpcd5PwkClAiClGaV5cINgcX6JUVZKmJcR6DQ hnoLUotzMElT5V4ziHIxKwrzXQKbwZOaVwO17BXQKE9Apc2aUgpxSkoiQkmpgTE+PSfTecXvp u5vZU46ef/9ocsimu+2/Fy6UuVqo6unwwDvsL5fw/v/PVVc5HeaJZzie+oVX/ODM/fK7KtSWe N1ayvG2qtjqrctyzdhGn+h2/WWzou5/fPTtgO8SJtGJGdNe+jw94zXXxii+5P8pN+7cb4KFep 2fv93bvDTlWI/2vxXTHL02hyqxFGckGmoxFxUnAgDhaDIf7gIAAA== X-Env-Sender: Egil.Hjelmeland@zenitel.com X-Msg-Ref: server-8.tower-39.messagelabs.com!1500910981!91674690!2 X-Originating-IP: [195.159.34.254] X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=zenitel.com,-,- X-VirusChecked: Checked From: Egil Hjelmeland Date: Wed, 14 Jun 2017 13:26:38 +0200 Subject: [PATCH 05/13] net: dsa: added dsa_net_device_to_dsa_port() To: , , , , , , , , CC: MIME-Version: 1.0 Content-Type: text/plain Message-ID: <48444b4b8fa14962b372caaf5027782e@nooslMX1.zenitelcss.com> X-Originating-IP: [10.5.202.90] X-ClientProxiedBy: nooslMX1.zenitelcss.com (10.5.2.91) To nooslMX1.zenitelcss.com (10.5.2.91) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allowing dsa drivers to attach sysfs nodes. Signed-off-by: Egil Hjelmeland --- include/net/dsa.h | 1 + net/dsa/slave.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 88da272d20d0..a71c0a2401ee 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -450,6 +450,7 @@ void unregister_switch_driver(struct dsa_switch_driver *type); struct mii_bus *dsa_host_dev_to_mii_bus(struct device *dev); struct net_device *dsa_dev_to_net_device(struct device *dev); +struct dsa_port *dsa_net_device_to_dsa_port(struct net_device *dev); /* Keep inline for faster access in hot path */ static inline bool netdev_uses_dsa(struct net_device *dev) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 9507bd38cf04..40410f1740de 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -209,6 +209,16 @@ static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) return -EOPNOTSUPP; } +struct dsa_port *dsa_net_device_to_dsa_port(struct net_device *dev) +{ + struct dsa_slave_priv *p = netdev_priv(dev); + + if (!dsa_slave_dev_check(dev)) + return NULL; + return p->dp; +} +EXPORT_SYMBOL_GPL(dsa_net_device_to_dsa_port); + static int dsa_slave_port_attr_set(struct net_device *dev, const struct switchdev_attr *attr, struct switchdev_trans *trans) -- 2.11.0 DISCLAIMER: This e-mail may contain confidential and privileged material for the sole use of the intended recipient. Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply e-mail and delete all copies of this message.