r8152: remove some bit operations

Remove DELL_TB_RX_AGG_BUG and LENOVO_MACPASSTHRU flags of rtl8152_flags.
They are only set when initializing and wouldn't be change. It is enough
to record them with variables.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Hayes Wang 2021-04-24 14:09:03 +08:00 committed by David S. Miller
parent 64ff412ad4
commit 9c68011bd7

View File

@ -767,8 +767,6 @@ enum rtl8152_flags {
PHY_RESET, PHY_RESET,
SCHEDULE_TASKLET, SCHEDULE_TASKLET,
GREEN_ETHERNET, GREEN_ETHERNET,
DELL_TB_RX_AGG_BUG,
LENOVO_MACPASSTHRU,
}; };
#define DEVICE_ID_THINKPAD_THUNDERBOLT3_DOCK_GEN2 0x3082 #define DEVICE_ID_THINKPAD_THUNDERBOLT3_DOCK_GEN2 0x3082
@ -934,6 +932,8 @@ struct r8152 {
u32 fc_pause_on, fc_pause_off; u32 fc_pause_on, fc_pause_off;
u32 support_2500full:1; u32 support_2500full:1;
u32 lenovo_macpassthru:1;
u32 dell_tb_rx_agg_bug:1;
u16 ocp_base; u16 ocp_base;
u16 speed; u16 speed;
u16 eee_adv; u16 eee_adv;
@ -1594,7 +1594,7 @@ static int vendor_mac_passthru_addr_read(struct r8152 *tp, struct sockaddr *sa)
acpi_object_type mac_obj_type; acpi_object_type mac_obj_type;
int mac_strlen; int mac_strlen;
if (test_bit(LENOVO_MACPASSTHRU, &tp->flags)) { if (tp->lenovo_macpassthru) {
mac_obj_name = "\\MACA"; mac_obj_name = "\\MACA";
mac_obj_type = ACPI_TYPE_STRING; mac_obj_type = ACPI_TYPE_STRING;
mac_strlen = 0x16; mac_strlen = 0x16;
@ -2283,7 +2283,7 @@ static int r8152_tx_agg_fill(struct r8152 *tp, struct tx_agg *agg)
remain = agg_buf_sz - (int)(tx_agg_align(tx_data) - agg->head); remain = agg_buf_sz - (int)(tx_agg_align(tx_data) - agg->head);
if (test_bit(DELL_TB_RX_AGG_BUG, &tp->flags)) if (tp->dell_tb_rx_agg_bug)
break; break;
} }
@ -6941,7 +6941,7 @@ static void r8153_init(struct r8152 *tp)
/* rx aggregation */ /* rx aggregation */
ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL); ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL);
ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN); ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN);
if (test_bit(DELL_TB_RX_AGG_BUG, &tp->flags)) if (tp->dell_tb_rx_agg_bug)
ocp_data |= RX_AGG_DISABLE; ocp_data |= RX_AGG_DISABLE;
ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data); ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data);
@ -9447,7 +9447,7 @@ static int rtl8152_probe(struct usb_interface *intf,
switch (le16_to_cpu(udev->descriptor.idProduct)) { switch (le16_to_cpu(udev->descriptor.idProduct)) {
case DEVICE_ID_THINKPAD_THUNDERBOLT3_DOCK_GEN2: case DEVICE_ID_THINKPAD_THUNDERBOLT3_DOCK_GEN2:
case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2: case DEVICE_ID_THINKPAD_USB_C_DOCK_GEN2:
set_bit(LENOVO_MACPASSTHRU, &tp->flags); tp->lenovo_macpassthru = 1;
} }
} }
@ -9455,7 +9455,7 @@ static int rtl8152_probe(struct usb_interface *intf,
(!strcmp(udev->serial, "000001000000") || (!strcmp(udev->serial, "000001000000") ||
!strcmp(udev->serial, "000002000000"))) { !strcmp(udev->serial, "000002000000"))) {
dev_info(&udev->dev, "Dell TB16 Dock, disable RX aggregation"); dev_info(&udev->dev, "Dell TB16 Dock, disable RX aggregation");
set_bit(DELL_TB_RX_AGG_BUG, &tp->flags); tp->dell_tb_rx_agg_bug = 1;
} }
netdev->ethtool_ops = &ops; netdev->ethtool_ops = &ops;