Commit 55b65475 authored by hayeswang's avatar hayeswang Committed by David S. Miller

r8152: modify rtl_ops_init

Replace using VID/PID with using tp->version to initialize the ops.
Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 82cf94cb
...@@ -3742,15 +3742,14 @@ static void rtl8153_unload(struct r8152 *tp) ...@@ -3742,15 +3742,14 @@ static void rtl8153_unload(struct r8152 *tp)
r8153_power_cut_en(tp, false); r8153_power_cut_en(tp, false);
} }
static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) static int rtl_ops_init(struct r8152 *tp)
{ {
struct rtl_ops *ops = &tp->rtl_ops; struct rtl_ops *ops = &tp->rtl_ops;
int ret = -ENODEV; int ret = 0;
switch (id->idVendor) { switch (tp->version) {
case VENDOR_ID_REALTEK: case RTL_VER_01:
switch (id->idProduct) { case RTL_VER_02:
case PRODUCT_ID_RTL8152:
ops->init = r8152b_init; ops->init = r8152b_init;
ops->enable = rtl8152_enable; ops->enable = rtl8152_enable;
ops->disable = rtl8152_disable; ops->disable = rtl8152_disable;
...@@ -3759,27 +3758,11 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) ...@@ -3759,27 +3758,11 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id)
ops->unload = rtl8152_unload; ops->unload = rtl8152_unload;
ops->eee_get = r8152_get_eee; ops->eee_get = r8152_get_eee;
ops->eee_set = r8152_set_eee; ops->eee_set = r8152_set_eee;
ret = 0;
break;
case PRODUCT_ID_RTL8153:
ops->init = r8153_init;
ops->enable = rtl8153_enable;
ops->disable = rtl8153_disable;
ops->up = rtl8153_up;
ops->down = rtl8153_down;
ops->unload = rtl8153_unload;
ops->eee_get = r8153_get_eee;
ops->eee_set = r8153_set_eee;
ret = 0;
break;
default:
break;
}
break; break;
case VENDOR_ID_SAMSUNG: case RTL_VER_03:
switch (id->idProduct) { case RTL_VER_04:
case PRODUCT_ID_SAMSUNG: case RTL_VER_05:
ops->init = r8153_init; ops->init = r8153_init;
ops->enable = rtl8153_enable; ops->enable = rtl8153_enable;
ops->disable = rtl8153_disable; ops->disable = rtl8153_disable;
...@@ -3788,20 +3771,14 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) ...@@ -3788,20 +3771,14 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id)
ops->unload = rtl8153_unload; ops->unload = rtl8153_unload;
ops->eee_get = r8153_get_eee; ops->eee_get = r8153_get_eee;
ops->eee_set = r8153_set_eee; ops->eee_set = r8153_set_eee;
ret = 0;
break;
default:
break;
}
break; break;
default: default:
ret = -ENODEV;
netif_err(tp, probe, tp->netdev, "Unknown Device\n");
break; break;
} }
if (ret)
netif_err(tp, probe, tp->netdev, "Unknown Device\n");
return ret; return ret;
} }
...@@ -3834,7 +3811,7 @@ static int rtl8152_probe(struct usb_interface *intf, ...@@ -3834,7 +3811,7 @@ static int rtl8152_probe(struct usb_interface *intf,
tp->intf = intf; tp->intf = intf;
r8152b_get_version(tp); r8152b_get_version(tp);
ret = rtl_ops_init(tp, id); ret = rtl_ops_init(tp);
if (ret) if (ret)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment