Commit 4e865a5a authored by David S. Miller's avatar David S. Miller

Merge branch 'r8152-next'

Hayes Wang says:

====================
r8152: rtl_ops_init modify

Initialize the ops through tp->version. This could skip checking
each VID/PID.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 926c5126 662412d1
...@@ -461,11 +461,7 @@ enum rtl8152_flags { ...@@ -461,11 +461,7 @@ enum rtl8152_flags {
/* Define these values to match your device */ /* Define these values to match your device */
#define VENDOR_ID_REALTEK 0x0bda #define VENDOR_ID_REALTEK 0x0bda
#define PRODUCT_ID_RTL8152 0x8152
#define PRODUCT_ID_RTL8153 0x8153
#define VENDOR_ID_SAMSUNG 0x04e8 #define VENDOR_ID_SAMSUNG 0x04e8
#define PRODUCT_ID_SAMSUNG 0xa101
#define MCU_TYPE_PLA 0x0100 #define MCU_TYPE_PLA 0x0100
#define MCU_TYPE_USB 0x0000 #define MCU_TYPE_USB 0x0000
...@@ -3742,66 +3738,43 @@ static void rtl8153_unload(struct r8152 *tp) ...@@ -3742,66 +3738,43 @@ 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; ops->up = rtl8152_up;
ops->up = rtl8152_up; ops->down = rtl8152_down;
ops->down = rtl8152_down; 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;
ops->up = rtl8153_up; ops->up = rtl8153_up;
ops->down = rtl8153_down; ops->down = rtl8153_down;
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;
} }
...@@ -3833,7 +3806,8 @@ static int rtl8152_probe(struct usb_interface *intf, ...@@ -3833,7 +3806,8 @@ static int rtl8152_probe(struct usb_interface *intf,
tp->netdev = netdev; tp->netdev = netdev;
tp->intf = intf; tp->intf = intf;
ret = rtl_ops_init(tp, id); r8152b_get_version(tp);
ret = rtl_ops_init(tp);
if (ret) if (ret)
goto out; goto out;
...@@ -3866,11 +3840,9 @@ static int rtl8152_probe(struct usb_interface *intf, ...@@ -3866,11 +3840,9 @@ static int rtl8152_probe(struct usb_interface *intf,
tp->mii.phy_id_mask = 0x3f; tp->mii.phy_id_mask = 0x3f;
tp->mii.reg_num_mask = 0x1f; tp->mii.reg_num_mask = 0x1f;
tp->mii.phy_id = R8152_PHY_ID; tp->mii.phy_id = R8152_PHY_ID;
tp->mii.supports_gmii = 0;
intf->needs_remote_wakeup = 1; intf->needs_remote_wakeup = 1;
r8152b_get_version(tp);
tp->rtl_ops.init(tp); tp->rtl_ops.init(tp);
set_ethernet_addr(tp); set_ethernet_addr(tp);
...@@ -3922,9 +3894,9 @@ static void rtl8152_disconnect(struct usb_interface *intf) ...@@ -3922,9 +3894,9 @@ static void rtl8152_disconnect(struct usb_interface *intf)
/* table of devices that work with this driver */ /* table of devices that work with this driver */
static struct usb_device_id rtl8152_table[] = { static struct usb_device_id rtl8152_table[] = {
{USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8152)}, {USB_DEVICE(VENDOR_ID_REALTEK, 0x8152)},
{USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8153)}, {USB_DEVICE(VENDOR_ID_REALTEK, 0x8153)},
{USB_DEVICE(VENDOR_ID_SAMSUNG, PRODUCT_ID_SAMSUNG)}, {USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101)},
{} {}
}; };
......
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