#define _RTL8366_SMI_H
#include <linux/phy.h>
+#include <linux/switch.h>
struct rtl8366_smi_ops;
struct rtl8366_vlan_ops;
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;
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 */
#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"
struct rtl8366rb {
struct device *parent;
struct rtl8366_smi smi;
- struct switch_dev dev;
};
static struct rtl8366_mib_counter rtl8366rb_mib_counters[] = {
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)
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));
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)
#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"
struct rtl8366s {
struct device *parent;
struct rtl8366_smi smi;
- struct switch_dev dev;
};
static struct rtl8366_mib_counter rtl8366s_mib_counters[] = {
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)
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));
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)