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 {
/* Define these values to match your device */
#define VENDOR_ID_REALTEK 0x0bda
#define PRODUCT_ID_RTL8152 0x8152
#define PRODUCT_ID_RTL8153 0x8153
#define VENDOR_ID_SAMSUNG 0x04e8
#define PRODUCT_ID_SAMSUNG 0xa101
#define MCU_TYPE_PLA 0x0100
#define MCU_TYPE_USB 0x0000
......@@ -3742,15 +3738,14 @@ static void rtl8153_unload(struct r8152 *tp)
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;
int ret = -ENODEV;
int ret = 0;
switch (id->idVendor) {
case VENDOR_ID_REALTEK:
switch (id->idProduct) {
case PRODUCT_ID_RTL8152:
switch (tp->version) {
case RTL_VER_01:
case RTL_VER_02:
ops->init = r8152b_init;
ops->enable = rtl8152_enable;
ops->disable = rtl8152_disable;
......@@ -3759,27 +3754,11 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id)
ops->unload = rtl8152_unload;
ops->eee_get = r8152_get_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;
case VENDOR_ID_SAMSUNG:
switch (id->idProduct) {
case PRODUCT_ID_SAMSUNG:
case RTL_VER_03:
case RTL_VER_04:
case RTL_VER_05:
ops->init = r8153_init;
ops->enable = rtl8153_enable;
ops->disable = rtl8153_disable;
......@@ -3788,20 +3767,14 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id)
ops->unload = rtl8153_unload;
ops->eee_get = r8153_get_eee;
ops->eee_set = r8153_set_eee;
ret = 0;
break;
default:
break;
}
break;
default:
ret = -ENODEV;
netif_err(tp, probe, tp->netdev, "Unknown Device\n");
break;
}
if (ret)
netif_err(tp, probe, tp->netdev, "Unknown Device\n");
return ret;
}
......@@ -3833,7 +3806,8 @@ static int rtl8152_probe(struct usb_interface *intf,
tp->netdev = netdev;
tp->intf = intf;
ret = rtl_ops_init(tp, id);
r8152b_get_version(tp);
ret = rtl_ops_init(tp);
if (ret)
goto out;
......@@ -3866,11 +3840,9 @@ static int rtl8152_probe(struct usb_interface *intf,
tp->mii.phy_id_mask = 0x3f;
tp->mii.reg_num_mask = 0x1f;
tp->mii.phy_id = R8152_PHY_ID;
tp->mii.supports_gmii = 0;
intf->needs_remote_wakeup = 1;
r8152b_get_version(tp);
tp->rtl_ops.init(tp);
set_ethernet_addr(tp);
......@@ -3922,9 +3894,9 @@ static void rtl8152_disconnect(struct usb_interface *intf)
/* table of devices that work with this driver */
static struct usb_device_id rtl8152_table[] = {
{USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8152)},
{USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8153)},
{USB_DEVICE(VENDOR_ID_SAMSUNG, PRODUCT_ID_SAMSUNG)},
{USB_DEVICE(VENDOR_ID_REALTEK, 0x8152)},
{USB_DEVICE(VENDOR_ID_REALTEK, 0x8153)},
{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