u16 g_dbg_reg;
#endif
-#define to_rtl8366(_dev) container_of(_dev, struct rtl8366_smi, dev)
+static inline struct rtl8366_smi *sw_to_rtl8366(struct switch_dev *sw)
+{
+ return container_of(sw, struct rtl8366_smi, dev);
+}
static inline void rtl8366_smi_clk_delay(struct rtl8366_smi *smi)
{
struct switch_val *val)
{
u32 data = 0;
- struct rtl8366_smi *smi = to_rtl8366(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366(dev);
if (val->value.i == 1) {
rtl8366_smi_read_reg(smi, RTL8366S_MIB_CTRL_REG, &data);
struct switch_val *val)
{
u32 data;
- struct rtl8366_smi *smi = to_rtl8366(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366(dev);
if (attr->ofs == 1) {
rtl8366_smi_read_reg(smi, RTL8366_CHIP_GLOBAL_CTRL_REG, &data);
struct switch_val *val)
{
u32 data;
- struct rtl8366_smi *smi = to_rtl8366(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366(dev);
rtl8366_smi_read_reg(smi, RTL8366_LED_BLINKRATE_REG, &data);
val->value.i = (data & (RTL8366_LED_BLINKRATE_MASK));
struct switch_val *val)
{
u32 data;
- struct rtl8366_smi *smi = to_rtl8366(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366(dev);
if (val->value.i >= 6)
return -EINVAL;
const struct switch_attr *attr,
struct switch_val *val)
{
- struct rtl8366_smi *smi = to_rtl8366(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366(dev);
if (attr->ofs == 1)
return rtl8366_vlan_set_vlan(smi, val->value.i);
{
u32 len = 0, data = 0;
int speed, duplex, link, txpause, rxpause, nway;
- struct rtl8366_smi *smi = to_rtl8366(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366(dev);
char *buf = smi->buf;
if (val->port_vlan >= RTL8366_NUM_PORTS)
u32 len = 0;
struct rtl8366s_vlanconfig vlanmc;
struct rtl8366s_vlan4kentry vlan4k;
- struct rtl8366_smi *smi = to_rtl8366(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366(dev);
char *buf = smi->buf;
if (val->port_vlan >= RTL8366_NUM_PORTS)
struct switch_val *val)
{
u32 data = 0;
- struct rtl8366_smi *smi = to_rtl8366(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366(dev);
if (val->port_vlan >= RTL8366_NUM_PORTS ||
(1 << val->port_vlan) == RTL8366_PORT_UNKNOWN)
return -EINVAL;
struct switch_val *val)
{
u32 data = 0;
- struct rtl8366_smi *smi = to_rtl8366(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366(dev);
if (val->port_vlan >= RTL8366_NUM_LEDGROUPS)
return -EINVAL;
struct switch_val *val)
{
u32 data = 0;
- struct rtl8366_smi *smi = to_rtl8366(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366(dev);
if (val->port_vlan >= RTL8366_NUM_PORTS)
return -EINVAL;
{
int i, len = 0;
unsigned long long counter = 0;
- struct rtl8366_smi *smi = to_rtl8366(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366(dev);
char *buf = smi->buf;
if (val->port_vlan >= RTL8366_NUM_PORTS)
struct switch_val *val)
{
struct rtl8366s_vlanconfig vlanmc;
- struct rtl8366_smi *smi = to_rtl8366(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366(dev);
struct switch_port *port;
int i;
{
struct rtl8366s_vlanconfig vlanmc;
struct rtl8366s_vlan4kentry vlan4k;
- struct rtl8366_smi *smi = to_rtl8366(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366(dev);
struct switch_port *port;
int i;
static int rtl8366_get_port_pvid(struct switch_dev *dev, int port, int *val)
{
- struct rtl8366_smi *smi = to_rtl8366(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366(dev);
return rtl8366_get_vlan_port_pvid(smi, port, val);
}
static int rtl8366_set_port_pvid(struct switch_dev *dev, int port, int val)
{
- struct rtl8366_smi *smi = to_rtl8366(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366(dev);
return rtl8366_set_vlan_port_pvid(smi, port, val);
}
static int rtl8366_reset_switch(struct switch_dev *dev)
{
- struct rtl8366_smi *smi = to_rtl8366(dev);
+ struct rtl8366_smi *smi = sw_to_rtl8366(dev);
int timeout = 10;
u32 data;