[PATCH 8/9] staging: ks7010: Remove 'eth_addr' field from 'struct ks_wlan_private'.
The ethernet address of the network device is already stored in the 'dev_addr' field of 'struct net_device'. Since 'struct ks_wlan_private' keeps a pointer to the driver's 'struct net_device', there is no reason to duplicate this information in 'struct ks_wlan_private'. Signed-off-by: Quytelda Kahja--- drivers/staging/ks7010/ks_hostif.c | 29 +++-- drivers/staging/ks7010/ks_wlan.h | 2 -- drivers/staging/ks7010/ks_wlan_net.c | 5 ++--- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index a4020eeaac18..7bb0a6dffe61 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -388,6 +388,7 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv, static void hostif_data_indication(struct ks_wlan_private *priv) { + struct net_device * dev = priv->net_dev; unsigned int rx_ind_size; /* indicate data size */ struct sk_buff *skb; unsigned short auth_type; @@ -411,9 +412,9 @@ void hostif_data_indication(struct ks_wlan_private *priv) eth_proto = ntohs(eth_hdr->h_proto); /* source address check */ - if (memcmp(>eth_addr[0], eth_hdr->h_source, ETH_ALEN) == 0) { - netdev_err(priv->net_dev, "invalid : source is own mac address !!\n"); - netdev_err(priv->net_dev, + if (memcmp(dev->dev_addr, eth_hdr->h_source, ETH_ALEN) == 0) { + netdev_err(dev, "invalid : source is own mac address !!\n"); + netdev_err(dev, "eth_hdrernet->h_dest=%02X:%02X:%02X:%02X:%02X:%02X\n", eth_hdr->h_source[0], eth_hdr->h_source[1], eth_hdr->h_source[2], eth_hdr->h_source[3], @@ -443,7 +444,7 @@ void hostif_data_indication(struct ks_wlan_private *priv) priv->nstats.rx_dropped++; return; } - netdev_dbg(priv->net_dev, "SNAP, rx_ind_size = %d\n", + netdev_dbg(dev, "SNAP, rx_ind_size = %d\n", rx_ind_size); size = ETH_ALEN * 2; @@ -463,7 +464,7 @@ void hostif_data_indication(struct ks_wlan_private *priv) priv->nstats.rx_dropped++; return; } - netdev_dbg(priv->net_dev, "NETBEUI/NetBIOS rx_ind_size=%d\n", + netdev_dbg(dev, "NETBEUI/NetBIOS rx_ind_size=%d\n", rx_ind_size); /* 8802/FDDI MAC copy */ @@ -480,7 +481,7 @@ void hostif_data_indication(struct ks_wlan_private *priv) aa1x_hdr = (struct ieee802_1x_hdr *)(priv->rxp + 14); break; default:/* other rx data */ - netdev_err(priv->net_dev, "invalid data format\n"); + netdev_err(dev, "invalid data format\n"); priv->nstats.rx_errors++; return; } @@ -522,17 +523,9 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv) case DOT11_MAC_ADDRESS: /* MAC address */ hostif_sme_enqueue(priv, SME_GET_MAC_ADDRESS); - memcpy(priv->eth_addr, priv->rxp, ETH_ALEN); + memcpy(dev->dev_addr, priv->rxp, ETH_ALEN); priv->mac_address_valid = true; - dev->dev_addr[0] = priv->eth_addr[0]; - dev->dev_addr[1] = priv->eth_addr[1]; - dev->dev_addr[2] = priv->eth_addr[2]; - dev->dev_addr[3] = priv->eth_addr[3]; - dev->dev_addr[4] = priv->eth_addr[4]; - dev->dev_addr[5] = priv->eth_addr[5]; - dev->dev_addr[6] = 0x00; - dev->dev_addr[7] = 0x00; - netdev_info(dev, "MAC ADDRESS = %pM\n", priv->eth_addr); + netdev_info(dev, "MAC ADDRESS = %pM\n", dev->dev_addr); break; case DOT11_PRODUCT_VERSION: /* firmware version */ @@ -,7 +1104,7 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb) /* skb check */ eth = (struct ethhdr *)skb->data; - if (memcmp(>eth_addr[0], eth->h_source, ETH_ALEN) != 0) { + if (memcmp(priv->net_dev->dev_addr, eth->h_source, ETH_ALEN) != 0) { netdev_err(priv->net_dev, "invalid mac address !!\n"); netdev_err(priv->net_dev, "ethernet->h_source=%pM\n", eth->h_source); ret = -ENXIO; @@ -2167,7 +2160,7 @@ void hostif_sme_execute(struct ks_wlan_private *priv, int event) case SME_MACADDRESS_SET_REQUEST: hostif_mib_set_request(priv, LOCAL_CURRENTADDRESS, ETH_ALEN, MIB_VALUE_TYPE_OSTRING, - >eth_addr[0]); + priv->net_dev->dev_addr);
[PATCH 8/9] staging: ks7010: Remove 'eth_addr' field from 'struct ks_wlan_private'.
The ethernet address of the network device is already stored in the 'dev_addr' field of 'struct net_device'. Since 'struct ks_wlan_private' keeps a pointer to the driver's 'struct net_device', there is no reason to duplicate this information in 'struct ks_wlan_private'. Signed-off-by: Quytelda Kahja --- drivers/staging/ks7010/ks_hostif.c | 29 +++-- drivers/staging/ks7010/ks_wlan.h | 2 -- drivers/staging/ks7010/ks_wlan_net.c | 5 ++--- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index a4020eeaac18..7bb0a6dffe61 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -388,6 +388,7 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv, static void hostif_data_indication(struct ks_wlan_private *priv) { + struct net_device * dev = priv->net_dev; unsigned int rx_ind_size; /* indicate data size */ struct sk_buff *skb; unsigned short auth_type; @@ -411,9 +412,9 @@ void hostif_data_indication(struct ks_wlan_private *priv) eth_proto = ntohs(eth_hdr->h_proto); /* source address check */ - if (memcmp(>eth_addr[0], eth_hdr->h_source, ETH_ALEN) == 0) { - netdev_err(priv->net_dev, "invalid : source is own mac address !!\n"); - netdev_err(priv->net_dev, + if (memcmp(dev->dev_addr, eth_hdr->h_source, ETH_ALEN) == 0) { + netdev_err(dev, "invalid : source is own mac address !!\n"); + netdev_err(dev, "eth_hdrernet->h_dest=%02X:%02X:%02X:%02X:%02X:%02X\n", eth_hdr->h_source[0], eth_hdr->h_source[1], eth_hdr->h_source[2], eth_hdr->h_source[3], @@ -443,7 +444,7 @@ void hostif_data_indication(struct ks_wlan_private *priv) priv->nstats.rx_dropped++; return; } - netdev_dbg(priv->net_dev, "SNAP, rx_ind_size = %d\n", + netdev_dbg(dev, "SNAP, rx_ind_size = %d\n", rx_ind_size); size = ETH_ALEN * 2; @@ -463,7 +464,7 @@ void hostif_data_indication(struct ks_wlan_private *priv) priv->nstats.rx_dropped++; return; } - netdev_dbg(priv->net_dev, "NETBEUI/NetBIOS rx_ind_size=%d\n", + netdev_dbg(dev, "NETBEUI/NetBIOS rx_ind_size=%d\n", rx_ind_size); /* 8802/FDDI MAC copy */ @@ -480,7 +481,7 @@ void hostif_data_indication(struct ks_wlan_private *priv) aa1x_hdr = (struct ieee802_1x_hdr *)(priv->rxp + 14); break; default:/* other rx data */ - netdev_err(priv->net_dev, "invalid data format\n"); + netdev_err(dev, "invalid data format\n"); priv->nstats.rx_errors++; return; } @@ -522,17 +523,9 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv) case DOT11_MAC_ADDRESS: /* MAC address */ hostif_sme_enqueue(priv, SME_GET_MAC_ADDRESS); - memcpy(priv->eth_addr, priv->rxp, ETH_ALEN); + memcpy(dev->dev_addr, priv->rxp, ETH_ALEN); priv->mac_address_valid = true; - dev->dev_addr[0] = priv->eth_addr[0]; - dev->dev_addr[1] = priv->eth_addr[1]; - dev->dev_addr[2] = priv->eth_addr[2]; - dev->dev_addr[3] = priv->eth_addr[3]; - dev->dev_addr[4] = priv->eth_addr[4]; - dev->dev_addr[5] = priv->eth_addr[5]; - dev->dev_addr[6] = 0x00; - dev->dev_addr[7] = 0x00; - netdev_info(dev, "MAC ADDRESS = %pM\n", priv->eth_addr); + netdev_info(dev, "MAC ADDRESS = %pM\n", dev->dev_addr); break; case DOT11_PRODUCT_VERSION: /* firmware version */ @@ -,7 +1104,7 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb) /* skb check */ eth = (struct ethhdr *)skb->data; - if (memcmp(>eth_addr[0], eth->h_source, ETH_ALEN) != 0) { + if (memcmp(priv->net_dev->dev_addr, eth->h_source, ETH_ALEN) != 0) { netdev_err(priv->net_dev, "invalid mac address !!\n"); netdev_err(priv->net_dev, "ethernet->h_source=%pM\n", eth->h_source); ret = -ENXIO; @@ -2167,7 +2160,7 @@ void hostif_sme_execute(struct ks_wlan_private *priv, int event) case SME_MACADDRESS_SET_REQUEST: hostif_mib_set_request(priv, LOCAL_CURRENTADDRESS, ETH_ALEN, MIB_VALUE_TYPE_OSTRING, - >eth_addr[0]); + priv->net_dev->dev_addr); break; case