struct r8152 *tp = netdev_priv(netdev);
int ret;
+ if (test_bit(RTL8152_UNPLUG, &tp->flags))
+ return -ENODEV;
+
if (phy_id != R8152_PHY_ID)
return -EINVAL;
{
struct r8152 *tp = netdev_priv(netdev);
+ if (test_bit(RTL8152_UNPLUG, &tp->flags))
+ return;
+
if (phy_id != R8152_PHY_ID)
return;
static int rtl8152_enable(struct r8152 *tp)
{
+ if (test_bit(RTL8152_UNPLUG, &tp->flags))
+ return -ENODEV;
+
set_tx_qlen(tp);
rtl_set_eee_plus(tp);
static int rtl8153_enable(struct r8152 *tp)
{
+ if (test_bit(RTL8152_UNPLUG, &tp->flags))
+ return -ENODEV;
+
set_tx_qlen(tp);
rtl_set_eee_plus(tp);
r8153_set_rx_agg(tp);
u32 ocp_data;
int i;
+ if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
+ rtl_drop_queued_tx(tp);
+ return;
+ }
+
ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR);
ocp_data &= ~RCR_ACPT_ALL;
ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data);
u32 ocp_data;
int i;
+ if (test_bit(RTL8152_UNPLUG, &tp->flags))
+ return;
+
ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR);
ocp_data &= ~RCR_ACPT_ALL;
ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data);
u32 ocp_data;
int i;
+ if (test_bit(RTL8152_UNPLUG, &tp->flags))
+ return;
+
rxdy_gated_en(tp, true);
r8153_teredo_off(tp);
static void rtl8152_down(struct r8152 *tp)
{
+ if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
+ rtl_drop_queued_tx(tp);
+ return;
+ }
+
r8152_power_cut_en(tp, false);
r8152b_disable_aldps(tp);
r8152b_enter_oob(tp);
static void rtl8153_down(struct r8152 *tp)
{
+ if (test_bit(RTL8152_UNPLUG, &tp->flags)) {
+ rtl_drop_queued_tx(tp);
+ return;
+ }
+
r8153_u1u2en(tp, false);
r8153_power_cut_en(tp, false);
r8153_disable_aldps(tp);
{
u32 ocp_data;
+ if (test_bit(RTL8152_UNPLUG, &tp->flags))
+ return;
+
if (tp->version == RTL_VER_01) {
ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_LED_FEATURE);
ocp_data &= ~LED_MODE_MASK;
u32 ocp_data;
int i;
+ if (test_bit(RTL8152_UNPLUG, &tp->flags))
+ return;
+
r8153_u1u2en(tp, false);
for (i = 0; i < 500; i++) {
struct mii_ioctl_data *data = if_mii(rq);
int res;
+ if (test_bit(RTL8152_UNPLUG, &tp->flags))
+ return -ENODEV;
+
res = usb_autopm_get_interface(tp->intf);
if (res < 0)
goto out;
static void rtl8152_unload(struct r8152 *tp)
{
+ if (test_bit(RTL8152_UNPLUG, &tp->flags))
+ return;
+
if (tp->version != RTL_VER_01)
r8152_power_cut_en(tp, true);
}
static void rtl8153_unload(struct r8152 *tp)
{
+ if (test_bit(RTL8152_UNPLUG, &tp->flags))
+ return;
+
r8153_power_cut_en(tp, true);
}