aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files/drivers
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2010-07-15 13:05:06 +0000
committerGabor Juhos <juhosg@openwrt.org>2010-07-15 13:05:06 +0000
commit008c81b85905f78112a4bfac13b0f39da2051808 (patch)
tree99171a794a0053b5a9efef549c3cd1a07cc68051 /target/linux/generic/files/drivers
parent5508b23aafc682e014538ea437d8567e6fd1346b (diff)
downloadupstream-008c81b85905f78112a4bfac13b0f39da2051808.tar.gz
upstream-008c81b85905f78112a4bfac13b0f39da2051808.tar.bz2
upstream-008c81b85905f78112a4bfac13b0f39da2051808.zip
generic: rtl8366: move switch device to the rtl8366_smi struct
SVN-Revision: 22193
Diffstat (limited to 'target/linux/generic/files/drivers')
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366_smi.h7
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366rb.c15
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366s.c15
3 files changed, 15 insertions, 22 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h
index 3b639f2b69..bd16cbe55e 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.h
@@ -12,6 +12,7 @@
#define _RTL8366_SMI_H
#include <linux/phy.h>
+#include <linux/switch.h>
struct rtl8366_smi_ops;
struct rtl8366_vlan_ops;
@@ -34,6 +35,7 @@ struct rtl8366_smi {
spinlock_t lock;
struct mii_bus *mii_bus;
int mii_irq[PHY_MAX_ADDR];
+ struct switch_dev sw_dev;
unsigned int cpu_port;
unsigned int num_ports;
@@ -101,4 +103,9 @@ int rtl8366_set_pvid(struct rtl8366_smi *smi, unsigned port, unsigned vid);
int rtl8366_debugfs_open(struct inode *inode, struct file *file);
#endif
+static inline struct rtl8366_smi *sw_to_rtl8366_smi(struct switch_dev *sw)
+{
+ return container_of(sw, struct rtl8366_smi, sw_dev);
+}
+
#endif /* _RTL8366_SMI_H */
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
index f23ec2152a..6dbed04056 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
@@ -15,7 +15,6 @@
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/skbuff.h>
-#include <linux/switch.h>
#include <linux/rtl8366rb.h>
#include "rtl8366_smi.h"
@@ -167,7 +166,6 @@
struct rtl8366rb {
struct device *parent;
struct rtl8366_smi smi;
- struct switch_dev dev;
};
static struct rtl8366_mib_counter rtl8366rb_mib_counters[] = {
@@ -227,13 +225,8 @@ static inline struct rtl8366rb *smi_to_rtl8366rb(struct rtl8366_smi *smi)
static inline struct rtl8366rb *sw_to_rtl8366rb(struct switch_dev *sw)
{
- return container_of(sw, struct rtl8366rb, dev);
-}
-
-static inline struct rtl8366_smi *sw_to_rtl8366_smi(struct switch_dev *sw)
-{
- struct rtl8366rb *rtl = sw_to_rtl8366rb(sw);
- return &rtl->smi;
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(sw);
+ return smi_to_rtl8366rb(smi);
}
static int rtl8366rb_reset_chip(struct rtl8366_smi *smi)
@@ -1028,7 +1021,7 @@ static struct switch_dev rtl8366_switch_dev = {
static int rtl8366rb_switch_init(struct rtl8366rb *rtl)
{
- struct switch_dev *dev = &rtl->dev;
+ struct switch_dev *dev = &rtl->smi.sw_dev;
int err;
memcpy(dev, &rtl8366_switch_dev, sizeof(struct switch_dev));
@@ -1044,7 +1037,7 @@ static int rtl8366rb_switch_init(struct rtl8366rb *rtl)
static void rtl8366rb_switch_cleanup(struct rtl8366rb *rtl)
{
- unregister_switch(&rtl->dev);
+ unregister_switch(&rtl->smi.sw_dev);
}
static int rtl8366rb_mii_read(struct mii_bus *bus, int addr, int reg)
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366s.c b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
index 4936ceadff..0d1291ad6e 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366s.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
@@ -15,7 +15,6 @@
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/skbuff.h>
-#include <linux/switch.h>
#include <linux/rtl8366s.h>
#include "rtl8366_smi.h"
@@ -173,7 +172,6 @@
struct rtl8366s {
struct device *parent;
struct rtl8366_smi smi;
- struct switch_dev dev;
};
static struct rtl8366_mib_counter rtl8366s_mib_counters[] = {
@@ -238,13 +236,8 @@ static inline struct rtl8366s *smi_to_rtl8366s(struct rtl8366_smi *smi)
static inline struct rtl8366s *sw_to_rtl8366s(struct switch_dev *sw)
{
- return container_of(sw, struct rtl8366s, dev);
-}
-
-static inline struct rtl8366_smi *sw_to_rtl8366_smi(struct switch_dev *sw)
-{
- struct rtl8366s *rtl = sw_to_rtl8366s(sw);
- return &rtl->smi;
+ struct rtl8366_smi *smi = sw_to_rtl8366_smi(sw);
+ return smi_to_rtl8366s(smi);
}
static int rtl8366s_reset_chip(struct rtl8366_smi *smi)
@@ -1055,7 +1048,7 @@ static struct switch_dev rtl8366_switch_dev = {
static int rtl8366s_switch_init(struct rtl8366s *rtl)
{
- struct switch_dev *dev = &rtl->dev;
+ struct switch_dev *dev = &rtl->smi.sw_dev;
int err;
memcpy(dev, &rtl8366_switch_dev, sizeof(struct switch_dev));
@@ -1071,7 +1064,7 @@ static int rtl8366s_switch_init(struct rtl8366s *rtl)
static void rtl8366s_switch_cleanup(struct rtl8366s *rtl)
{
- unregister_switch(&rtl->dev);
+ unregister_switch(&rtl->smi.sw_dev);
}
static int rtl8366s_mii_read(struct mii_bus *bus, int addr, int reg)