Re: [v2] staging:fsl-mc: Move DPIO from staging to drivers/soc/fsl
Hi Roy, I love your patch! Perhaps something to improve: [auto build test WARNING on staging/staging-testing] [also build test WARNING on next-20180322] [cannot apply to linus/master v4.16-rc6] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Roy-Pledge/staging-fsl-mc-Move-DPIO-from-staging-to-drivers-soc-fsl/20180323-102325 reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__ sparse warnings: (new ones prefixed by >>) >> drivers/soc/fsl/dpio/qbman-portal.c:163:22: sparse: incorrect type in >> assignment (different address spaces) @@expected void [noderef] >> *addr_cena @@got ef] *addr_cena @@ drivers/soc/fsl/dpio/qbman-portal.c:163:22:expected void [noderef] *addr_cena drivers/soc/fsl/dpio/qbman-portal.c:163:22:got void *const cena_bar >> drivers/soc/fsl/dpio/qbman-portal.c:164:22: sparse: incorrect type in >> assignment (different address spaces) @@expected void [noderef] >> *addr_cinh @@got ef] *addr_cinh @@ drivers/soc/fsl/dpio/qbman-portal.c:164:22:expected void [noderef] *addr_cinh drivers/soc/fsl/dpio/qbman-portal.c:164:22:got void *const cinh_bar >> drivers/soc/fsl/dpio/qbman-portal.c:92:29: sparse: incorrect type in return >> expression (different address spaces) @@expected void * @@got void >> [noderef] * >> drivers/soc/fsl/dpio/qbman-portal.c:92:29: sparse: incorrect type in return >> expression (different address spaces) @@expected void * @@got void >> [noderef] * >> drivers/soc/fsl/dpio/qbman-portal.c:92:29: sparse: incorrect type in return >> expression (different address spaces) @@expected void * @@got void >> [noderef] * >> drivers/soc/fsl/dpio/qbman-portal.c:92:29: sparse: incorrect type in return >> expression (different address spaces) @@expected void * @@got void >> [noderef] * >> drivers/soc/fsl/dpio/qbman-portal.c:92:29: sparse: incorrect type in return >> expression (different address spaces) @@expected void * @@got void >> [noderef] * >> drivers/soc/fsl/dpio/qbman-portal.c:92:29: sparse: incorrect type in return >> expression (different address spaces) @@expected void * @@got void >> [noderef] * >> drivers/soc/fsl/dpio/qbman-portal.c:92:29: sparse: incorrect type in return >> expression (different address spaces) @@expected void * @@got void >> [noderef] * >> drivers/soc/fsl/dpio/qbman-portal.c:92:29: sparse: incorrect type in return >> expression (different address spaces) @@expected void * @@got void >> [noderef] * >> drivers/soc/fsl/dpio/qbman-portal.c:92:29: sparse: incorrect type in return >> expression (different address spaces) @@expected void * @@got void >> [noderef] * -- >> drivers/soc/fsl/dpio/dpio-driver.c:149:24: sparse: incorrect type in >> assignment (different address spaces) @@expected void *[assigned] >> regs_cena @@got void [void *[assigned] regs_cena @@ drivers/soc/fsl/dpio/dpio-driver.c:149:24:expected void *[assigned] regs_cena drivers/soc/fsl/dpio/dpio-driver.c:149:24:got void [noderef] * >> drivers/soc/fsl/dpio/dpio-driver.c:151:24: sparse: incorrect type in >> assignment (different address spaces) @@expected void *[assigned] >> regs_cinh @@got void [void *[assigned] regs_cinh @@ drivers/soc/fsl/dpio/dpio-driver.c:151:24:expected void *[assigned] regs_cinh drivers/soc/fsl/dpio/dpio-driver.c:151:24:got void [noderef] * vim +163 drivers/soc/fsl/dpio/qbman-portal.c 321eecb0 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c Roy Pledge 2017-03-13 89 321eecb0 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c Roy Pledge 2017-03-13 90 static inline void *qbman_get_cmd(struct qbman_swp *p, u32 offset) 321eecb0 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c Roy Pledge 2017-03-13 91 { 321eecb0 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c Roy Pledge 2017-03-13 @92 return p->addr_cena + offset; 321eecb0 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c Roy Pledge 2017-03-13 93 } 321eecb0 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c Roy Pledge 2017-03-13 94 321eecb0 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c Roy Pledge 2017-03-13 95 #define QBMAN_CINH_SWP_CFG 0xd00 321eecb0 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c Roy Pledge 2017-03-13 96 321eecb0 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c Roy Pledge 2017-03-13 97 #define SWP_CFG_DQRR_MF_SHIFT 20 321eecb0 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c Roy Pledge 2017-03-13 98 #define SWP_CF
[PATCH 6/7] staging: ks7010: Factor out repeated code for reading IEs.
Some of the code for reading IEs is replicated multiple times in the switch statement for get_ap_information(). Factor that code out into read_ie(). Signed-off-by: Quytelda Kahja--- drivers/staging/ks7010/ks_hostif.c | 31 +++ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 1a0fe15e842e..21219d0bbb6a 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -216,6 +216,15 @@ int get_current_ap(struct ks_wlan_private *priv, struct link_ap_info_t *ap_info) return 0; } +static u8 read_ie(unsigned char *bp, u8 max, u8 *body) +{ + u8 size = (*(bp + 1) <= max) ? *(bp + 1) : max; + + memcpy(body, bp + 2, size); + return size; +} + + static int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info, struct local_ap_t *ap) @@ -245,11 +254,8 @@ int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info, while (bsize > offset) { switch (*bp) { /* Information Element ID */ case WLAN_EID_SSID: - if (*(bp + 1) <= IEEE80211_MAX_SSID_LEN) - ap->ssid.size = *(bp + 1); - else - ap->ssid.size = IEEE80211_MAX_SSID_LEN; - memcpy(ap->ssid.body, bp + 2, ap->ssid.size); + ap->ssid.size = read_ie(bp, IEEE80211_MAX_SSID_LEN, + ap->ssid.body); break; case WLAN_EID_SUPP_RATES: case WLAN_EID_EXT_SUPP_RATES: @@ -270,22 +276,15 @@ int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info, break; case WLAN_EID_RSN: ap->rsn_ie.id = *bp; - if (*(bp + 1) <= RSN_IE_BODY_MAX) - ap->rsn_ie.size = *(bp + 1); - else - ap->rsn_ie.size = RSN_IE_BODY_MAX; - memcpy(ap->rsn_ie.body, bp + 2, ap->rsn_ie.size); + ap->rsn_ie.size = read_ie(bp, RSN_IE_BODY_MAX, + ap->rsn_ie.body); break; case WLAN_EID_VENDOR_SPECIFIC: /* WPA */ /* WPA OUI check */ if (memcmp(bp + 2, CIPHER_ID_WPA_WEP40, 4) == 0) { ap->wpa_ie.id = *bp; - if (*(bp + 1) <= RSN_IE_BODY_MAX) - ap->wpa_ie.size = *(bp + 1); - else - ap->wpa_ie.size = RSN_IE_BODY_MAX; - memcpy(ap->wpa_ie.body, bp + 2, - ap->wpa_ie.size); + ap->wpa_ie.size = read_ie(bp, RSN_IE_BODY_MAX, + ap->wpa_ie.body); } break; -- 2.16.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/7] staging: ks7010: Remove duplicate #define's
The AUTH_TYPE_OPEN_SYSTEM and AUTH_TYPE_SHARED_KEY #define lines are duplicated in ks_hostif.h. Replace them both with one set of Signed-off-by: Quytelda Kahja--- drivers/staging/ks7010/ks_hostif.h | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index 87686fe83c67..fde89bafd7fa 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -369,6 +369,9 @@ struct hostif_ps_adhoc_set_confirm_t { __le16 result_code; } __packed; +#define AUTH_TYPE_OPEN_SYSTEM 0 +#define AUTH_TYPE_SHARED_KEY 1 + /** * struct hostif_infrastructure_set_request_t * @capability: bit5 : preamble @@ -382,8 +385,6 @@ struct hostif_infrastructure_set_request_t { struct ssid_t ssid; __le16 beacon_lost_count; __le16 auth_type; -#define AUTH_TYPE_OPEN_SYSTEM 0 -#define AUTH_TYPE_SHARED_KEY 1 struct channel_list_t channel_list; } __packed; @@ -400,8 +401,6 @@ struct hostif_infrastructure_set2_request_t { struct ssid_t ssid; __le16 beacon_lost_count; __le16 auth_type; -#define AUTH_TYPE_OPEN_SYSTEM 0 -#define AUTH_TYPE_SHARED_KEY 1 struct channel_list_t channel_list; u8 bssid[ETH_ALEN]; } __packed; -- 2.16.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 7/7] staging: ks7010: Remove hostif_infrastructure_set2_request_t.
The handling of hostif_infrastructure_set_request_t and hostif_infrastructure_set2_request_t is identical, with the exception of the event type value. Merge the two structs so they can be handled by a single function ('hostif_infrastructure_set_request'). Signed-off-by: Quytelda Kahja--- drivers/staging/ks7010/ks_hostif.c | 50 +++--- drivers/staging/ks7010/ks_hostif.h | 16 2 files changed, 4 insertions(+), 62 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 21219d0bbb6a..143413c3cae2 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -1345,11 +1345,11 @@ void hostif_ps_adhoc_set_request(struct ks_wlan_private *priv) } static -void hostif_infrastructure_set_request(struct ks_wlan_private *priv) +void hostif_infrastructure_set_request(struct ks_wlan_private *priv, int event) { struct hostif_infrastructure_set_request_t *pp; - pp = hostif_generic_request(sizeof(*pp), HIF_INFRA_SET_REQ); + pp = hostif_generic_request(sizeof(*pp), event); if (!pp) return; @@ -1385,48 +1385,6 @@ void hostif_infrastructure_set_request(struct ks_wlan_private *priv) ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL); } -static void hostif_infrastructure_set2_request(struct ks_wlan_private *priv) -{ - struct hostif_infrastructure_set2_request_t *pp; - - pp = hostif_generic_request(sizeof(*pp), HIF_INFRA_SET2_REQ); - if (!pp) - return; - - init_request(priv, >request); - pp->ssid.size = priv->reg.ssid.size; - memcpy(>ssid.body[0], >reg.ssid.body[0], priv->reg.ssid.size); - pp->beacon_lost_count = - cpu_to_le16((uint16_t)(priv->reg.beacon_lost_count)); - pp->auth_type = cpu_to_le16((uint16_t)(priv->reg.authenticate_type)); - - pp->channel_list.body[0] = 1; - pp->channel_list.body[1] = 8; - pp->channel_list.body[2] = 2; - pp->channel_list.body[3] = 9; - pp->channel_list.body[4] = 3; - pp->channel_list.body[5] = 10; - pp->channel_list.body[6] = 4; - pp->channel_list.body[7] = 11; - pp->channel_list.body[8] = 5; - pp->channel_list.body[9] = 12; - pp->channel_list.body[10] = 6; - pp->channel_list.body[11] = 13; - pp->channel_list.body[12] = 7; - if (priv->reg.phy_type == D_11G_ONLY_MODE) { - pp->channel_list.size = 13; - } else { - pp->channel_list.body[13] = 14; - pp->channel_list.size = 14; - } - - memcpy(pp->bssid, priv->reg.bssid, ETH_ALEN); - - /* send to device request */ - ps_confirm_wait_inc(priv); - ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL); -} - static void hostif_adhoc_set_request(struct ks_wlan_private *priv) { @@ -1974,9 +1932,9 @@ void hostif_sme_mode_setup(struct ks_wlan_private *priv) case MODE_INFRASTRUCTURE: /* Infrastructure mode */ if (!is_valid_ether_addr((u8 *)priv->reg.bssid)) { - hostif_infrastructure_set_request(priv); + hostif_infrastructure_set_request(priv, HIF_INFRA_SET_REQ); } else { - hostif_infrastructure_set2_request(priv); + hostif_infrastructure_set_request(priv, HIF_INFRA_SET2_REQ); netdev_dbg(priv->net_dev, "Infra bssid = %pM\n", priv->reg.bssid); } diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index fde89bafd7fa..c262fef72806 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -386,22 +386,6 @@ struct hostif_infrastructure_set_request_t { __le16 beacon_lost_count; __le16 auth_type; struct channel_list_t channel_list; -} __packed; - -/** - * struct hostif_infrastructure_set2_request_t - * @capability: bit5 : preamble - * bit6 : pbcc - Not supported always 0 - * bit10 : ShortSlotTime - * bit13 : DSSS-OFDM - Not supported always 0 - */ -struct hostif_infrastructure_set2_request_t { - struct hostif_hdr header; - struct hostif_request_t request; - struct ssid_t ssid; - __le16 beacon_lost_count; - __le16 auth_type; - struct channel_list_t channel_list; u8 bssid[ETH_ALEN]; } __packed; -- 2.16.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/7] staging: ks7010: Replace memcmp() operation with ether_addr_equal().
Instead of using memcmp() to directly compare BSSIDs, use ether_addr_equal() from 'linux/etherdevice.h'. Signed-off-by: Quytelda Kahja--- drivers/staging/ks7010/ks_hostif.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 32f35d297628..1a0fe15e842e 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -783,8 +783,9 @@ void hostif_scan_indication(struct ks_wlan_private *priv) if (priv->scan_ind_count) { /* bssid check */ for (i = 0; i < priv->aplist.size; i++) { - if (memcmp(ap_info->bssid, - priv->aplist.ap[i].bssid, ETH_ALEN) != 0) + u8 *bssid = priv->aplist.ap[i].bssid; + + if (ether_addr_equal(ap_info->bssid, bssid)) continue; if (ap_info->frame_type == IEEE80211_STYPE_PROBE_RESP) -- 2.16.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/7] staging: ks7010: Fix lines over 80 characters due to comments.
There are several instances where comments are spaced so far to the right they cause the line to go over the 80 character limit. Move these comments to above the statements they describe instead. Signed-off-by: Quytelda Kahja--- drivers/staging/ks7010/ks_hostif.c | 19 --- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 534cca95bfb9..653f6aae3420 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -277,7 +277,8 @@ int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info, memcpy(ap->rsn_ie.body, bp + 2, ap->rsn_ie.size); break; case WLAN_EID_VENDOR_SPECIFIC: /* WPA */ - if (memcmp(bp + 2, CIPHER_ID_WPA_WEP40, 4) == 0) { /* WPA OUI check */ + /* WPA OUI check */ + if (memcmp(bp + 2, CIPHER_ID_WPA_WEP40, 4) == 0) { ap->wpa_ie.id = *bp; if (*(bp + 1) <= RSN_IE_BODY_MAX) ap->wpa_ie.size = *(bp + 1); @@ -469,13 +470,16 @@ void hostif_data_indication(struct ks_wlan_private *priv) netdev_dbg(priv->net_dev, "NETBEUI/NetBIOS rx_ind_size=%d\n", rx_ind_size); - skb_put_data(skb, priv->rxp, 12); /* 8802/FDDI MAC copy */ + /* 8802/FDDI MAC copy */ + skb_put_data(skb, priv->rxp, 12); - temp[0] = (((rx_ind_size - 12) >> 8) & 0xff); /* NETBEUI size add */ + /* NETBEUI size add */ + temp[0] = (((rx_ind_size - 12) >> 8) & 0xff); temp[1] = ((rx_ind_size - 12) & 0xff); skb_put_data(skb, temp, 2); - skb_put_data(skb, priv->rxp + 12, rx_ind_size - 14);/* copy after Type */ + /* copy after Type */ + skb_put_data(skb, priv->rxp + 12, rx_ind_size - 14); aa1x_hdr = (struct ieee802_1x_hdr *)(priv->rxp + 14); break; @@ -1090,8 +1094,8 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb) return 0; } - /* for PowerSave */ - if (atomic_read(>psstatus.status) == PS_SNOOZE) { /* power save wakeup */ + /* power save wakeup */ + if (atomic_read(>psstatus.status) == PS_SNOOZE) { if (!netif_queue_stopped(priv->net_dev)) netif_stop_queue(priv->net_dev); } @@ -1163,11 +1167,12 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb) } if (priv->wpa.rsn_enabled && priv->wpa.key[0].key_len) { + /* no encryption */ if (eth_proto == ETH_P_PAE && priv->wpa.key[1].key_len == 0 && priv->wpa.key[2].key_len == 0 && priv->wpa.key[3].key_len == 0) { - pp->auth_type = cpu_to_le16((uint16_t)TYPE_AUTH); /* no encryption */ + pp->auth_type = cpu_to_le16((uint16_t)TYPE_AUTH); } else { if (priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) { MichaelMICFunction(_mic, -- 2.16.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/7] staging: ks7010: Factor out common members in request structs.
Most of the request structures defined in ks_hostif.h have common members: * __le16 phy_type; * __le16 cts_mode; * __le16 scan_type; * __le16 capability; * struct rate_set16_t rate_set; Factor out these members into a common substructure of type 'hostif_request_t'. This allows a large portion of the request initialization code in ks_hostif.c to be factored out into the 'init_request' function. Signed-off-by: Quytelda Kahja--- drivers/staging/ks7010/ks_hostif.c | 53 +++-- drivers/staging/ks7010/ks_hostif.h | 54 -- 2 files changed, 38 insertions(+), 69 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 653f6aae3420..32f35d297628 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -1316,6 +1316,17 @@ static __le16 ks_wlan_cap(struct ks_wlan_private *priv) return cpu_to_le16((uint16_t)capability); } +static void init_request(struct ks_wlan_private *priv, struct hostif_request_t *req) +{ + req->phy_type = cpu_to_le16((uint16_t)(priv->reg.phy_type)); + req->cts_mode = cpu_to_le16((uint16_t)(priv->reg.cts_mode)); + req->scan_type = cpu_to_le16((uint16_t)(priv->reg.scan_type)); + req->rate_set.size = priv->reg.rate_set.size; + req->capability = ks_wlan_cap(priv); + memcpy(>rate_set.body[0], >reg.rate_set.body[0], + priv->reg.rate_set.size); +} + static void hostif_ps_adhoc_set_request(struct ks_wlan_private *priv) { @@ -1325,14 +1336,8 @@ void hostif_ps_adhoc_set_request(struct ks_wlan_private *priv) if (!pp) return; - pp->phy_type = cpu_to_le16((uint16_t)(priv->reg.phy_type)); - pp->cts_mode = cpu_to_le16((uint16_t)(priv->reg.cts_mode)); - pp->scan_type = cpu_to_le16((uint16_t)(priv->reg.scan_type)); + init_request(priv, >request); pp->channel = cpu_to_le16((uint16_t)(priv->reg.channel)); - pp->rate_set.size = priv->reg.rate_set.size; - pp->capability = ks_wlan_cap(priv); - memcpy(>rate_set.body[0], >reg.rate_set.body[0], - priv->reg.rate_set.size); /* send to device request */ ps_confirm_wait_inc(priv); @@ -1348,16 +1353,9 @@ void hostif_infrastructure_set_request(struct ks_wlan_private *priv) if (!pp) return; - pp->phy_type = cpu_to_le16((uint16_t)(priv->reg.phy_type)); - pp->cts_mode = cpu_to_le16((uint16_t)(priv->reg.cts_mode)); - pp->scan_type = cpu_to_le16((uint16_t)(priv->reg.scan_type)); - - pp->rate_set.size = priv->reg.rate_set.size; - memcpy(>rate_set.body[0], >reg.rate_set.body[0], - priv->reg.rate_set.size); + init_request(priv, >request); pp->ssid.size = priv->reg.ssid.size; memcpy(>ssid.body[0], >reg.ssid.body[0], priv->reg.ssid.size); - pp->capability = ks_wlan_cap(priv); pp->beacon_lost_count = cpu_to_le16((uint16_t)(priv->reg.beacon_lost_count)); pp->auth_type = cpu_to_le16((uint16_t)(priv->reg.authenticate_type)); @@ -1395,16 +1393,9 @@ static void hostif_infrastructure_set2_request(struct ks_wlan_private *priv) if (!pp) return; - pp->phy_type = cpu_to_le16((uint16_t)(priv->reg.phy_type)); - pp->cts_mode = cpu_to_le16((uint16_t)(priv->reg.cts_mode)); - pp->scan_type = cpu_to_le16((uint16_t)(priv->reg.scan_type)); - - pp->rate_set.size = priv->reg.rate_set.size; - memcpy(>rate_set.body[0], >reg.rate_set.body[0], - priv->reg.rate_set.size); + init_request(priv, >request); pp->ssid.size = priv->reg.ssid.size; memcpy(>ssid.body[0], >reg.ssid.body[0], priv->reg.ssid.size); - pp->capability = ks_wlan_cap(priv); pp->beacon_lost_count = cpu_to_le16((uint16_t)(priv->reg.beacon_lost_count)); pp->auth_type = cpu_to_le16((uint16_t)(priv->reg.authenticate_type)); @@ -1445,16 +1436,10 @@ void hostif_adhoc_set_request(struct ks_wlan_private *priv) if (!pp) return; - pp->phy_type = cpu_to_le16((uint16_t)(priv->reg.phy_type)); - pp->cts_mode = cpu_to_le16((uint16_t)(priv->reg.cts_mode)); - pp->scan_type = cpu_to_le16((uint16_t)(priv->reg.scan_type)); + init_request(priv, >request); pp->channel = cpu_to_le16((uint16_t)(priv->reg.channel)); - pp->rate_set.size = priv->reg.rate_set.size; - memcpy(>rate_set.body[0], >reg.rate_set.body[0], - priv->reg.rate_set.size); pp->ssid.size = priv->reg.ssid.size; memcpy(>ssid.body[0], >reg.ssid.body[0], priv->reg.ssid.size); - pp->capability = ks_wlan_cap(priv); /* send to device request */ ps_confirm_wait_inc(priv); @@ -1470,15 +1455,9 @@ void hostif_adhoc_set2_request(struct ks_wlan_private *priv) if (!pp) return; -
[PATCH 1/7] staging: ks7010: Fix line over 80 characters.
There is no reason for comment describing the BSSID check for loop to be spaced so far to the right. Move it above the for loop. Signed-off-by: Quytelda Kahja--- drivers/staging/ks7010/ks_hostif.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 3ef9126ab810..534cca95bfb9 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -777,7 +777,8 @@ void hostif_scan_indication(struct ks_wlan_private *priv) ap_info = (struct ap_info_t *)(priv->rxp); if (priv->scan_ind_count) { - for (i = 0; i < priv->aplist.size; i++) { /* bssid check */ + /* bssid check */ + for (i = 0; i < priv->aplist.size; i++) { if (memcmp(ap_info->bssid, priv->aplist.ap[i].bssid, ETH_ALEN) != 0) continue; -- 2.16.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] Storvsc: Select channel based on available percentage of ring buffer to write
From: Long LiThis is a best effort for estimating on how busy the ring buffer is for that channel, based on available buffer to write in percentage. It is still possible that at the time of actual ring buffer write, the space may not be available due to other processes may be writing at the time. Selecting a channel based on how full it is can reduce the possibility that a ring buffer write will fail, and avoid the situation a channel is over busy. Now it's possible that storvsc can use a smaller ring buffer size (e.g. 40k bytes) to take advantage of cache locality. Signed-off-by: Long Li --- drivers/scsi/storvsc_drv.c | 62 +- 1 file changed, 50 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index a2ec0bc9e9fa..96681c4f75cb 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -395,6 +395,12 @@ MODULE_PARM_DESC(storvsc_ringbuffer_size, "Ring buffer size (bytes)"); module_param(storvsc_vcpus_per_sub_channel, int, S_IRUGO); MODULE_PARM_DESC(storvsc_vcpus_per_sub_channel, "Ratio of VCPUs to subchannels"); + +static int ring_avail_percent_lowater = 10; +module_param(ring_avail_percent_lowater, int, S_IRUGO); +MODULE_PARM_DESC(ring_avail_percent_lowater, + "Select a channel if available ring size > this in percent"); + /* * Timeout in seconds for all devices managed by this driver. */ @@ -1285,9 +1291,9 @@ static int storvsc_do_io(struct hv_device *device, { struct storvsc_device *stor_device; struct vstor_packet *vstor_packet; - struct vmbus_channel *outgoing_channel; + struct vmbus_channel *outgoing_channel, *channel; int ret = 0; - struct cpumask alloced_mask; + struct cpumask alloced_mask, other_numa_mask; int tgt_cpu; vstor_packet = >vstor_packet; @@ -1301,22 +1307,53 @@ static int storvsc_do_io(struct hv_device *device, /* * Select an an appropriate channel to send the request out. */ - if (stor_device->stor_chns[q_num] != NULL) { outgoing_channel = stor_device->stor_chns[q_num]; - if (outgoing_channel->target_cpu == smp_processor_id()) { + if (outgoing_channel->target_cpu == q_num) { /* * Ideally, we want to pick a different channel if * available on the same NUMA node. */ cpumask_and(_mask, _device->alloced_cpus, cpumask_of_node(cpu_to_node(q_num))); - for_each_cpu_wrap(tgt_cpu, _mask, - outgoing_channel->target_cpu + 1) { - if (tgt_cpu != outgoing_channel->target_cpu) { - outgoing_channel = - stor_device->stor_chns[tgt_cpu]; - break; + + for_each_cpu_wrap(tgt_cpu, _mask, q_num + 1) { + if (tgt_cpu == q_num) + continue; + channel = stor_device->stor_chns[tgt_cpu]; + if (hv_get_avail_to_write_percent( + >outbound) + > ring_avail_percent_lowater) { + outgoing_channel = channel; + goto found_channel; + } + } + + /* +* All the othe channels on the same NUMA node are +* busy. Try to use the channel with the current CPU +*/ + if (hv_get_avail_to_write_percent( + _channel->outbound) + > ring_avail_percent_lowater) + goto found_channel; + + /* +* If we reach here, all the channels on the current +* NUMA node are busy. Try to find a channel in +* other NUMA nodes +*/ + cpumask_andnot(_numa_mask, + _device->alloced_cpus, + cpumask_of_node(cpu_to_node(q_num))); + + for_each_cpu(tgt_cpu, _numa_mask) { + channel = stor_device->stor_chns[tgt_cpu]; + if (hv_get_avail_to_write_percent( + >outbound) + > ring_avail_percent_lowater) { +
[PATCH 2/3] Netvsc: Use the vmbus functiton to calculate ring buffer percentage
From: Long LiIn Vmbus, we have defined a function to calculate available ring buffer percentage to write. Use that function and remove duplicate netvsc code. Signed-off-by: Long Li --- drivers/net/hyperv/netvsc.c | 17 +++-- drivers/net/hyperv/netvsc_drv.c | 3 --- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 0265d703eb03..8af0069e4d8c 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -31,7 +31,6 @@ #include #include #include -#include #include @@ -590,17 +589,6 @@ void netvsc_device_remove(struct hv_device *device) #define RING_AVAIL_PERCENT_HIWATER 20 #define RING_AVAIL_PERCENT_LOWATER 10 -/* - * Get the percentage of available bytes to write in the ring. - * The return value is in range from 0 to 100. - */ -static u32 hv_ringbuf_avail_percent(const struct hv_ring_buffer_info *ring_info) -{ - u32 avail_write = hv_get_bytes_to_write(ring_info); - - return reciprocal_divide(avail_write * 100, netvsc_ring_reciprocal); -} - static inline void netvsc_free_send_slot(struct netvsc_device *net_device, u32 index) { @@ -649,7 +637,8 @@ static void netvsc_send_tx_complete(struct netvsc_device *net_device, wake_up(_device->wait_drain); if (netif_tx_queue_stopped(netdev_get_tx_queue(ndev, q_idx)) && - (hv_ringbuf_avail_percent(>outbound) > RING_AVAIL_PERCENT_HIWATER || + (hv_get_avail_to_write_percent(>outbound) > +RING_AVAIL_PERCENT_HIWATER || queue_sends < 1)) { netif_tx_wake_queue(netdev_get_tx_queue(ndev, q_idx)); ndev_ctx->eth_stats.wake_queue++; @@ -757,7 +746,7 @@ static inline int netvsc_send_pkt( struct netdev_queue *txq = netdev_get_tx_queue(ndev, packet->q_idx); u64 req_id; int ret; - u32 ring_avail = hv_ringbuf_avail_percent(_channel->outbound); + u32 ring_avail = hv_get_avail_to_write_percent(_channel->outbound); nvmsg.hdr.msg_type = NVSP_MSG1_TYPE_SEND_RNDIS_PKT; if (skb) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index faea0be18924..b0b1c2fd2b7b 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -55,7 +54,6 @@ static unsigned int ring_size __ro_after_init = 128; module_param(ring_size, uint, S_IRUGO); MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)"); unsigned int netvsc_ring_bytes __ro_after_init; -struct reciprocal_value netvsc_ring_reciprocal __ro_after_init; static const u32 default_msg = NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK | NETIF_MSG_IFUP | @@ -2186,7 +2184,6 @@ static int __init netvsc_drv_init(void) ring_size); } netvsc_ring_bytes = ring_size * PAGE_SIZE; - netvsc_ring_reciprocal = reciprocal_value(netvsc_ring_bytes); ret = vmbus_driver_register(_drv); if (ret) -- 2.14.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/3] Vmbus: Add function to report available ring buffer to write in total ring size percentage
From: Long LiNetvsc has a similar function to calculate how much ring buffer in percentage is available to write. This function is useful for storvsc and other vmbus devices. Define a similar function in vmbus to be used by storvsc. Signed-off-by: Long Li --- drivers/hv/ring_buffer.c | 2 ++ include/linux/hyperv.h | 12 2 files changed, 14 insertions(+) diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index 8699bb969e7e..3c836c099a8f 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -227,6 +227,8 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, ring_info->ring_buffer->feature_bits.value = 1; ring_info->ring_size = page_cnt << PAGE_SHIFT; + ring_info->ring_size_div10_reciprocal = + reciprocal_value(ring_info->ring_size / 10); ring_info->ring_datasize = ring_info->ring_size - sizeof(struct hv_ring_buffer); diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 2048f3c3b68a..eb7204851089 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -36,6 +36,7 @@ #include #include #include +#include #define MAX_PAGE_BUFFER_COUNT 32 #define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */ @@ -121,6 +122,7 @@ struct hv_ring_buffer { struct hv_ring_buffer_info { struct hv_ring_buffer *ring_buffer; u32 ring_size; /* Include the shared header */ + struct reciprocal_value ring_size_div10_reciprocal; spinlock_t ring_lock; u32 ring_datasize; /* < ring_size */ @@ -155,6 +157,16 @@ static inline u32 hv_get_bytes_to_write(const struct hv_ring_buffer_info *rbi) return write; } +static inline u32 hv_get_avail_to_write_percent( + const struct hv_ring_buffer_info *rbi) +{ + u32 avail_write = hv_get_bytes_to_write(rbi); + + return reciprocal_divide( + (avail_write << 3) + (avail_write << 1), + rbi->ring_size_div10_reciprocal); +} + /* * VMBUS version is 32 bit entity broken up into * two 16 bit quantities: major_number. minor_number. -- 2.14.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] storvsc: Set up correct queue depth values for IDE devices
From: Long LiUnlike SCSI and FC, we don't use multiple channels for IDE. Also fix the calculation for sub-channels. Change log: v2: Addressed comment on incorrect number of sub-channels. (Michael Kelley ) Signed-off-by: Long Li --- drivers/scsi/storvsc_drv.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 8c51d628b52e..a2ec0bc9e9fa 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -1722,11 +1722,14 @@ static int storvsc_probe(struct hv_device *device, max_targets = STORVSC_MAX_TARGETS; max_channels = STORVSC_MAX_CHANNELS; /* -* On Windows8 and above, we support sub-channels for storage. +* On Windows8 and above, we support sub-channels for storage +* on SCSI and FC controllers. * The number of sub-channels offerred is based on the number of * VCPUs in the guest. */ - max_sub_channels = (num_cpus / storvsc_vcpus_per_sub_channel); + if (!dev_is_ide) + max_sub_channels = + (num_cpus - 1) / storvsc_vcpus_per_sub_channel; } scsi_driver.can_queue = (max_outstanding_req_per_channel * -- 2.14.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4] staging: bcm2835-audio: Release resources on module_exit()
In the current implementation, `rmmod snd_bcm2835` does not release resources properly. It causes an oops when trying to list sound devices. This commit fixes it. The details WRT allocation / free are described below. Device structure WRT allocation: pdev \childdev[] \card \chip \pcm \ctl Allocation / register sequence: * childdev: devm_kzalloc - freed during driver detach * childdev: device_initialize - freed during device_unregister * pdev: devres_alloc - freed during driver detach * childdev: device_add- removed during device_unregister * pdev, childdev: devres_add - freed during driver detach * card: snd_card_new - freed during snd_card_free * chip: kzalloc - freed during kfree * card, chip: snd_device_new - freed during snd_device_free * chip: new_pcm - TODO: free pcm * chip: new_ctl - TODO: free ctl * card: snd_card_register - unregistered during snd_card_free Free / unregister sequence: * card: snd_card_free * card, chip: snd_device_free * childdev: device_unregister * chip: kfree Steps to reproduce the issue before this commit: $ rmmod snd_bcm2835 $ aplay -L [ 138.648130] Unable to handle kernel paging request at virtual address 7f1343c0 [ 138.660415] pgd = ad8f [ 138.665567] [7f1343c0] *pgd=3864c811, *pte=, *ppte= [ 138.674887] Internal error: Oops: 7 [#1] SMP ARM [ 138.683571] Modules linked in: sha256_generic cfg80211 rfkill snd_pcm snd_timer snd fixed uio_pdrv_genirq uio ip_tables x_tables ipv6 [last unloaded: snd_bcm2835 ] [ 138.706594] CPU: 3 PID: 463 Comm: aplay Tainted: GWC 4.15.0-rc1-v 7+ #6 [ 138.719833] Hardware name: BCM2835 [ 138.726016] task: b877ac00 task.stack: aebec000 [ 138.733408] PC is at try_module_get+0x38/0x24c [ 138.740813] LR is at snd_ctl_open+0x58/0x194 [snd] [ 138.748485] pc : [<801c4d5c>]lr : [<7f0e6b2c>]psr: 2013 [ 138.757709] sp : aebedd60 ip : aebedd88 fp : aebedd84 [ 138.765884] r10: r9 : 0004 r8 : 7f0ed440 [ 138.774040] r7 : b7e469b0 r6 : 7f0e6b2c r5 : afd91900 r4 : 7f1343c0 [ 138.783571] r3 : aebec000 r2 : 0001 r1 : b877ac00 r0 : 7f1343c0 [ 138.793084] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user [ 138.803300] Control: 10c5387d Table: 2d8f006a DAC: 0055 [ 138.812064] Process aplay (pid: 463, stack limit = 0xaebec210) [ 138.820868] Stack: (0xaebedd60 to 0xaebee000) [ 138.828207] dd60: b848d000 afd91900 b7e469b0 7f0ed440 aebedda4 aebedd88 [ 138.842371] dd80: 7f0e6b2c 801c4d30 afd91900 7f0ea4dc b7e469b0 aebeddcc aebedda8 [ 138.856611] dda0: 7f0e250c 7f0e6ae0 7f0e2464 b8478ec0 b7e469b0 afd91900 7f0ea388 [ 138.870864] ddc0: aebeddf4 aebeddd0 802ce590 7f0e2470 8090ab64 afd91900 afd91900 b7e469b0 [ 138.885301] dde0: afd91908 802ce4e4 aebede1c aebeddf8 802c57b4 802ce4f0 afd91900 aebedea8 [ 138.900110] de00: b7fa4c00 0004 aebede3c aebede20 802c6ba8 802c56b4 [ 138.915260] de20: aebedea8 aebedf5c aebedea4 aebede40 802d9a68 802c6b58 [ 138.930661] de40: b874ddd0 0001 0041 afd91900 aebede70 [ 138.946402] de60: 0002 b7e469b0 b8a87610 b8d6ab80 801852f8 0008 [ 138.962314] de80: aebedf5c aebedea8 0001 80108464 aebec000 aebedf4c aebedea8 [ 138.978414] dea0: 802dacd4 802d970c b8a87610 b8d6ab80 a7982bc6 0009 af363019 b9231480 [ 138.994617] dec0: b8c038a0 b7e469b0 0101 0002 0238 [ 139.010823] dee0: aebedee8 0008 000f aebedf3c aebedf00 802ed7e4 80843f94 [ 139.027025] df00: 0003 0008 b9231490 b9231480 0008 af363000 [ 139.043229] df20: 0005 0002 ff9c 0008 ff9c af363000 0003 [ 139.059430] df40: aebedf94 aebedf50 802c6f70 802dac70 aebec000 0001 [ 139.075629] df60: 0002 0004 0100 0001 7ebe577c 0002e038 0005 [ 139.091828] df80: 80108464 aebec000 aebedfa4 aebedf98 802c7060 802c6e6c aebedfa8 [ 139.108025] dfa0: 801082c0 802c7040 7ebe577c 0002e038 7ebe577c 0008 0b98 e81c8400 [ 139.124222] dfc0: 7ebe577c 0002e038 0005 7ebe57e4 00a20af8 7ebe57f0 76f87394 [ 139.140419] dfe0: 7ebe55c4 76ec88e8 76df1d9c 6010 7ebe577c [ 139.156715] [<801c4d5c>] (try_module_get) from [<7f0e6b2c>] (snd_ctl_open+0x58/0x194 [snd]) [ 139.173222] [<7f0e6b2c>] (snd_ctl_open [snd]) from [<7f0e250c>] (snd_open+0xa8/0x14c [snd]) [ 139.189683] [<7f0e250c>] (snd_open [snd]) from [<802ce590>] (chrdev_open+0xac/0x188) [ 139.205465] [<802ce590>] (chrdev_open) from [<802c57b4>] (do_dentry_open+0x10c/0x314) [ 139.221347] [<802c57b4>] (do_dentry_open) from [<802c6ba8>] (vfs_open+0x5c/0x88) [ 139.236788] [<802c6ba8>] (vfs_open) from [<802d9a68>]
Re: [PATCH v3] staging: bcm2835-audio: Release resources on module_exit()
On 03/21/18 20:24, Andy Shevchenko wrote: > On Wed, Mar 21, 2018 at 8:48 PM, Kirill Marinushkin >wrote: >> In the current implementation, `rmmod snd_bcm2835` does not release >> resources properly. It causes an oops when trying to list sound devices. >> >> This commit fixes it. >> >> The details WRT allocation / free are described below. >> >> Device structure WRT allocation: >> >> pdev >> \childdev[] >> \card >> \chip >> \pcm >> \ctl >> >> Allocation / register sequence: >> >> * childdev: devm_kzalloc - freed during driver detach >> * childdev: device_initialize - freed during device_unregister >> * pdev: devres_alloc - freed during driver detach >> * childdev: device_add- removed during device_unregister >> * pdev, childdev: devres_add - freed during driver detach >> * card: snd_card_new - freed during snd_card_free >> * chip: kzalloc - freed during kfree >> * card, chip: snd_device_new - freed during snd_device_free >> * chip: new_pcm - TODO: free pcm >> * chip: new_ctl - TODO: free ctl >> * card: snd_card_register - unregistered during snd_card_free >> >> Free / unregister sequence: >> >> * card: snd_card_free >> * card, chip: snd_device_free >> * childdev: device_unregister >> * chip: kfree >> >> Steps to reproduce the issue before this commit: >> >> >> $ rmmod snd_bcm2835 >> $ aplay -L >> [ 138.648130] Unable to handle kernel paging request at virtual address >> 7f1343c0 >> [ 138.660415] pgd = ad8f >> [ 138.665567] [7f1343c0] *pgd=3864c811, *pte=, *ppte= >> [ 138.674887] Internal error: Oops: 7 [#1] SMP ARM >> [ 138.683571] Modules linked in: sha256_generic cfg80211 rfkill snd_pcm >> snd_timer >> snd fixed uio_pdrv_genirq uio ip_tables x_tables ipv6 [last unloaded: >> snd_bcm2835 >> ] >> [ 138.706594] CPU: 3 PID: 463 Comm: aplay Tainted: GWC >> 4.15.0-rc1-v >> 7+ #6 >> [ 138.719833] Hardware name: BCM2835 >> [ 138.726016] task: b877ac00 task.stack: aebec000 >> [ 138.733408] PC is at try_module_get+0x38/0x24c >> [ 138.740813] LR is at snd_ctl_open+0x58/0x194 [snd] >> [ 138.748485] pc : [<801c4d5c>]lr : [<7f0e6b2c>]psr: 2013 >> [ 138.757709] sp : aebedd60 ip : aebedd88 fp : aebedd84 >> [ 138.765884] r10: r9 : 0004 r8 : 7f0ed440 >> [ 138.774040] r7 : b7e469b0 r6 : 7f0e6b2c r5 : afd91900 r4 : 7f1343c0 >> [ 138.783571] r3 : aebec000 r2 : 0001 r1 : b877ac00 r0 : 7f1343c0 >> [ 138.793084] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment >> user >> [ 138.803300] Control: 10c5387d Table: 2d8f006a DAC: 0055 >> [ 138.812064] Process aplay (pid: 463, stack limit = 0xaebec210) >> [ 138.820868] Stack: (0xaebedd60 to 0xaebee000) >> [ 138.828207] dd60: b848d000 afd91900 b7e469b0 7f0ed440 >> aebedda4 aebedd88 >> [ 138.842371] dd80: 7f0e6b2c 801c4d30 afd91900 7f0ea4dc b7e469b0 >> aebeddcc aebedda8 >> [ 138.856611] dda0: 7f0e250c 7f0e6ae0 7f0e2464 b8478ec0 b7e469b0 afd91900 >> 7f0ea388 >> [ 138.870864] ddc0: aebeddf4 aebeddd0 802ce590 7f0e2470 8090ab64 afd91900 >> afd91900 b7e469b0 >> [ 138.885301] dde0: afd91908 802ce4e4 aebede1c aebeddf8 802c57b4 802ce4f0 >> afd91900 aebedea8 >> [ 138.900110] de00: b7fa4c00 0004 aebede3c aebede20 >> 802c6ba8 802c56b4 >> [ 138.915260] de20: aebedea8 aebedf5c aebedea4 aebede40 >> 802d9a68 802c6b58 >> [ 138.930661] de40: b874ddd0 0001 0041 >> afd91900 aebede70 >> [ 138.946402] de60: 0002 b7e469b0 b8a87610 b8d6ab80 >> 801852f8 0008 >> [ 138.962314] de80: aebedf5c aebedea8 0001 80108464 aebec000 >> aebedf4c aebedea8 >> [ 138.978414] dea0: 802dacd4 802d970c b8a87610 b8d6ab80 a7982bc6 0009 >> af363019 b9231480 >> [ 138.994617] dec0: b8c038a0 b7e469b0 0101 0002 0238 >> >> [ 139.010823] dee0: aebedee8 0008 000f aebedf3c aebedf00 >> 802ed7e4 80843f94 >> [ 139.027025] df00: 0003 0008 b9231490 b9231480 0008 >> af363000 >> [ 139.043229] df20: 0005 0002 ff9c 0008 ff9c >> af363000 0003 >> [ 139.059430] df40: aebedf94 aebedf50 802c6f70 802dac70 aebec000 >> 0001 >> [ 139.075629] df60: 0002 0004 0100 0001 7ebe577c 0002e038 >> 0005 >> [ 139.091828] df80: 80108464 aebec000 aebedfa4 aebedf98 802c7060 802c6e6c >> aebedfa8 >> [ 139.108025] dfa0: 801082c0 802c7040 7ebe577c 0002e038 7ebe577c 0008 >> 0b98 e81c8400 >> [ 139.124222] dfc0: 7ebe577c 0002e038 0005 7ebe57e4 00a20af8 >> 7ebe57f0 76f87394 >> [ 139.140419] dfe0: 7ebe55c4 76ec88e8 76df1d9c 6010 7ebe577c >> >> [ 139.156715] [<801c4d5c>] (try_module_get) from [<7f0e6b2c>] >>
[PATCH 00/12] staging: ks7010: clean michael_mic header and source files
The following patch series clean michael_mic source and header files. Changes are as follows: * avoid camel cases in some structs and function definitions * replace macros with inline functions * use u8 type replacing some uint8_t types and avoid some no more needed casts. Sergio Paracuellos (12): staging: ks7010: use lower case names in michael_mic_t struct fields staging: ks7010: avoid camel cases in MichaelMICFunction staging: ks7010: avoid camel cases for MichaelInitFunction staging: ks7010: avoid camel cases in MichaelAppend function staging: ks7010: replace macro MichaelClear with inline function staging: ks7010: avoid camel cases in MichaelGetMIC function staging: ks7010: replace PutUInt32 macro with an inline function staging: ks7010: replace GetUInt32 macro with inline function staging: ks7010: replace MichaelBlockFunction macro with inline function staging: ks7010: replace uint8_t in favour of u8 in michael_init staging: ks7010: replace uint8_t in favour of u8 in michael_append staging: ks7010: replace uint8_t in favour of u8 in michael_get_mic drivers/staging/ks7010/ks_hostif.c | 28 +++ drivers/staging/ks7010/michael_mic.c | 147 +-- drivers/staging/ks7010/michael_mic.h | 19 +++-- 3 files changed, 96 insertions(+), 98 deletions(-) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/12] staging: ks7010: use lower case names in michael_mic_t struct fields
Replace upper case fields and camel cases for fields included in michael_mic_t structure Signed-off-by: Sergio Paracuellos--- drivers/staging/ks7010/ks_hostif.c | 8 +++--- drivers/staging/ks7010/michael_mic.c | 54 ++-- drivers/staging/ks7010/michael_mic.h | 14 +- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 3ef9126..07795f6 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -349,9 +349,9 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv, (uint8_t *)priv->rxp, (int)priv->rx_size, (uint8_t)0, /* priority */ - (uint8_t *)michael_mic.Result); + (uint8_t *)michael_mic.result); } - if (memcmp(michael_mic.Result, recv_mic, 8) != 0) { + if (memcmp(michael_mic.result, recv_mic, 8) != 0) { now = jiffies; mic_failure = >wpa.mic_failure; /* MIC FAILURE */ @@ -1174,8 +1174,8 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb) (uint8_t *)>data[0], (int)skb_len, (uint8_t)0, /* priority */ - (uint8_t *)michael_mic.Result); - memcpy(p, michael_mic.Result, 8); + (uint8_t *)michael_mic.result); + memcpy(p, michael_mic.result, 8); length += 8; skb_len += 8; p += 8; diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c index 1df4366..861721d 100644 --- a/drivers/staging/ks7010/michael_mic.c +++ b/drivers/staging/ks7010/michael_mic.c @@ -30,17 +30,17 @@ do { \ // Reset the state to the empty message. #define MichaelClear(A)\ do { \ - A->L = A->K0; \ - A->R = A->K1; \ - A->nBytesInM = 0; \ + A->l = A->k0; \ + A->r = A->k1; \ + A->m_bytes = 0; \ } while (0) static void MichaelInitializeFunction(struct michael_mic_t *Mic, uint8_t *key) { // Set the key - Mic->K0 = getUInt32(key, 0); - Mic->K1 = getUInt32(key, 4); + Mic->k0 = getUInt32(key, 0); + Mic->k1 = getUInt32(key, 4); //clear(); MichaelClear(Mic); @@ -63,61 +63,61 @@ void MichaelAppend(struct michael_mic_t *Mic, uint8_t *src, int nBytes) { int addlen; - if (Mic->nBytesInM) { - addlen = 4 - Mic->nBytesInM; + if (Mic->m_bytes) { + addlen = 4 - Mic->m_bytes; if (addlen > nBytes) addlen = nBytes; - memcpy(>M[Mic->nBytesInM], src, addlen); - Mic->nBytesInM += addlen; + memcpy(>m[Mic->m_bytes], src, addlen); + Mic->m_bytes += addlen; src += addlen; nBytes -= addlen; - if (Mic->nBytesInM < 4) + if (Mic->m_bytes < 4) return; - Mic->L ^= getUInt32(Mic->M, 0); - MichaelBlockFunction(Mic->L, Mic->R); - Mic->nBytesInM = 0; + Mic->l ^= getUInt32(Mic->m, 0); + MichaelBlockFunction(Mic->l, Mic->r); + Mic->m_bytes = 0; } while (nBytes >= 4) { - Mic->L ^= getUInt32(src, 0); - MichaelBlockFunction(Mic->L, Mic->R); + Mic->l ^= getUInt32(src, 0); + MichaelBlockFunction(Mic->l, Mic->r); src += 4; nBytes -= 4; } if (nBytes > 0) { - Mic->nBytesInM = nBytes; - memcpy(Mic->M, src, nBytes); + Mic->m_bytes = nBytes; + memcpy(Mic->m, src, nBytes); } } static void MichaelGetMIC(struct michael_mic_t *Mic, uint8_t *dst) { - u8 *data = Mic->M; + u8 *data = Mic->m; - switch (Mic->nBytesInM) { + switch (Mic->m_bytes) { case 0: - Mic->L ^= 0x5a; + Mic->l ^= 0x5a; break; case 1: - Mic->L ^= data[0] | 0x5a00; + Mic->l ^= data[0] | 0x5a00; break; case
[PATCH 11/12] staging: ks7010: replace uint8_t in favour of u8 in michael_append
This commit replaces param which is uint8_t in michael_append function in favour of preferred one u8. Signed-off-by: Sergio Paracuellos--- drivers/staging/ks7010/michael_mic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c index 69c1f39..04831eaa 100644 --- a/drivers/staging/ks7010/michael_mic.c +++ b/drivers/staging/ks7010/michael_mic.c @@ -60,7 +60,7 @@ static inline void michael_block(u32 *l, u32 *r) *l += *r; } -static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes) +static void michael_append(struct michael_mic_t *mic, u8 *src, int bytes) { int addlen; @@ -138,8 +138,8 @@ void michael_mic_function(struct michael_mic_t *mic, u8 *key, * +--+--++--++--+--+--+--+--+--+--+--+ */ michael_init(mic, key); - michael_append(mic, (uint8_t *)data, 12); /* |DA|SA| */ + michael_append(mic, data, 12); /* |DA|SA| */ michael_append(mic, pad_data, 4); /* |Priority|0|0|0| */ - michael_append(mic, (uint8_t *)(data + 12), len - 12); /* |Data| */ + michael_append(mic, (data + 12), len - 12); /* |Data| */ michael_get_mic(mic, result); } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/12] staging: ks7010: replace MichaelBlockFunction macro with inline function
This commit replaces MichaelBlockFunction macro with similar inline function renaming it to michael_block. Signed-off-by: Sergio Paracuellos--- drivers/staging/ks7010/michael_mic.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c index 6829cb5..07913d0 100644 --- a/drivers/staging/ks7010/michael_mic.c +++ b/drivers/staging/ks7010/michael_mic.c @@ -48,17 +48,17 @@ static void michael_init(struct michael_mic_t *mic, uint8_t *key) michael_clear(mic); } -#define MichaelBlockFunction(L, R) \ -do { \ - R ^= rol32(L, 17); \ - L += R; \ - R ^= ((L & 0xff00ff00) >> 8) | ((L & 0x00ff00ff) << 8); \ - L += R; \ - R ^= rol32(L, 3); \ - L += R; \ - R ^= ror32(L, 2); \ - L += R; \ -} while (0) +static inline void michael_block(u32 *l, u32 *r) +{ + *l ^= rol32(*l, 17); + *l += *r; + *r ^= ((*l & 0xff00ff00) >> 8) | ((*l & 0x00ff00ff) << 8); + *l += *r; + *r ^= rol32(*l, 3); + *l += *r; + *r ^= ror32(*l, 2); + *l += *r; +} static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes) { @@ -77,13 +77,13 @@ static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes) return; mic->l ^= get_uint32(mic->m, 0); - MichaelBlockFunction(mic->l, mic->r); + michael_block(>l, >r); mic->m_bytes = 0; } while (bytes >= 4) { mic->l ^= get_uint32(src, 0); - MichaelBlockFunction(mic->l, mic->r); + michael_block(>l, >r); src += 4; bytes -= 4; } @@ -113,8 +113,8 @@ static void michael_get_mic(struct michael_mic_t *mic, uint8_t *dst) 0x5a00; break; } - MichaelBlockFunction(mic->l, mic->r); - MichaelBlockFunction(mic->l, mic->r); + michael_block(>l, >r); + michael_block(>l, >r); // The appendByte function has already computed the result. put_uint32(dst, 0, mic->l); put_uint32(dst, 4, mic->r); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/12] staging: ks7010: replace macro MichaelClear with inline function
This commit replaces MichaelClear macro with similar inline function renaming it to michael_clear. Signed-off-by: Sergio Paracuellos--- drivers/staging/ks7010/michael_mic.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c index 276ecd9..af36b12d 100644 --- a/drivers/staging/ks7010/michael_mic.c +++ b/drivers/staging/ks7010/michael_mic.c @@ -28,12 +28,12 @@ do { \ } while (0) // Reset the state to the empty message. -#define MichaelClear(A)\ -do { \ - A->l = A->k0; \ - A->r = A->k1; \ - A->m_bytes = 0; \ -} while (0) +static inline void michael_clear(struct michael_mic_t *mic) +{ + mic->l = mic->k0; + mic->r = mic->k1; + mic->m_bytes = 0; +} static void michael_init(struct michael_mic_t *mic, uint8_t *key) { @@ -42,7 +42,7 @@ static void michael_init(struct michael_mic_t *mic, uint8_t *key) mic->k1 = getUInt32(key, 4); //clear(); - MichaelClear(mic); + michael_clear(mic); } #define MichaelBlockFunction(L, R) \ @@ -118,7 +118,7 @@ void MichaelGetMIC(struct michael_mic_t *Mic, uint8_t *dst) putUInt32(dst, 4, Mic->r); // Reset to the empty message. - MichaelClear(Mic); + michael_clear(Mic); } void michael_mic_function(struct michael_mic_t *mic, u8 *key, -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/12] staging: ks7010: avoid camel cases in MichaelAppend function
This commit avoid camel cases in MichaelAppend function and params renaming it to michael_append. Signed-off-by: Sergio Paracuellos--- drivers/staging/ks7010/michael_mic.c | 45 ++-- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c index bc92db1..276ecd9 100644 --- a/drivers/staging/ks7010/michael_mic.c +++ b/drivers/staging/ks7010/michael_mic.c @@ -57,38 +57,37 @@ do { \ L += R; \ } while (0) -static -void MichaelAppend(struct michael_mic_t *Mic, uint8_t *src, int nBytes) +static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes) { int addlen; - if (Mic->m_bytes) { - addlen = 4 - Mic->m_bytes; - if (addlen > nBytes) - addlen = nBytes; - memcpy(>m[Mic->m_bytes], src, addlen); - Mic->m_bytes += addlen; + if (mic->m_bytes) { + addlen = 4 - mic->m_bytes; + if (addlen > bytes) + addlen = bytes; + memcpy(>m[mic->m_bytes], src, addlen); + mic->m_bytes += addlen; src += addlen; - nBytes -= addlen; + bytes -= addlen; - if (Mic->m_bytes < 4) + if (mic->m_bytes < 4) return; - Mic->l ^= getUInt32(Mic->m, 0); - MichaelBlockFunction(Mic->l, Mic->r); - Mic->m_bytes = 0; + mic->l ^= getUInt32(mic->m, 0); + MichaelBlockFunction(mic->l, mic->r); + mic->m_bytes = 0; } - while (nBytes >= 4) { - Mic->l ^= getUInt32(src, 0); - MichaelBlockFunction(Mic->l, Mic->r); + while (bytes >= 4) { + mic->l ^= getUInt32(src, 0); + MichaelBlockFunction(mic->l, mic->r); src += 4; - nBytes -= 4; + bytes -= 4; } - if (nBytes > 0) { - Mic->m_bytes = nBytes; - memcpy(Mic->m, src, nBytes); + if (bytes > 0) { + mic->m_bytes = bytes; + memcpy(mic->m, src, bytes); } } @@ -137,8 +136,8 @@ void michael_mic_function(struct michael_mic_t *mic, u8 *key, * +--+--++--++--+--+--+--+--+--+--+--+ */ michael_init(mic, key); - MichaelAppend(mic, (uint8_t *)data, 12);/* |DA|SA| */ - MichaelAppend(mic, pad_data, 4);/* |Priority|0|0|0| */ - MichaelAppend(mic, (uint8_t *)(data + 12), len - 12); /* |Data| */ + michael_append(mic, (uint8_t *)data, 12); /* |DA|SA| */ + michael_append(mic, pad_data, 4); /* |Priority|0|0|0| */ + michael_append(mic, (uint8_t *)(data + 12), len - 12); /* |Data| */ MichaelGetMIC(mic, result); } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/12] staging: ks7010: replace uint8_t in favour of u8 in michael_get_mic
This commit replaces uint8_t parameter for preferred one u8 in michael_get_mic function. Signed-off-by: Sergio Paracuellos--- drivers/staging/ks7010/michael_mic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c index 04831eaa..cb95146 100644 --- a/drivers/staging/ks7010/michael_mic.c +++ b/drivers/staging/ks7010/michael_mic.c @@ -94,7 +94,7 @@ static void michael_append(struct michael_mic_t *mic, u8 *src, int bytes) } } -static void michael_get_mic(struct michael_mic_t *mic, uint8_t *dst) +static void michael_get_mic(struct michael_mic_t *mic, u8 *dst) { u8 *data = mic->m; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/12] staging: ks7010: avoid camel cases in MichaelMICFunction
This commit replace camel cases for name and params used in MichaelMICFunction. This improves a bit readability. Signed-off-by: Sergio Paracuellos--- drivers/staging/ks7010/ks_hostif.c | 24 drivers/staging/ks7010/michael_mic.c | 15 +++ drivers/staging/ks7010/michael_mic.h | 5 ++--- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 07795f6..fe20aca 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -344,12 +344,12 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv, memcpy(_mic[0], (priv->rxp) + ((priv->rx_size) - 8), 8); priv->rx_size = priv->rx_size - 8; if (auth_type > 0 && auth_type < 4) { /* auth_type check */ - MichaelMICFunction(_mic, - (uint8_t *)key->rx_mic_key, - (uint8_t *)priv->rxp, - (int)priv->rx_size, - (uint8_t)0, /* priority */ - (uint8_t *)michael_mic.result); + michael_mic_function(_mic, +(uint8_t *)key->rx_mic_key, +(uint8_t *)priv->rxp, +(int)priv->rx_size, +(uint8_t)0,/* priority */ +(uint8_t *)michael_mic.result); } if (memcmp(michael_mic.result, recv_mic, 8) != 0) { now = jiffies; @@ -1169,12 +1169,12 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb) pp->auth_type = cpu_to_le16((uint16_t)TYPE_AUTH); /* no encryption */ } else { if (priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) { - MichaelMICFunction(_mic, - (uint8_t *)priv->wpa.key[0].tx_mic_key, - (uint8_t *)>data[0], - (int)skb_len, - (uint8_t)0, /* priority */ - (uint8_t *)michael_mic.result); + michael_mic_function(_mic, +(uint8_t *)priv->wpa.key[0].tx_mic_key, +(uint8_t *)>data[0], +(int)skb_len, +(uint8_t)0,/* priority */ +(uint8_t *)michael_mic.result); memcpy(p, michael_mic.result, 8); length += 8; skb_len += 8; diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c index 861721d..f795043 100644 --- a/drivers/staging/ks7010/michael_mic.c +++ b/drivers/staging/ks7010/michael_mic.c @@ -123,9 +123,8 @@ void MichaelGetMIC(struct michael_mic_t *Mic, uint8_t *dst) MichaelClear(Mic); } -void MichaelMICFunction(struct michael_mic_t *Mic, u8 *Key, - u8 *Data, int Len, u8 priority, - u8 *Result) +void michael_mic_function(struct michael_mic_t *mic, u8 *key, + u8 *data, int len, u8 priority, u8 *result) { u8 pad_data[4] = { priority, 0, 0, 0 }; // Compute the MIC value @@ -138,9 +137,9 @@ void MichaelMICFunction(struct michael_mic_t *Mic, u8 *Key, * |DA|SA|Priority|0 |Data|M0|M1|M2|M3|M4|M5|M6|M7| * +--+--++--++--+--+--+--+--+--+--+--+ */ - MichaelInitializeFunction(Mic, Key); - MichaelAppend(Mic, (uint8_t *)Data, 12);/* |DA|SA| */ - MichaelAppend(Mic, pad_data, 4);/* |Priority|0|0|0| */ - MichaelAppend(Mic, (uint8_t *)(Data + 12), Len - 12); /* |Data| */ - MichaelGetMIC(Mic, Result); + MichaelInitializeFunction(mic, key); + MichaelAppend(mic, (uint8_t *)data, 12);/* |DA|SA| */ + MichaelAppend(mic, pad_data, 4);/* |Priority|0|0|0| */ + MichaelAppend(mic, (uint8_t *)(data + 12), len - 12); /* |Data| */ + MichaelGetMIC(mic, result); } diff --git a/drivers/staging/ks7010/michael_mic.h b/drivers/staging/ks7010/michael_mic.h index 64db7d1..894a8d4 100644 --- a/drivers/staging/ks7010/michael_mic.h +++ b/drivers/staging/ks7010/michael_mic.h @@ -20,6 +20,5 @@ struct michael_mic_t { u8 result[8]; }; -void
[PATCH 10/12] staging: ks7010: replace uint8_t in favour of u8 in michael_init
This commit replaces uint8_t for preferred one u8 in parameter of michael_init function. Signed-off-by: Sergio Paracuellos--- drivers/staging/ks7010/michael_mic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c index 07913d0..69c1f39 100644 --- a/drivers/staging/ks7010/michael_mic.c +++ b/drivers/staging/ks7010/michael_mic.c @@ -38,7 +38,7 @@ static inline void michael_clear(struct michael_mic_t *mic) mic->m_bytes = 0; } -static void michael_init(struct michael_mic_t *mic, uint8_t *key) +static void michael_init(struct michael_mic_t *mic, u8 *key) { // Set the key mic->k0 = get_uint32(key, 0); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/12] staging: ks7010: avoid camel cases for MichaelInitFunction
This commit avoid camel cases in MichaelInitFunction signature and params renaming it to michael_init. Signed-off-by: Sergio Paracuellos--- drivers/staging/ks7010/michael_mic.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c index f795043..bc92db1 100644 --- a/drivers/staging/ks7010/michael_mic.c +++ b/drivers/staging/ks7010/michael_mic.c @@ -35,15 +35,14 @@ do {\ A->m_bytes = 0; \ } while (0) -static -void MichaelInitializeFunction(struct michael_mic_t *Mic, uint8_t *key) +static void michael_init(struct michael_mic_t *mic, uint8_t *key) { // Set the key - Mic->k0 = getUInt32(key, 0); - Mic->k1 = getUInt32(key, 4); + mic->k0 = getUInt32(key, 0); + mic->k1 = getUInt32(key, 4); //clear(); - MichaelClear(Mic); + MichaelClear(mic); } #define MichaelBlockFunction(L, R) \ @@ -137,7 +136,7 @@ void michael_mic_function(struct michael_mic_t *mic, u8 *key, * |DA|SA|Priority|0 |Data|M0|M1|M2|M3|M4|M5|M6|M7| * +--+--++--++--+--+--+--+--+--+--+--+ */ - MichaelInitializeFunction(mic, key); + michael_init(mic, key); MichaelAppend(mic, (uint8_t *)data, 12);/* |DA|SA| */ MichaelAppend(mic, pad_data, 4);/* |Priority|0|0|0| */ MichaelAppend(mic, (uint8_t *)(data + 12), len - 12); /* |Data| */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/12] staging: ks7010: replace GetUInt32 macro with inline function
This commit replaces GetUInt32 with inline function renaming it to get_uint32. Signed-off-by: Sergio Paracuellos--- drivers/staging/ks7010/michael_mic.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c index 9de31b4..6829cb5 100644 --- a/drivers/staging/ks7010/michael_mic.c +++ b/drivers/staging/ks7010/michael_mic.c @@ -15,8 +15,11 @@ #include "michael_mic.h" // Convert from Byte[] to UInt32 in a portable way -#define getUInt32(A, B)((uint32_t)(A[B + 0] << 0) \ - + (A[B + 1] << 8) + (A[B + 2] << 16) + (A[B + 3] << 24)) +static inline u32 get_uint32(const u8 *buf, u8 pos) +{ + return (u32)((buf[pos] << 0) + (buf[pos + 1] << 8) + +(buf[pos + 2] << 16) + (buf[pos + 3] << 24)); +} // Convert from UInt32 to Byte[] in a portable way static inline void put_uint32(u8 *dst, u8 pos, u32 orig) @@ -38,8 +41,8 @@ static inline void michael_clear(struct michael_mic_t *mic) static void michael_init(struct michael_mic_t *mic, uint8_t *key) { // Set the key - mic->k0 = getUInt32(key, 0); - mic->k1 = getUInt32(key, 4); + mic->k0 = get_uint32(key, 0); + mic->k1 = get_uint32(key, 4); //clear(); michael_clear(mic); @@ -73,13 +76,13 @@ static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes) if (mic->m_bytes < 4) return; - mic->l ^= getUInt32(mic->m, 0); + mic->l ^= get_uint32(mic->m, 0); MichaelBlockFunction(mic->l, mic->r); mic->m_bytes = 0; } while (bytes >= 4) { - mic->l ^= getUInt32(src, 0); + mic->l ^= get_uint32(src, 0); MichaelBlockFunction(mic->l, mic->r); src += 4; bytes -= 4; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/12] staging: ks7010: replace PutUInt32 macro with an inline function
This commit replaces PutUInt32 macro in favour of inline function renaming it to put_uint32. Signed-off-by: Sergio Paracuellos--- drivers/staging/ks7010/michael_mic.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c index 82ac122..9de31b4 100644 --- a/drivers/staging/ks7010/michael_mic.c +++ b/drivers/staging/ks7010/michael_mic.c @@ -19,13 +19,13 @@ + (A[B + 1] << 8) + (A[B + 2] << 16) + (A[B + 3] << 24)) // Convert from UInt32 to Byte[] in a portable way -#define putUInt32(A, B, C) \ -do { \ - A[B + 0] = (uint8_t)(C & 0xff); \ - A[B + 1] = (uint8_t)((C >> 8) & 0xff); \ - A[B + 2] = (uint8_t)((C >> 16) & 0xff); \ - A[B + 3] = (uint8_t)((C >> 24) & 0xff); \ -} while (0) +static inline void put_uint32(u8 *dst, u8 pos, u32 orig) +{ + dst[pos] = (u8)(orig & 0xff); + dst[pos + 1] = (u8)((orig >> 8) & 0xff); + dst[pos + 2] = (u8)((orig >> 16) & 0xff); + dst[pos + 3] = (u8)((orig >> 24) & 0xff); +} // Reset the state to the empty message. static inline void michael_clear(struct michael_mic_t *mic) @@ -113,8 +113,8 @@ static void michael_get_mic(struct michael_mic_t *mic, uint8_t *dst) MichaelBlockFunction(mic->l, mic->r); MichaelBlockFunction(mic->l, mic->r); // The appendByte function has already computed the result. - putUInt32(dst, 0, mic->l); - putUInt32(dst, 4, mic->r); + put_uint32(dst, 0, mic->l); + put_uint32(dst, 4, mic->r); // Reset to the empty message. michael_clear(mic); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/12] staging: ks7010: avoid camel cases in MichaelGetMIC function
This commit avoid camel cases in MichaelGetMIC function and params renaming it to michael_get_mic. Signed-off-by: Sergio Paracuellos--- drivers/staging/ks7010/michael_mic.c | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c index af36b12d..82ac122 100644 --- a/drivers/staging/ks7010/michael_mic.c +++ b/drivers/staging/ks7010/michael_mic.c @@ -91,34 +91,33 @@ static void michael_append(struct michael_mic_t *mic, uint8_t *src, int bytes) } } -static -void MichaelGetMIC(struct michael_mic_t *Mic, uint8_t *dst) +static void michael_get_mic(struct michael_mic_t *mic, uint8_t *dst) { - u8 *data = Mic->m; + u8 *data = mic->m; - switch (Mic->m_bytes) { + switch (mic->m_bytes) { case 0: - Mic->l ^= 0x5a; + mic->l ^= 0x5a; break; case 1: - Mic->l ^= data[0] | 0x5a00; + mic->l ^= data[0] | 0x5a00; break; case 2: - Mic->l ^= data[0] | (data[1] << 8) | 0x5a; + mic->l ^= data[0] | (data[1] << 8) | 0x5a; break; case 3: - Mic->l ^= data[0] | (data[1] << 8) | (data[2] << 16) | + mic->l ^= data[0] | (data[1] << 8) | (data[2] << 16) | 0x5a00; break; } - MichaelBlockFunction(Mic->l, Mic->r); - MichaelBlockFunction(Mic->l, Mic->r); + MichaelBlockFunction(mic->l, mic->r); + MichaelBlockFunction(mic->l, mic->r); // The appendByte function has already computed the result. - putUInt32(dst, 0, Mic->l); - putUInt32(dst, 4, Mic->r); + putUInt32(dst, 0, mic->l); + putUInt32(dst, 4, mic->r); // Reset to the empty message. - michael_clear(Mic); + michael_clear(mic); } void michael_mic_function(struct michael_mic_t *mic, u8 *key, @@ -139,5 +138,5 @@ void michael_mic_function(struct michael_mic_t *mic, u8 *key, michael_append(mic, (uint8_t *)data, 12); /* |DA|SA| */ michael_append(mic, pad_data, 4); /* |Priority|0|0|0| */ michael_append(mic, (uint8_t *)(data + 12), len - 12); /* |Data| */ - MichaelGetMIC(mic, result); + michael_get_mic(mic, result); } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] Staging: iio: accel: adis16201: Remove unused headers
Remove few unused headers files since the adis core handles the buffer and sysfs support. Signed-off-by: Himanshu Jha--- drivers/staging/iio/accel/adis16201.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/iio/accel/adis16201.c b/drivers/staging/iio/accel/adis16201.c index 97e25a3..b04dbb3 100644 --- a/drivers/staging/iio/accel/adis16201.c +++ b/drivers/staging/iio/accel/adis16201.c @@ -6,7 +6,6 @@ * Licensed under the GPL-2 or later. */ -#include #include #include #include @@ -16,8 +15,6 @@ #include #include -#include -#include #include #define ADIS16201_STARTUP_DELAY_MS 220 -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/4] Staging: iio: accel: adis16201: Use GENMASK
Use GENMASK to improve readability and remove the local variables used to store intermediate data. Signed-off-by: Himanshu Jha--- drivers/staging/iio/accel/adis16201.c | 34 +++--- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/drivers/staging/iio/accel/adis16201.c b/drivers/staging/iio/accel/adis16201.c index b04dbb3..e7593fa 100644 --- a/drivers/staging/iio/accel/adis16201.c +++ b/drivers/staging/iio/accel/adis16201.c @@ -185,28 +185,24 @@ static int adis16201_write_raw(struct iio_dev *indio_dev, long mask) { struct adis *st = iio_priv(indio_dev); - int bits; - s16 val16; - u8 addr; + int m; - switch (mask) { - case IIO_CHAN_INFO_CALIBBIAS: - switch (chan->type) { - case IIO_ACCEL: - bits = 12; - break; - case IIO_INCLI: - bits = 9; - break; - default: - return -EINVAL; + if (mask != IIO_CHAN_INFO_CALIBBIAS) + return -EINVAL; + + switch (chan->type) { + case IIO_ACCEL: + m = GENMASK(11, 0); + break; + case IIO_INCLI: + m = GENMASK(8, 0); + break; + default: + return -EINVAL; } - val16 = val & ((1 << bits) - 1); - addr = adis16201_addresses[chan->scan_index]; - return adis_write_reg_16(st, addr, val16); - } - return -EINVAL; + return adis_write_reg_16(st, adis16201_addresses[chan->scan_index], +val & m); } static const struct iio_chan_spec adis16201_channels[] = { -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] Staging: iio: accel: adis16201: Move adis16201 driver out of staging
Move adis16201 driver out of staging and merge into mainline IIO subsystem. Signed-off-by: Himanshu Jha--- drivers/iio/accel/Kconfig | 12 ++ drivers/iio/accel/Makefile| 1 + drivers/iio/accel/adis16201.c | 321 ++ drivers/staging/iio/accel/Kconfig | 12 -- drivers/staging/iio/accel/Makefile| 1 - drivers/staging/iio/accel/adis16201.c | 321 -- 6 files changed, 334 insertions(+), 334 deletions(-) create mode 100644 drivers/iio/accel/adis16201.c delete mode 100644 drivers/staging/iio/accel/adis16201.c diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig index c6d9517..9416c6f 100644 --- a/drivers/iio/accel/Kconfig +++ b/drivers/iio/accel/Kconfig @@ -5,6 +5,18 @@ menu "Accelerometers" +config ADIS16201 +tristate "Analog Devices ADIS16201 Dual-Axis Digital Inclinometer and Accelerometer" +depends on SPI +select IIO_ADIS_LIB +select IIO_ADIS_LIB_BUFFER if IIO_BUFFER +help + Say Y here to build support for Analog Devices adis16201 dual-axis + digital inclinometer and accelerometer. + + To compile this driver as a module, say M here: the module will + be called adis16201. + config ADXL345 tristate diff --git a/drivers/iio/accel/Makefile b/drivers/iio/accel/Makefile index 368aedb..7832ec9 100644 --- a/drivers/iio/accel/Makefile +++ b/drivers/iio/accel/Makefile @@ -4,6 +4,7 @@ # # When adding new entries keep the list in alphabetical order +obj-$(CONFIG_ADIS16201) += adis16201.o obj-$(CONFIG_ADXL345) += adxl345_core.o obj-$(CONFIG_ADXL345_I2C) += adxl345_i2c.o obj-$(CONFIG_ADXL345_SPI) += adxl345_spi.o diff --git a/drivers/iio/accel/adis16201.c b/drivers/iio/accel/adis16201.c new file mode 100644 index 000..51e1afb --- /dev/null +++ b/drivers/iio/accel/adis16201.c @@ -0,0 +1,321 @@ +/* + * ADIS16201 Dual-Axis Digital Inclinometer and Accelerometer + * + * Copyright 2010 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define ADIS16201_STARTUP_DELAY_MS 220 +#define ADIS16201_FLASH_CNT0x00 + +/* Data Output Register Information */ +#define ADIS16201_SUPPLY_OUT_REG 0x02 +#define ADIS16201_XACCL_OUT_REG0x04 +#define ADIS16201_YACCL_OUT_REG0x06 +#define ADIS16201_AUX_ADC_REG 0x08 +#define ADIS16201_TEMP_OUT_REG 0x0A +#define ADIS16201_XINCL_OUT_REG0x0C +#define ADIS16201_YINCL_OUT_REG0x0E + +/* Calibration Register Definition */ +#define ADIS16201_XACCL_OFFS_REG 0x10 +#define ADIS16201_YACCL_OFFS_REG 0x12 +#define ADIS16201_XACCL_SCALE_REG 0x14 +#define ADIS16201_YACCL_SCALE_REG 0x16 +#define ADIS16201_XINCL_OFFS_REG 0x18 +#define ADIS16201_YINCL_OFFS_REG 0x1A +#define ADIS16201_XINCL_SCALE_REG 0x1C +#define ADIS16201_YINCL_SCALE_REG 0x1E + +/* Alarm Register Definition */ +#define ADIS16201_ALM_MAG1_REG 0x20 +#define ADIS16201_ALM_MAG2_REG 0x22 +#define ADIS16201_ALM_SMPL1_REG0x24 +#define ADIS16201_ALM_SMPL2_REG0x26 +#define ADIS16201_ALM_CTRL_REG 0x28 + +#define ADIS16201_AUX_DAC_REG 0x30 +#define ADIS16201_GPIO_CTRL_REG0x32 +#define ADIS16201_SMPL_PRD_REG 0x36 +/* Operation, filter configuration */ +#define ADIS16201_AVG_CNT_REG 0x38 +#define ADIS16201_SLP_CNT_REG 0x3A + +/* Miscellaneous Control Register Definition */ +#define ADIS16201_MSC_CTRL_REG 0x34 +#define ADIS16201_MSC_CTRL_SELF_TEST_EN BIT(8) +/* Data-ready enable: 1 = enabled, 0 = disabled */ +#define ADIS16201_MSC_CTRL_DATA_RDY_ENBIT(2) +/* Data-ready polarity: 1 = active high, 0 = active low */ +#define ADIS16201_MSC_CTRL_ACTIVE_DATA_RDY_HIGH BIT(1) +/* Data-ready line selection: 1 = DIO1, 0 = DIO0 */ +#define ADIS16201_MSC_CTRL_DATA_RDY_DIO1 BIT(0) + +/* Diagnostics System Status Register Definition */ +#define ADIS16201_DIAG_STAT_REG0x3C +#define ADIS16201_DIAG_STAT_ALARM2BIT(9) +#define ADIS16201_DIAG_STAT_ALARM1BIT(8) +#define ADIS16201_DIAG_STAT_SPI_FAIL_BIT 3 +#define ADIS16201_DIAG_STAT_FLASH_UPT_FAIL_BIT
[PATCH net-next, 2/2] hv_netvsc: Add range checking for rx packet offset and length
From: Haiyang ZhangThis patch adds range checking for rx packet offset and length. It may only happen if there is a host side bug. Signed-off-by: Haiyang Zhang --- drivers/net/hyperv/hyperv_net.h | 1 + drivers/net/hyperv/netvsc.c | 17 +++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 0db3bd1ea06f..49c05ac894e5 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -793,6 +793,7 @@ struct netvsc_device { /* Receive buffer allocated by us but manages by NetVSP */ void *recv_buf; + u32 recv_buf_size; /* allocated bytes */ u32 recv_buf_gpadl_handle; u32 recv_section_cnt; u32 recv_section_size; diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 1ddb2c39b6e4..a6700d65f206 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -289,6 +289,8 @@ static int netvsc_init_buf(struct hv_device *device, goto cleanup; } + net_device->recv_buf_size = buf_size; + /* * Establish the gpadl handle for this buffer on this * channel. Note: This call uses the vmbus connection rather @@ -1095,11 +1097,22 @@ static int netvsc_receive(struct net_device *ndev, /* Each range represents 1 RNDIS pkt that contains 1 ethernet frame */ for (i = 0; i < count; i++) { - void *data = recv_buf - + vmxferpage_packet->ranges[i].byte_offset; + u32 offset = vmxferpage_packet->ranges[i].byte_offset; u32 buflen = vmxferpage_packet->ranges[i].byte_count; + void *data; int ret; + if (unlikely(offset + buflen > net_device->recv_buf_size)) { + status = NVSP_STAT_FAIL; + netif_err(net_device_ctx, rx_err, ndev, + "Packet offset:%u + len:%u too big\n", + offset, buflen); + + continue; + } + + data = recv_buf + offset; + trace_rndis_recv(ndev, q_idx, data); /* Pass it to the upper layer */ -- 2.15.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next,1/2] hv_netvsc: Fix the return status in RX path
From: Haiyang ZhangAs defined in hyperv_net.h, the NVSP_STAT_SUCCESS is one not zero. Some functions returns 0 when it actually means NVSP_STAT_SUCCESS. This patch fixes them. In netvsc_receive(), it puts the last RNDIS packet's receive status for all packets in a vmxferpage which may contain multiple RNDIS packets. This patch puts NVSP_STAT_FAIL in the receive completion if one of the packets in a vmxferpage fails. Signed-off-by: Haiyang Zhang --- drivers/net/hyperv/netvsc.c | 8 ++-- drivers/net/hyperv/netvsc_drv.c | 2 +- drivers/net/hyperv/rndis_filter.c | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index aa95e81af6e5..1ddb2c39b6e4 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -1098,12 +1098,16 @@ static int netvsc_receive(struct net_device *ndev, void *data = recv_buf + vmxferpage_packet->ranges[i].byte_offset; u32 buflen = vmxferpage_packet->ranges[i].byte_count; + int ret; trace_rndis_recv(ndev, q_idx, data); /* Pass it to the upper layer */ - status = rndis_filter_receive(ndev, net_device, - channel, data, buflen); + ret = rndis_filter_receive(ndev, net_device, + channel, data, buflen); + + if (unlikely(ret != NVSP_STAT_SUCCESS)) + status = NVSP_STAT_FAIL; } enq_receive_complete(ndev, net_device, q_idx, diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index cdb78eefab67..33607995be62 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -818,7 +818,7 @@ int netvsc_recv_callback(struct net_device *net, u64_stats_update_end(_stats->syncp); napi_gro_receive(>napi, skb); - return 0; + return NVSP_STAT_SUCCESS; } static void netvsc_get_drvinfo(struct net_device *net, diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 2dc00f714482..591fb8080f11 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -443,10 +443,10 @@ int rndis_filter_receive(struct net_device *ndev, "unhandled rndis message (type %u len %u)\n", rndis_msg->ndis_msg_type, rndis_msg->msg_len); - break; + return NVSP_STAT_FAIL; } - return 0; + return NVSP_STAT_SUCCESS; } static int rndis_filter_query_device(struct rndis_device *dev, -- 2.15.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH net-next,0/2] hv_netvsc: Fix/improve RX path error handling
From: Haiyang ZhangFix the status code returned to the host. Also add range check for rx packet offset and length. Haiyang Zhang (2): hv_netvsc: Fix the return status in RX path hv_netvsc: Add range checking for rx packet offset and length drivers/net/hyperv/hyperv_net.h | 1 + drivers/net/hyperv/netvsc.c | 25 + drivers/net/hyperv/netvsc_drv.c | 2 +- drivers/net/hyperv/rndis_filter.c | 4 ++-- 4 files changed, 25 insertions(+), 7 deletions(-) -- 2.15.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/6] staging: ks7010: Factor out repeated code.
On Mon, Mar 19, 2018 at 10:58:10PM -0700, Quytelda Kahja wrote: > Some of the code for reading IEs is replicated multiple times in the > switch statement for get_ap_information(). Factor that code out into > read_ie(). > > Signed-off-by: Quytelda Kahja> --- > drivers/staging/ks7010/ks_hostif.c | 48 > +- > 1 file changed, 22 insertions(+), 26 deletions(-) Does not apply at all to my tree :( Please rebase and resend the whole series. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 6/6] staging: ks7010: Factor out repeated request initialization code.
On Mon, Mar 19, 2018 at 10:58:15PM -0700, Quytelda Kahja wrote: > The code to initialize various different types of request structs > is repeated multiple times. Factor this code out into a macro > called INIT_REQUEST. > > Signed-off-by: Quytelda Kahja> --- > drivers/staging/ks7010/ks_hostif.c | 55 > +++--- > 1 file changed, 16 insertions(+), 39 deletions(-) > > diff --git a/drivers/staging/ks7010/ks_hostif.c > b/drivers/staging/ks7010/ks_hostif.c > index 6fc2c3647908..3e5016aad029 100644 > --- a/drivers/staging/ks7010/ks_hostif.c > +++ b/drivers/staging/ks7010/ks_hostif.c > @@ -40,6 +40,17 @@ static inline unsigned int cnt_smeqbody(struct > ks_wlan_private *priv) > > #define KS_WLAN_MEM_FLAG (GFP_ATOMIC) > > +#define INIT_REQUEST(pp, priv) Ick, please make it a function if you really want to do something like this. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/6] staging: ks7010: Remove unnecessary parentheses.
On Mon, Mar 19, 2018 at 10:58:12PM -0700, Quytelda Kahja wrote: > Remove unnecessary parentheses highlighted by checkpatch. > > Signed-off-by: Quytelda Kahja> --- > drivers/staging/ks7010/ks_hostif.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/ks7010/ks_hostif.c > b/drivers/staging/ks7010/ks_hostif.c > index 948d45280d18..00b97e8e9b4f 100644 > --- a/drivers/staging/ks7010/ks_hostif.c > +++ b/drivers/staging/ks7010/ks_hostif.c > @@ -45,7 +45,7 @@ inline u8 get_BYTE(struct ks_wlan_private *priv) > { > u8 data; > > - data = *(priv->rxp)++; > + data = *priv->rxp++; Leave this one alone, you now have to go look up exactly what the priority levels are to figure out what is being incremented (the pointer? The value?) thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH PATCH net 0/4] hv_netvsc: fix races during shutdown and changes
From: Stephen HemmingerDate: Tue, 20 Mar 2018 15:03:01 -0700 > This set of patches fixes issues identified by Vitaly Kuznetsov and > Mohammed Gamal related to state changes in Hyper-v network driver. > > A lot of the issues are because setting up the netvsc device requires > a second step (in work queue) to get all the sub-channels running. Series applied, thanks Stephen. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: comedi: fix multiple line dereference coding style issue in cb_pcidas64.c
On 22/03/18 12:27, Jian Zhang wrote: This is a patch to the cb_pcidas64.c file that fixes up a multiple line dereference warning found by the checkpatch.pl tool Signed-off-by: Jian Zhang--- drivers/staging/comedi/drivers/cb_pcidas64.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index ceef9058b59f..77099f177516 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -2464,18 +2464,15 @@ static int setup_channel_queue(struct comedi_device *dev, for (i = 0; i < cmd->chanlist_len; i++) { Could I suggest setting a local variable here? : unsigned int chanspec = cmd->chanlist[i]; bits = 0; /* set channel */ - bits |= adc_chan_bits(CR_CHAN(cmd-> - chanlist[i])); + bits |= adc_chan_bits( + CR_CHAN(cmd->chanlist[i])); /* set gain */ - bits |= ai_range_bits_6xxx(dev, - CR_RANGE(cmd-> - chanlist - [i])); + bits |= ai_range_bits_6xxx( + dev, CR_RANGE(cmd->chanlist[i])); /* set single-ended / differential */ - bits |= se_diff_bit_6xxx(dev, -CR_AREF(cmd-> -chanlist[i]) == -AREF_DIFF); + bits |= se_diff_bit_6xxx( + dev, + CR_AREF(cmd->chanlist[i]) == AREF_DIFF); if (CR_AREF(cmd->chanlist[i]) == AREF_COMMON) bits |= ADC_COMMON_BIT; /* mark end of queue */ Then just replace `cmd->chanlist[i]` with `chanspec` in the above statements, and line the arguments up with the opening parentheses as they were before. For example, replace `CR_CHAN(cmd->chanlist[i])` with `CR_CHAN(chanspec)`. That should make the code formatting a bit neater. -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Web: http://www.mev.co.uk/ )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: comedi: fix multiple line dereference coding style issue in cb_pcidas64.c
This is a patch to the cb_pcidas64.c file that fixes up a multiple line dereference warning found by the checkpatch.pl tool Signed-off-by: Jian Zhang--- drivers/staging/comedi/drivers/cb_pcidas64.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index ceef9058b59f..77099f177516 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -2464,18 +2464,15 @@ static int setup_channel_queue(struct comedi_device *dev, for (i = 0; i < cmd->chanlist_len; i++) { bits = 0; /* set channel */ - bits |= adc_chan_bits(CR_CHAN(cmd-> - chanlist[i])); + bits |= adc_chan_bits( + CR_CHAN(cmd->chanlist[i])); /* set gain */ - bits |= ai_range_bits_6xxx(dev, - CR_RANGE(cmd-> - chanlist - [i])); + bits |= ai_range_bits_6xxx( + dev, CR_RANGE(cmd->chanlist[i])); /* set single-ended / differential */ - bits |= se_diff_bit_6xxx(dev, -CR_AREF(cmd-> -chanlist[i]) == -AREF_DIFF); + bits |= se_diff_bit_6xxx( + dev, + CR_AREF(cmd->chanlist[i]) == AREF_DIFF); if (CR_AREF(cmd->chanlist[i]) == AREF_COMMON) bits |= ADC_COMMON_BIT; /* mark end of queue */ -- 2.16.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: comedi: fix multiple line dereference coding style issue in cb_pcidas64.c
On Thu, Mar 22, 2018 at 08:27:28PM +0800, Jian Zhang wrote: > This is a patch to the cb_pcidas64.c file that fixes up a multiple line > dereference warning found by the checkpatch.pl tool Please properly wrap your changelog comments at 72 columns, like your editor tried to force you to do :) > > Signed-off-by: Jian Zhang> --- > drivers/staging/comedi/drivers/cb_pcidas64.c | 17 +++-- > 1 file changed, 7 insertions(+), 10 deletions(-) > > diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c > b/drivers/staging/comedi/drivers/cb_pcidas64.c > index ceef9058b59f..77099f177516 100644 > --- a/drivers/staging/comedi/drivers/cb_pcidas64.c > +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c > @@ -2464,18 +2464,15 @@ static int setup_channel_queue(struct comedi_device > *dev, > for (i = 0; i < cmd->chanlist_len; i++) { > bits = 0; > /* set channel */ > - bits |= adc_chan_bits(CR_CHAN(cmd-> > - chanlist[i])); > + bits |= adc_chan_bits( > + CR_CHAN(cmd->chanlist[i])); > /* set gain */ > - bits |= ai_range_bits_6xxx(dev, No need to change this line. > -CR_RANGE(cmd-> > - chanlist > - [i])); > + bits |= ai_range_bits_6xxx( > + dev, CR_RANGE(cmd->chanlist[i])); > /* set single-ended / differential */ > - bits |= se_diff_bit_6xxx(dev, > - CR_AREF(cmd-> > - chanlist[i]) == > - AREF_DIFF); > + bits |= se_diff_bit_6xxx( > + dev, No need to change this line, right? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[bug report] staging: vchiq_core: Bail out in case of invalid tx_pos
Hello Stefan Wahren, The patch d1eab9dec610: "staging: vchiq_core: Bail out in case of invalid tx_pos" from May 26, 2017, leads to the following static checker warning: drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:617 reserve_space() warn: inconsistent returns 'state->slot_available_event'. Locked on : 605 Unlocked on: 600 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 581 /* If necessary, get the next slot. */ 582 if ((tx_pos & VCHIQ_SLOT_MASK) == 0) { 583 int slot_index; 584 585 /* If there is no free slot... */ 586 587 if (down_trylock(>slot_available_event) != 0) { 588 /* ...wait for one. */ 589 590 VCHIQ_STATS_INC(state, slot_stalls); 591 592 /* But first, flush through the last slot. */ 593 state->local_tx_pos = tx_pos; 594 local->tx_pos = tx_pos; 595 remote_event_signal(>remote->trigger); 596 597 if (!is_blocking || 598 (down_interruptible( 599 >slot_available_event) != 0)) 600 return NULL; /* No space available */ ^^^ We're not holding the locks here when we return NULL 601 } 602 603 if (tx_pos == (state->slot_queue_available * VCHIQ_SLOT_SIZE)) { 604 pr_warn("%s: invalid tx_pos: %d\n", __func__, tx_pos); 605 return NULL; ^^^ so we should probably drop the lock before this return 606 } 607 608 slot_index = local->slot_queue[ 609 SLOT_QUEUE_INDEX_FROM_POS(tx_pos) & 610 VCHIQ_SLOT_QUEUE_MASK]; 611 state->tx_data = 612 (char *)SLOT_DATA_FROM_INDEX(state, slot_index); 613 } 614 615 state->local_tx_pos = tx_pos + space; 616 617 return (VCHIQ_HEADER_T *)(state->tx_data + (tx_pos & VCHIQ_SLOT_MASK)); 618 } regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: mt7621-eth: fix spelling mistake: "devictree" -> "devicetree"
From: Colin Ian KingTrivial fix to spelling mistake in dev_err message text Signed-off-by: Colin Ian King --- drivers/staging/mt7621-eth/mtk_eth_soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/mt7621-eth/mtk_eth_soc.c b/drivers/staging/mt7621-eth/mtk_eth_soc.c index 98b44629bc1d..eb3e14ae2929 100644 --- a/drivers/staging/mt7621-eth/mtk_eth_soc.c +++ b/drivers/staging/mt7621-eth/mtk_eth_soc.c @@ -2096,7 +2096,7 @@ static int mtk_probe(struct platform_device *pdev) sysclk = devm_clk_get(>dev, NULL); if (IS_ERR(sysclk)) { dev_err(>dev, - "the clock is not defined in the devictree\n"); + "the clock is not defined in the devicetree\n"); return -ENXIO; } eth->sysclk = clk_get_rate(sysclk); -- 2.15.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
OK
Dear Friend, I have a profitable business to share with you .But only need your permision to disclose it to you. Thanks Ahmed Zama ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel