[PATCH] Staging: comedi: drivers: comedi_test: Avoid multiple line dereference
Fix checkpatch warning "Avoid multiple line dereference" using a local variable to avoid line wrap. Signed-off-by: Cheah Kok Cheong --- drivers/staging/comedi/drivers/comedi_test.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c index 2a063f0..fde83e0 100644 --- a/drivers/staging/comedi/drivers/comedi_test.c +++ b/drivers/staging/comedi/drivers/comedi_test.c @@ -480,11 +480,9 @@ static void waveform_ao_timer(unsigned long arg) /* output the last scan */ for (i = 0; i < cmd->scan_end_arg; i++) { unsigned int chan = CR_CHAN(cmd->chanlist[i]); + unsigned short d = devpriv->ao_loopbacks[chan]; - if (comedi_buf_read_samples(s, - &devpriv-> -ao_loopbacks[chan], - 1) == 0) { + if (!comedi_buf_read_samples(s, &d, 1)) { /* unexpected underrun! (cancelled?) */ async->events |= COMEDI_CB_OVERFLOW; goto underrun; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/8] staging: ks7010: Refactor, fix checkpatch
This is the second patch series to staging ks7010. The two series are on different files. Checkpatch emits various warnings. Warnings are an indication that the code needs refactoring. Clear trivial checkpatch warnings and errors first. Split large function into smaller functions. Refactor new functions to make code cleaner. This code has not been tested other than to be built. Needs hardware to test. Tobin C. Harding (8): staging: ks7010: Fix checkpatch errors staging: ks7010: Fix checkpatch warning staging: ks7010: Refactor hostif_data_indication whitespace refactor staging: ks7010: Remove level of indentation staging: ks7010: Remove level of indentation staging: ks7010: Refactor after indentation removal rename refactored function drivers/staging/ks7010/ks_hostif.c | 282 - drivers/staging/ks7010/ks_hostif.h | 60 2 files changed, 179 insertions(+), 163 deletions(-) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/8] staging: ks7010: Fix checkpatch warning
Checkpatch emits WARNING: Comparisons should place the constant on the right side of the test. Move constant to the rights side of the test. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_hostif.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 1fbd495..a976060 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -2608,13 +2608,12 @@ void hostif_sme_task(unsigned long dev) DPRINTK(3, "\n"); if (priv->dev_state >= DEVICE_STATE_BOOT) { - if (0 < cnt_smeqbody(priv) - && priv->dev_state >= DEVICE_STATE_BOOT) { + if (cnt_smeqbody(priv) > 0 && priv->dev_state >= DEVICE_STATE_BOOT) { hostif_sme_execute(priv, priv->sme_i.event_buff[priv->sme_i. qhead]); inc_smeqhead(priv); - if (0 < cnt_smeqbody(priv)) + if (cnt_smeqbody(priv) > 0) tasklet_schedule(&priv->sme_task); } } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/8] staging: ks7010: Refactor hostif_data_indicationyes
Function hostif_data_indication has 14 local variables an is over 200 lines long. Contains code nested deeply. Function could be refactored. Start to refactor function. Split out three separate functions. Don't modify code except to make it compile, add/remove correct local variables and add code to call new functions. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_hostif.c | 267 + 1 file changed, 149 insertions(+), 118 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index a976060..f4beb86 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -307,42 +307,9 @@ int get_ap_information(struct ks_wlan_private *priv, struct ap_info_t *ap_info, return 0; } -static -void hostif_data_indication(struct ks_wlan_private *priv) +static int source_address_is_valid(struct ks_wlan_private *priv, + struct ether_hdr *eth_hdr) { - unsigned int rx_ind_size; /* indicate data size */ - struct sk_buff *skb; - unsigned short auth_type; - unsigned char temp[256]; - - unsigned char RecvMIC[8]; - char buf[128]; - struct ether_hdr *eth_hdr; - unsigned short eth_proto; - unsigned long now; - struct mic_failure_t *mic_failure; - struct ieee802_1x_hdr *aa1x_hdr; - struct wpa_eapol_key *eap_key; - struct michel_mic_t michel_mic; - union iwreq_data wrqu; - - DPRINTK(3, "\n"); - - /* min length check */ - if (priv->rx_size <= ETH_HLEN) { - DPRINTK(3, "rx_size = %d\n", priv->rx_size); - priv->nstats.rx_errors++; - return; - } - - auth_type = get_WORD(priv); /* AuthType */ - get_WORD(priv); /* Reserve Area */ - - eth_hdr = (struct ether_hdr *)(priv->rxp); - eth_proto = ntohs(eth_hdr->h_proto); - DPRINTK(3, "ether protocol = %04X\n", eth_proto); - - /* source address check */ if (!memcmp(&priv->eth_addr[0], eth_hdr->h_source, ETH_ALEN)) { DPRINTK(1, "invalid : source is own mac address !!\n"); DPRINTK(1, @@ -351,92 +318,19 @@ void hostif_data_indication(struct ks_wlan_private *priv) eth_hdr->h_source[2], eth_hdr->h_source[3], eth_hdr->h_source[4], eth_hdr->h_source[5]); priv->nstats.rx_errors++; - return; - } - - /* for WPA */ - if (auth_type != TYPE_DATA && priv->wpa.rsn_enabled) { - if (memcmp(ð_hdr->h_source[0], &priv->eth_addr[0], ETH_ALEN)) { /* source address check */ - if (eth_hdr->h_dest_snap != eth_hdr->h_source_snap) { - DPRINTK(1, "invalid data format\n"); - priv->nstats.rx_errors++; - return; - } - if (((auth_type == TYPE_PMK1 - && priv->wpa.pairwise_suite == - IW_AUTH_CIPHER_TKIP) || (auth_type == TYPE_GMK1 - && priv->wpa. - group_suite == - IW_AUTH_CIPHER_TKIP) -|| (auth_type == TYPE_GMK2 -&& priv->wpa.group_suite == -IW_AUTH_CIPHER_TKIP)) - && priv->wpa.key[auth_type - 1].key_len) { - DPRINTK(4, "TKIP: protocol=%04X: size=%u\n", - eth_proto, priv->rx_size); - /* MIC save */ - memcpy(&RecvMIC[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(&michel_mic, (uint8_t *) priv->wpa.key[auth_type - 1].rx_mic_key, (uint8_t *) priv->rxp, (int)priv->rx_size, (uint8_t) 0,/* priority */ - (uint8_t *) - michel_mic.Result); - } - if (memcmp(michel_mic.Result, RecvMIC, 8)) { - now = jiffies; - mic_failure = &priv->wpa.mic_failure; - /* MIC FAILURE */ - if (mic_failure->last_failure_time && - (now - -mic_failure->last_failure_time) / -
[PATCH 5/8] staging: ks7010: Remove level of indentation
'if' statement conditional guards large block of code. Conditional can be inverted and function made to return. This allows following code to have one level of indentation removed. Invert conditional and return directly if new conditioal is true. Remove one level of indentation. Signed-off-by: Tobin C. Harding --- Correct error constant to return? drivers/staging/ks7010/ks_hostif.c | 143 +++-- 1 file changed, 72 insertions(+), 71 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 565f051..d28e9af 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -414,81 +414,82 @@ static int function_needs_naming(struct ks_wlan_private *priv, struct mic_failure_t *mic_failure; union iwreq_data wrqu; - if (memcmp(ð_hdr->h_source[0], &priv->eth_addr[0], ETH_ALEN)) { /* source address check */ - if (eth_hdr->h_dest_snap != eth_hdr->h_source_snap) { - DPRINTK(1, "invalid data format\n"); - priv->nstats.rx_errors++; - return -ERROR; - } + if (memcmp(ð_hdr->h_source[0], &priv->eth_addr[0], ETH_ALEN) != 0) + return 0; + + if (eth_hdr->h_dest_snap != eth_hdr->h_source_snap) { + DPRINTK(1, "invalid data format\n"); + priv->nstats.rx_errors++; + return -ERROR; + } + + auth_type = get_WORD(priv); /* AuthType */ + eth_proto = ntohs(eth_hdr->h_proto); - auth_type = get_WORD(priv); /* AuthType */ - eth_proto = ntohs(eth_hdr->h_proto); - - if (((auth_type == TYPE_PMK1 - && priv->wpa.pairwise_suite == - IW_AUTH_CIPHER_TKIP) || (auth_type == TYPE_GMK1 - && priv->wpa. - group_suite == - IW_AUTH_CIPHER_TKIP) - || (auth_type == TYPE_GMK2 - && priv->wpa.group_suite == - IW_AUTH_CIPHER_TKIP)) - && priv->wpa.key[auth_type - 1].key_len) { - DPRINTK(4, "TKIP: protocol=%04X: size=%u\n", - eth_proto, priv->rx_size); - /* MIC save */ - memcpy(&RecvMIC[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(&michel_mic, (uint8_t *) priv->wpa.key[auth_type - 1].rx_mic_key, (uint8_t *) priv->rxp, (int)priv->rx_size, (uint8_t) 0,/* priority */ - (uint8_t *) - michel_mic.Result); + if (((auth_type == TYPE_PMK1 + && priv->wpa.pairwise_suite == + IW_AUTH_CIPHER_TKIP) || (auth_type == TYPE_GMK1 + && priv->wpa. + group_suite == + IW_AUTH_CIPHER_TKIP) + || (auth_type == TYPE_GMK2 + && priv->wpa.group_suite == + IW_AUTH_CIPHER_TKIP)) + && priv->wpa.key[auth_type - 1].key_len) { + DPRINTK(4, "TKIP: protocol=%04X: size=%u\n", + eth_proto, priv->rx_size); + /* MIC save */ + memcpy(&RecvMIC[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(&michel_mic, (uint8_t *) priv->wpa.key[auth_type - 1].rx_mic_key, (uint8_t *) priv->rxp, (int)priv->rx_size, (uint8_t) 0,/* priority */ + (uint8_t *) + michel_mic.Result); + } + if (memcmp(michel_mic.Result, RecvMIC, 8)) { + now = jiffies; + mic_failure = &priv->wpa.mic_failure; + /* MIC FAILURE */ + if (mic_failure->last_failure_time && + (now - + mic_failure->last_failure_time) / + HZ >= 60) { + mic_failure->failure = 0; } -
[PATCH 8/8] staging: ks7010: Rename refactored function
Function was not named during initial refactoring. Give function new meaningful name. Signed-off-by: Tobin C. Harding --- 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 ca1051ff..e58ce42 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -402,7 +402,7 @@ static void check_13th_byte_of_rx_data(struct ks_wlan_private *priv) } #define ERROR -1 /* FIXME */ -static int function_needs_naming(struct ks_wlan_private *priv, +static int check_mic(struct ks_wlan_private *priv, struct ether_hdr *eth_hdr) { unsigned short auth_type; @@ -508,7 +508,7 @@ void hostif_data_indication(struct ks_wlan_private *priv) /* for WPA */ if (auth_type != TYPE_DATA && priv->wpa.rsn_enabled) { - err = function_needs_naming(priv, eth_hdr); + err = check_mic(priv, eth_hdr); if (err) return; } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/8] staging: ks7010: Remove level of indentation
'if' statement conditional guards large block of code. Conditional can be inverted and function return. This allows following code to have one level of indentation removed. However the conditional is complicated, it can be moved into a separate variable to ease reading. Move complicated conditional to separate variable. Invert conditional and remove level of indentation as per previous commit. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_hostif.c | 121 ++--- 1 file changed, 59 insertions(+), 62 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index d28e9af..d479a88 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -413,6 +413,7 @@ static int function_needs_naming(struct ks_wlan_private *priv, char buf[128]; struct mic_failure_t *mic_failure; union iwreq_data wrqu; + int cond; if (memcmp(ð_hdr->h_source[0], &priv->eth_addr[0], ETH_ALEN) != 0) return 0; @@ -426,71 +427,67 @@ static int function_needs_naming(struct ks_wlan_private *priv, auth_type = get_WORD(priv); /* AuthType */ eth_proto = ntohs(eth_hdr->h_proto); - if (((auth_type == TYPE_PMK1 - && priv->wpa.pairwise_suite == - IW_AUTH_CIPHER_TKIP) || (auth_type == TYPE_GMK1 - && priv->wpa. - group_suite == - IW_AUTH_CIPHER_TKIP) - || (auth_type == TYPE_GMK2 - && priv->wpa.group_suite == - IW_AUTH_CIPHER_TKIP)) - && priv->wpa.key[auth_type - 1].key_len) { - DPRINTK(4, "TKIP: protocol=%04X: size=%u\n", - eth_proto, priv->rx_size); - /* MIC save */ - memcpy(&RecvMIC[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(&michel_mic, (uint8_t *) priv->wpa.key[auth_type - 1].rx_mic_key, (uint8_t *) priv->rxp, (int)priv->rx_size, (uint8_t) 0,/* priority */ - (uint8_t *) - michel_mic.Result); + cond = ((auth_type == TYPE_PMK1 && priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) || + (auth_type == TYPE_GMK1 && priv->wpa.group_suite == IW_AUTH_CIPHER_TKIP) || + (auth_type == TYPE_GMK2 && priv->wpa.group_suite == IW_AUTH_CIPHER_TKIP)); + + if (!cond || !priv->wpa.key[auth_type - 1].key_len) + return 0; + + DPRINTK(4, "TKIP: protocol=%04X: size=%u\n", + eth_proto, priv->rx_size); + /* MIC save */ + memcpy(&RecvMIC[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(&michel_mic, (uint8_t *) priv->wpa.key[auth_type - 1].rx_mic_key, (uint8_t *) priv->rxp, (int)priv->rx_size, (uint8_t) 0,/* priority */ + (uint8_t *) + michel_mic.Result); + } + if (memcmp(michel_mic.Result, RecvMIC, 8)) { + now = jiffies; + mic_failure = &priv->wpa.mic_failure; + /* MIC FAILURE */ + if (mic_failure->last_failure_time && + (now - + mic_failure->last_failure_time) / + HZ >= 60) { + mic_failure->failure = 0; } - if (memcmp(michel_mic.Result, RecvMIC, 8)) { - now = jiffies; - mic_failure = &priv->wpa.mic_failure; - /* MIC FAILURE */ - if (mic_failure->last_failure_time && - (now - - mic_failure->last_failure_time) / - HZ >= 60) { - mic_failure->failure = 0; - } - DPRINTK(4, "MIC FAILURE\n"); - if (mic_failure->failure == 0) { - mic_failure->failure = 1; - mic_failure->counter = 0; - } else if (mic_failure->failure == 1) { - mic_failure->failure = 2; + DPRINTK(4, "MIC FAILURE\n"); + if (mic_failure->failure == 0) { + mic_failure->failure = 1; + mic_failure->counter =
[PATCH 7/8] staging: ks7010: Refactor after indentation removal
Code is able to be refactored after previous removal of levels of indentation. Refactor code to bring it more inline with kernel standards. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_hostif.c | 53 ++ 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index d479a88..ca1051ff 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -424,7 +424,7 @@ static int function_needs_naming(struct ks_wlan_private *priv, return -ERROR; } - auth_type = get_WORD(priv); /* AuthType */ + auth_type = get_WORD(priv); /* AuthType */ eth_proto = ntohs(eth_hdr->h_proto); cond = ((auth_type == TYPE_PMK1 && priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) || @@ -433,26 +433,25 @@ static int function_needs_naming(struct ks_wlan_private *priv, if (!cond || !priv->wpa.key[auth_type - 1].key_len) return 0; - - DPRINTK(4, "TKIP: protocol=%04X: size=%u\n", - eth_proto, priv->rx_size); + + DPRINTK(4, "TKIP: protocol=%04X: size=%u\n", eth_proto, priv->rx_size); + /* MIC save */ - memcpy(&RecvMIC[0], - (priv->rxp) + ((priv->rx_size) - 8), 8); + memcpy(&RecvMIC[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(&michel_mic, (uint8_t *) priv->wpa.key[auth_type - 1].rx_mic_key, (uint8_t *) priv->rxp, (int)priv->rx_size, (uint8_t) 0,/* priority */ - (uint8_t *) - michel_mic.Result); + if (auth_type > 0 && auth_type < 4) { /* auth_type check */ + MichaelMICFunction(&michel_mic, + (uint8_t *) priv->wpa.key[auth_type - 1].rx_mic_key, + (uint8_t *) priv->rxp, (int)priv->rx_size, + (uint8_t) 0, /* priority */ + (uint8_t *)michel_mic.Result); } if (memcmp(michel_mic.Result, RecvMIC, 8)) { now = jiffies; mic_failure = &priv->wpa.mic_failure; /* MIC FAILURE */ if (mic_failure->last_failure_time && - (now - - mic_failure->last_failure_time) / - HZ >= 60) { + (now - mic_failure->last_failure_time) / HZ >= 60) { mic_failure->failure = 0; } DPRINTK(4, "MIC FAILURE\n"); @@ -461,32 +460,20 @@ static int function_needs_naming(struct ks_wlan_private *priv, mic_failure->counter = 0; } else if (mic_failure->failure == 1) { mic_failure->failure = 2; - mic_failure->counter = - (uint16_t) ((now - - mic_failure-> - last_failure_time) - / HZ); + mic_failure->counter = (uint16_t)((now - mic_failure->last_failure_time) / HZ); if (!mic_failure->counter) /* mic_failure counter value range 1-60 */ - mic_failure->counter = - 1; + mic_failure->counter = 1; } - priv->wpa.mic_failure. - last_failure_time = now; + priv->wpa.mic_failure.last_failure_time = now; + /* needed parameters: count, keyid, key type, TSC */ - sprintf(buf, - "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=" - "%pM)", + sprintf(buf, "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=%pM)", auth_type - 1, - eth_hdr-> - h_dest[0] & 0x01 ? "broad" : - "uni", eth_hdr->h_source); + eth_hdr->h_dest[0] & 0x01 ? "broad" : "uni", eth_hdr->h_source); memset(&wrqu, 0, sizeof(wrqu)); wrqu.data.length = strlen(buf); - DPRINTK(4, - "IWEVENT:MICHAELMICFAILURE\n"); - wireless_send_event(priv->net_dev, - IWEVCUSTOM, &wrqu, - buf); + DPRINTK(4, "IWEVENT:MICHAELMICFAILURE\n"); + wireless_send_event(priv->net_dev, IWEVCUSTOM, &wrqu, buf); return -ERROR; } return 0; -- 2.7.4 ___ devel mailing list de...@linuxd
[PATCH 1/8] staging: ks7010: Fix checkpatch errors
Checkpatch emits various whitespace errors and warnings. Add whitespace around binary operators and logical operators. Remove whitespace where checkpatch complains. Signed-off-by: Tobin C. Harding --- Perhaps I do not know how to parse a diff visually but these changes do not look like an improvement. The do look aligned in the file when applied and they do clear the warnings. Please nit pick openly if it is wrong. drivers/staging/ks7010/ks_hostif.h | 60 +++--- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index 743f31e..a9da8e9 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -1,6 +1,6 @@ /* * Driver for KeyStream wireless LAN - * + * * Copyright (c) 2005-2008 KeyStream Corp. * Copyright (C) 2009 Renesas Technology Corp. * @@ -128,7 +128,7 @@ struct channel_list_t { #define DOT11_PMK_TSC 0x55010100 /* PMK_TSC (W) */ #define DOT11_GMK1_TSC0x55010101 /* GMK1_TSC (W) */ #define DOT11_GMK2_TSC0x55010102 /* GMK2_TSC (W) */ -#define DOT11_GMK3_TSC 0x55010103/* GMK3_TSC */ +#define DOT11_GMK3_TSC 0x55010103/* GMK3_TSC */ #define LOCAL_PMK 0x58010100 /* Pairwise Master Key cache (W) */ #define LOCAL_REGION 0xF10A0100 /* Region setting */ @@ -360,7 +360,7 @@ struct hostif_ps_adhoc_set_request_t { #define CTS_MODE_TRUE 1 uint16_t channel; struct rate_set16_t rate_set; - uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 + uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 * bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ uint16_t scan_type; } __packed; @@ -376,7 +376,7 @@ struct hostif_infrastructure_set_request_t { uint16_t cts_mode; struct rate_set16_t rate_set; struct ssid_t ssid; - uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 + uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 * bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ uint16_t beacon_lost_count; uint16_t auth_type; @@ -392,7 +392,7 @@ struct hostif_infrastructure_set2_request_t { uint16_t cts_mode; struct rate_set16_t rate_set; struct ssid_t ssid; - uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 + uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 * bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ uint16_t beacon_lost_count; uint16_t auth_type; @@ -415,7 +415,7 @@ struct hostif_adhoc_set_request_t { uint16_t channel; struct rate_set16_t rate_set; struct ssid_t ssid; - uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 + uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 * bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ uint16_t scan_type; } __packed; @@ -427,7 +427,7 @@ struct hostif_adhoc_set2_request_t { uint16_t reserved; struct rate_set16_t rate_set; struct ssid_t ssid; - uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 + uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 * bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ uint16_t scan_type; struct channel_list_t channel_list; @@ -568,19 +568,19 @@ struct hostif_mic_failure_confirm_t { #define TX_RATE_48M(uint8_t)(480/5) #define TX_RATE_54M(uint8_t)(540/5) -#define IS_11B_RATE(A) (((A&RATE_MASK)==TX_RATE_1M)||((A&RATE_MASK)==TX_RATE_2M)||\ - ((A&RATE_MASK)==TX_RATE_5M)||((A&RATE_MASK)==TX_RATE_11M)) +#define IS_11B_RATE(A) (((A&RATE_MASK) == TX_RATE_1M) || ((A&RATE_MASK) == TX_RATE_2M) || \ + ((A&RATE_MASK) == TX_RATE_5M) || ((A&RATE_MASK) == TX_RATE_11M)) -#define IS_OFDM_RATE(A) (((A&RATE_MASK)==TX_RATE_6M)||((A&RATE_MASK)==TX_RATE_12M)||\ - ((A&RATE_MASK)==TX_RATE_24M)||((A&RATE_MASK)==TX_RATE_9M)||\ - ((A&RATE_MASK)==TX_RATE_18M)||((A&RATE_MASK)==TX_RATE_36M)||\ - ((A&RATE_MASK)==TX_RATE_48M)||((A&RATE_MASK)==TX_RATE_54M)) +#define IS_OFDM_RATE(A) (((A&RATE_MASK) == TX_RATE_6M) || ((A&RATE_MASK) == TX_RATE_12M) || \ + ((A&RATE_MASK) == TX_RATE_24M) || ((A&RATE_MASK) ==
[PATCH 4/8] staging: ks7010: Refactor whitespace
hostif_data_indication is able to be refactored after previous commit. Refactor function in two separate patches to ease review. Signed-off-by: Tobin C. Harding --- drivers/staging/ks7010/ks_hostif.c | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index f4beb86..565f051 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -340,13 +340,14 @@ static void check_13th_byte_of_rx_data(struct ks_wlan_private *priv) if (skb) { memcpy(skb_put(skb, 12), priv->rxp, 12);/* 8802/FDDI MAC copy */ /* (SNAP+UI..) skip */ - memcpy(skb_put(skb, rx_ind_size - 12), priv->rxp + 18, rx_ind_size - 12); /* copy after Type */ + + /* copy after Type */ + memcpy(skb_put(skb, rx_ind_size - 12), priv->rxp + 18, rx_ind_size - 12); aa1x_hdr = (struct ieee802_1x_hdr *)(priv->rxp + 20); - if (aa1x_hdr->type == IEEE802_1X_TYPE_EAPOL_KEY - && priv->wpa.rsn_enabled) { - eap_key = - (struct wpa_eapol_key *)(aa1x_hdr + 1); + if (aa1x_hdr->type == IEEE802_1X_TYPE_EAPOL_KEY && + priv->wpa.rsn_enabled) { + eap_key = (struct wpa_eapol_key *)(aa1x_hdr + 1); atomic_set(&priv->psstatus.snooze_guard, 1); } @@ -367,19 +368,19 @@ static void check_13th_byte_of_rx_data(struct ks_wlan_private *priv) DPRINTK(3, "NETBEUI/NetBIOS rx_ind_size=%d\n", rx_ind_size); if (skb) { - memcpy(skb_put(skb, 12), priv->rxp, 12);/* 8802/FDDI MAC copy */ + memcpy(skb_put(skb, 12), priv->rxp, 12); /* 8802/FDDI MAC copy */ - temp[0] = (((rx_ind_size - 12) >> 8) & 0xff); /* NETBEUI size add */ + temp[0] = (((rx_ind_size - 12) >> 8) & 0xff); /* NETBEUI size add */ temp[1] = ((rx_ind_size - 12) & 0xff); memcpy(skb_put(skb, 2), temp, 2); - memcpy(skb_put(skb, rx_ind_size - 14), priv->rxp + 12, rx_ind_size - 14); /* copy after Type */ + /* copy after Type */ + memcpy(skb_put(skb, rx_ind_size - 14), priv->rxp + 12, rx_ind_size - 14); aa1x_hdr = (struct ieee802_1x_hdr *)(priv->rxp + 14); - if (aa1x_hdr->type == IEEE802_1X_TYPE_EAPOL_KEY - && priv->wpa.rsn_enabled) { - eap_key = - (struct wpa_eapol_key *)(aa1x_hdr + 1); + if (aa1x_hdr->type == IEEE802_1X_TYPE_EAPOL_KEY && + priv->wpa.rsn_enabled) { + eap_key = (struct wpa_eapol_key *)(aa1x_hdr + 1); atomic_set(&priv->psstatus.snooze_guard, 1); } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [Outreachy kernel] [PATCH 2/2] staging: ks7010: Unnecessary parentheses are removed.
On Sun, 19 Feb 2017, Arushi Singhal wrote: > > > On Monday, February 20, 2017 at 12:32:22 PM UTC+5:30, Julia Lawall wrote: > > > On Mon, 20 Feb 2017, Arushi Singhal wrote: > > > Unnecessary parentheses should be avoided as reported by > checkpatch.pl. > > Remove unnecessary parentheses, as reported by checkpatch as > are nicer > > to read.For example:- > > It's often nicer to read if &(foo[0]) is converted to foo > like: > > memcpy(&(ap->bssid[0]), &(ap_info->bssid[0]), ETH_ALEN); > > memcpy(ap->bssid, ap_info->bssid, ETH_ALEN); > > The commit message is not well presented. One has the > impression that all > of the changes are related to 0 array elements. It would be > better to > split the patch into two: one for removing parentheses, and one > for making > the &x[0] -> x change. They don't really have anything to do > with each > other. > > julia > > > > Hi > So should I change the commit message to more appropriate one so that it > better explain the changes? Yes please. Remember to put v2 in the subject line and to explain the change you made under the --- julia > > > > > > Signed-off-by: Arushi Singhal > > --- > > drivers/staging/ks7010/ks_hostif.c | 20 > ++-- > > drivers/staging/ks7010/ks_wlan_net.c | 20 > ++-- > > 2 files changed, 20 insertions(+), 20 deletions(-) > > > > diff --git a/drivers/staging/ks7010/ks_hostif.c > b/drivers/staging/ks7010/ks_hostif.c > > index ba283ab741a7..2d5ec57c5cfd 100644 > > --- a/drivers/staging/ks7010/ks_hostif.c > > +++ b/drivers/staging/ks7010/ks_hostif.c > > @@ -239,19 +239,19 @@ int get_ap_information(struct > ks_wlan_private *priv, struct ap_info_t *ap_info, > > *(bp + 1)); > > ap->ssid.size = > SSID_MAX_SIZE; > > } > > -memcpy(&(ap->ssid.body[0]), bp + 2, > ap->ssid.size); > > +memcpy(ap->ssid.body, bp + 2, > ap->ssid.size); > > break; > > case 1:/* rate */ > > case 50:/* ext rate */ > > if ((*(bp + 1) + ap->rate_set.size) > <= > > RATE_SET_MAX_SIZE) { > >- > memcpy(&(ap->rate_set.body[ap->rate_set.si > ze]), > >+ > memcpy(&ap->rate_set.body[ap->rate_set.siz > e], > > bp + 2, *(bp + 1)); > > ap->rate_set.size += *(bp + > 1); > > } else { > > DPRINTK(1, "size over :: rate > size=%d\n", > > (*(bp + 1) + > ap->rate_set.size)); > >- > memcpy(&(ap->rate_set.body[ap->rate_set.si > ze]), > >+ > memcpy(&ap->rate_set.body[ap->rate_set.siz > e], > > bp + 2, > > RATE_SET_MAX_SIZE - > ap->rate_set.size); > > ap->rate_set.size += > > @@ -269,7 +269,7 @@ int get_ap_information(struct > ks_wlan_private *priv, struct ap_info_t *ap_info, > > *(bp + 1)); > > ap->rsn_ie.size = > RSN_IE_BODY_MAX; > > } > > -memcpy(&(ap->rsn_ie.body[0]), bp + 2, > ap->rsn_ie.size); > > +memcpy(ap->rsn_ie.body, bp + 2, > ap->rsn_ie.size); > > break; > > case 221:/* WPA */ > > if (!memcmp(bp + 2, > "\x00\x50\xf2\x01", 4)) {/* WPA OUI check */ > > @@ -282,7 +282,7 @@ int get_ap_information(struct > ks_wlan_private *priv, struct ap_info_t *ap_info, > > *(bp + 1)); > > ap->wpa_ie.size = > RSN_IE_BODY_MAX; > > } > > -memcpy(&(ap->wpa_ie.body[0]), > bp + 2, > > +memcpy(ap->wpa_ie.body, bp + > 2, > > ap->wpa_ie.size); > > } > > break; > > @@ -832,8 +832,8 @@ void hostif_scan_indication(struct >
[PATCH] Staging: board: Fix redundant macro
Fixes a 'macro with flow control statement' checkpatch code style error by removing the board_staging() macro and replacing its one and only call Signed-off-by: Valentin Hübner --- drivers/staging/board/armadillo800eva.c | 10 +- drivers/staging/board/board.h | 11 --- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/staging/board/armadillo800eva.c b/drivers/staging/board/armadillo800eva.c index 4de4fd0..2f1613a 100644 --- a/drivers/staging/board/armadillo800eva.c +++ b/drivers/staging/board/armadillo800eva.c @@ -101,4 +101,12 @@ static void __init armadillo800eva_init(void) ARRAY_SIZE(armadillo800eva_devices)); } -board_staging("renesas,armadillo800eva", armadillo800eva_init); +static int __init runtime_board_check(void) +{ + if (of_machine_is_compatible("renesas,armadillo800eva")) + armadillo800eva_init(); + + return 0; +} + +device_initcall(runtime_board_check) diff --git a/drivers/staging/board/board.h b/drivers/staging/board/board.h index 42ed125..0fa1197 100644 --- a/drivers/staging/board/board.h +++ b/drivers/staging/board/board.h @@ -31,15 +31,4 @@ int board_staging_register_device(const struct board_staging_dev *dev); void board_staging_register_devices(const struct board_staging_dev *devs, unsigned int ndevs); -#define board_staging(str, fn) \ -static int __init runtime_board_check(void)\ -{ \ - if (of_machine_is_compatible(str)) \ - fn(); \ - \ - return 0; \ -} \ - \ -device_initcall(runtime_board_check) - #endif /* __BOARD_H__ */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/3 staging-next] android: Lowmemmorykiller task tree
On Mon 13-02-17 16:42:42, peter enderborg wrote: > On 02/10/2017 11:27 AM, Michal Hocko wrote: > > [I have only now see this cover - it answers some of the questions I've > > had to specific patches. It would be really great if you could use git > > send-email to post patch series - it just does the right thing(tm)] > > > > On Thu 09-02-17 14:21:40, peter enderborg wrote: > >> Lowmemorykiller efficiency problem and a solution. > >> > >> Lowmemorykiller in android has a severe efficiency problem. The basic > >> problem is that the registered shrinker gets called very often without > >> anything actually happening. > > Which is an inherent problem because lkml doesn't belong to shrinkers > > infrastructure. > > Not really what this patch address. I see it as a problem with shrinker > that there no slow-path-free (scan/count) where it should belong. > This patch address a specific problem where lot of cpu are wasted > in low memory conditions. Let me repeat. The specific problem you are trying to solve is _inherent_ to how the lmk is designed. Full stop. -- Michal Hocko SUSE Labs ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: Is it time to move drivers/staging/netlogic/ out of staging?
On Sat, Feb 4, 2017 at 2:08 AM, Florian Fainelli wrote: > On 02/03/2017 12:36 PM, Greg KH wrote: >> On Fri, Feb 03, 2017 at 10:57:16AM -0800, Joe Perches wrote: >>> On Fri, 2017-02-03 at 10:50 -0800, Florian Fainelli wrote: (with JC's other email) >>> >>> And now with Greg's proper email too >>> On 02/03/2017 10:47 AM, Joe Perches wrote: > 64 bit stats isn't implemented, but is that really necessary? > Anything else? Joe, do you have such hardware that you are interested in getting supported, or was that just to reduce the amount of drivers in staging? I am really not clear about what happened to that entire product line, and whether there is any interest in having anything supported these days... >>> >>> No hardware. Just to reduce staging driver count. >> >> Without hardware or a "real" maintainer, it shouldn't be moved. >> >> Heck, if no one has the hardware, let's just delete the thing. > > I do have one, and other colleagues have some too, but I am not heavily > using it, nor do I have many cycles to spend on that... sounds like we > could keep it in staging for another 6 months and see what happens then? Unfortunately, I am no longer with Broadcom and don't have access to these boards anymore. This driver is for XLR, the next generation SoC called XLP has a different on-chip network accelerator - and that driver is not available publicly other than in FreeBSD[1] JC. [1] https://svnweb.freebsd.org/base/head/sys/mips/nlm/dev/net/ ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: greybus: loopback_test: Change array index from loop bound to loop index
[+CC: greybus and staging lists] On Sat, Feb 18, 2017 at 01:47:38PM +0530, sayli karnik wrote: > Change array index from the loop bound variable to loop index. > The open_poll_files() functions attempts to open poll files of devices > numbered from 0 to device_count. If the open() function inside it is > unsuccessful for any intermediate device, all files with fds of devices from 0 > upto that device must be closed and open_poll_files() should return -1. > The current code only closes the poll file with the most recent fd allocated, > and in most cases tries to close the same file multiple times. Nice catch! You forgot to CC the relevant mailings lists however (use scripts/get_maintainer.pl). Also your patch summary is a bit too detailed, something like staging: greybus: loopback_test: fix open error path would be better. Care to resend as a v2 with a shorter summary and lists on CC? > Detected by coccinelle: > > @@ > expression arr,ex1,ex2; > @@ > > for(ex1 = 0; ex1 < ex2; ex1++) { <... > arr[ > - ex2 > + ex1 > ] > ...> } > > Signed-off-by: sayli karnik > --- > drivers/staging/greybus/tools/loopback_test.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/greybus/tools/loopback_test.c > b/drivers/staging/greybus/tools/loopback_test.c > index 18d7a3d..2ee9a22 100644 > --- a/drivers/staging/greybus/tools/loopback_test.c > +++ b/drivers/staging/greybus/tools/loopback_test.c > @@ -674,7 +674,7 @@ static int open_poll_files(struct loopback_test *t) > > err: > for (i = 0; i < fds_idx; i++) > - close(t->fds[fds_idx].fd); > + close(t->fds[i].fd); > > return -1; > } Thanks, Johan ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: board: Fix redundant macro
Hi [auto build test ERROR on staging/staging-testing] [also build test ERROR on v4.10 next-20170220] [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/UTF-8-q-Valentin-20H-C3-BCbner/Staging-board-Fix-redundant-macro/20170220-175655 config: arm-shmobile_defconfig (attached as .config) compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705 reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=arm All errors (new ones prefixed by >>): >> drivers/staging/board/kzm9d.c:25:15: error: expected declaration specifiers >> or '...' before string constant board_staging("renesas,kzm9d", kzm9d_init); ^~~ >> drivers/staging/board/kzm9d.c:25:32: error: expected declaration specifiers >> or '...' before 'kzm9d_init' board_staging("renesas,kzm9d", kzm9d_init); ^~ drivers/staging/board/kzm9d.c:12:20: warning: 'kzm9d_init' defined but not used [-Wunused-function] static void __init kzm9d_init(void) ^~ vim +25 drivers/staging/board/kzm9d.c f22f4ea5 Magnus Damm2014-06-06 9 DEFINE_RES_IRQ(159), f22f4ea5 Magnus Damm2014-06-06 10 }; f22f4ea5 Magnus Damm2014-06-06 11 f22f4ea5 Magnus Damm2014-06-06 12 static void __init kzm9d_init(void) f22f4ea5 Magnus Damm2014-06-06 13 { cebbddb6 Geert Uytterhoeven 2015-11-20 14 board_staging_gic_setup_xlate("arm,pl390", 32); a8589088 Geert Uytterhoeven 2015-06-17 15 a8589088 Geert Uytterhoeven 2015-06-17 16 if (!board_staging_dt_node_available(usbs1_res, a8589088 Geert Uytterhoeven 2015-06-17 17 ARRAY_SIZE(usbs1_res))) { a8589088 Geert Uytterhoeven 2015-06-17 18 board_staging_gic_fixup_resources(usbs1_res, a8589088 Geert Uytterhoeven 2015-06-17 19 ARRAY_SIZE(usbs1_res)); f22f4ea5 Magnus Damm2014-06-06 20 platform_device_register_simple("emxx_udc", -1, usbs1_res, f22f4ea5 Magnus Damm2014-06-06 21 ARRAY_SIZE(usbs1_res)); f22f4ea5 Magnus Damm2014-06-06 22 } a8589088 Geert Uytterhoeven 2015-06-17 23 } f22f4ea5 Magnus Damm2014-06-06 24 f22f4ea5 Magnus Damm2014-06-06 @25 board_staging("renesas,kzm9d", kzm9d_init); :: The code at line 25 was first introduced by commit :: f22f4ea5c63fbc6ee7a3f7240c84a276eba96d76 staging: board: kzm9d: Board staging support for emxx_udc :: TO: Magnus Damm :: CC: Greg Kroah-Hartman --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: board: Fix redundant macro
On Mon, Feb 20, 2017 at 10:10 AM, =?UTF-8?q?Valentin=20H=C3=BCbner?= wrote: > Fixes a 'macro with flow control statement' checkpatch code style > error by removing the board_staging() macro and replacing its one > and only call It's not the only user, as 0day has already told you. > Signed-off-by: Valentin Hübner NAKed-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/1] Staging: FBTFT: Fix wrong type casting warnings generated by sparse
Fixed the following warnings reported by sparse: drivers/staging/fbtft/fb_watterott.c:83:16: warning: incorrect type in assignment (different base types) drivers/staging/fbtft/fb_watterott.c:83:16:expected unsigned short [unsigned] [short] [usertype] drivers/staging/fbtft/fb_watterott.c:83:16:got restricted __be16 [usertype] drivers/staging/fbtft/fb_watterott.c:84:16: warning: incorrect type in assignment (different base types) drivers/staging/fbtft/fb_watterott.c:84:16:expected unsigned short [unsigned] [short] [usertype] drivers/staging/fbtft/fb_watterott.c:84:16:got restricted __be16 [usertype] drivers/staging/fbtft/fb_watterott.c:88:24: warning: incorrect type in assignment (different base types) drivers/staging/fbtft/fb_watterott.c:88:24:expected unsigned short [unsigned] [short] [usertype] drivers/staging/fbtft/fb_watterott.c:88:24:got restricted __be16 [usertype] drivers/staging/fbtft/fb_watterott.c:90:34: warning: incorrect type in assignment (different base types) drivers/staging/fbtft/fb_watterott.c:90:34:expected unsigned short [unsigned] [short] [usertype] drivers/staging/fbtft/fb_watterott.c:90:34:got restricted __be16 [usertype] drivers/staging/fbtft/fb_watterott.c:120:16: warning: incorrect type in assignment (different base types) drivers/staging/fbtft/fb_watterott.c:120:16:expected unsigned short [unsigned] [short] [usertype] drivers/staging/fbtft/fb_watterott.c:120:16:got restricted __be16 [usertype] drivers/staging/fbtft/fb_watterott.c:121:16: warning: incorrect type in assignment (different base types) drivers/staging/fbtft/fb_watterott.c:121:16:expected unsigned short [unsigned] [short] [usertype] drivers/staging/fbtft/fb_watterott.c:121:16:got restricted __be16 [usertype] drivers/staging/fbtft/fb_watterott.c:125:24: warning: incorrect type in assignment (different base types) drivers/staging/fbtft/fb_watterott.c:125:24:expected unsigned short [unsigned] [short] [usertype] drivers/staging/fbtft/fb_watterott.c:125:24:got restricted __be16 [usertype] Signed-off-by: Mandel Benjamin --- drivers/staging/fbtft/fb_watterott.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/fbtft/fb_watterott.c b/drivers/staging/fbtft/fb_watterott.c index 429304546b44..276f7fe1dbe7 100644 --- a/drivers/staging/fbtft/fb_watterott.c +++ b/drivers/staging/fbtft/fb_watterott.c @@ -69,8 +69,8 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) { unsigned int start_line, end_line; u16 *vmem16 = (u16 *)(par->info->screen_buffer + offset); - u16 *pos = par->txbuf.buf + 1; - u16 *buf16 = par->txbuf.buf + 10; + __be16 *pos = (__be16 *)par->txbuf.buf + 1; + __be16 *buf16 = (__be16 *)par->txbuf.buf + 10; int i, j; int ret = 0; @@ -106,7 +106,7 @@ static int write_vmem_8bit(struct fbtft_par *par, size_t offset, size_t len) { unsigned int start_line, end_line; u16 *vmem16 = (u16 *)(par->info->screen_buffer + offset); - u16 *pos = par->txbuf.buf + 1; + __be16 *pos = (__be16 *)par->txbuf.buf + 1; u8 *buf8 = par->txbuf.buf + 10; int i, j; int ret = 0; -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: comedi: drivers: comedi_test: Avoid multiple line dereference
On 20/02/17 08:28, Cheah Kok Cheong wrote: Fix checkpatch warning "Avoid multiple line dereference" using a local variable to avoid line wrap. Signed-off-by: Cheah Kok Cheong --- drivers/staging/comedi/drivers/comedi_test.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c index 2a063f0..fde83e0 100644 --- a/drivers/staging/comedi/drivers/comedi_test.c +++ b/drivers/staging/comedi/drivers/comedi_test.c @@ -480,11 +480,9 @@ static void waveform_ao_timer(unsigned long arg) /* output the last scan */ for (i = 0; i < cmd->scan_end_arg; i++) { unsigned int chan = CR_CHAN(cmd->chanlist[i]); + unsigned short d = devpriv->ao_loopbacks[chan]; - if (comedi_buf_read_samples(s, - &devpriv-> -ao_loopbacks[chan], - 1) == 0) { + if (!comedi_buf_read_samples(s, &d, 1)) { /* unexpected underrun! (cancelled?) */ async->events |= COMEDI_CB_OVERFLOW; goto underrun; NAK. This leaves devpriv->ao_loopbacks[chan] unchanged. -- -=( 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
Re: [PATCH] Staging: comedi: drivers: comedi_test: Avoid multiple line dereference
On Mon, Feb 20, 2017 at 10:03:39AM +, Ian Abbott wrote: > On 20/02/17 08:28, Cheah Kok Cheong wrote: > >Fix checkpatch warning "Avoid multiple line dereference" > >using a local variable to avoid line wrap. > > > >Signed-off-by: Cheah Kok Cheong > >--- > > drivers/staging/comedi/drivers/comedi_test.c | 6 ++ > > 1 file changed, 2 insertions(+), 4 deletions(-) > > > >diff --git a/drivers/staging/comedi/drivers/comedi_test.c > >b/drivers/staging/comedi/drivers/comedi_test.c > >index 2a063f0..fde83e0 100644 > >--- a/drivers/staging/comedi/drivers/comedi_test.c > >+++ b/drivers/staging/comedi/drivers/comedi_test.c > >@@ -480,11 +480,9 @@ static void waveform_ao_timer(unsigned long arg) > > /* output the last scan */ > > for (i = 0; i < cmd->scan_end_arg; i++) { > > unsigned int chan = CR_CHAN(cmd->chanlist[i]); > >+unsigned short d = devpriv->ao_loopbacks[chan]; > > > >-if (comedi_buf_read_samples(s, > >-&devpriv-> > >- ao_loopbacks[chan], > >-1) == 0) { > >+if (!comedi_buf_read_samples(s, &d, 1)) { > > /* unexpected underrun! (cancelled?) */ > > async->events |= COMEDI_CB_OVERFLOW; > > goto underrun; > > > > NAK. This leaves devpriv->ao_loopbacks[chan] unchanged. > Thanks for pointing this out. In that case will assigning the variable to devpriv->ao_loopbacks[chan] be acceptable? Please review below snippet. Otherwise I'll just drop the variable and adjust the lines to avoid checkpatch warning. Sorry for the inconvenience caused. [ Snip ] /* output the last scan */ for (i = 0; i < cmd->scan_end_arg; i++) { unsigned int chan = CR_CHAN(cmd->chanlist[i]); unsigned short data; if (!comedi_buf_read_samples(s, &data, 1)) { /* unexpected underrun! (cancelled?) */ async->events |= COMEDI_CB_OVERFLOW; goto underrun; } devpriv->ao_loopbacks[chan] = data; } /* advance time of last scan */ [ Snip ] Thks. Brgds, CheahKC ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: greybus: loopback_test: Change array index from loop bound to loop index
On Mon, Feb 20, 2017 at 5:30 PM, Johan Hovold wrote: > [+CC: greybus and staging lists] > > On Sat, Feb 18, 2017 at 01:47:38PM +0530, sayli karnik wrote: >> Change array index from the loop bound variable to loop index. >> The open_poll_files() functions attempts to open poll files of devices >> numbered from 0 to device_count. If the open() function inside it is >> unsuccessful for any intermediate device, all files with fds of devices from >> 0 >> upto that device must be closed and open_poll_files() should return -1. >> The current code only closes the poll file with the most recent fd allocated, >> and in most cases tries to close the same file multiple times. > > Nice catch! > > You forgot to CC the relevant mailings lists however (use > scripts/get_maintainer.pl). Yes I'll do that! > > Also your patch summary is a bit too detailed, something like > > staging: greybus: loopback_test: fix open error path > > would be better. > > Care to resend as a v2 with a shorter summary and lists on CC? > Yes sure I'm sending a v2. thanks, sayli >> Detected by coccinelle: >> >> @@ >> expression arr,ex1,ex2; >> @@ >> >> for(ex1 = 0; ex1 < ex2; ex1++) { <... >> arr[ >> - ex2 >> + ex1 >> ] >> ...> } >> >> Signed-off-by: sayli karnik >> --- >> drivers/staging/greybus/tools/loopback_test.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/staging/greybus/tools/loopback_test.c >> b/drivers/staging/greybus/tools/loopback_test.c >> index 18d7a3d..2ee9a22 100644 >> --- a/drivers/staging/greybus/tools/loopback_test.c >> +++ b/drivers/staging/greybus/tools/loopback_test.c >> @@ -674,7 +674,7 @@ static int open_poll_files(struct loopback_test *t) >> >> err: >> for (i = 0; i < fds_idx; i++) >> - close(t->fds[fds_idx].fd); >> + close(t->fds[i].fd); >> >> return -1; >> } > > Thanks, > Johan ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [Outreachy kernel] [PATCH] staging: ks7010: remove unecessary spaces after casts
On Mon, Feb 20, 2017 at 07:37:33AM +0100, Julia Lawall wrote: > On Sun, 19 Feb 2017, Katie Dunne wrote: > > > Remove spaces after casts found by checkpatch.pl. In some cases, > > remove returns after casts and place them on a single line. > > What do you mean by "returns after casts"? I didn't see anything like > that. > > julia > By return I mean there is a new line between the cast and value: In void hostif_sleep_request @@ -1728,9 +1727,8: cpu_to_le16((unint16_t) is on a separate line from the value In int hostif_data_request @@ -1219,37 +1218,37: There are also issues with multiple lines, but these don't directly affect casts so I saved them for a different patch. Katie > > > > Signed-off-by: Katie Dunne > > --- > > drivers/staging/ks7010/ks_hostif.c | 206 > > ++--- > > 1 file changed, 102 insertions(+), 104 deletions(-) > > > > diff --git a/drivers/staging/ks7010/ks_hostif.c > > b/drivers/staging/ks7010/ks_hostif.c > > index 97d7b56..1872f40 100644 > > --- a/drivers/staging/ks7010/ks_hostif.c > > +++ b/drivers/staging/ks7010/ks_hostif.c > > @@ -379,9 +379,8 @@ void hostif_data_indication(struct ks_wlan_private > > *priv) > >(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(&michel_mic, > > (uint8_t *) priv->wpa.key[auth_type - 1].rx_mic_key, (uint8_t *) priv->rxp, > > (int)priv->rx_size, (uint8_t) 0,/* priority */ > > - (uint8_t *) > > - michel_mic.Result); > > + MichaelMICFunction(&michel_mic, > > (uint8_t *)priv->wpa.key[auth_type - 1].rx_mic_key, (uint8_t *)priv->rxp, > > (int)priv->rx_size, (uint8_t)0, /* priority */ > > + (uint8_t > > *)michel_mic.Result); > > } > > if (memcmp(michel_mic.Result, RecvMIC, 8)) { > > now = jiffies; > > @@ -400,7 +399,7 @@ void hostif_data_indication(struct ks_wlan_private > > *priv) > > } else if (mic_failure->failure == 1) { > > mic_failure->failure = 2; > > mic_failure->counter = > > - (uint16_t) ((now - > > + (uint16_t)((now - > > mic_failure-> > > > > last_failure_time) > > / HZ); > > @@ -1219,37 +1218,37 @@ int hostif_data_request(struct ks_wlan_private > > *priv, struct sk_buff *packet) > > && !(priv->wpa.key[1].key_len) > > && !(priv->wpa.key[2].key_len) > > && !(priv->wpa.key[3].key_len)) { > > - pp->auth_type = cpu_to_le16((uint16_t) TYPE_AUTH); > > /* no encryption */ > > + pp->auth_type = cpu_to_le16((uint16_t)TYPE_AUTH); > > /* no encryption */ > > } else { > > if (priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) { > > - MichaelMICFunction(&michel_mic, (uint8_t *) > > priv->wpa.key[0].tx_mic_key, (uint8_t *) &pp->data[0], (int)packet_len, > > (uint8_t) 0,/* priority */ > > - (uint8_t *) michel_mic. > > + MichaelMICFunction(&michel_mic, (uint8_t > > *)priv->wpa.key[0].tx_mic_key, (uint8_t *)&pp->data[0], (int)packet_len, > > (uint8_t)0, /* priority */ > > + (uint8_t *)michel_mic. > >Result); > > memcpy(p, michel_mic.Result, 8); > > length += 8; > > packet_len += 8; > > p += 8; > > pp->auth_type = > > - cpu_to_le16((uint16_t) TYPE_DATA); > > + cpu_to_le16((uint16_t)TYPE_DATA); > > > > } else if (priv->wpa.pairwise_suite == > >IW_AUTH_CIPHER_CCMP) { > > pp->auth_type = > > - cpu_to_le16((uint16_t) TYPE_DATA); > > + cpu_to_le16((uint16_t)TYPE_DATA); > > } > > } > > } else { > > if (eth_proto == ETHER_PROTOCOL_TYPE_EAP) > > - pp->auth_type = cpu_to_le16
Re: [Outreachy kernel] [PATCH] staging: ks7010: remove unecessary spaces after casts
On Mon, 20 Feb 2017, Katie Dunne wrote: > On Mon, Feb 20, 2017 at 07:37:33AM +0100, Julia Lawall wrote: > > On Sun, 19 Feb 2017, Katie Dunne wrote: > > > > > Remove spaces after casts found by checkpatch.pl. In some cases, > > > remove returns after casts and place them on a single line. > > > > What do you mean by "returns after casts"? I didn't see anything like > > that. > > > > julia > > > > By return I mean there is a new line between the cast and value: Ah, OK, I was looking for return XYZ; :) > > In void hostif_sleep_request @@ -1728,9 +1727,8: > cpu_to_le16((unint16_t) is on a separate line from the value It looks ok. julia > In int hostif_data_request @@ -1219,37 +1218,37: > There are also issues with multiple lines, but these don't > directly affect casts so I saved them for a different patch. > > Katie > > > > > > > Signed-off-by: Katie Dunne > > > --- > > > drivers/staging/ks7010/ks_hostif.c | 206 > > > ++--- > > > 1 file changed, 102 insertions(+), 104 deletions(-) > > > > > > diff --git a/drivers/staging/ks7010/ks_hostif.c > > > b/drivers/staging/ks7010/ks_hostif.c > > > index 97d7b56..1872f40 100644 > > > --- a/drivers/staging/ks7010/ks_hostif.c > > > +++ b/drivers/staging/ks7010/ks_hostif.c > > > @@ -379,9 +379,8 @@ void hostif_data_indication(struct ks_wlan_private > > > *priv) > > > (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(&michel_mic, > > > (uint8_t *) priv->wpa.key[auth_type - 1].rx_mic_key, (uint8_t *) > > > priv->rxp, (int)priv->rx_size, (uint8_t) 0,/* priority */ > > > -(uint8_t *) > > > -michel_mic.Result); > > > + MichaelMICFunction(&michel_mic, > > > (uint8_t *)priv->wpa.key[auth_type - 1].rx_mic_key, (uint8_t *)priv->rxp, > > > (int)priv->rx_size, (uint8_t)0, /* priority */ > > > +(uint8_t > > > *)michel_mic.Result); > > > } > > > if (memcmp(michel_mic.Result, RecvMIC, 8)) { > > > now = jiffies; > > > @@ -400,7 +399,7 @@ void hostif_data_indication(struct ks_wlan_private > > > *priv) > > > } else if (mic_failure->failure == 1) { > > > mic_failure->failure = 2; > > > mic_failure->counter = > > > - (uint16_t) ((now - > > > + (uint16_t)((now - > > >mic_failure-> > > > > > > last_failure_time) > > > / HZ); > > > @@ -1219,37 +1218,37 @@ int hostif_data_request(struct ks_wlan_private > > > *priv, struct sk_buff *packet) > > > && !(priv->wpa.key[1].key_len) > > > && !(priv->wpa.key[2].key_len) > > > && !(priv->wpa.key[3].key_len)) { > > > - pp->auth_type = cpu_to_le16((uint16_t) TYPE_AUTH); > > > /* no encryption */ > > > + pp->auth_type = cpu_to_le16((uint16_t)TYPE_AUTH); > > > /* no encryption */ > > > } else { > > > if (priv->wpa.pairwise_suite == IW_AUTH_CIPHER_TKIP) { > > > - MichaelMICFunction(&michel_mic, (uint8_t *) > > > priv->wpa.key[0].tx_mic_key, (uint8_t *) &pp->data[0], (int)packet_len, > > > (uint8_t) 0,/* priority */ > > > -(uint8_t *) michel_mic. > > > + MichaelMICFunction(&michel_mic, (uint8_t > > > *)priv->wpa.key[0].tx_mic_key, (uint8_t *)&pp->data[0], (int)packet_len, > > > (uint8_t)0, /* priority */ > > > +(uint8_t *)michel_mic. > > > Result); > > > memcpy(p, michel_mic.Result, 8); > > > length += 8; > > > packet_len += 8; > > > p += 8; > > > pp->auth_type = > > > - cpu_to_le16((uint16_t) TYPE_DATA); > > > + cpu_to_le16((uint16_t)TYPE_DATA); > > > > > > } else if (priv->wpa.pairwise_suite == > > > IW_AUTH_CIPHER_CCMP) { > > > pp->auth_type = > > > - cpu_to_le16((uint16_t) TYPE_DATA); > > > +
[PATCH v2 6/6] staging: rtl8192e: Removed unnecessary parentheses
Extra parentheses were causing checkpatch issues and were removed. Signed-off-by: simran singhal --- v2: -Removed parentheses around argument of cast -Removed cast drivers/staging/rtl8192e/rtl819x_HTProc.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c index cded0f4..0a9234e 100644 --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c @@ -297,7 +297,7 @@ void HTConstructCapabilityElement(struct rtllib_device *ieee, u8 *posHTCap, u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; memcpy(posHTCap, EWC11NHTCap, sizeof(EWC11NHTCap)); - pCapELE = (struct ht_capab_ele *)&(posHTCap[4]); + pCapELE = (struct ht_capab_ele *)&posHTCap[4]; *len = 30 + 2; } else { pCapELE = (struct ht_capab_ele *)posHTCap; @@ -663,13 +663,13 @@ void HTInitializeHTInfo(struct rtllib_device *ieee) pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density; pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor; - memset((void *)(&(pHTInfo->SelfHTCap)), 0, + memset(&pHTInfo->SelfHTCap, 0, sizeof(pHTInfo->SelfHTCap)); - memset((void *)(&(pHTInfo->SelfHTInfo)), 0, + memset(&pHTInfo->SelfHTInfo, 0, sizeof(pHTInfo->SelfHTInfo)); - memset((void *)(&(pHTInfo->PeerHTCapBuf)), 0, + memset(&pHTInfo->PeerHTCapBuf, 0, sizeof(pHTInfo->PeerHTCapBuf)); - memset((void *)(&(pHTInfo->PeerHTInfoBuf)), 0, + memset(&pHTInfo->PeerHTInfoBuf, 0, sizeof(pHTInfo->PeerHTInfoBuf)); pHTInfo->bSwBwInProgress = false; @@ -685,7 +685,7 @@ void HTInitializeHTInfo(struct rtllib_device *ieee) pHTInfo->IOTRaFunc = 0; { - u8 *RegHTSuppRateSets = &(ieee->RegHTSuppRateSet[0]); + u8 *RegHTSuppRateSets = &ieee->RegHTSuppRateSet[0]; RegHTSuppRateSets[0] = 0xFF; RegHTSuppRateSets[1] = 0xFF; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: greybus: loopback_test: Fix open error path
Change array index from the loop bound variable to loop index. If a poll file fails to open for any intermediate device, all poll files with fds of devices from 0 upto that device must be closed in the open_poll_files() function. The current code only closes the poll file with the most recent fd allocated, and at times tries to close the same file multiple times. Detected by coccinelle: @@ expression arr,ex1,ex2; @@ for(ex1 = 0; ex1 < ex2; ex1++) { <... arr[ - ex2 + ex1 ] ...> } Signed-off-by: sayli karnik --- v2: Made the subject and changelog more concise drivers/staging/greybus/tools/loopback_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/greybus/tools/loopback_test.c b/drivers/staging/greybus/tools/loopback_test.c index 18d7a3d..2ee9a22 100644 --- a/drivers/staging/greybus/tools/loopback_test.c +++ b/drivers/staging/greybus/tools/loopback_test.c @@ -674,7 +674,7 @@ static int open_poll_files(struct loopback_test *t) err: for (i = 0; i < fds_idx; i++) - close(t->fds[fds_idx].fd); + close(t->fds[i].fd); return -1; } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: greybus: loopback_test: Fix open error path
On Mon, Feb 20, 2017 at 10:40:28PM +0530, sayli karnik wrote: > Change array index from the loop bound variable to loop index. > If a poll file fails to open for any intermediate device, all poll files with > fds of devices from 0 upto that device must be closed in the open_poll_files() > function. The current code only closes the poll file with the most recent fd > allocated, and at times tries to close the same file multiple times. > > Detected by coccinelle: > > @@ > expression arr,ex1,ex2; > @@ > > for(ex1 = 0; ex1 < ex2; ex1++) { <... > arr[ > - ex2 > + ex1 > ] > ...> } > > Signed-off-by: sayli karnik > --- > v2: > Made the subject and changelog more concise Thanks for the update. Reviewed-by: Johan Hovold Johan ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] *Updating complex macros for checkpatch.
Signed-off-by: Matthew Giassa --- drivers/staging/ks7010/ks_wlan_ioctl.h | 80 +- 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/drivers/staging/ks7010/ks_wlan_ioctl.h b/drivers/staging/ks7010/ks_wlan_ioctl.h index 84554b6..00eec18 100644 --- a/drivers/staging/ks7010/ks_wlan_ioctl.h +++ b/drivers/staging/ks7010/ks_wlan_ioctl.h @@ -1,6 +1,6 @@ /* * Driver for KeyStream 11b/g wireless LAN - * + * * Copyright (c) 2005-2008 KeyStream Corp. * Copyright (C) 2009 Renesas Technology Corp. * @@ -8,60 +8,62 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ - #ifndef _KS_WLAN_IOCTL_H #define _KS_WLAN_IOCTL_H #include -/* The low order bit identify a SET (0) or a GET (1) ioctl. */ +/* The low order bit identify a SET (0) or a GET (1) ioctl. */ -/* SIOCIWFIRSTPRIV+0 */ -/* former KS_WLAN_GET_DRIVER_VERSION SIOCIWFIRSTPRIV+1 */ -/* SIOCIWFIRSTPRIV+2 */ -#define KS_WLAN_GET_FIRM_VERSION SIOCIWFIRSTPRIV+3 +/* (SIOCIWFIRSTPRIV + 0) */ +/* Former KS_WLAN_GET_DRIVER_VERSION (SIOCIWFIRSTPRIV + 1) */ +/* (SIOCIWFIRSTPRIV + 2) */ +#define KS_WLAN_GET_FIRM_VERSION (SIOCIWFIRSTPRIV + 3) #ifdef WPS -#define KS_WLAN_SET_WPS_ENABLE SIOCIWFIRSTPRIV+4 -#define KS_WLAN_GET_WPS_ENABLE SIOCIWFIRSTPRIV+5 -#define KS_WLAN_SET_WPS_PROBE_REQ SIOCIWFIRSTPRIV+6 +#define KS_WLAN_SET_WPS_ENABLE (SIOCIWFIRSTPRIV + 4) +#define KS_WLAN_GET_WPS_ENABLE (SIOCIWFIRSTPRIV + 5) +#define KS_WLAN_SET_WPS_PROBE_REQ (SIOCIWFIRSTPRIV + 6) #endif -#define KS_WLAN_GET_EEPROM_CKSUM SIOCIWFIRSTPRIV+7 -#define KS_WLAN_SET_PREAMBLE SIOCIWFIRSTPRIV+8 -#define KS_WLAN_GET_PREAMBLE SIOCIWFIRSTPRIV+9 -#define KS_WLAN_SET_POWER_SAVE SIOCIWFIRSTPRIV+10 -#define KS_WLAN_GET_POWER_SAVE SIOCIWFIRSTPRIV+11 -#define KS_WLAN_SET_SCAN_TYPE SIOCIWFIRSTPRIV+12 -#define KS_WLAN_GET_SCAN_TYPE SIOCIWFIRSTPRIV+13 -#define KS_WLAN_SET_RX_GAINSIOCIWFIRSTPRIV+14 -#define KS_WLAN_GET_RX_GAINSIOCIWFIRSTPRIV+15 -#define KS_WLAN_HOSTT SIOCIWFIRSTPRIV+16 /* unused */ -//#define KS_WLAN_SET_REGIONSIOCIWFIRSTPRIV+17 -#define KS_WLAN_SET_BEACON_LOSTSIOCIWFIRSTPRIV+18 -#define KS_WLAN_GET_BEACON_LOSTSIOCIWFIRSTPRIV+19 +#define KS_WLAN_GET_EEPROM_CKSUM (SIOCIWFIRSTPRIV + 7) +#define KS_WLAN_SET_PREAMBLE (SIOCIWFIRSTPRIV + 8) +#define KS_WLAN_GET_PREAMBLE (SIOCIWFIRSTPRIV + 9) +#define KS_WLAN_SET_POWER_SAVE (SIOCIWFIRSTPRIV + 10) +#define KS_WLAN_GET_POWER_SAVE (SIOCIWFIRSTPRIV + 11) +#define KS_WLAN_SET_SCAN_TYPE (SIOCIWFIRSTPRIV + 12) +#define KS_WLAN_GET_SCAN_TYPE (SIOCIWFIRSTPRIV + 13) +#define KS_WLAN_SET_RX_GAIN(SIOCIWFIRSTPRIV + 14) +#define KS_WLAN_GET_RX_GAIN(SIOCIWFIRSTPRIV + 15) +#define KS_WLAN_HOSTT (SIOCIWFIRSTPRIV + 16) /* unused */ +/*#define KS_WLAN_SET_REGION(SIOCIWFIRSTPRIV + 17) */ +#define KS_WLAN_SET_BEACON_LOST(SIOCIWFIRSTPRIV + 18) +#define KS_WLAN_GET_BEACON_LOST(SIOCIWFIRSTPRIV + 19) -#define KS_WLAN_SET_TX_GAINSIOCIWFIRSTPRIV+20 -#define KS_WLAN_GET_TX_GAINSIOCIWFIRSTPRIV+21 +#define KS_WLAN_SET_TX_GAIN(SIOCIWFIRSTPRIV + 20) +#define KS_WLAN_GET_TX_GAIN(SIOCIWFIRSTPRIV + 21) -/* for KS7010 */ -#define KS_WLAN_SET_PHY_TYPE SIOCIWFIRSTPRIV+22 -#define KS_WLAN_GET_PHY_TYPE SIOCIWFIRSTPRIV+23 -#define KS_WLAN_SET_CTS_MODE SIOCIWFIRSTPRIV+24 -#define KS_WLAN_GET_CTS_MODE SIOCIWFIRSTPRIV+25 -/* SIOCIWFIRSTPRIV+26 */ -/* SIOCIWFIRSTPRIV+27 */ -#define KS_WLAN_SET_SLEEP_MODE SIOCIWFIRSTPRIV+28 /* sleep mode */ -#define KS_WLAN_GET_SLEEP_MODE SIOCIWFIRSTPRIV+29 /* sleep mode */ -/* SIOCIWFIRSTPRIV+30 */ -/* SIOCIWFIRSTPRIV+31 */ +/* For KS7010. */ +#define KS_WLAN_SET_PHY_TYPE (SIOCIWFIRSTPRIV + 22) +#define KS_WLAN_GET_PHY_TYPE (SIOCIWFIRSTPRIV + 23) +#define KS_WLAN_SET_CTS_MODE (SIOCIWFIRSTPRIV + 24) +#define KS_WLAN_GET_CTS_MODE (SIOCIWFIRSTPRIV + 25) +/* (SIOCIWFIRSTPRIV + 26) */ +/* (SIOCIWFIRSTPRIV + 27) */ +#define KS_WLAN_SET_SLEEP_MODE (SIOCIWFIRSTPRIV + 28) /* sleep mode */ +#define KS_WLAN_GET_SLEEP_MODE (SIOCIWFIRSTPRIV + 29) /* sleep mode */ +/* (SIOCIWFIRSTPRIV + 30) */ +/*
Re: [PATCH] Staging: comedi: drivers: comedi_test: Avoid multiple line dereference
On 20/02/17 16:02, Cheah Kok Cheong wrote: On Mon, Feb 20, 2017 at 10:03:39AM +, Ian Abbott wrote: On 20/02/17 08:28, Cheah Kok Cheong wrote: Fix checkpatch warning "Avoid multiple line dereference" using a local variable to avoid line wrap. Signed-off-by: Cheah Kok Cheong --- drivers/staging/comedi/drivers/comedi_test.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c index 2a063f0..fde83e0 100644 --- a/drivers/staging/comedi/drivers/comedi_test.c +++ b/drivers/staging/comedi/drivers/comedi_test.c @@ -480,11 +480,9 @@ static void waveform_ao_timer(unsigned long arg) /* output the last scan */ for (i = 0; i < cmd->scan_end_arg; i++) { unsigned int chan = CR_CHAN(cmd->chanlist[i]); + unsigned short d = devpriv->ao_loopbacks[chan]; - if (comedi_buf_read_samples(s, - &devpriv-> -ao_loopbacks[chan], - 1) == 0) { + if (!comedi_buf_read_samples(s, &d, 1)) { /* unexpected underrun! (cancelled?) */ async->events |= COMEDI_CB_OVERFLOW; goto underrun; NAK. This leaves devpriv->ao_loopbacks[chan] unchanged. Thanks for pointing this out. In that case will assigning the variable to devpriv->ao_loopbacks[chan] be acceptable? Please review below snippet. Otherwise I'll just drop the variable and adjust the lines to avoid checkpatch warning. Sorry for the inconvenience caused. [ Snip ] /* output the last scan */ for (i = 0; i < cmd->scan_end_arg; i++) { unsigned int chan = CR_CHAN(cmd->chanlist[i]); unsigned short data; if (!comedi_buf_read_samples(s, &data, 1)) { /* unexpected underrun! (cancelled?) */ async->events |= COMEDI_CB_OVERFLOW; goto underrun; } devpriv->ao_loopbacks[chan] = data; } /* advance time of last scan */ [ Snip ] It will work, but you could just use a pointer variable set to &devpriv->ao_loopbacks[chan] and pass that to comedi_buf_read_samples(). -- -=( 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: board: Fix macro code style error
Fixes a 'macro with flow control statement' checkpatch code style error by removing the board_staging() macro and replacing its two calls Signed-off-by: Valentin Hübner --- drivers/staging/board/armadillo800eva.c | 10 +- drivers/staging/board/board.h | 11 --- drivers/staging/board/kzm9d.c | 10 +- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/staging/board/armadillo800eva.c b/drivers/staging/board/armadillo800eva.c index 4de4fd0..2f1613a 100644 --- a/drivers/staging/board/armadillo800eva.c +++ b/drivers/staging/board/armadillo800eva.c @@ -101,4 +101,12 @@ static void __init armadillo800eva_init(void) ARRAY_SIZE(armadillo800eva_devices)); } -board_staging("renesas,armadillo800eva", armadillo800eva_init); +static int __init runtime_board_check(void) +{ + if (of_machine_is_compatible("renesas,armadillo800eva")) + armadillo800eva_init(); + + return 0; +} + +device_initcall(runtime_board_check) diff --git a/drivers/staging/board/board.h b/drivers/staging/board/board.h index 42ed125..0fa1197 100644 --- a/drivers/staging/board/board.h +++ b/drivers/staging/board/board.h @@ -31,15 +31,4 @@ int board_staging_register_device(const struct board_staging_dev *dev); void board_staging_register_devices(const struct board_staging_dev *devs, unsigned int ndevs); -#define board_staging(str, fn) \ -static int __init runtime_board_check(void)\ -{ \ - if (of_machine_is_compatible(str)) \ - fn(); \ - \ - return 0; \ -} \ - \ -device_initcall(runtime_board_check) - #endif /* __BOARD_H__ */ diff --git a/drivers/staging/board/kzm9d.c b/drivers/staging/board/kzm9d.c index 05a6d43..662501c 100644 --- a/drivers/staging/board/kzm9d.c +++ b/drivers/staging/board/kzm9d.c @@ -22,4 +22,12 @@ static void __init kzm9d_init(void) } } -board_staging("renesas,kzm9d", kzm9d_init); +static int __init runtime_board_check(void) +{ + if (of_machine_is_compatible("renesas,kzm9d")) + kzm9d_init(); + + return 0; +} + +device_initcall(runtime_board_check) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] *Updating complex macros for checkpatch.
On Mon, Feb 20, 2017 at 09:20:52AM -0800, Matthew Giassa wrote: > Signed-off-by: Matthew Giassa > --- > drivers/staging/ks7010/ks_wlan_ioctl.h | 80 > +- > 1 file changed, 41 insertions(+), 39 deletions(-) I can't take patches without any changelog text :( ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: board: Fix macro code style error
On Mon, Feb 20, 2017 at 05:44:50PM +, Valentin Huebner wrote: > Fixes a 'macro with flow control statement' checkpatch code style > error by removing the board_staging() macro and replacing its two > calls checkpatch is wrong here, you are now adding more lines than you remove: > Signed-off-by: Valentin Hübner > --- > drivers/staging/board/armadillo800eva.c | 10 +- > drivers/staging/board/board.h | 11 --- > drivers/staging/board/kzm9d.c | 10 +- > 3 files changed, 18 insertions(+), 13 deletions(-) See? There's nothing wrong with the macro as-is, it's like many other macros we have for module init sequences. checkpatch is just a hint, you still have to use your brain :) sorry, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates
Hi Steve, On Wed, Feb 15, 2017 at 06:19:31PM -0800, Steve Longerbeam wrote: > From: Russell King > > Setting and getting frame rates is part of the negotiation mechanism > between subdevs. The lack of support means that a frame rate at the > sensor can't be negotiated through the subdev path. Just wondering --- what do you need this for? -- Sakari Ailus e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates
On 02/20/2017 02:04 PM, Sakari Ailus wrote: Hi Steve, On Wed, Feb 15, 2017 at 06:19:31PM -0800, Steve Longerbeam wrote: From: Russell King Setting and getting frame rates is part of the negotiation mechanism between subdevs. The lack of support means that a frame rate at the sensor can't be negotiated through the subdev path. Just wondering --- what do you need this for? Hi Sakari, i.MX does need the ability to negotiate the frame rates in the pipelines. The CSI has the ability to skip frames at the output, which is something Philipp added to the CSI subdev. That affects frame interval at the CSI output. But as Russell pointed out, the lack of [gs]_frame_interval op causes media-ctl to fail: media-ctl -v -d /dev/media1 --set-v4l2 '"imx6-mipi-csi2":1[fmt:SGBRG8/512x512@1/30]' Opening media device /dev/media1 Enumerating entities Found 29 entities Enumerating pads and links Setting up format SGBRG8 512x512 on pad imx6-mipi-csi2/1 Format set: SGBRG8 512x512 Setting up frame interval 1/30 on entity imx6-mipi-csi2 Unable to set frame interval: Inappropriate ioctl for device (-25)Unable to setup formats: Inappropriate ioctl for device (25) So i.MX needs to implement this op in every subdev in the pipeline, otherwise it's not possible to configure the pipeline with media-ctl. Steve ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8192u: Fix endianness warnings in ieee80211_rx.c
Fixes the endianness warning "restricted __le16 degrades to integer" by converting __le16 to short before using it in bitmasks or in the macro WLAN_FC_GET_STYPE. Signed-off-by: Sebastian Haas --- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 52 +++ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index d1057b1..006835f 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -2398,39 +2398,41 @@ static inline void ieee80211_process_probe_response( #ifdef CONFIG_IEEE80211_DEBUG struct ieee80211_info_element *info_element = &beacon->info_element[0]; #endif + int fc = WLAN_FC_GET_STYPE(le16_to_cpu(beacon->header.frame_ctl)); unsigned long flags; short renew; + u16 capability; //u8 wmm_info; memset(&network, 0, sizeof(struct ieee80211_network)); + capability = le16_to_cpu(beacon->capability); IEEE80211_DEBUG_SCAN( "'%s' (%pM): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", escape_essid(info_element->data, info_element->len), beacon->header.addr3, - (beacon->capability & (1<<0xf)) ? '1' : '0', - (beacon->capability & (1<<0xe)) ? '1' : '0', - (beacon->capability & (1<<0xd)) ? '1' : '0', - (beacon->capability & (1<<0xc)) ? '1' : '0', - (beacon->capability & (1<<0xb)) ? '1' : '0', - (beacon->capability & (1<<0xa)) ? '1' : '0', - (beacon->capability & (1<<0x9)) ? '1' : '0', - (beacon->capability & (1<<0x8)) ? '1' : '0', - (beacon->capability & (1<<0x7)) ? '1' : '0', - (beacon->capability & (1<<0x6)) ? '1' : '0', - (beacon->capability & (1<<0x5)) ? '1' : '0', - (beacon->capability & (1<<0x4)) ? '1' : '0', - (beacon->capability & (1<<0x3)) ? '1' : '0', - (beacon->capability & (1<<0x2)) ? '1' : '0', - (beacon->capability & (1<<0x1)) ? '1' : '0', - (beacon->capability & (1<<0x0)) ? '1' : '0'); + (capability & (1 << 0xf)) ? '1' : '0', + (capability & (1 << 0xe)) ? '1' : '0', + (capability & (1 << 0xd)) ? '1' : '0', + (capability & (1 << 0xc)) ? '1' : '0', + (capability & (1 << 0xb)) ? '1' : '0', + (capability & (1 << 0xa)) ? '1' : '0', + (capability & (1 << 0x9)) ? '1' : '0', + (capability & (1 << 0x8)) ? '1' : '0', + (capability & (1 << 0x7)) ? '1' : '0', + (capability & (1 << 0x6)) ? '1' : '0', + (capability & (1 << 0x5)) ? '1' : '0', + (capability & (1 << 0x4)) ? '1' : '0', + (capability & (1 << 0x3)) ? '1' : '0', + (capability & (1 << 0x2)) ? '1' : '0', + (capability & (1 << 0x1)) ? '1' : '0', + (capability & (1 << 0x0)) ? '1' : '0'); if (ieee80211_network_init(ieee, beacon, &network, stats)) { IEEE80211_DEBUG_SCAN("Dropped '%s' (%pM) via %s.\n", escape_essid(info_element->data, info_element->len), beacon->header.addr3, - WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == -IEEE80211_STYPE_PROBE_RESP ? +fc == IEEE80211_STYPE_PROBE_RESP ? "PROBE RESPONSE" : "BEACON"); return; } @@ -2446,7 +2448,7 @@ static inline void ieee80211_process_probe_response( return; if (ieee->bGlobalDomain) { - if (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_PROBE_RESP) + if (fc == IEEE80211_STYPE_PROBE_RESP) { // Case 1: Country code if(IS_COUNTRY_IE_VALID(ieee) ) @@ -2553,8 +2555,7 @@ static inline void ieee80211_process_probe_response( escape_essid(network.ssid, network.ssid_len), network.bssid, - WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == -IEEE80211_STYPE_PROBE_RESP ? +fc == IEEE80211_STYPE_PROBE_RESP ? "PROBE RESPONSE" : "BEACON"); #endif memcpy(target, &network, sizeof(*target)); @@ -2566,8 +2567,7 @@ static inline void ieee80211_process_probe_response( escape_essid(target->ssid,
Re: [PATCH v4 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates
On 02/20/2017 02:56 PM, Steve Longerbeam wrote: On 02/20/2017 02:04 PM, Sakari Ailus wrote: Hi Steve, On Wed, Feb 15, 2017 at 06:19:31PM -0800, Steve Longerbeam wrote: From: Russell King Setting and getting frame rates is part of the negotiation mechanism between subdevs. The lack of support means that a frame rate at the sensor can't be negotiated through the subdev path. Just wondering --- what do you need this for? Hi Sakari, i.MX does need the ability to negotiate the frame rates in the pipelines. The CSI has the ability to skip frames at the output, which is something Philipp added to the CSI subdev. That affects frame interval at the CSI output. But as Russell pointed out, the lack of [gs]_frame_interval op causes media-ctl to fail: media-ctl -v -d /dev/media1 --set-v4l2 '"imx6-mipi-csi2":1[fmt:SGBRG8/512x512@1/30]' Opening media device /dev/media1 Enumerating entities Found 29 entities Enumerating pads and links Setting up format SGBRG8 512x512 on pad imx6-mipi-csi2/1 Format set: SGBRG8 512x512 Setting up frame interval 1/30 on entity imx6-mipi-csi2 Unable to set frame interval: Inappropriate ioctl for device (-25)Unable to setup formats: Inappropriate ioctl for device (25) So i.MX needs to implement this op in every subdev in the pipeline, otherwise it's not possible to configure the pipeline with media-ctl. Hi Russell, But Sakari brings up a good point. The mipi csi-2 receiver doesn't have any control over frame rate, so why do you even need to give it this information via media-ctl? Steve ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates
On Tue, Feb 21, 2017 at 12:04:10AM +0200, Sakari Ailus wrote: > On Wed, Feb 15, 2017 at 06:19:31PM -0800, Steve Longerbeam wrote: > > From: Russell King > > > > Setting and getting frame rates is part of the negotiation mechanism > > between subdevs. The lack of support means that a frame rate at the > > sensor can't be negotiated through the subdev path. > > Just wondering --- what do you need this for? The v4l2 documentation contradicts the media-ctl implementation. While v4l2 documentation says: These ioctls are used to get and set the frame interval at specific subdev pads in the image pipeline. The frame interval only makes sense for sub-devices that can control the frame period on their own. This includes, for instance, image sensors and TV tuners. Sub-devices that don't support frame intervals must not implement these ioctls. However, when trying to configure the pipeline using media-ctl, eg: media-ctl -d /dev/media1 --set-v4l2 '"imx219 pixel 0-0010":0[crop:(0,0)/3264x2464]' media-ctl -d /dev/media1 --set-v4l2 '"imx219 0-0010":1[fmt:SRGGB10/3264x2464@1/30]' media-ctl -d /dev/media1 --set-v4l2 '"imx219 0-0010":0[fmt:SRGGB8/816x616@1/30]' media-ctl -d /dev/media1 --set-v4l2 '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616@1/30]' Unable to setup formats: Inappropriate ioctl for device (25) media-ctl -d /dev/media1 --set-v4l2 '"ipu1_csi0_mux":2[fmt:SRGGB8/816x616@1/30]' media-ctl -d /dev/media1 --set-v4l2 '"ipu1_csi0":2[fmt:SRGGB8/816x616@1/30]' The problem there is that the format setting for the csi2 does not get propagated forward: $ strace media-ctl -d /dev/media1 --set-v4l2 '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616@1/30]' ... open("/dev/v4l-subdev16", O_RDWR) = 3 ioctl(3, VIDIOC_SUBDEV_S_FMT, 0xbec16244) = 0 ioctl(3, VIDIOC_SUBDEV_S_FRAME_INTERVAL, 0xbec162a4) = -1 ENOTTY (Inappropriate ioctl for device) fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 2), ...}) = 0 write(1, "Unable to setup formats: Inappro"..., 61) = 61 Unable to setup formats: Inappropriate ioctl for device (25) close(3)= 0 exit_group(1) = ? +++ exited with 1 +++ because media-ctl exits as soon as it encouters the error while trying to set the frame rate. This makes implementing setup of the media pipeline in shell scripts unnecessarily difficult - as you need to then know whether an entity is likely not to support the VIDIOC_SUBDEV_S_FRAME_INTERVAL call, and either avoid specifying a frame rate: $ strace media-ctl -d /dev/media1 --set-v4l2 '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616]' ... open("/dev/v4l-subdev16", O_RDWR) = 3 ioctl(3, VIDIOC_SUBDEV_S_FMT, 0xbeb1a254) = 0 open("/dev/v4l-subdev0", O_RDWR)= 4 ioctl(4, VIDIOC_SUBDEV_S_FMT, 0xbeb1a254) = 0 close(4)= 0 close(3)= 0 exit_group(0) = ? +++ exited with 0 +++ or manually setting the format on the sink. Allowing the S_FRAME_INTERVAL call seems to me to be more in keeping with the negotiation mechanism that is implemented in subdevs, and IMHO should be implemented inside the kernel as a pad operation along with the format negotiation, especially so as frame skipping is defined as scaling, in just the same way as the frame size is also scaling: - ``MEDIA_ENT_F_PROC_VIDEO_SCALER`` - Video scaler. An entity capable of video scaling must have at least one sink pad and one source pad, and scale the video frame(s) received on its sink pad(s) to a different resolution output on its source pad(s). The range of supported scaling ratios is entity-specific and can differ between the horizontal and vertical directions (in particular scaling can be supported in one direction only). Binning and skipping are considered as scaling. Although, this is vague, as it doesn't define what it means by "skipping", whether that's skipping pixels (iow, sub-sampling) or whether that's frame skipping. Then there's the issue where, if you have this setup: camera --> csi2 receiver --> csi --> capture and the "csi" subdev can skip frames, you need to know (a) at the CSI sink pad what the frame rate is of the source (b) what the desired source pad frame rate is, so you can configure the frame skipping. So, does the csi subdev have to walk back through the media graph looking for the frame rate? Does the capture device have to walk back through the media graph looking for some subdev to tell it what the frame rate is - the capture device certainly can't go straight to the sensor to get an answer to that question, because that bypasses the effect of the CSI frame skipping (which will lower the frame rate.) IMHO, frame rate is just another format property, just like the resolution and data format itself, and v4l2 should be treating it no differently. In any case, the documentation vs media-ctl create something of a very obscure situ
Re: [PATCH v4 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates
On 02/20/2017 04:13 PM, Russell King - ARM Linux wrote: On Tue, Feb 21, 2017 at 12:04:10AM +0200, Sakari Ailus wrote: On Wed, Feb 15, 2017 at 06:19:31PM -0800, Steve Longerbeam wrote: From: Russell King Setting and getting frame rates is part of the negotiation mechanism between subdevs. The lack of support means that a frame rate at the sensor can't be negotiated through the subdev path. Just wondering --- what do you need this for? The v4l2 documentation contradicts the media-ctl implementation. While v4l2 documentation says: These ioctls are used to get and set the frame interval at specific subdev pads in the image pipeline. The frame interval only makes sense for sub-devices that can control the frame period on their own. This includes, for instance, image sensors and TV tuners. Sub-devices that don't support frame intervals must not implement these ioctls. However, when trying to configure the pipeline using media-ctl, eg: media-ctl -d /dev/media1 --set-v4l2 '"imx219 pixel 0-0010":0[crop:(0,0)/3264x2464]' media-ctl -d /dev/media1 --set-v4l2 '"imx219 0-0010":1[fmt:SRGGB10/3264x2464@1/30]' media-ctl -d /dev/media1 --set-v4l2 '"imx219 0-0010":0[fmt:SRGGB8/816x616@1/30]' media-ctl -d /dev/media1 --set-v4l2 '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616@1/30]' Unable to setup formats: Inappropriate ioctl for device (25) media-ctl -d /dev/media1 --set-v4l2 '"ipu1_csi0_mux":2[fmt:SRGGB8/816x616@1/30]' media-ctl -d /dev/media1 --set-v4l2 '"ipu1_csi0":2[fmt:SRGGB8/816x616@1/30]' The problem there is that the format setting for the csi2 does not get propagated forward: $ strace media-ctl -d /dev/media1 --set-v4l2 '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616@1/30]' ... open("/dev/v4l-subdev16", O_RDWR) = 3 ioctl(3, VIDIOC_SUBDEV_S_FMT, 0xbec16244) = 0 ioctl(3, VIDIOC_SUBDEV_S_FRAME_INTERVAL, 0xbec162a4) = -1 ENOTTY (Inappropriate ioctl for device) fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 2), ...}) = 0 write(1, "Unable to setup formats: Inappro"..., 61) = 61 Unable to setup formats: Inappropriate ioctl for device (25) close(3)= 0 exit_group(1) = ? +++ exited with 1 +++ because media-ctl exits as soon as it encouters the error while trying to set the frame rate. This makes implementing setup of the media pipeline in shell scripts unnecessarily difficult - as you need to then know whether an entity is likely not to support the VIDIOC_SUBDEV_S_FRAME_INTERVAL call, and either avoid specifying a frame rate: $ strace media-ctl -d /dev/media1 --set-v4l2 '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616]' ... open("/dev/v4l-subdev16", O_RDWR) = 3 ioctl(3, VIDIOC_SUBDEV_S_FMT, 0xbeb1a254) = 0 open("/dev/v4l-subdev0", O_RDWR)= 4 ioctl(4, VIDIOC_SUBDEV_S_FMT, 0xbeb1a254) = 0 close(4)= 0 close(3)= 0 exit_group(0) = ? +++ exited with 0 +++ or manually setting the format on the sink. Allowing the S_FRAME_INTERVAL call seems to me to be more in keeping with the negotiation mechanism that is implemented in subdevs, and IMHO should be implemented inside the kernel as a pad operation along with the format negotiation, especially so as frame skipping is defined as scaling, in just the same way as the frame size is also scaling: - ``MEDIA_ENT_F_PROC_VIDEO_SCALER`` - Video scaler. An entity capable of video scaling must have at least one sink pad and one source pad, and scale the video frame(s) received on its sink pad(s) to a different resolution output on its source pad(s). The range of supported scaling ratios is entity-specific and can differ between the horizontal and vertical directions (in particular scaling can be supported in one direction only). Binning and skipping are considered as scaling. Although, this is vague, as it doesn't define what it means by "skipping", whether that's skipping pixels (iow, sub-sampling) or whether that's frame skipping. Then there's the issue where, if you have this setup: camera --> csi2 receiver --> csi --> capture and the "csi" subdev can skip frames, you need to know (a) at the CSI sink pad what the frame rate is of the source (b) what the desired source pad frame rate is, so you can configure the frame skipping. So, does the csi subdev have to walk back through the media graph looking for the frame rate? Does the capture device have to walk back through the media graph looking for some subdev to tell it what the frame rate is - the capture device certainly can't go straight to the sensor to get an answer to that question, because that bypasses the effect of the CSI frame skipping (which will lower the frame rate.) IMHO, frame rate is just another format property, just like the resolution and data format itself, and v4l2 should be treating it no differently. I agree, frame rate, if indicated/specified
[PATCH] staging/ks7010: formatting updates.
Please pardon the earlier e-mail which was missing the changelog text. Wrapping complex macros with parentheses to remove checkpatch errors. Some additional style changes to appease checkpatch. --- drivers/staging/ks7010/ks_wlan_ioctl.h | 80 +- 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/drivers/staging/ks7010/ks_wlan_ioctl.h b/drivers/staging/ks7010/ks_wlan_ioctl.h index 84554b6..00eec18 100644 --- a/drivers/staging/ks7010/ks_wlan_ioctl.h +++ b/drivers/staging/ks7010/ks_wlan_ioctl.h @@ -1,6 +1,6 @@ /* * Driver for KeyStream 11b/g wireless LAN - * + * * Copyright (c) 2005-2008 KeyStream Corp. * Copyright (C) 2009 Renesas Technology Corp. * @@ -8,60 +8,62 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ - #ifndef _KS_WLAN_IOCTL_H #define _KS_WLAN_IOCTL_H #include -/* The low order bit identify a SET (0) or a GET (1) ioctl. */ +/* The low order bit identify a SET (0) or a GET (1) ioctl. */ -/* SIOCIWFIRSTPRIV+0 */ -/* former KS_WLAN_GET_DRIVER_VERSION SIOCIWFIRSTPRIV+1 */ -/* SIOCIWFIRSTPRIV+2 */ -#define KS_WLAN_GET_FIRM_VERSION SIOCIWFIRSTPRIV+3 +/* (SIOCIWFIRSTPRIV + 0) */ +/* Former KS_WLAN_GET_DRIVER_VERSION (SIOCIWFIRSTPRIV + 1) */ +/* (SIOCIWFIRSTPRIV + 2) */ +#define KS_WLAN_GET_FIRM_VERSION (SIOCIWFIRSTPRIV + 3) #ifdef WPS -#define KS_WLAN_SET_WPS_ENABLE SIOCIWFIRSTPRIV+4 -#define KS_WLAN_GET_WPS_ENABLE SIOCIWFIRSTPRIV+5 -#define KS_WLAN_SET_WPS_PROBE_REQ SIOCIWFIRSTPRIV+6 +#define KS_WLAN_SET_WPS_ENABLE (SIOCIWFIRSTPRIV + 4) +#define KS_WLAN_GET_WPS_ENABLE (SIOCIWFIRSTPRIV + 5) +#define KS_WLAN_SET_WPS_PROBE_REQ (SIOCIWFIRSTPRIV + 6) #endif -#define KS_WLAN_GET_EEPROM_CKSUM SIOCIWFIRSTPRIV+7 -#define KS_WLAN_SET_PREAMBLE SIOCIWFIRSTPRIV+8 -#define KS_WLAN_GET_PREAMBLE SIOCIWFIRSTPRIV+9 -#define KS_WLAN_SET_POWER_SAVE SIOCIWFIRSTPRIV+10 -#define KS_WLAN_GET_POWER_SAVE SIOCIWFIRSTPRIV+11 -#define KS_WLAN_SET_SCAN_TYPE SIOCIWFIRSTPRIV+12 -#define KS_WLAN_GET_SCAN_TYPE SIOCIWFIRSTPRIV+13 -#define KS_WLAN_SET_RX_GAINSIOCIWFIRSTPRIV+14 -#define KS_WLAN_GET_RX_GAINSIOCIWFIRSTPRIV+15 -#define KS_WLAN_HOSTT SIOCIWFIRSTPRIV+16 /* unused */ -//#define KS_WLAN_SET_REGIONSIOCIWFIRSTPRIV+17 -#define KS_WLAN_SET_BEACON_LOSTSIOCIWFIRSTPRIV+18 -#define KS_WLAN_GET_BEACON_LOSTSIOCIWFIRSTPRIV+19 +#define KS_WLAN_GET_EEPROM_CKSUM (SIOCIWFIRSTPRIV + 7) +#define KS_WLAN_SET_PREAMBLE (SIOCIWFIRSTPRIV + 8) +#define KS_WLAN_GET_PREAMBLE (SIOCIWFIRSTPRIV + 9) +#define KS_WLAN_SET_POWER_SAVE (SIOCIWFIRSTPRIV + 10) +#define KS_WLAN_GET_POWER_SAVE (SIOCIWFIRSTPRIV + 11) +#define KS_WLAN_SET_SCAN_TYPE (SIOCIWFIRSTPRIV + 12) +#define KS_WLAN_GET_SCAN_TYPE (SIOCIWFIRSTPRIV + 13) +#define KS_WLAN_SET_RX_GAIN(SIOCIWFIRSTPRIV + 14) +#define KS_WLAN_GET_RX_GAIN(SIOCIWFIRSTPRIV + 15) +#define KS_WLAN_HOSTT (SIOCIWFIRSTPRIV + 16) /* unused */ +/*#define KS_WLAN_SET_REGION(SIOCIWFIRSTPRIV + 17) */ +#define KS_WLAN_SET_BEACON_LOST(SIOCIWFIRSTPRIV + 18) +#define KS_WLAN_GET_BEACON_LOST(SIOCIWFIRSTPRIV + 19) -#define KS_WLAN_SET_TX_GAINSIOCIWFIRSTPRIV+20 -#define KS_WLAN_GET_TX_GAINSIOCIWFIRSTPRIV+21 +#define KS_WLAN_SET_TX_GAIN(SIOCIWFIRSTPRIV + 20) +#define KS_WLAN_GET_TX_GAIN(SIOCIWFIRSTPRIV + 21) -/* for KS7010 */ -#define KS_WLAN_SET_PHY_TYPE SIOCIWFIRSTPRIV+22 -#define KS_WLAN_GET_PHY_TYPE SIOCIWFIRSTPRIV+23 -#define KS_WLAN_SET_CTS_MODE SIOCIWFIRSTPRIV+24 -#define KS_WLAN_GET_CTS_MODE SIOCIWFIRSTPRIV+25 -/* SIOCIWFIRSTPRIV+26 */ -/* SIOCIWFIRSTPRIV+27 */ -#define KS_WLAN_SET_SLEEP_MODE SIOCIWFIRSTPRIV+28 /* sleep mode */ -#define KS_WLAN_GET_SLEEP_MODE SIOCIWFIRSTPRIV+29 /* sleep mode */ -/* SIOCIWFIRSTPRIV+30 */ -/* SIOCIWFIRSTPRIV+31 */ +/* For KS7010. */ +#define KS_WLAN_SET_PHY_TYPE (SIOCIWFIRSTPRIV + 22) +#define KS_WLAN_GET_PHY_TYPE (SIOCIWFIRSTPRIV + 23) +#define KS_WLAN_SET_CTS_MODE (SIOCIWFIRSTPRIV + 24) +#define KS_WLAN_GET_CTS_MODE (SIOCIWFIRSTPRIV + 25) +/* (SIOCIWFIRSTPRIV + 26) */ +/* (SIOCIWFIRSTPRIV + 27) */ +#define KS_WLAN_SET_SLEEP_MODE (SIOCIWFIRSTPRIV + 28) /* sleep mod
Re: [Linaro-mm-sig] [RFCv3][PATCH 3/5] arm64: Implement ARCH_HAS_FORCE_CACHE
Hi Laura, When we enable kernel v4.4 or newer version on our platform, we meet the issue of flushing cache without reference device. It seems that this patch set is a solution. I'm curious the progress of the discussion. Do you have any plan to fix it in v4.4 and newer kernel verison? On 2016/9/14 2:41, Laura Abbott wrote: > On 09/13/2016 08:14 AM, Will Deacon wrote: >> On Tue, Sep 13, 2016 at 08:02:20AM -0700, Laura Abbott wrote: >>> On 09/13/2016 02:19 AM, Will Deacon wrote: On Mon, Sep 12, 2016 at 02:32:56PM -0700, Laura Abbott wrote: > > arm64 may need to guarantee the caches are synced. Implement versions of > the kernel_force_cache API to allow this. > > Signed-off-by: Laura Abbott > --- > v3: Switch to calling cache operations directly instead of relying on > DMA mapping. > --- > arch/arm64/include/asm/cacheflush.h | 8 > arch/arm64/mm/cache.S | 24 > arch/arm64/mm/flush.c | 11 +++ > 3 files changed, 39 insertions(+), 4 deletions(-) I'm really hesitant to expose these cache routines as an API solely to support a driver sitting in staging/. I appreciate that there's a chicken and egg problem here, but we *really* don't want people using these routines in preference to the DMA API, and I fear that we'll simply grow a bunch more users of these things if we promote it as an API like you're proposing. Can the code not be contained under staging/, as part of ion? >>> >>> I proposed that in V1 and it was suggested I make it a proper API >>> >>> http://www.mail-archive.com/driverdev-devel@linuxdriverproject.org/msg47654.html >>> http://www.mail-archive.com/driverdev-devel@linuxdriverproject.org/msg47672.html >> >> :/ then I guess we're in disagreement. If ion really needs this stuff >> (which I don't fully grok), perhaps we should be exposing something at >> a higher level from the architecture, so it really can't be used for >> anything other than ion. > > I talked/complained about this at a past plumbers. The gist is that Ion > ends up acting as a fake DMA layer for clients. It doesn't match nicely > because clients can allocate both coherent and non-coherent memory. > Trying to use dma_map doesn't work because a) a device for coherency isn't > known at allocation time b) it kills performance. Part of the motivation > for taking this approach is to avoid the need to rework the existing > Android userspace and keep the existing behavior, as terrible as it > is. Having Ion out of staging and not actually usable isn't helpful. > > I'll give this all some more thought and hopefully have one or two more > proposals before Connect/Plumbers. > >> >> Will >> > > Thanks, > Laura > ___ > Linaro-mm-sig mailing list > linaro-mm-...@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/linaro-mm-sig ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel