Re: [PATCH V2 net-next] hv_netvsc: cleanup netdev feature flags for netvsc
From: Simon Xiao Date: Thu, 4 Feb 2016 15:49:34 -0800 > 1. Adding NETIF_F_TSO6 feature flag; > 2. Adding NETIF_F_HW_CSUM. NETIF_F_IPV6_CSUM and NETIF_F_IP_CSUM are > being deprecated; > 3. Cleanup the coding style of flag assignment by using macro. > > Signed-off-by: Simon Xiao > Reviewed-by: K. Y. Srinivasan > Reviewed-by: Haiyang Zhang Applied, thanks. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] rdma: amso1100: c2_provider: Use netdev_dbg()
On 02/06/2016 10:11 AM, Amitoj Kaur Chawla wrote: > Replace generic pr_debug() with netdev_dbg() for net devices. > > Found using Coccinelle. The semantic patch used to find this is as > follows: > > // > @@ > expression e; > identifier f,i; > position p; > @@ > > f(...,struct net_device *i,...) { > ... > - pr_debug@p(e); > + netdev_dbg(i, e); > ... > } > // > > Signed-off-by: Amitoj Kaur Chawla This driver has been removed entire as of 4.5-rc2, so this patch can no longer be applied. > --- > drivers/staging/rdma/amso1100/c2_provider.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/rdma/amso1100/c2_provider.c > b/drivers/staging/rdma/amso1100/c2_provider.c > index e44ad22..75a7de5 100644 > --- a/drivers/staging/rdma/amso1100/c2_provider.c > +++ b/drivers/staging/rdma/amso1100/c2_provider.c > @@ -659,7 +659,7 @@ static int c2_pseudo_up(struct net_device *netdev) > if (!ind) > return 0; > > - pr_debug("adding...\n"); > + netdev_dbg(netdev, "adding...\n"); > for_ifa(ind) { > #ifdef DEBUG > u8 *ip = (u8 *) & ifa->ifa_address; > @@ -684,7 +684,7 @@ static int c2_pseudo_down(struct net_device *netdev) > if (!ind) > return 0; > > - pr_debug("deleting...\n"); > + netdev_dbg(netdev, "deleting...\n"); > for_ifa(ind) { > #ifdef DEBUG > u8 *ip = (u8 *) & ifa->ifa_address; > -- Doug Ledford GPG KeyID: 0E572FDD signature.asc Description: OpenPGP digital signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] rtlwifi: rtl8821ae: Silence useless log output
When driver rtl8821ae is loaded but not connected to any AP, it logs a "firmware not ready to run" message roughly once a minute. To eliminate logging this massage under normal debug conditions, the degug level needed to print this message is increased. Signed-off-by: Larry Finger --- Kalle, This patch is intended for kernel 4.6. Signed-off-by: Larry Finger --- drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c index 525eb23..a4fc70e 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c @@ -271,7 +271,7 @@ int rtl8821ae_download_fw(struct ieee80211_hw *hw, bool buse_wake_on_wlan_fw) err = _rtl8821ae_fw_free_to_go(hw); if (err) { - RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, + RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG, "Firmware is not ready to run!\n"); } else { RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/4] rtlwifi: rtl8192de: Convert driver to use common 5G channels
This driver defines its owh copy of the 5G channels. Change it to use the common definitions. Signed-off-by: Larry Finger --- Kalle, This material is for kernel 4.6. Larry .../net/wireless/realtek/rtlwifi/rtl8192de/phy.c | 23 -- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c index bb06fe8..7810fe8 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c @@ -924,19 +924,11 @@ static void _rtl92d_ccxpower_index_check(struct ieee80211_hw *hw, static u8 _rtl92c_phy_get_rightchnlplace(u8 chnl) { - u8 channel_5g[59] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, - 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, - 114, 116, 118, 120, 122, 124, 126, 128, - 130, 132, 134, 136, 138, 140, 149, 151, - 153, 155, 157, 159, 161, 163, 165 - }; u8 place = chnl; if (chnl > 14) { - for (place = 14; place < sizeof(channel_5g); place++) { - if (channel_5g[place] == chnl) { + for (place = 14; place < sizeof(channel5g); place++) { + if (channel5g[place] == chnl) { place++; break; } @@ -2471,16 +2463,9 @@ static bool _rtl92d_is_legal_5g_channel(struct ieee80211_hw *hw, u8 channel) { int i; - u8 channel_5g[45] = { - 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, - 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, - 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, - 134, 136, 138, 140, 149, 151, 153, 155, 157, 159, - 161, 163, 165 - }; - for (i = 0; i < sizeof(channel_5g); i++) - if (channel == channel_5g[i]) + for (i = 0; i < sizeof(channel5g); i++) + if (channel == channel5g[i]) return true; return false; } -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] rtlwifi: rtl8821ae: Convert driver to use common 5G channel table
There are several copies of the 5G channel tables in this driver. These are removed so that the tables in the core will be used. This change also removes a useless message of "Channel 163 in Group not found". The number of possible 5G channels was reduced from 54 to a better value of 49 during the conversion. Signed-off-by: Larry Finger --- Kalle, This material is for kernel 4.6. Larry .../net/wireless/realtek/rtlwifi/rtl8821ae/hw.c| 18 --- .../net/wireless/realtek/rtlwifi/rtl8821ae/phy.c | 27 +- drivers/net/wireless/realtek/rtlwifi/wifi.h| 2 +- 3 files changed, 7 insertions(+), 40 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c index bbb789f..5da9bd0 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c @@ -2786,14 +2786,6 @@ static void _rtl8812ae_read_txpower_info_from_hwpg(struct ieee80211_hw *hw, struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); struct txpower_info_2g pwrinfo24g; struct txpower_info_5g pwrinfo5g; - u8 channel5g[CHANNEL_MAX_NUMBER_5G] = { - 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, - 56, 58, 60, 62, 64, 100, 102, 104, 106, - 108, 110, 112, 114, 116, 118, 120, 122, - 124, 126, 128, 130, 132, 134, 136, 138, - 140, 142, 144, 149, 151, 153, 155, 157, - 159, 161, 163, 165, 167, 168, 169, 171, 173, 175, 177}; - u8 channel5g_80m[CHANNEL_MAX_NUMBER_5G_80M] = {42, 58, 106, 122, 138, 155, 171}; u8 rf_path, index; u8 i; @@ -2872,16 +2864,6 @@ static void _rtl8821ae_read_txpower_info_from_hwpg(struct ieee80211_hw *hw, struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); struct txpower_info_2g pwrinfo24g; struct txpower_info_5g pwrinfo5g; - u8 channel5g[CHANNEL_MAX_NUMBER_5G] = { - 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, - 56, 58, 60, 62, 64, 100, 102, 104, 106, - 108, 110, 112, 114, 116, 118, 120, 122, - 124, 126, 128, 130, 132, 134, 136, 138, - 140, 142, 144, 149, 151, 153, 155, 157, - 159, 161, 163, 165, 167, 168, 169, 171, - 173, 175, 177}; - u8 channel5g_80m[CHANNEL_MAX_NUMBER_5G_80M] = { - 42, 58, 106, 122, 138, 155, 171}; u8 rf_path, index; u8 i; diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c index 9b4d8a6..74165b3 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c @@ -1472,18 +1472,13 @@ static char _rtl8812ae_phy_get_chnl_idx_of_txpwr_lmt(struct ieee80211_hw *hw, { struct rtl_priv *rtlpriv = rtl_priv(hw); char channel_index = -1; - u8 channel_5g[CHANNEL_MAX_NUMBER_5G] = { - 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, - 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, - 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 149, - 151, 153, 155, 157, 159, 161, 163, 165, 167, 168, 169, 171, - 173, 175, 177}; u8 i = 0; + if (band == BAND_ON_2_4G) channel_index = channel - 1; else if (band == BAND_ON_5G) { - for (i = 0; i < sizeof(channel_5g)/sizeof(u8); ++i) { - if (channel_5g[i] == channel) + for (i = 0; i < sizeof(channel5g)/sizeof(u8); ++i) { + if (channel5g[i] == channel) channel_index = i; } } else @@ -2240,13 +2235,6 @@ void rtl8821ae_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel) static bool _rtl8821ae_phy_get_chnl_index(u8 channel, u8 *chnl_index) { - u8 channel_5g[CHANNEL_MAX_NUMBER_5G] = { - 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, - 64, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, - 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, - 142, 144, 149, 151, 153, 155, 157, 159, 161, 163, 165, - 167, 168, 169, 171, 173, 175, 177 - }; u8 i = 0; bool in_24g = true; @@ -2257,7 +2245,7 @@ static bool _rtl8821ae_phy_get_chnl_index(u8 channel, u8 *chnl_index) in_24g = false; for (i = 0; i < CHANNEL_MAX_NUMBER_5G; ++i) { - if (channel_5g[i] == channel) { + if (channel5g[i] == channel) { *chnl_index = i; return in_24g; } @@ -2728,13 +2716,10 @@ static u8 _rtl8821ae_get_txpower_index(struct ieee80211_hw *hw, u8 path,
[PATCH 1/4] rtlwifi: Prepare for reworking 5G channels
There are 3 drivers in this family that have 5G radios. Each of them defines local copies of the available channels. This patch adds the two arrays to the core driver. Signed-off-by: Larry Finger --- Kalle, This material is for kernel 4.6. Larry drivers/net/wireless/realtek/rtlwifi/core.c | 16 drivers/net/wireless/realtek/rtlwifi/wifi.h | 9 - 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c index 4ae421e..02eba0e 100644 --- a/drivers/net/wireless/realtek/rtlwifi/core.c +++ b/drivers/net/wireless/realtek/rtlwifi/core.c @@ -35,6 +35,22 @@ #include #include +u8 channel5g[CHANNEL_MAX_NUMBER_5G] = { + 36, 38, 40, 42, 44, 46, 48, /* Band 1 */ + 52, 54, 56, 58, 60, 62, 64, /* Band 2 */ + 100, 102, 104, 106, 108, 110, 112, /* Band 3 */ + 116, 118, 120, 122, 124, 126, 128, /* Band 3 */ + 132, 134, 136, 138, 140, 142, 144, /* Band 3 */ + 149, 151, 153, 155, 157, 159, 161, /* Band 4 */ + 165, 167, 169, 171, 173, 175, 177 /* Band 4 */ +}; +EXPORT_SYMBOL(channel5g); + +u8 channel5g_80m[CHANNEL_MAX_NUMBER_5G_80M] = { + 42, 58, 106, 122, 138, 155, 171 +}; +EXPORT_SYMBOL(channel5g_80m); + void rtl_addr_delay(u32 addr) { if (addr == 0xfe) diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h index 4544752..e603819 100644 --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h @@ -122,11 +122,6 @@ */ #define CHANNEL_MAX_NUMBER_5G_80M 7 #define CHANNEL_GROUP_MAX (3 + 9) /* ch1~3, 4~9, 10~14 = three groups */ -#define CHANNEL_MAX_NUMBER_5G 54 /* Please refer to - *"phy_GetChnlGroup8812A" and - * "Hal_ReadTxPowerInfo8812A" - */ -#define CHANNEL_MAX_NUMBER_5G_80M 7 #define MAX_PG_GROUP 13 #defineCHANNEL_GROUP_MAX_2G3 #defineCHANNEL_GROUP_IDX_5GL 3 @@ -2904,6 +2899,10 @@ value to host byte ordering.*/ #defineSTBC_VHT_TEST_TX_ENABLE BIT(2) #defineSTBC_VHT_CAP_TX BIT(3) +extern u8 channel5g[CHANNEL_MAX_NUMBER_5G]; + +extern u8 channel5g_80m[CHANNEL_MAX_NUMBER_5G_80M]; + static inline u8 rtl_read_byte(struct rtl_priv *rtlpriv, u32 addr) { return rtlpriv->io.read8_sync(rtlpriv, addr); -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/4] rtlwifi: Rework 5G channel arrays
Several of the rtlwifi drivers have separate definitions of the 5D channel arrays. This patch set replaces 5 separate instances with a single one in the common header. These patches also eliminate spurious messages "rtl8821ae:_rtl8821ae_get_chnl_group(): 5G, Channel 163 in Group not found" from rtl8821ae. This material is for kernel 4.6. Signed-off-by: Larry Finger Larry Finger (4): rtlwifi: Prepare for reworking 5G channels rtlwifi: rtl8192de: Convert driver to use common 5G channels rtlwifi: rtl8192ee: Convert driver to use new 5G channel tables rtlwifi: rtl8821ae: Convert driver to use common 5G channel table drivers/net/wireless/realtek/rtlwifi/core.c| 16 + .../net/wireless/realtek/rtlwifi/rtl8192de/phy.c | 23 -- .../net/wireless/realtek/rtlwifi/rtl8192ee/hw.c| 12 -- .../net/wireless/realtek/rtlwifi/rtl8821ae/hw.c| 18 --- .../net/wireless/realtek/rtlwifi/rtl8821ae/phy.c | 27 +- drivers/net/wireless/realtek/rtlwifi/wifi.h| 11 - 6 files changed, 31 insertions(+), 76 deletions(-) -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/4] rtlwifi: rtl8192ee: Convert driver to use new 5G channel tables
The driver defines its own set of channel tables for the 5G band. With this change, it will use those of the core. Signed-off-by: Larry Finger --- Kalle, This material is for kernel 4.6. Larry drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c | 12 1 file changed, 12 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c index 5f14308..9fd3f1b 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c @@ -2018,18 +2018,6 @@ static void _rtl92ee_read_txpower_info_from_hwpg(struct ieee80211_hw *hw, struct rtl_efuse *efu = rtl_efuse(rtl_priv(hw)); struct txpower_info_2g pwr2g; struct txpower_info_5g pwr5g; - u8 channel5g[CHANNEL_MAX_NUMBER_5G] = { - 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, - 56, 58, 60, 62, 64, 100, 102, 104, 106, - 108, 110, 112, 114, 116, 118, 120, 122, - 124, 126, 128, 130, 132, 134, 136, 138, - 140, 142, 144, 149, 151, 153, 155, 157, - 159, 161, 163, 165, 167, 168, 169, 171, - 173, 175, 177 - }; - u8 channel5g_80m[CHANNEL_MAX_NUMBER_5G_80M] = { - 42, 58, 106, 122, 138, 155, 171 - }; u8 rf, idx; u8 i; -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] staging: rtl8188eu: add release_firmware() between request_firmware and function error exit
Small memory leak fixed. Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/hal/fw.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 55c17df..656133c 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -175,14 +175,17 @@ int rtl88eu_download_fw(struct adapter *adapt) if (fw->size > FW_8188E_SIZE) { dev_err(device, "Firmware size exceed 0x%X. Check it.\n", FW_8188E_SIZE); + release_firmware(fw); return -1; } trailing_zeros_length = (4 - fw->size % 4) % 4; fw_data = kmalloc(fw->size + trailing_zeros_length, GFP_KERNEL); - if (!fw_data) + if (!fw_data) { + release_firmware(fw); return -ENOMEM; + } memcpy(fw_data, fw->data, fw->size); memset(fw_data + fw->size, 0, trailing_zeros_length); -- 2.4.10 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] staging: rtl8188eu: remove pfirmware and fwsize of the hal_data_8188e structure
The pfirmware is used only in rtl88eu_download_fw function (except the kfree(rtlhal->pfirmware) in netdev_close). The fwsize not used after initialization at all. The pfirmvare replaced by fw_data and fwsize removed. Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/hal/fw.c | 20 +--- drivers/staging/rtl8188eu/include/rtl8188e_hal.h | 2 -- drivers/staging/rtl8188eu/os_dep/os_intfs.c | 4 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 25cecae..55c17df 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -158,13 +158,12 @@ exit: int rtl88eu_download_fw(struct adapter *adapt) { - struct hal_data_8188e *rtlhal = GET_HAL_DATA(adapt); struct dvobj_priv *dvobj = adapter_to_dvobj(adapt); struct device *device = dvobj_to_dev(dvobj); const struct firmware *fw; const char fw_name[] = "rtlwifi/rtl8188eufw.bin"; struct rtl92c_firmware_header *pfwheader = NULL; - u8 *download_data; + u8 *download_data, *fw_data; size_t download_size; unsigned int trailing_zeros_length; @@ -181,22 +180,20 @@ int rtl88eu_download_fw(struct adapter *adapt) trailing_zeros_length = (4 - fw->size % 4) % 4; - rtlhal->fwsize = fw->size; - rtlhal->pfirmware = kmalloc(fw->size + trailing_zeros_length, - GFP_KERNEL); - if (!rtlhal->pfirmware) + fw_data = kmalloc(fw->size + trailing_zeros_length, GFP_KERNEL); + if (!fw_data) return -ENOMEM; - memcpy(rtlhal->pfirmware, fw->data, fw->size); - memset(rtlhal->pfirmware + fw->size, 0, trailing_zeros_length); + memcpy(fw_data, fw->data, fw->size); + memset(fw_data + fw->size, 0, trailing_zeros_length); - pfwheader = (struct rtl92c_firmware_header *)rtlhal->pfirmware; + pfwheader = (struct rtl92c_firmware_header *)fw_data; if (IS_FW_HEADER_EXIST(pfwheader)) { - download_data = rtlhal->pfirmware + 32; + download_data = fw_data + 32; download_size = fw->size + trailing_zeros_length - 32; } else { - download_data = rtlhal->pfirmware; + download_data = fw_data; download_size = fw->size + trailing_zeros_length; } @@ -211,5 +208,6 @@ int rtl88eu_download_fw(struct adapter *adapt) _rtl88e_write_fw(adapt, download_data, download_size); _rtl88e_enable_fw_download(adapt, false); + kfree(fw_data); return _rtl88e_fw_free_to_go(adapt); } diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h index cbad364..9f5050e 100644 --- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h @@ -191,8 +191,6 @@ struct txpowerinfo24g { struct hal_data_8188e { struct HAL_VERSION VersionID; u16 CustomerID; - u8 *pfirmware; - u32 fwsize; u16 FirmwareVersion; u16 FirmwareVersionRev; u16 FirmwareSubVersion; diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c b/drivers/staging/rtl8188eu/os_dep/os_intfs.c index 3b25acf..7986e67 100644 --- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c +++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c @@ -1155,7 +1155,6 @@ int pm_netdev_open(struct net_device *pnetdev, u8 bnormal) static int netdev_close(struct net_device *pnetdev) { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); - struct hal_data_8188e *rtlhal = GET_HAL_DATA(padapter); RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+88eu_drv - drv_close\n")); @@ -1188,9 +1187,6 @@ static int netdev_close(struct net_device *pnetdev) rtw_led_control(padapter, LED_CTL_POWER_OFF); } - kfree(rtlhal->pfirmware); - rtlhal->pfirmware = NULL; - RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-88eu_drv - drv_close\n")); DBG_88E("-88eu_drv - drv_close, bup =%d\n", padapter->bup); return 0; -- 2.4.10 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/3] staging: rtl8188eu: remove _rtl88e_fill_dummy
The _rtl88e_fill_dummy function replaced by memset in rtl88eu_download_fw. More appropriate names are used for pfwdata and fwsize variables (download_data and download_size respectively). Also u32 replaced by size_t for download_size variable. Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/hal/fw.c | 45 +- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 4d72537..25cecae 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -75,16 +75,6 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, usb_write8(adapt, write_address, byte_buffer[i]); } -static void _rtl88e_fill_dummy(u8 *pfwbuf, u32 *pfwlen) -{ - u32 i; - - for (i = *pfwlen; i < roundup(*pfwlen, 4); i++) - pfwbuf[i] = 0; - - *pfwlen = i; -} - static void _rtl88e_fw_page_write(struct adapter *adapt, u32 page, const u8 *buffer, u32 size) { @@ -103,8 +93,6 @@ static void _rtl88e_write_fw(struct adapter *adapt, u8 *buffer, u32 size) u32 page_no, remain; u32 page, offset; - _rtl88e_fill_dummy(buf_ptr, &size); - page_no = size / FW_8192C_PAGE_SIZE; remain = size % FW_8192C_PAGE_SIZE; @@ -176,8 +164,9 @@ int rtl88eu_download_fw(struct adapter *adapt) const struct firmware *fw; const char fw_name[] = "rtlwifi/rtl8188eufw.bin"; struct rtl92c_firmware_header *pfwheader = NULL; - u8 *pfwdata; - u32 fwsize; + u8 *download_data; + size_t download_size; + unsigned int trailing_zeros_length; if (request_firmware(&fw, fw_name, device)) { dev_err(device, "Firmware %s not available\n", fw_name); @@ -186,34 +175,40 @@ int rtl88eu_download_fw(struct adapter *adapt) if (fw->size > FW_8188E_SIZE) { dev_err(device, "Firmware size exceed 0x%X. Check it.\n", -FW_8188E_SIZE); + FW_8188E_SIZE); return -1; } - pfwdata = kzalloc(FW_8188E_SIZE, GFP_KERNEL); - if (!pfwdata) + trailing_zeros_length = (4 - fw->size % 4) % 4; + + rtlhal->fwsize = fw->size; + rtlhal->pfirmware = kmalloc(fw->size + trailing_zeros_length, + GFP_KERNEL); + if (!rtlhal->pfirmware) return -ENOMEM; - rtlhal->pfirmware = pfwdata; memcpy(rtlhal->pfirmware, fw->data, fw->size); - rtlhal->fwsize = fw->size; - release_firmware(fw); + memset(rtlhal->pfirmware + fw->size, 0, trailing_zeros_length); - fwsize = rtlhal->fwsize; - pfwheader = (struct rtl92c_firmware_header *)pfwdata; + pfwheader = (struct rtl92c_firmware_header *)rtlhal->pfirmware; if (IS_FW_HEADER_EXIST(pfwheader)) { - pfwdata = pfwdata + 32; - fwsize = fwsize - 32; + download_data = rtlhal->pfirmware + 32; + download_size = fw->size + trailing_zeros_length - 32; + } else { + download_data = rtlhal->pfirmware; + download_size = fw->size + trailing_zeros_length; } + release_firmware(fw); + if (usb_read8(adapt, REG_MCUFWDL) & RAM_DL_SEL) { usb_write8(adapt, REG_MCUFWDL, 0); rtl88e_firmware_selfreset(adapt); } _rtl88e_enable_fw_download(adapt, true); usb_write8(adapt, REG_MCUFWDL, usb_read8(adapt, REG_MCUFWDL) | FWDL_ChkSum_rpt); - _rtl88e_write_fw(adapt, pfwdata, fwsize); + _rtl88e_write_fw(adapt, download_data, download_size); _rtl88e_enable_fw_download(adapt, false); return _rtl88e_fw_free_to_go(adapt); -- 2.4.10 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: wilc1000: spelling corrections
This patch fixes spelling warnings generated by checkpatch.pl Signed-off-by: Roger H. Newell --- drivers/staging/wilc1000/host_interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index c42286a..5570707 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -543,7 +543,7 @@ static s32 handle_cfg_param(struct wilc_vif *vif, wid_list[wid_cnt].size = sizeof(char); hif_drv->cfg_values.power_mgmt_mode = (u8)cfg_param_attr->cfg_attr_info.power_mgmt_mode; } else { - PRINT_ER("Invalide power mode\n"); + PRINT_ER("Invalid power mode\n"); result = -EINVAL; goto ERRORHANDLER; } @@ -881,7 +881,7 @@ static s32 Handle_Scan(struct wilc_vif *vif, wilc_get_vif_idx(vif)); if (result) - PRINT_ER("Failed to send scan paramters config packet\n"); + PRINT_ER("Failed to send scan parameters config packet\n"); ERRORHANDLER: if (result) { @@ -2081,7 +2081,7 @@ static s32 Handle_GetStatistics(struct wilc_vif *vif, wilc_get_vif_idx(vif)); if (result) - PRINT_ER("Failed to send scan paramters config packet\n"); + PRINT_ER("Failed to send scan parameters config packet\n"); if (pstrStatistics->link_speed > TCP_ACK_FILTER_LINK_SPEED_THRESH && pstrStatistics->link_speed != DEFAULT_LINK_SPEED) -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: octeon: refactor rgmii 10 mbps preamble error checking
Refactor RGMII 10 Mbps preamble error checking. The current implementation does not work correctly in phydev mode since only the link status changes trigger the callback, and if we stay on 10 Mbps operation the periodic checks for error counters are never done. Provide a periodic worker also during the phydev operation, and notify the link status changes through the phydev instead of the inband status change interrupt. This also has the benefit that we don't need to use legacy CVMX MDIO calls to check the PHY state, and we can avoid races that trigger bogus "Using 10Mbps with software preamble removal" logs when interfaces are being bringed up. It also avoids some corner-case crashes when the in-band interrupt triggers while the interface is being taken down. Tested on EdgeRouter Lite & D-Link DSR-1000N. Signed-off-by: Aaro Koskinen --- drivers/staging/octeon/ethernet-mdio.c | 17 +- drivers/staging/octeon/ethernet-rgmii.c | 287 --- drivers/staging/octeon/ethernet.c| 4 +- drivers/staging/octeon/octeon-ethernet.h | 4 +- 4 files changed, 87 insertions(+), 225 deletions(-) diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c index fd9b3d8..55abd83 100644 --- a/drivers/staging/octeon/ethernet-mdio.c +++ b/drivers/staging/octeon/ethernet-mdio.c @@ -118,13 +118,20 @@ void cvm_oct_adjust_link(struct net_device *dev) struct octeon_ethernet *priv = netdev_priv(dev); cvmx_helper_link_info_t link_info; + link_info.u64 = 0; + link_info.s.link_up = priv->phydev->link ? 1 : 0; + link_info.s.full_duplex = priv->phydev->duplex ? 1 : 0; + link_info.s.speed = priv->phydev->speed; + priv->link_info = link_info.u64; + + /* +* The polling task need to know about link status changes. +*/ + if (priv->poll) + priv->poll(dev); + if (priv->last_link != priv->phydev->link) { priv->last_link = priv->phydev->link; - link_info.u64 = 0; - link_info.s.link_up = priv->last_link ? 1 : 0; - link_info.s.full_duplex = priv->phydev->duplex ? 1 : 0; - link_info.s.speed = priv->phydev->speed; - cvmx_helper_link_set(priv->port, link_info); cvm_oct_note_carrier(priv, link_info); } diff --git a/drivers/staging/octeon/ethernet-rgmii.c b/drivers/staging/octeon/ethernet-rgmii.c index 9353796..91b148c 100644 --- a/drivers/staging/octeon/ethernet-rgmii.c +++ b/drivers/staging/octeon/ethernet-rgmii.c @@ -30,8 +30,6 @@ static DEFINE_SPINLOCK(global_register_lock); -static int number_rgmii_ports; - static void cvm_oct_set_hw_preamble(struct octeon_ethernet *priv, bool enable) { union cvmx_gmxx_rxx_frm_ctl gmxx_rxx_frm_ctl; @@ -63,247 +61,106 @@ static void cvm_oct_set_hw_preamble(struct octeon_ethernet *priv, bool enable) gmxx_rxx_int_reg.u64); } -static void cvm_oct_rgmii_poll(struct net_device *dev) +static void cvm_oct_check_preamble_errors(struct net_device *dev) { struct octeon_ethernet *priv = netdev_priv(dev); - unsigned long flags = 0; cvmx_helper_link_info_t link_info; - int use_global_register_lock = (priv->phydev == NULL); + unsigned long flags; + + link_info.u64 = priv->link_info; - BUG_ON(in_interrupt()); - if (use_global_register_lock) { + /* +* Take the global register lock since we are going to +* touch registers that affect more than one port. +*/ + spin_lock_irqsave(&global_register_lock, flags); + + if (link_info.s.speed == 10 && priv->last_speed == 10) { /* -* Take the global register lock since we are going to -* touch registers that affect more than one port. +* Read the GMXX_RXX_INT_REG[PCTERR] bit and see if we are +* getting preamble errors. */ - spin_lock_irqsave(&global_register_lock, flags); - } else { - mutex_lock(&priv->phydev->mdio.bus->mdio_lock); - } + int interface = INTERFACE(priv->port); + int index = INDEX(priv->port); + union cvmx_gmxx_rxx_int_reg gmxx_rxx_int_reg; - link_info = cvmx_helper_link_get(priv->port); - if (link_info.u64 == priv->link_info) { - if (link_info.s.speed == 10) { + gmxx_rxx_int_reg.u64 = cvmx_read_csr(CVMX_GMXX_RXX_INT_REG + (index, interface)); + if (gmxx_rxx_int_reg.s.pcterr) { /* -* Read the GMXX_RXX_INT_REG[PCTERR] bit and -* see if we are getting preamble errors. +* We are getting preamble errors at 10Mbps. Most +* likely the P
[PATCH] rtl8188eu: fix signal strength indication
RTL8188E can only have a maximum of 2 chains so match that in the actual phy_rx_agc_info structure within phy_status_rpt. This will cause the other data received from the PHY, such as signal strength indication of beacons, to properly align and allow extraction and use within the signal strength record-keeping mechanisms. Signed-off-by: Andrew Bradford --- drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h | 2 +- drivers/staging/rtl8188eu/include/odm_HWConfig.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h b/drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h index e058162..b8833fa 100644 --- a/drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h +++ b/drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h @@ -75,7 +75,7 @@ enum rf_radio_path { #define MAX_PG_GROUP 13 -#defineRF_PATH_MAX 3 +#defineRF_PATH_MAX 2 #defineMAX_RF_PATH RF_PATH_MAX #defineMAX_TX_COUNT4 /* path numbers */ diff --git a/drivers/staging/rtl8188eu/include/odm_HWConfig.h b/drivers/staging/rtl8188eu/include/odm_HWConfig.h index 62a0049..ef792bf 100644 --- a/drivers/staging/rtl8188eu/include/odm_HWConfig.h +++ b/drivers/staging/rtl8188eu/include/odm_HWConfig.h @@ -69,7 +69,7 @@ struct phy_rx_agc_info { }; struct phy_status_rpt { - struct phy_rx_agc_info path_agc[3]; + struct phy_rx_agc_info path_agc[RF_PATH_MAX]; u8 ch_corr[2]; u8 cck_sig_qual_ofdm_pwdb_all; u8 cck_agc_rpt_ofdm_cfosho_a; -- 2.7.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] Staging: fix coding style in rtl8188eu/core
On Wed, Feb 10, 2016 at 10:09:28PM +0100, Colin Vidal wrote: > Set constant operand on right of test, and refactor the code in a more > compact and readable way. Please don't do two different things in the same patch, break this up into different patches. thanks, gregk -h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 1/8] Staging: rts5208: rtsx_transport.c: Cleanup comments
This patch fixes all multiline comments to conform to the coding style, which states that multiline comments should start with "/*" and end with "*/" on a separate line. Also cleans up some comments to make them more clear and/or reflect what the code is doing. Signed-off-by: Shaun Ren --- Changes since v3 * Removed the extraneous SCSI comment in the first patch in rtsx_stor_access_xfer_buf() Changes since v2 * Cleaned up comments as per Joshua Clayton's suggestions drivers/staging/rts5208/rtsx_transport.c | 53 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c index f2eb18e..91fdccf 100644 --- a/drivers/staging/rts5208/rtsx_transport.c +++ b/drivers/staging/rts5208/rtsx_transport.c @@ -1,4 +1,5 @@ -/* Driver for Realtek PCI-Express card reader +/* + * Driver for Realtek PCI-Express card reader * * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved. * @@ -30,13 +31,15 @@ * Scatter-gather transfer buffer access routines ***/ -/* Copy a buffer of length buflen to/from the srb's transfer buffer. +/* + * Copy a buffer of length buflen to/from the srb's transfer buffer. * (Note: for scatter-gather transfers (srb->use_sg > 0), srb->request_buffer * points to a list of s-g entries and we ignore srb->request_bufflen. * For non-scatter-gather transfers, srb->request_buffer points to the * transfer buffer itself and srb->request_bufflen is the buffer's length.) * Update the *index and *offset variables so that the next copy will - * pick up from where this one left off. */ + * pick up from where this one left off. + */ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer, unsigned int buflen, struct scsi_cmnd *srb, unsigned int *index, @@ -44,8 +47,7 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer, { unsigned int cnt; - /* If not using scatter-gather, just transfer the data directly. -* Make certain it will fit in the available buffer space. */ + /* If not using scatter-gather, just transfer the data directly. */ if (scsi_sg_count(srb) == 0) { if (*offset >= scsi_bufflen(srb)) return 0; @@ -58,22 +60,22 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer, *offset, cnt); *offset += cnt; - /* Using scatter-gather. We have to go through the list one entry + /* +* Using scatter-gather. We have to go through the list one entry * at a time. Each s-g entry contains some number of pages, and -* each page has to be kmap()'ed separately. If the page is already -* in kernel-addressable memory then kmap() will return its address. -* If the page is not directly accessible -- such as a user buffer -* located in high memory -- then kmap() will map it to a temporary -* position in the kernel's virtual address space. */ +* each page has to be kmap()'ed separately. +*/ } else { struct scatterlist *sg = (struct scatterlist *) scsi_sglist(srb) + *index; - /* This loop handles a single s-g list entry, which may + /* +* This loop handles a single s-g list entry, which may * include multiple pages. Find the initial page structure * and the starting offset within the page, and update -* the *offset and *index values for the next loop. */ +* the *offset and *index values for the next loop. +*/ cnt = 0; while (cnt < buflen && *index < scsi_sg_count(srb)) { struct page *page = sg_page(sg) + @@ -95,9 +97,6 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer, ++sg; } - /* Transfer the data for all the pages in this -* s-g entry. For each page: call kmap(), do the -* transfer, and call kunmap() immediately after. */ while (sglen > 0) { unsigned int plen = min(sglen, (unsigned int) PAGE_SIZE - poff); @@ -122,8 +121,10 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer, return cnt; } -/* Store the contents of buffer into srb's transfer buffer and set the -* SCSI residue. */ +/* + * Store the contents of buffer into srb's transfer buffer and set the + * SCSI residue. + */ void rtsx_stor_set_xfer_buf(unsigned char *buffer, unsigned int buflen, struct scsi_cmnd *srb) { @@ -151,7 +152,8 @@ vo
[PATCH v4 0/8] Staging: rts5208: Fix coding style
This set of patches fixes the coding style issues in rtsx_transport.c. Changes since v3 * Removed the extraneous SCSI comment in the first patch * Removed the last patch (Staging: rts5208: Add missing dma_mapping_error) as it is already done in change 9a66d05d82db (Staging: rts5208: fix check for dma mapping error) Changes since v2 * Incorporated Joshua Clayton's suggestions regarding the block comments Shaun Ren (8): Staging: rts5208: rtsx_transport.c: Cleanup comments Staging: rts5208: rtsx_transport.c: Align to open parenthesis Staging: rts5208: rtsx_transport.c: Remove spaces after casts Staging: rts5208: rtsx_transport.c: Add spaces around - Staging: rts5208: rtsx_transport.c: Remove extra newlines Staging: rts5208: rtsx_transport.c: Fix label naming convention Staging: rts5208: rtsx_transport.c: Remove unnecessary parentheses Staging: rts5208: rtsx_transport.c: Fix comparisons to NULL drivers/staging/rts5208/rtsx_transport.c | 152 --- 1 file changed, 81 insertions(+), 71 deletions(-) -- 2.7.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 3/8] Staging: rts5208: rtsx_transport.c: Remove spaces after casts
This patch removes all spaces after casts in rtsx_transport.c, as reported by checkpatch.pl: CHECK: No space is necessary after a cast Signed-off-by: Shaun Ren --- drivers/staging/rts5208/rtsx_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c index 1a4da89..1a6018a 100644 --- a/drivers/staging/rts5208/rtsx_transport.c +++ b/drivers/staging/rts5208/rtsx_transport.c @@ -72,7 +72,7 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer, */ } else { struct scatterlist *sg = - (struct scatterlist *) scsi_sglist(srb) + (struct scatterlist *)scsi_sglist(srb) + *index; /* -- 2.7.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 4/8] Staging: rts5208: rtsx_transport.c: Add spaces around -
This patch fixes the following styling issue in rtsx_transport.c as reported by checkpatch.pl: CHECK: spaces preferred around that '-' (ctx:VxV) Signed-off-by: Shaun Ren --- drivers/staging/rts5208/rtsx_transport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c index 1a6018a..d8c8436 100644 --- a/drivers/staging/rts5208/rtsx_transport.c +++ b/drivers/staging/rts5208/rtsx_transport.c @@ -85,8 +85,8 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer, while (cnt < buflen && *index < scsi_sg_count(srb)) { struct page *page = sg_page(sg) + ((sg->offset + *offset) >> PAGE_SHIFT); - unsigned int poff = - (sg->offset + *offset) & (PAGE_SIZE-1); + unsigned int poff = (sg->offset + *offset) & + (PAGE_SIZE - 1); unsigned int sglen = sg->length - *offset; if (sglen > buflen - cnt) { -- 2.7.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 2/8] Staging: rts5208: rtsx_transport.c: Align to open parenthesis
This patch fixes the alignment issue reported by checkpatch.pl: CHECK: Alignment should match open parenthesis Add a unsigned char *sgbuffer in rtsx_stor_access_xfer_buffer to make the following memcpy logic easier to read. Add a struct scatterlist *sg in the use_sg branch of rtsx_transfer_data_partial to make the parameters of the rtsx_transfer_sglist_adma_partial call fit in 80 character lines after aligning them to the open parenthesis. Refactor memcpy logic in rtsx_stor_access_xfer_buf to make it more legible. Signed-off-by: Shaun Ren --- Changes since v3 * Fixed misalignment of the last parameter of rtsx_stor_access_xfer_buf() * Refactored memcpy in rtsx_stor_access_xfer_buf() for legibility drivers/staging/rts5208/rtsx_transport.c | 68 +++- 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c index 91fdccf..1a4da89 100644 --- a/drivers/staging/rts5208/rtsx_transport.c +++ b/drivers/staging/rts5208/rtsx_transport.c @@ -42,8 +42,11 @@ */ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer, - unsigned int buflen, struct scsi_cmnd *srb, unsigned int *index, - unsigned int *offset, enum xfer_buf_dir dir) + unsigned int buflen, + struct scsi_cmnd *srb, + unsigned int *index, + unsigned int *offset, + enum xfer_buf_dir dir) { unsigned int cnt; @@ -52,12 +55,14 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer, if (*offset >= scsi_bufflen(srb)) return 0; cnt = min(buflen, scsi_bufflen(srb) - *offset); + + unsigned char *sgbuffer = (unsigned char *)scsi_sglist(srb) + + *offset; + if (dir == TO_XFER_BUF) - memcpy((unsigned char *) scsi_sglist(srb) + *offset, - buffer, cnt); + memcpy(sgbuffer, buffer, cnt); else - memcpy(buffer, (unsigned char *) scsi_sglist(srb) + - *offset, cnt); + memcpy(buffer, sgbuffer, cnt); *offset += cnt; /* @@ -126,7 +131,7 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer, * SCSI residue. */ void rtsx_stor_set_xfer_buf(unsigned char *buffer, - unsigned int buflen, struct scsi_cmnd *srb) + unsigned int buflen, struct scsi_cmnd *srb) { unsigned int index = 0, offset = 0; @@ -137,7 +142,7 @@ void rtsx_stor_set_xfer_buf(unsigned char *buffer, } void rtsx_stor_get_xfer_buf(unsigned char *buffer, - unsigned int buflen, struct scsi_cmnd *srb) + unsigned int buflen, struct scsi_cmnd *srb) { unsigned int index = 0, offset = 0; @@ -191,8 +196,8 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip) /* set the result so the higher layers expect this data */ srb->result = SAM_STAT_CHECK_CONDITION; memcpy(srb->sense_buffer, - (unsigned char *)&(chip->sense_buffer[SCSI_LUN(srb)]), - sizeof(struct sense_data_t)); + (unsigned char *)&(chip->sense_buffer[SCSI_LUN(srb)]), + sizeof(struct sense_data_t)); } return; @@ -202,7 +207,7 @@ Handle_Errors: } void rtsx_add_cmd(struct rtsx_chip *chip, - u8 cmd_type, u16 reg_addr, u8 mask, u8 data) + u8 cmd_type, u16 reg_addr, u8 mask, u8 data) { u32 *cb = (u32 *)(chip->host_cmds_ptr); u32 val = 0; @@ -321,9 +326,11 @@ static inline void rtsx_add_sg_tbl( } static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, - struct scatterlist *sg, int num_sg, unsigned int *index, - unsigned int *offset, int size, - enum dma_data_direction dma_dir, int timeout) +struct scatterlist *sg, int num_sg, +unsigned int *index, +unsigned int *offset, int size, +enum dma_data_direction dma_dir, +int timeout) { struct rtsx_dev *rtsx = chip->rtsx; struct completion trans_done; @@ -486,8 +493,9 @@ out: } static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card, - struct scatterlist *sg, int num_sg, - enum dma_data_direction dma_dir, int timeout) +struct scatterlist *sg, int num_sg, +
[PATCH v4 6/8] Staging: rts5208: rtsx_transport.c: Fix label naming convention
This patch fixes the following naming convention issue in rtsx_transport.c, as reported by checkpatch.pl: CHECK: Avoid CamelCase: Signed-off-by: Shaun Ren --- drivers/staging/rts5208/rtsx_transport.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c index 1ce9b9d..0d332f5 100644 --- a/drivers/staging/rts5208/rtsx_transport.c +++ b/drivers/staging/rts5208/rtsx_transport.c @@ -172,14 +172,14 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip) if (rtsx_chk_stat(chip, RTSX_STAT_ABORT)) { dev_dbg(rtsx_dev(chip), "-- command was aborted\n"); srb->result = DID_ABORT << 16; - goto Handle_Errors; + goto handle_errors; } /* if there is a transport error, reset and don't auto-sense */ if (result == TRANSPORT_ERROR) { dev_dbg(rtsx_dev(chip), "-- transport indicates error, resetting\n"); srb->result = DID_ERROR << 16; - goto Handle_Errors; + goto handle_errors; } srb->result = SAM_STAT_GOOD; @@ -199,7 +199,7 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip) return; -Handle_Errors: +handle_errors: return; } -- 2.7.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 7/8] Staging: rts5208: rtsx_transport.c: Remove unnecessary parentheses
This patch removes all unnecessary parentheses found by checkpatch.pl. Signed-off-by: Shaun Ren --- Changes since v3 * Fixed patch conflicts due to commit 9a66d05d82db ("Staging: rts5208: fix check for dma mapping error"), and commit b3232842dbef ("Staging: rts5208: remove unnecessary parantheses") drivers/staging/rts5208/rtsx_transport.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c index 0d332f5..be3423a 100644 --- a/drivers/staging/rts5208/rtsx_transport.c +++ b/drivers/staging/rts5208/rtsx_transport.c @@ -193,7 +193,7 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip) /* set the result so the higher layers expect this data */ srb->result = SAM_STAT_CHECK_CONDITION; memcpy(srb->sense_buffer, - (unsigned char *)&(chip->sense_buffer[SCSI_LUN(srb)]), + (unsigned char *)&chip->sense_buffer[SCSI_LUN(srb)], sizeof(struct sense_data_t)); } @@ -367,7 +367,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, spin_unlock_irq(&rtsx->reg_lock); - sg_cnt = dma_map_sg(&(rtsx->pci->dev), sg, num_sg, dma_dir); + sg_cnt = dma_map_sg(&rtsx->pci->dev, sg, num_sg, dma_dir); resid = size; sg_ptr = sg; @@ -481,7 +481,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, out: rtsx->done = NULL; rtsx->trans_state = STATE_TRANS_NONE; - dma_unmap_sg(&(rtsx->pci->dev), sg, num_sg, dma_dir); + dma_unmap_sg(&rtsx->pci->dev, sg, num_sg, dma_dir); if (err < 0) rtsx_stop_cmd(chip, card); @@ -531,7 +531,7 @@ static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card, spin_unlock_irq(&rtsx->reg_lock); - buf_cnt = dma_map_sg(&(rtsx->pci->dev), sg, num_sg, dma_dir); + buf_cnt = dma_map_sg(&rtsx->pci->dev, sg, num_sg, dma_dir); sg_ptr = sg; @@ -629,7 +629,7 @@ static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card, out: rtsx->done = NULL; rtsx->trans_state = STATE_TRANS_NONE; - dma_unmap_sg(&(rtsx->pci->dev), sg, num_sg, dma_dir); + dma_unmap_sg(&rtsx->pci->dev, sg, num_sg, dma_dir); if (err < 0) rtsx_stop_cmd(chip, card); @@ -713,7 +713,7 @@ static int rtsx_transfer_buf(struct rtsx_chip *chip, u8 card, void *buf, out: rtsx->done = NULL; rtsx->trans_state = STATE_TRANS_NONE; - dma_unmap_single(&(rtsx->pci->dev), addr, len, dma_dir); + dma_unmap_single(&rtsx->pci->dev, addr, len, dma_dir); if (err < 0) rtsx_stop_cmd(chip, card); -- 2.7.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 8/8] Staging: rts5208: rtsx_transport.c: Fix comparisons to NULL
This patch changes all comparsions to NULL with !..., as reported by checkpatch.pl. Signed-off-by: Shaun Ren --- drivers/staging/rts5208/rtsx_transport.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c index be3423a..73e50ec 100644 --- a/drivers/staging/rts5208/rtsx_transport.c +++ b/drivers/staging/rts5208/rtsx_transport.c @@ -338,7 +338,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, struct scatterlist *sg_ptr; u32 val = TRIG_DMA; - if ((sg == NULL) || (num_sg <= 0) || !offset || !index) + if (!sg || (num_sg <= 0) || !offset || !index) return -EIO; if (dma_dir == DMA_TO_DEVICE) @@ -502,7 +502,7 @@ static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card, long timeleft; struct scatterlist *sg_ptr; - if ((sg == NULL) || (num_sg <= 0)) + if (!sg || (num_sg <= 0)) return -EIO; if (dma_dir == DMA_TO_DEVICE) @@ -649,7 +649,7 @@ static int rtsx_transfer_buf(struct rtsx_chip *chip, u8 card, void *buf, u32 val = 1 << 31; long timeleft; - if ((buf == NULL) || (len <= 0)) + if (!buf || (len <= 0)) return -EIO; if (dma_dir == DMA_TO_DEVICE) -- 2.7.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 5/8] Staging: rts5208: rtsx_transport.c: Remove extra newlines
This patch fixes the following issues in rtsx_transport.c as reported by checkpatch.pl: CHECK: Blank lines aren't necessary after an open brace '{' CHECK: Please don't use multiple blank lines Signed-off-by: Shaun Ren --- drivers/staging/rts5208/rtsx_transport.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c index d8c8436..1ce9b9d 100644 --- a/drivers/staging/rts5208/rtsx_transport.c +++ b/drivers/staging/rts5208/rtsx_transport.c @@ -90,12 +90,10 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer, unsigned int sglen = sg->length - *offset; if (sglen > buflen - cnt) { - /* Transfer ends within this s-g entry */ sglen = buflen - cnt; *offset += sglen; } else { - /* Transfer continues to next s-g entry */ *offset = 0; ++*index; @@ -152,7 +150,6 @@ void rtsx_stor_get_xfer_buf(unsigned char *buffer, scsi_set_resid(srb, scsi_bufflen(srb) - buflen); } - /*** * Transport routines ***/ -- 2.7.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 2/8] Staging: rts5208: rtsx_transport.c: Align to open parenthesis
Hi Shaun, [auto build test WARNING on staging/staging-testing] [also build test WARNING on v4.5-rc3 next-20160211] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Shaun-Ren/Staging-rts5208-Fix-coding-style/20160212-122003 config: xtensa-allyesconfig (attached as .config) 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=xtensa All warnings (new ones prefixed by >>): drivers/staging/rts5208/rtsx_transport.c: In function 'rtsx_stor_access_xfer_buf': >> drivers/staging/rts5208/rtsx_transport.c:59:3: warning: ISO C90 forbids >> mixed declarations and code [-Wdeclaration-after-statement] unsigned char *sgbuffer = (unsigned char *)scsi_sglist(srb) + ^ vim +59 drivers/staging/rts5208/rtsx_transport.c 43 44 unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer, 45 unsigned int buflen, 46 struct scsi_cmnd *srb, 47 unsigned int *index, 48 unsigned int *offset, 49 enum xfer_buf_dir dir) 50 { 51 unsigned int cnt; 52 53 /* If not using scatter-gather, just transfer the data directly. */ 54 if (scsi_sg_count(srb) == 0) { 55 if (*offset >= scsi_bufflen(srb)) 56 return 0; 57 cnt = min(buflen, scsi_bufflen(srb) - *offset); 58 > 59 unsigned char *sgbuffer = (unsigned char *)scsi_sglist(srb) + 60 *offset; 61 62 if (dir == TO_XFER_BUF) 63 memcpy(sgbuffer, buffer, cnt); 64 else 65 memcpy(buffer, sgbuffer, cnt); 66 *offset += cnt; 67 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4 2/8] Staging: rts5208: rtsx_transport.c: Align to open parenthesis
On Thu, 2016-02-11 at 20:07 -0800, Shaun Ren wrote: > This patch fixes the alignment issue reported by checkpatch.pl: > > CHECK: Alignment should match open parenthesis [] > diff --git a/drivers/staging/rts5208/rtsx_transport.c > b/drivers/staging/rts5208/rtsx_transport.c [] > @@ -52,12 +55,14 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char > *buffer, > if (*offset >= scsi_bufflen(srb)) > return 0; > cnt = min(buflen, scsi_bufflen(srb) - *offset); > + > + unsigned char *sgbuffer = (unsigned char *)scsi_sglist(srb) + > + *offset; Please don't declare variables in the middle of functions. Variable declarations are only done at the beginning of functions. > + > if (dir == TO_XFER_BUF) > - memcpy((unsigned char *) scsi_sglist(srb) + *offset, > - buffer, cnt); > + memcpy(sgbuffer, buffer, cnt); > else > - memcpy(buffer, (unsigned char *) scsi_sglist(srb) + > - *offset, cnt); > + memcpy(buffer, sgbuffer, cnt); > *offset += cnt; ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 2/8] Staging: rts5208: rtsx_transport.c: Align to open parenthesis
This patch fixes the alignment issue reported by checkpatch.pl: CHECK: Alignment should match open parenthesis Add a unsigned char *sgbuffer in rtsx_stor_access_xfer_buffer to make the following memcpy logic easier to read. Add a struct scatterlist *sg in the use_sg branch of rtsx_transfer_data_partial to make the parameters of the rtsx_transfer_sglist_adma_partial call fit in 80 character lines after aligning them to the open parenthesis. Refactor memcpy logic in rtsx_stor_access_xfer_buf to make it more legible. Signed-off-by: Shaun Ren --- drivers/staging/rts5208/rtsx_transport.c | 69 +++- Changes since v3 * Fixed misalignment of the last parameter of rtsx_stor_access_xfer_buf() * Refactored memcpy in rtsx_stor_access_xfer_buf() for legibility 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c index 91fdccf..b6de93f 100644 --- a/drivers/staging/rts5208/rtsx_transport.c +++ b/drivers/staging/rts5208/rtsx_transport.c @@ -42,22 +42,28 @@ */ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer, - unsigned int buflen, struct scsi_cmnd *srb, unsigned int *index, - unsigned int *offset, enum xfer_buf_dir dir) + unsigned int buflen, + struct scsi_cmnd *srb, + unsigned int *index, + unsigned int *offset, + enum xfer_buf_dir dir) { unsigned int cnt; /* If not using scatter-gather, just transfer the data directly. */ if (scsi_sg_count(srb) == 0) { + unsigned char *sgbuffer; + if (*offset >= scsi_bufflen(srb)) return 0; cnt = min(buflen, scsi_bufflen(srb) - *offset); + + sgbuffer = (unsigned char *)scsi_sglist(srb) + *offset; + if (dir == TO_XFER_BUF) - memcpy((unsigned char *) scsi_sglist(srb) + *offset, - buffer, cnt); + memcpy(sgbuffer, buffer, cnt); else - memcpy(buffer, (unsigned char *) scsi_sglist(srb) + - *offset, cnt); + memcpy(buffer, sgbuffer, cnt); *offset += cnt; /* @@ -126,7 +132,7 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer, * SCSI residue. */ void rtsx_stor_set_xfer_buf(unsigned char *buffer, - unsigned int buflen, struct scsi_cmnd *srb) + unsigned int buflen, struct scsi_cmnd *srb) { unsigned int index = 0, offset = 0; @@ -137,7 +143,7 @@ void rtsx_stor_set_xfer_buf(unsigned char *buffer, } void rtsx_stor_get_xfer_buf(unsigned char *buffer, - unsigned int buflen, struct scsi_cmnd *srb) + unsigned int buflen, struct scsi_cmnd *srb) { unsigned int index = 0, offset = 0; @@ -191,8 +197,8 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip) /* set the result so the higher layers expect this data */ srb->result = SAM_STAT_CHECK_CONDITION; memcpy(srb->sense_buffer, - (unsigned char *)&(chip->sense_buffer[SCSI_LUN(srb)]), - sizeof(struct sense_data_t)); + (unsigned char *)&(chip->sense_buffer[SCSI_LUN(srb)]), + sizeof(struct sense_data_t)); } return; @@ -202,7 +208,7 @@ Handle_Errors: } void rtsx_add_cmd(struct rtsx_chip *chip, - u8 cmd_type, u16 reg_addr, u8 mask, u8 data) + u8 cmd_type, u16 reg_addr, u8 mask, u8 data) { u32 *cb = (u32 *)(chip->host_cmds_ptr); u32 val = 0; @@ -321,9 +327,11 @@ static inline void rtsx_add_sg_tbl( } static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, - struct scatterlist *sg, int num_sg, unsigned int *index, - unsigned int *offset, int size, - enum dma_data_direction dma_dir, int timeout) +struct scatterlist *sg, int num_sg, +unsigned int *index, +unsigned int *offset, int size, +enum dma_data_direction dma_dir, +int timeout) { struct rtsx_dev *rtsx = chip->rtsx; struct completion trans_done; @@ -486,8 +494,9 @@ out: } static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card, - struct scatterlist *sg, int num_sg, - enum dma_data_direction dma_dir, int timeout) +struct scatterlist *sg,
re: Staging: fbtft: add ssd1325 controller support
Hello Alexey Mednyy, The patch 12e2a34165d5: "Staging: fbtft: add ssd1325 controller support" from Jan 27, 2016, leads to the following static checker warning: drivers/staging/fbtft/fb_ssd1325.c:100 blank() warn: passing __func__ while the format string already contains the name of the function 'blank' drivers/staging/fbtft/fb_ssd1325.c 98 static int blank(struct fbtft_par *par, bool on) 99 { 100 fbtft_par_dbg(DEBUG_BLANK, par, "%s(blank=%s)\n", 101__func__, on ? "true" : "false"); blank(blank=true) is sort of duplicative, yes. 102 103 if (on) 104 write_reg(par, 0xAE); 105 else 106 write_reg(par, 0xAF); 107 return 0; 108 } regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel