[PATCH 05/11] staging: rtl8723bs: core: Remove function enable_rate_adaptive()

2019-06-12 Thread Nishka Dasgupta
Remove function enable_rate_adaptive as all it does is call
Update_RA_Entry.
Modify the single callsite of enable_rate_adaptive to call
Update_RA_Entry directly instead.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index d7103f73e281..93f4ea0ac433 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1615,16 +1615,10 @@ void Update_RA_Entry(struct adapter *padapter, struct 
sta_info *psta)
rtw_hal_update_ra_mask(psta, 0);
 }
 
-void enable_rate_adaptive(struct adapter *padapter, struct sta_info *psta);
-void enable_rate_adaptive(struct adapter *padapter, struct sta_info *psta)
-{
-   Update_RA_Entry(padapter, psta);
-}
-
 void set_sta_rate(struct adapter *padapter, struct sta_info *psta)
 {
/* rate adaptive */
-   enable_rate_adaptive(padapter, psta);
+   Update_RA_Entry(padapter, psta);
 }
 
 unsigned char check_assoc_AP(u8 *pframe, uint len)
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] binder: fix possible UAF when freeing buffer

2019-06-12 Thread Greg KH
On Wed, Jun 12, 2019 at 01:29:27PM -0700, Todd Kjos wrote:
> There is a race between the binder driver cleaning
> up a completed transaction via binder_free_transaction()
> and a user calling binder_ioctl(BC_FREE_BUFFER) to
> release a buffer. It doesn't matter which is first but
> they need to be protected against running concurrently
> which can result in a UAF.
> 
> Signed-off-by: Todd Kjos 
> ---
>  drivers/android/binder.c | 16 ++--
>  1 file changed, 14 insertions(+), 2 deletions(-)

Does this also need to go to the stable kernels?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 03/11] staging: rtl8723bs: core: Remove eeprom_write16()

2019-06-12 Thread Nishka Dasgupta
Remove unused function eeprom_write16.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8723bs/core/rtw_eeprom.c | 62 -
 1 file changed, 62 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_eeprom.c 
b/drivers/staging/rtl8723bs/core/rtw_eeprom.c
index 8594848e9a56..a707c2534a65 100644
--- a/drivers/staging/rtl8723bs/core/rtw_eeprom.c
+++ b/drivers/staging/rtl8723bs/core/rtw_eeprom.c
@@ -166,68 +166,6 @@ _func_enter_;
 _func_exit_;
 }
 
-void eeprom_write16(_adapter *padapter, u16 reg, u16 data)
-{
-   u8 x;
-
-_func_enter_;
-
-   x = rtw_read8(padapter, EE_9346CR);
-
-   x &= ~(_EEDI | _EEDO | _EESK | _EEM0);
-   x |= _EEM1 | _EECS;
-   rtw_write8(padapter, EE_9346CR, x);
-
-   shift_out_bits(padapter, EEPROM_EWEN_OPCODE, 5);
-
-   if (padapter->EepromAddressSize == 8)   /*CF+ and SDIO*/
-   shift_out_bits(padapter, 0, 6);
-   else
/*USB*/
-   shift_out_bits(padapter, 0, 4);
-
-   standby(padapter);
-
-/* Commented out by rcnjko, 2004.0
-*   Erase this particular word.  Write the erase opcode and register
-*   number in that order. The opcode is 3bits in length; reg is 6 bits 
long.
-*  shift_out_bits(Adapter, EEPROM_ERASE_OPCODE, 3);
-*  shift_out_bits(Adapter, reg, Adapter->EepromAddressSize);
-*
-*  if (wait_eeprom_cmd_done(Adapter ) == false)
-*  {
-*  return;
-*  }
-*/
-
-   standby(padapter);
-
-   /* write the new word to the EEPROM*/
-
-   /* send the write opcode the EEPORM*/
-   shift_out_bits(padapter, EEPROM_WRITE_OPCODE, 3);
-
-   /* select which word in the EEPROM that we are writing to.*/
-   shift_out_bits(padapter, reg, padapter->EepromAddressSize);
-
-   /* write the data to the selected EEPROM word.*/
-   shift_out_bits(padapter, data, 16);
-
-   if (wait_eeprom_cmd_done(padapter) == false) {
-
-   goto exit;
-   }
-
-   standby(padapter);
-
-   shift_out_bits(padapter, EEPROM_EWDS_OPCODE, 5);
-   shift_out_bits(padapter, reg, 4);
-
-   eeprom_clean(padapter);
-exit:
-_func_exit_;
-   return;
-}
-
 u16 eeprom_read16(_adapter *padapter, u16 reg) /*ReadEEprom*/
 {
 
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 11/11] staging: rtl8723bs: Remove rtw_btcoex_Initialize()

2019-06-12 Thread Nishka Dasgupta
Remove function rtw_btcoex_Initialize as the only thing it does is call
hal_btcoex_Initialize.
Modify call sites accordingly.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8723bs/core/rtw_btcoex.c| 6 --
 drivers/staging/rtl8723bs/include/rtw_btcoex.h | 1 -
 drivers/staging/rtl8723bs/os_dep/sdio_intf.c   | 3 ++-
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_btcoex.c 
b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
index 8944db15863d..1f3f8cbb3d66 100644
--- a/drivers/staging/rtl8723bs/core/rtw_btcoex.c
+++ b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
@@ -9,12 +9,6 @@
 #include 
 #include 
 
-
-void rtw_btcoex_Initialize(struct adapter *padapter)
-{
-   hal_btcoex_Initialize(padapter);
-}
-
 void rtw_btcoex_PowerOnSetting(struct adapter *padapter)
 {
hal_btcoex_PowerOnSetting(padapter);
diff --git a/drivers/staging/rtl8723bs/include/rtw_btcoex.h 
b/drivers/staging/rtl8723bs/include/rtw_btcoex.h
index 53f49c6b2fcd..03877d854c03 100644
--- a/drivers/staging/rtl8723bs/include/rtw_btcoex.h
+++ b/drivers/staging/rtl8723bs/include/rtw_btcoex.h
@@ -15,7 +15,6 @@
 #definePACKET_ARP  2
 #definePACKET_EAPOL3
 
-void rtw_btcoex_Initialize(struct adapter *);
 void rtw_btcoex_PowerOnSetting(struct adapter *padapter);
 void rtw_btcoex_HAL_Initialize(struct adapter *padapter, u8 bWifiOnly);
 void rtw_btcoex_IpsNotify(struct adapter *, u8 type);
diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c 
b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index 16245e2ab89b..101a22ff5d13 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -8,6 +8,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #ifndef dev_to_sdio_func
@@ -378,7 +379,7 @@ static struct adapter *rtw_sdio_if1_init(struct dvobj_priv 
*dvobj, const struct
 
rtw_hal_chip_configure(padapter);
 
-   rtw_btcoex_Initialize(padapter);
+   hal_btcoex_Initialize(padapter);
 
/* 3 6. read efuse/eeprom data */
rtw_hal_read_chip_info(padapter);
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 04/11] staging: rtl8723bs: core: Replace function Set_MSR()

2019-06-12 Thread Nishka Dasgupta
Remove function Set_NETYPE0_MSR as it only has one line and it is only
called by one other function, Set_MSR.
Replace contents of Set_MSR with the contents of Set_NETYPE0_MSR as
Set_MSR does nothing except call Set_NETYPE0_MSR.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c  | 2 +-
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 7 +--
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 5f0b20038a28..1f09e668c672 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -6036,7 +6036,7 @@ u8 setopmode_hdl(struct adapter *padapter, u8 *pbuf)
}
 
rtw_hal_set_hwreg(padapter, HW_VAR_SET_OPMODE, (u8 *)());
-   /* Set_NETYPE0_MSR(padapter, type); */
+   /* Set_MSR(padapter, type); */
 
 
 #ifdef CONFIG_AUTO_AP_MODE
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index a131d5cd46df..d7103f73e281 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -302,14 +302,9 @@ void Switch_DM_Func(struct adapter *padapter, u32 mode, u8 
enable)
rtw_hal_set_hwreg(padapter, HW_VAR_DM_FUNC_CLR, (u8 *)());
 }
 
-static void Set_NETYPE0_MSR(struct adapter *padapter, u8 type)
-{
-   rtw_hal_set_hwreg(padapter, HW_VAR_MEDIA_STATUS, (u8 *)());
-}
-
 void Set_MSR(struct adapter *padapter, u8 type)
 {
-   Set_NETYPE0_MSR(padapter, type);
+   rtw_hal_set_hwreg(padapter, HW_VAR_MEDIA_STATUS, (u8 *)());
 }
 
 inline u8 rtw_get_oper_ch(struct adapter *adapter)
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 02/11] staging: rtl8723bs: core: Remove function read_eeprom_content()

2019-06-12 Thread Nishka Dasgupta
Remove unused function read_eeprom_content.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8723bs/core/rtw_eeprom.c | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_eeprom.c 
b/drivers/staging/rtl8723bs/core/rtw_eeprom.c
index 433d5d255e77..8594848e9a56 100644
--- a/drivers/staging/rtl8723bs/core/rtw_eeprom.c
+++ b/drivers/staging/rtl8723bs/core/rtw_eeprom.c
@@ -301,14 +301,3 @@ _func_enter_;
 _func_exit_;
return true;
 }
-
-
-
-void read_eeprom_content(_adapter *padapter)
-{
-
-_func_enter_;
-
-
-_func_exit_;
-}
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 10/11] staging: rtl8723bs: hal: Replace function _InitQueuePriority()

2019-06-12 Thread Nishka Dasgupta
Remove function _InitQueuePriority as all it does it call
_InitNormalChipQueuePriority.
Rename _InitNormalChipQueuePriority to _InitQueuePriority for
compatibility with call site.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8723bs/hal/sdio_halinit.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c 
b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
index 55d21aa52e62..0676e4febf33 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
@@ -397,7 +397,7 @@ static void _InitNormalChipThreeOutEpPriority(struct 
adapter *padapter)
_InitNormalChipRegPriority(padapter, beQ, bkQ, viQ, voQ, mgtQ, hiQ);
 }
 
-static void _InitNormalChipQueuePriority(struct adapter *Adapter)
+static void _InitQueuePriority(struct adapter *Adapter)
 {
struct hal_com_data *pHalData = GET_HAL_DATA(Adapter);
 
@@ -419,11 +419,6 @@ static void _InitNormalChipQueuePriority(struct adapter 
*Adapter)
 
 }
 
-static void _InitQueuePriority(struct adapter *padapter)
-{
-   _InitNormalChipQueuePriority(padapter);
-}
-
 static void _InitPageBoundary(struct adapter *padapter)
 {
/*  RX Page Boundary */
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 08/11] staging: rtl8723bs: Remove function rtw_set_scan_deny_timer_hdl()

2019-06-12 Thread Nishka Dasgupta
Remove function rtw_set_scan_deny_timer_hdl as all it does is call
rtw_clear_scan_deny.
Modify call sites of rtw_set_scan_deny_timer_hdl to call
rtw_clear_scan_deny instead.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c | 5 -
 drivers/staging/rtl8723bs/include/rtw_mlme.h  | 1 -
 drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 2 +-
 3 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index b42d94a3a28c..63b381ed4a17 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1930,11 +1930,6 @@ inline void rtw_clear_scan_deny(struct adapter *adapter)
DBG_871X(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(adapter));
 }
 
-void rtw_set_scan_deny_timer_hdl(struct adapter *adapter)
-{
-   rtw_clear_scan_deny(adapter);
-}
-
 void rtw_set_scan_deny(struct adapter *adapter, u32 ms)
 {
struct mlme_priv *mlmepriv = >mlmepriv;
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h 
b/drivers/staging/rtl8723bs/include/rtw_mlme.h
index 9c9aa9254288..d3c07d1c36e9 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h
@@ -589,7 +589,6 @@ extern void rtw_scan_timeout_handler(struct timer_list *t);
 extern void rtw_dynamic_check_timer_handler(struct adapter *adapter);
 bool rtw_is_scan_deny(struct adapter *adapter);
 void rtw_clear_scan_deny(struct adapter *adapter);
-void rtw_set_scan_deny_timer_hdl(struct adapter *adapter);
 void rtw_set_scan_deny(struct adapter *adapter, u32 ms);
 
 void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv);
diff --git a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c 
b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c
index da4bd5292b0a..aa2499f10611 100644
--- a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c
@@ -26,7 +26,7 @@ static void _rtw_set_scan_deny_timer_hdl(struct timer_list *t)
struct adapter *adapter =
from_timer(adapter, t, mlmepriv.set_scan_deny_timer);
 
-   rtw_set_scan_deny_timer_hdl(adapter);
+   rtw_clear_scan_deny(adapter);
 }
 
 void rtw_init_mlme_timer(struct adapter *padapter)
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 06/11] staging: rtl8723bs: core: Remove wrapper functions

2019-06-12 Thread Nishka Dasgupta
Remove function power_saving_wk_hdl as all it does is call
rtw_ps_processor. Edit call sites accordingly.
Remove function reset_securitypriv_hdl as all it does is call
rtw_reset_securitypriv. Modify call sites accordingly.
Remove function free_assoc_resources_hdl as all it does is call
rtw_free_assoc_resources with one extra constant argument, and the
former is only called once.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 22 +++---
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c 
b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index fcd26e1c95d5..988e909a5124 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1660,22 +1660,6 @@ u8 rtw_dm_ra_mask_wk_cmd(struct adapter *padapter, u8 
*psta)
 
 }
 
-static void power_saving_wk_hdl(struct adapter *padapter)
-{
-rtw_ps_processor(padapter);
-}
-
-/* add for CONFIG_IEEE80211W, none 11w can use it */
-static void reset_securitypriv_hdl(struct adapter *padapter)
-{
-rtw_reset_securitypriv(padapter);
-}
-
-static void free_assoc_resources_hdl(struct adapter *padapter)
-{
-rtw_free_assoc_resources(padapter, 1);
-}
-
 u8 rtw_ps_cmd(struct adapter *padapter)
 {
struct cmd_obj  *ppscmd;
@@ -1977,7 +1961,7 @@ u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, 
unsigned char *pbuf)
dynamic_chk_wk_hdl(padapter);
break;
case POWER_SAVING_CTRL_WK_CID:
-   power_saving_wk_hdl(padapter);
+   rtw_ps_processor(padapter);
break;
case LPS_CTRL_WK_CID:
lps_ctrl_wk_hdl(padapter, (u8)pdrvextra_cmd->type);
@@ -1993,10 +1977,10 @@ u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, 
unsigned char *pbuf)
break;
/* add for CONFIG_IEEE80211W, none 11w can use it */
case RESET_SECURITYPRIV:
-   reset_securitypriv_hdl(padapter);
+   rtw_reset_securitypriv(padapter);
break;
case FREE_ASSOC_RESOURCES:
-   free_assoc_resources_hdl(padapter);
+   rtw_free_assoc_resources(padapter, 1);
break;
case C2H_WK_CID:
rtw_hal_set_hwreg_with_buf(padapter, HW_VAR_C2H_HANDLE, 
pdrvextra_cmd->pbuf, pdrvextra_cmd->size);
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 07/11] staging: rtl8723bs: Replace function rtw_free_network_queue()

2019-06-12 Thread Nishka Dasgupta
Remove function rtw_free_network_queue as all it does is call
_rtw_free_network_queue.
Rename _rtw_free_network_queue to rtw_free_network_queue to maintain
compatibility with call sites.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c| 8 +---
 drivers/staging/rtl8723bs/include/rtw_mlme.h | 2 --
 2 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index d26d8cf661df..b42d94a3a28c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -275,7 +275,7 @@ struct wlan_network *_rtw_find_network(struct __queue 
*scanned_queue, u8 *addr)
return pnetwork;
 }
 
-void _rtw_free_network_queue(struct adapter *padapter, u8 isfreeall)
+void rtw_free_network_queue(struct adapter *padapter, u8 isfreeall)
 {
struct list_head *phead, *plist;
struct wlan_network *pnetwork;
@@ -375,12 +375,6 @@ void rtw_free_network_nolock(struct adapter *padapter, 
struct wlan_network *pnet
rtw_cfg80211_unlink_bss(padapter, pnetwork);
 }
 
-
-void rtw_free_network_queue(struct adapter *dev, u8 isfreeall)
-{
-   _rtw_free_network_queue(dev, isfreeall);
-}
-
 /*
return the wlan_network with the matching addr
 
diff --git a/drivers/staging/rtl8723bs/include/rtw_mlme.h 
b/drivers/staging/rtl8723bs/include/rtw_mlme.h
index 2693b554f414..9c9aa9254288 100644
--- a/drivers/staging/rtl8723bs/include/rtw_mlme.h
+++ b/drivers/staging/rtl8723bs/include/rtw_mlme.h
@@ -607,8 +607,6 @@ extern void _rtw_free_network_nolock(struct mlme_priv 
*pmlmepriv, struct wlan_ne
 
 extern struct wlan_network* _rtw_find_network(struct __queue *scanned_queue, 
u8 *addr);
 
-extern void _rtw_free_network_queue(struct adapter *padapter, u8 isfreeall);
-
 extern sint rtw_if_up(struct adapter *padapter);
 
 sint rtw_linked_check(struct adapter *padapter);
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 09/11] staging: rtl8723bs: Fix typo in function name

2019-06-12 Thread Nishka Dasgupta
Change name of function hal_btcoex_Hanlder to hal_btcoex_Handler.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8723bs/core/rtw_btcoex.c| 2 +-
 drivers/staging/rtl8723bs/hal/hal_btcoex.c | 2 +-
 drivers/staging/rtl8723bs/include/hal_btcoex.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_btcoex.c 
b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
index 35310e8e0806..8944db15863d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_btcoex.c
+++ b/drivers/staging/rtl8723bs/core/rtw_btcoex.c
@@ -101,7 +101,7 @@ u8 rtw_btcoex_IsBtDisabled(struct adapter *padapter)
 
 void rtw_btcoex_Handler(struct adapter *padapter)
 {
-   hal_btcoex_Hanlder(padapter);
+   hal_btcoex_Handler(padapter);
 }
 
 s32 rtw_btcoex_IsBTCoexCtrlAMPDUSize(struct adapter *padapter)
diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c 
b/drivers/staging/rtl8723bs/hal/hal_btcoex.c
index aebe8b8977ad..fd0be52988c1 100644
--- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c
+++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c
@@ -1472,7 +1472,7 @@ void hal_btcoex_HaltNotify(struct adapter *padapter)
EXhalbtcoutsrc_HaltNotify();
 }
 
-void hal_btcoex_Hanlder(struct adapter *padapter)
+void hal_btcoex_Handler(struct adapter *padapter)
 {
EXhalbtcoutsrc_Periodical();
 }
diff --git a/drivers/staging/rtl8723bs/include/hal_btcoex.h 
b/drivers/staging/rtl8723bs/include/hal_btcoex.h
index 4066b0a1450c..10f44ed72c0a 100644
--- a/drivers/staging/rtl8723bs/include/hal_btcoex.h
+++ b/drivers/staging/rtl8723bs/include/hal_btcoex.h
@@ -43,7 +43,7 @@ void hal_btcoex_BtInfoNotify(struct adapter *padapter, u8 
length, u8 *tmpBuf);
 void hal_btcoex_SuspendNotify(struct adapter *padapter, u8 state);
 void hal_btcoex_HaltNotify(struct adapter *padapter);
 
-void hal_btcoex_Hanlder(struct adapter *padapter);
+void hal_btcoex_Handler(struct adapter *padapter);
 
 s32 hal_btcoex_IsBTCoexCtrlAMPDUSize(struct adapter *padapter);
 void hal_btcoex_SetManualControl(struct adapter *padapter, u8 bmanual);
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/11] staging: rtl8723bs: core: Remove function eeprom_read_sz()

2019-06-12 Thread Nishka Dasgupta
Remove unused function eeprom_read_sz.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8723bs/core/rtw_eeprom.c | 47 -
 1 file changed, 47 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_eeprom.c 
b/drivers/staging/rtl8723bs/core/rtw_eeprom.c
index 5eea02cfce1f..433d5d255e77 100644
--- a/drivers/staging/rtl8723bs/core/rtw_eeprom.c
+++ b/drivers/staging/rtl8723bs/core/rtw_eeprom.c
@@ -268,53 +268,6 @@ _func_exit_;
 
 }
 
-
-
-
-/*From even offset*/
-void eeprom_read_sz(_adapter *padapter, u16 reg, u8 *data, u32 sz)
-{
-
-   u16 x, data16;
-   u32 i;
-_func_enter_;
-   if (padapter->bSurpriseRemoved == true) {
-   RT_TRACE(_module_rtl871x_eeprom_c_, _drv_err_, 
("padapter->bSurpriseRemoved==true"));
-   goto out;
-   }
-   /* select EEPROM, reset bits, set _EECS*/
-   x = rtw_read8(padapter, EE_9346CR);
-
-   if (padapter->bSurpriseRemoved == true) {
-   RT_TRACE(_module_rtl871x_eeprom_c_, _drv_err_, 
("padapter->bSurpriseRemoved==true"));
-   goto out;
-   }
-
-   x &= ~(_EEDI | _EEDO | _EESK | _EEM0);
-   x |= _EEM1 | _EECS;
-   rtw_write8(padapter, EE_9346CR, (unsigned char)x);
-
-   /* write the read opcode and register number in that order*/
-   /* The opcode is 3bits in length, reg is 6 bits long*/
-   shift_out_bits(padapter, EEPROM_READ_OPCODE, 3);
-   shift_out_bits(padapter, reg, padapter->EepromAddressSize);
-
-
-   for (i = 0; i < sz; i += 2) {
-   data16 = shift_in_bits(padapter);
-   data[i] = data16 & 0xff;
-   data[i+1] = data16 >> 8;
-   }
-
-   eeprom_clean(padapter);
-out:
-_func_exit_;
-
-
-
-}
-
-
 /*addr_off : address offset of the entry in eeprom (not the tuple number of 
eeprom (reg); that is addr_off !=reg)*/
 u8 eeprom_read(_adapter *padapter, u32 addr_off, u8 sz, u8 *rbuf)
 {
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] binder: fix possible UAF when freeing buffer

2019-06-12 Thread Todd Kjos
There is a race between the binder driver cleaning
up a completed transaction via binder_free_transaction()
and a user calling binder_ioctl(BC_FREE_BUFFER) to
release a buffer. It doesn't matter which is first but
they need to be protected against running concurrently
which can result in a UAF.

Signed-off-by: Todd Kjos 
---
 drivers/android/binder.c | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 748ac489ef7eb..bc26b5511f0a9 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -1941,8 +1941,18 @@ static void binder_free_txn_fixups(struct 
binder_transaction *t)
 
 static void binder_free_transaction(struct binder_transaction *t)
 {
-   if (t->buffer)
-   t->buffer->transaction = NULL;
+   struct binder_proc *target_proc = t->to_proc;
+
+   if (target_proc) {
+   binder_inner_proc_lock(target_proc);
+   if (t->buffer)
+   t->buffer->transaction = NULL;
+   binder_inner_proc_unlock(target_proc);
+   }
+   /*
+* If the transaction has no target_proc, then
+* t->buffer->transaction has already been cleared.
+*/
binder_free_txn_fixups(t);
kfree(t);
binder_stats_deleted(BINDER_STAT_TRANSACTION);
@@ -3551,10 +3561,12 @@ static void binder_transaction(struct binder_proc *proc,
 static void
 binder_free_buf(struct binder_proc *proc, struct binder_buffer *buffer)
 {
+   binder_inner_proc_lock(proc);
if (buffer->transaction) {
buffer->transaction->buffer = NULL;
buffer->transaction = NULL;
}
+   binder_inner_proc_unlock(proc);
if (buffer->async_transaction && buffer->target_node) {
struct binder_node *buf_node;
struct binder_work *w;
-- 
2.22.0.rc2.383.gf4fbbf30c2-goog

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[ashmem] Re: WARNING in __vm_enough_memory

2019-06-12 Thread Eric Biggers
On Tue, Jan 16, 2018 at 06:20:37AM +0100, 'Dmitry Vyukov' via syzkaller-bugs 
wrote:
> On Tue, Jan 16, 2018 at 12:58 AM, syzbot
>  wrote:
> > Hello,
> >
> > syzkaller hit the following crash on
> > 8418f88764046d0e8ca6a3c04a69a0e57189aa1e
> > git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master
> > compiler: gcc (GCC) 7.1.1 20170620
> > .config is attached
> > Raw console output is attached.
> > C reproducer is attached
> > syzkaller reproducer is attached. See https://goo.gl/kgGztJ
> > for information about syzkaller reproducers
> 
> 
> Most likely it is drivers/staging/android/ashmem.c which is guilty. So
> +ashmem maintainers.
> 
> 
> > IMPORTANT: if you fix the bug, please add the following tag to the commit:
> > Reported-by: syzbot+cc298e15b6a571ba0...@syzkaller.appspotmail.com
> > It will help syzbot understand when the bug is fixed. See footer for
> > details.
> > If you forward the report, please keep this part and the footer.
> >
> > audit: type=1400 audit(1515720420.441:8): avc:  denied  { sys_admin } for
> > pid=3511 comm="syzkaller485245" capability=21
> > scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
> > tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=cap_userns
> > permissive=1
> > audit: type=1400 audit(1515720420.495:9): avc:  denied  { sys_chroot } for
> > pid=3512 comm="syzkaller485245" capability=18
> > scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
> > tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=cap_userns
> > permissive=1
> > [ cut here ]
> > memory commitment underflow
> > WARNING: CPU: 0 PID: 3512 at mm/util.c:606 __vm_enough_memory+0x5a6/0x810
> > mm/util.c:604
> > Kernel panic - not syncing: panic_on_warn set ...
> >
> > CPU: 0 PID: 3512 Comm: syzkaller485245 Not tainted 4.15.0-rc7-next-20180111+
> > #94
> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> > Google 01/01/2011
> > Call Trace:
> >  __dump_stack lib/dump_stack.c:17 [inline]
> >  dump_stack+0x194/0x257 lib/dump_stack.c:53
> >  panic+0x1e4/0x41c kernel/panic.c:183
> >  __warn+0x1dc/0x200 kernel/panic.c:547
> >  report_bug+0x211/0x2d0 lib/bug.c:184
> >  fixup_bug.part.11+0x37/0x80 arch/x86/kernel/traps.c:178
> >  fixup_bug arch/x86/kernel/traps.c:247 [inline]
> >  do_error_trap+0x2d7/0x3e0 arch/x86/kernel/traps.c:296
> >  do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315
> >  invalid_op+0x22/0x40 arch/x86/entry/entry_64.S:1102
> > RIP: 0010:__vm_enough_memory+0x5a6/0x810 mm/util.c:604
> > RSP: 0018:8801bfbaf8e0 EFLAGS: 00010282
> > RAX: dc08 RBX: 110037f75f21 RCX: 815a613e
> > RDX:  RSI: 110037e84d3b RDI: 0293
> > RBP: 8801bfbafa90 R08: 110037f75eaf R09: 
> > R10:  R11:  R12: 8801bfbafa68
> > R13: 869b8c80 R14: 0fff R15: dc00
> >  security_vm_enough_memory_mm+0x90/0xb0 security/security.c:327
> >  mmap_region+0x321/0x15a0 mm/mmap.c:1666
> >  do_mmap+0x73c/0xf70 mm/mmap.c:1494
> >  do_mmap_pgoff include/linux/mm.h:2224 [inline]
> >  vm_mmap_pgoff+0x1de/0x280 mm/util.c:333
> >  SYSC_mmap_pgoff mm/mmap.c:1544 [inline]
> >  SyS_mmap_pgoff+0x23b/0x5f0 mm/mmap.c:1502
> >  SYSC_mmap arch/x86/kernel/sys_x86_64.c:100 [inline]
> >  SyS_mmap+0x16/0x20 arch/x86/kernel/sys_x86_64.c:91
> >  entry_SYSCALL_64_fastpath+0x29/0xa0
> > RIP: 0033:0x440ac9
> > RSP: 002b:007dff58 EFLAGS: 0212 ORIG_RAX: 0009
> > RAX: ffda RBX:  RCX: 00440ac9
> > RDX: 0003 RSI: 00fff000 RDI: 2000
> > RBP: 7fff R08:  R09: 
> > R10: 0032 R11: 0212 R12: 6873612f7665642f
> > R13: 6c616b7a79732f2e R14:  R15: 
> > Dumping ftrace buffer:
> >(ftrace buffer empty)
> > Kernel Offset: disabled
> > Rebooting in 86400 seconds..
> >
> >
> > ---
> > This bug is generated by a dumb bot. It may contain errors.
> > See https://goo.gl/tpsmEJ for details.
> > Direct all questions to syzkal...@googlegroups.com.
> >
> > syzbot will keep track of this bug report.
> > If you forgot to add the Reported-by tag, once the fix for this bug is
> > merged
> > into any tree, please reply to this email with:
> > #syz fix: exact-commit-title
> > If you want to test a patch for this bug, please reply with:
> > #syz test: git://repo/address.git branch
> > and provide the patch inline or as an attachment.
> > To mark this as a duplicate of another syzbot report, please reply with:
> > #syz dup: exact-subject-of-another-report
> > If it's a one-off invalid bug report, please reply with:
> > #syz invalid
> > Note: if the crash happens again, it will cause creation of a new bug
> > report.
> > Note: all commands must start from beginning of the line in the email body.
> >

Can the ashmem maintainers please look into this?  syzbot has 

Re: WARNING in binder_transaction_buffer_release

2019-06-12 Thread Eric Biggers
On Mon, May 20, 2019 at 07:18:06AM -0700, syzbot wrote:
> Hello,
> 
> syzbot found the following crash on:
> 
> HEAD commit:72cf0b07 Merge tag 'sound-fix-5.2-rc1' of git://git.kernel..
> git tree:   upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=17c7d4bca0
> kernel config:  https://syzkaller.appspot.com/x/.config?x=d103f114f9010324
> dashboard link: https://syzkaller.appspot.com/bug?extid=8b3c354d33c4ac78bfad
> compiler:   gcc (GCC) 9.0.0 20181231 (experimental)
> userspace arch: i386
> syz repro:  https://syzkaller.appspot.com/x/repro.syz?x=15b99b44a0
> 
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+8b3c354d33c4ac78b...@syzkaller.appspotmail.com
> 
> WARNING: CPU: 1 PID: 8535 at drivers/android/binder.c:2368
> binder_transaction_buffer_release+0x673/0x8f0 drivers/android/binder.c:2368
> Kernel panic - not syncing: panic_on_warn set ...
> CPU: 1 PID: 8535 Comm: syz-executor.2 Not tainted 5.1.0+ #19
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:77 [inline]
>  dump_stack+0x172/0x1f0 lib/dump_stack.c:113
>  panic+0x2cb/0x715 kernel/panic.c:214
>  __warn.cold+0x20/0x4c kernel/panic.c:571
>  report_bug+0x263/0x2b0 lib/bug.c:186
>  fixup_bug arch/x86/kernel/traps.c:179 [inline]
>  fixup_bug arch/x86/kernel/traps.c:174 [inline]
>  do_error_trap+0x11b/0x200 arch/x86/kernel/traps.c:272
>  do_invalid_op+0x37/0x50 arch/x86/kernel/traps.c:291
>  invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:986
> RIP: 0010:binder_transaction_buffer_release+0x673/0x8f0
> drivers/android/binder.c:2368
> Code: 31 ff 41 89 c5 89 c6 e8 7b 04 1f fc 45 85 ed 0f 85 1f 41 01 00 49 8d
> 47 40 48 89 85 50 fe ff ff e9 9d fa ff ff e8 dd 02 1f fc <0f> 0b e9 7f fc ff
> ff e8 d1 02 1f fc 48 89 d8 45 31 c9 4c 89 fe 4c
> RSP: 0018:88807b2775f0 EFLAGS: 00010293
> RAX: 888092b1e040 RBX: 0060 RCX: 111012563caa
> RDX:  RSI: 85519e13 RDI: 888097a2d248
> RBP: 88807b2777d8 R08: 888092b1e040 R09: ed100f64eee3
> R10: ed100f64eee2 R11: 88807b277717 R12: 88808fd2c340
> R13: 0068 R14: 88807b2777b0 R15: 88809f7ea580
>  binder_transaction+0x153d/0x6620 drivers/android/binder.c:3484
>  binder_thread_write+0x87e/0x2820 drivers/android/binder.c:3792
>  binder_ioctl_write_read drivers/android/binder.c:4836 [inline]
>  binder_ioctl+0x102f/0x1833 drivers/android/binder.c:5013
>  __do_compat_sys_ioctl fs/compat_ioctl.c:1052 [inline]
>  __se_compat_sys_ioctl fs/compat_ioctl.c:998 [inline]
>  __ia32_compat_sys_ioctl+0x195/0x620 fs/compat_ioctl.c:998
>  do_syscall_32_irqs_on arch/x86/entry/common.c:337 [inline]
>  do_fast_syscall_32+0x27b/0xd7d arch/x86/entry/common.c:408
>  entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139
> RIP: 0023:0xf7f9e849
> Code: 85 d2 74 02 89 0a 5b 5d c3 8b 04 24 c3 8b 14 24 c3 8b 3c 24 c3 90 90
> 90 90 90 90 90 90 90 90 90 90 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90
> 90 90 eb 0d 90 90 90 90 90 90 90 90 90 90 90 90
> RSP: 002b:f7f9a0cc EFLAGS: 0296 ORIG_RAX: 0036
> RAX: ffda RBX: 0004 RCX: c0306201
> RDX: 2140 RSI:  RDI: 
> RBP:  R08:  R09: 
> R10:  R11:  R12: 
> R13:  R14:  R15: 
> Kernel Offset: disabled
> Rebooting in 86400 seconds..
> 
> 
> ---
> This bug is generated by a bot. It may contain errors.
> See https://goo.gl/tpsmEJ for more information about syzbot.
> syzbot engineers can be reached at syzkal...@googlegroups.com.
> 
> syzbot will keep track of this bug report. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> syzbot can test patches for this bug, for details see:
> https://goo.gl/tpsmEJ#testing-patches
> 

Are any of the binder maintainers planning to fix this?  This seems to be the
only open syzbot report for binder on the upstream kernel.

- Eric
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH][next] staging: media: meson: remove redundant initialization of mpeg12

2019-06-12 Thread Colin King
From: Colin Ian King 

The pointer mpeg12 is being initialized however that value is never
read and mpeg12 is being re-assigned almost immediately afterwards.
Remove the redundant initialization.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King 
---
 drivers/staging/media/meson/vdec/codec_mpeg12.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/meson/vdec/codec_mpeg12.c 
b/drivers/staging/media/meson/vdec/codec_mpeg12.c
index 5398fbf7ce20..48869cc3d973 100644
--- a/drivers/staging/media/meson/vdec/codec_mpeg12.c
+++ b/drivers/staging/media/meson/vdec/codec_mpeg12.c
@@ -63,7 +63,7 @@ static void codec_mpeg12_recycle(struct amvdec_core *core, 
u32 buf_idx)
 static int codec_mpeg12_start(struct amvdec_session *sess)
 {
struct amvdec_core *core = sess->core;
-   struct codec_mpeg12 *mpeg12 = sess->priv;
+   struct codec_mpeg12 *mpeg12;
int ret;
 
mpeg12 = kzalloc(sizeof(*mpeg12), GFP_KERNEL);
-- 
2.20.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 0/2] staging: kpc2000: minor fixes in kp2000_pcie_probe

2019-06-12 Thread Simon Sandström
These two patches fixes issues pointed out by Dan in a previous
staging/kpc2000 patch thread: many comments in kp2000_pcie_probe just
repeats the code and the current label names doesn't add any information
and makes it hard to follow the code.

Rename all labels and remove the comments that just repeats the code.

Version 2:
 - Don't convert C style comments to C++ style

Simon Sandström (2):
  staging: kpc2000: improve label names in kp2000_pcie_probe
  staging: kpc2000: remove unnecessary comments in kp2000_pcie_probe

 drivers/staging/kpc2000/kpc2000/core.c | 80 --
 1 file changed, 25 insertions(+), 55 deletions(-)

-- 
2.20.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 1/2] staging: kpc2000: improve label names in kp2000_pcie_probe

2019-06-12 Thread Simon Sandström
Use self-explanatory label names instead of the generic numbered ones,
to make it easier to follow and understand the code.

Signed-off-by: Simon Sandström 
---
 drivers/staging/kpc2000/kpc2000/core.c | 42 --
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000/core.c 
b/drivers/staging/kpc2000/kpc2000/core.c
index 9b9b29ac90c5..ee6b9be7127d 100644
--- a/drivers/staging/kpc2000/kpc2000/core.c
+++ b/drivers/staging/kpc2000/kpc2000/core.c
@@ -327,7 +327,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
if (err < 0) {
dev_err(>dev, "probe: failed to get card number (%d)\n",
err);
-   goto out2;
+   goto err_free_pcard;
}
pcard->card_num = err;
scnprintf(pcard->name, 16, "kpcard%u", pcard->card_num);
@@ -346,7 +346,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
dev_err(>pdev->dev,
"probe: failed to enable PCIE2000 PCIe device (%d)\n",
err);
-   goto out3;
+   goto err_remove_ida;
}
 
/*
@@ -360,7 +360,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
dev_err(>pdev->dev,
"probe: REG_BAR could not remap memory to virtual 
space\n");
err = -ENODEV;
-   goto out4;
+   goto err_disable_device;
}
dev_dbg(>pdev->dev,
"probe: REG_BAR virt hardware address start [%p]\n",
@@ -373,7 +373,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
"probe: failed to acquire PCI region (%d)\n",
err);
err = -ENODEV;
-   goto out4;
+   goto err_disable_device;
}
 
pcard->regs_base_resource.start = reg_bar_phys_addr;
@@ -393,7 +393,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
dev_err(>pdev->dev,
"probe: DMA_BAR could not remap memory to virtual 
space\n");
err = -ENODEV;
-   goto out5;
+   goto err_unmap_regs;
}
dev_dbg(>pdev->dev,
"probe: DMA_BAR virt hardware address start [%p]\n",
@@ -407,7 +407,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
dev_err(>pdev->dev,
"probe: failed to acquire PCI region (%d)\n", err);
err = -ENODEV;
-   goto out5;
+   goto err_unmap_regs;
}
 
pcard->dma_base_resource.start = dma_bar_phys_addr;
@@ -421,7 +421,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
pcard->sysinfo_regs_base = pcard->regs_bar_base;
err = read_system_regs(pcard);
if (err)
-   goto out6;
+   goto err_unmap_dma;
 
// Disable all "user" interrupts because they're not used yet.
writeq(0x,
@@ -461,7 +461,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
if (err) {
dev_err(>pdev->dev,
"CANNOT use DMA mask %0llx\n", DMA_BIT_MASK(64));
-   goto out7;
+   goto err_unmap_dma;
}
dev_dbg(>pdev->dev,
"Using DMA mask %0llx\n", dma_get_mask(PCARD_TO_DEV(pcard)));
@@ -471,14 +471,14 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
 */
err = pci_enable_msi(pcard->pdev);
if (err < 0)
-   goto out8a;
+   goto err_unmap_dma;
 
rv = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
 pcard->name, pcard);
if (rv) {
dev_err(>pdev->dev,
"%s: failed to request_irq: %d\n", __func__, rv);
-   goto out8b;
+   goto err_disable_msi;
}
 
/*
@@ -487,7 +487,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
err = sysfs_create_files(>dev.kobj, kp_attr_list);
if (err) {
dev_err(>dev, "Failed to add sysfs files: %d\n", err);
-   goto out9;
+   goto err_free_irq;
}
 
/*
@@ -495,7 +495,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
 */
err = kp2000_probe_cores(pcard);
if (err)
-   goto out10;
+   goto err_remove_sysfs;
 
/*
 * Step 11: Enable IRQs in HW
@@ -506,28 +506,26 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
mutex_unlock(>sem);
return 0;
 
-out10:
+err_remove_sysfs:
sysfs_remove_files(>dev.kobj, kp_attr_list);
-out9:
+err_free_irq:
free_irq(pcard->pdev->irq, pcard);
-out8b:
+err_disable_msi:
pci_disable_msi(pcard->pdev);
-out8a:
-out7:
-out6:
+err_unmap_dma:
iounmap(pcard->dma_bar_base);
pci_release_region(pdev, DMA_BAR);
pcard->dma_bar_base = 

[PATCH v2 2/2] staging: kpc2000: remove unnecessary comments in kp2000_pcie_probe

2019-06-12 Thread Simon Sandström
Much of the code comments in kp2000_pcie_probe just repeats the code and
does not add any additional information. Delete them and make sure that
comments still left in the function all use the same style.

Signed-off-by: Simon Sandström 
---
 drivers/staging/kpc2000/kpc2000/core.c | 38 --
 1 file changed, 5 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000/core.c 
b/drivers/staging/kpc2000/kpc2000/core.c
index ee6b9be7127d..6a5999e8ff4e 100644
--- a/drivers/staging/kpc2000/kpc2000/core.c
+++ b/drivers/staging/kpc2000/kpc2000/core.c
@@ -311,18 +311,12 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
unsigned long dma_bar_phys_len;
u16 regval;
 
-   /*
-* Step 1: Allocate a struct for the pcard
-*/
pcard = kzalloc(sizeof(*pcard), GFP_KERNEL);
if (!pcard)
return -ENOMEM;
dev_dbg(>dev, "probe: allocated struct kp2000_device @ %p\n",
pcard);
 
-   /*
-* Step 2: Initialize trivial pcard elements
-*/
err = ida_simple_get(_num_ida, 1, INT_MAX, GFP_KERNEL);
if (err < 0) {
dev_err(>dev, "probe: failed to get card number (%d)\n",
@@ -338,9 +332,6 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
pcard->pdev = pdev;
pci_set_drvdata(pdev, pcard);
 
-   /*
-* Step 3: Enable PCI device
-*/
err = pci_enable_device(pcard->pdev);
if (err) {
dev_err(>pdev->dev,
@@ -349,9 +340,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
goto err_remove_ida;
}
 
-   /*
-* Step 4: Setup the Register BAR
-*/
+   /* Setup the Register BAR */
reg_bar_phys_addr = pci_resource_start(pcard->pdev, REG_BAR);
reg_bar_phys_len = pci_resource_len(pcard->pdev, REG_BAR);
 
@@ -381,9 +370,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
  reg_bar_phys_len - 1;
pcard->regs_base_resource.flags = IORESOURCE_MEM;
 
-   /*
-* Step 5: Setup the DMA BAR
-*/
+   /* Setup the DMA BAR */
dma_bar_phys_addr = pci_resource_start(pcard->pdev, DMA_BAR);
dma_bar_phys_len = pci_resource_len(pcard->pdev, DMA_BAR);
 
@@ -415,9 +402,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
 dma_bar_phys_len - 1;
pcard->dma_base_resource.flags = IORESOURCE_MEM;
 
-   /*
-* Step 6: System Regs
-*/
+   /* Read System Regs */
pcard->sysinfo_regs_base = pcard->regs_bar_base;
err = read_system_regs(pcard);
if (err)
@@ -427,11 +412,9 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
writeq(0x,
   pcard->sysinfo_regs_base + REG_INTERRUPT_MASK);
 
-   /*
-* Step 7: Configure PCI thingies
-*/
// let the card master PCIe
pci_set_master(pcard->pdev);
+
// enable IO and mem if not already done
pci_read_config_word(pcard->pdev, PCI_COMMAND, );
regval |= (PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
@@ -466,9 +449,6 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
dev_dbg(>pdev->dev,
"Using DMA mask %0llx\n", dma_get_mask(PCARD_TO_DEV(pcard)));
 
-   /*
-* Step 8: Configure IRQs
-*/
err = pci_enable_msi(pcard->pdev);
if (err < 0)
goto err_unmap_dma;
@@ -481,25 +461,17 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
goto err_disable_msi;
}
 
-   /*
-* Step 9: Setup sysfs attributes
-*/
err = sysfs_create_files(>dev.kobj, kp_attr_list);
if (err) {
dev_err(>dev, "Failed to add sysfs files: %d\n", err);
goto err_free_irq;
}
 
-   /*
-* Step 10: Probe cores
-*/
err = kp2000_probe_cores(pcard);
if (err)
goto err_remove_sysfs;
 
-   /*
-* Step 11: Enable IRQs in HW
-*/
+   /* Enable IRQs in HW */
writel(KPC_DMA_CARD_IRQ_ENABLE | KPC_DMA_CARD_USER_INTERRUPT_MODE,
   pcard->dma_common_regs);
 
-- 
2.20.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[driver-core:debugfs_cleanup 77/85] drivers/net/wireless/intel/iwlegacy/4965-rs.c:2779:49: sparse: sparse: incorrect type in assignment (different base types)

2019-06-12 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 
debugfs_cleanup
head:   38bfd17b38b31dfc13afabb1742a23d5741b16d2
commit: 2cd2d7ff48151c0a5326606dbc48a00df3a4d596 [77/85] debugfs: remove return 
value of debugfs_create_u8()
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-rc1-7-g2b96cd8-dirty
git checkout 2cd2d7ff48151c0a5326606dbc48a00df3a4d596
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 


sparse warnings: (new ones prefixed by >>)

>> drivers/net/wireless/intel/iwlegacy/4965-rs.c:2779:49: sparse: sparse: 
>> incorrect type in assignment (different base types) @@expected struct 
>> dentry *rs_sta_dbgfs_tx_agg_tid_en_file @@got ry 
>> *rs_sta_dbgfs_tx_agg_tid_en_file @@
>> drivers/net/wireless/intel/iwlegacy/4965-rs.c:2779:49: sparse:expected 
>> struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file
>> drivers/net/wireless/intel/iwlegacy/4965-rs.c:2779:49: sparse:got void
--
   drivers/net/wireless/intel/iwlwifi/dvm/..//fw/file.h:325:19: sparse: sparse: 
mixed bitwiseness
   drivers/net/wireless/intel/iwlwifi/dvm/..//fw/file.h:470:19: sparse: sparse: 
mixed bitwiseness
>> drivers/net/wireless/intel/iwlwifi/dvm/rs.c:3283:49: sparse: sparse: 
>> incorrect type in assignment (different base types) @@expected struct 
>> dentry *rs_sta_dbgfs_tx_agg_tid_en_file @@got ry 
>> *rs_sta_dbgfs_tx_agg_tid_en_file @@
>> drivers/net/wireless/intel/iwlwifi/dvm/rs.c:3283:49: sparse:expected 
>> struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file
>> drivers/net/wireless/intel/iwlwifi/dvm/rs.c:3283:49: sparse:got void

vim +2779 drivers/net/wireless/intel/iwlegacy/4965-rs.c

be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21  2765  
e7392364 drivers/net/wireless/iwlegacy/4965-rs.c   Stanislaw Gruszka 
2011-11-15  2766  static void
e7392364 drivers/net/wireless/iwlegacy/4965-rs.c   Stanislaw Gruszka 
2011-11-15  2767  il4965_rs_add_debugfs(void *il, void *il_sta, struct dentry 
*dir)
be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21  2768  {
46bc8d4b drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Stanislaw Gruszka 
2011-10-24  2769   struct il_lq_sta *lq_sta = il_sta;
be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21  2770   lq_sta->rs_sta_dbgfs_scale_table_file =
2ef00c53 drivers/net/wireless/intel/iwlegacy/4965-rs.c Joe Perches   
2018-03-23  2771   debugfs_create_file("rate_scale_table", 0600, dir,
be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21  2772   lq_sta, 
_sta_dbgfs_scale_table_ops);
be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21  2773   lq_sta->rs_sta_dbgfs_stats_table_file =
2ef00c53 drivers/net/wireless/intel/iwlegacy/4965-rs.c Joe Perches   
2018-03-23  2774   debugfs_create_file("rate_stats_table", 0400, dir, 
lq_sta,
e7392364 drivers/net/wireless/iwlegacy/4965-rs.c   Stanislaw Gruszka 
2011-11-15  2775   _sta_dbgfs_stats_table_ops);
be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21  2776   lq_sta->rs_sta_dbgfs_rate_scale_data_file =
2ef00c53 drivers/net/wireless/intel/iwlegacy/4965-rs.c Joe Perches   
2018-03-23  2777   debugfs_create_file("rate_scale_data", 0400, dir, 
lq_sta,
e7392364 drivers/net/wireless/iwlegacy/4965-rs.c   Stanislaw Gruszka 
2011-11-15  2778   
_sta_dbgfs_rate_scale_data_ops);
be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21 @2779   lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file =
2ef00c53 drivers/net/wireless/intel/iwlegacy/4965-rs.c Joe Perches   
2018-03-23  2780   debugfs_create_u8("tx_agg_tid_enable", 0600, dir,
be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21  2781 _sta->tx_agg_tid_en);
be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21  2782  

:: The code at line 2779 was first introduced by commit
:: be663ab67077fac8e23eb8e231a8c1c94cb32e54 iwlwifi: split the drivers for 
agn and legacy devices 3945/4965

:: TO: Wey-Yi Guy 
:: CC: Wey-Yi Guy 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] x86/hyperv: Disable preemption while setting reenlightenment vector

2019-06-12 Thread Peter Zijlstra
On Tue, Jun 11, 2019 at 10:20:03PM +0100, Dmitry Safonov wrote:
> KVM support may be compiled as dynamic module, which triggers the
> following splat on modprobe:
> 
>  KVM: vmx: using Hyper-V Enlightened VMCS
>  BUG: using smp_processor_id() in preemptible [] code: modprobe/466 
> caller is debug_smp_processor_id+0x17/0x19
>  CPU: 0 PID: 466 Comm: modprobe Kdump: loaded Not tainted 4.19.43 #1
>  Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS 
> 090007  06/02/2017
>  Call Trace:
>   dump_stack+0x61/0x7e
>   check_preemption_disabled+0xd4/0xe6
>   debug_smp_processor_id+0x17/0x19
>   set_hv_tscchange_cb+0x1b/0x89
>   kvm_arch_init+0x14a/0x163 [kvm]
>   kvm_init+0x30/0x259 [kvm]
>   vmx_init+0xed/0x3db [kvm_intel]
>   do_one_initcall+0x89/0x1bc
>   do_init_module+0x5f/0x207
>   load_module+0x1b34/0x209b
>   __ia32_sys_init_module+0x17/0x19
>   do_fast_syscall_32+0x121/0x1fa
>   entry_SYSENTER_compat+0x7f/0x91
> 
> The easiest solution seems to be disabling preemption while setting up
> reenlightment MSRs. While at it, fix hv_cpu_*() callbacks.
> 
> Fixes: 93286261de1b4 ("x86/hyperv: Reenlightenment notifications
> support")
> 
> Cc: Andy Lutomirski 
> Cc: Borislav Petkov 
> Cc: Cathy Avery 
> Cc: Haiyang Zhang 
> Cc: "H. Peter Anvin" 
> Cc: Ingo Molnar 
> Cc: "K. Y. Srinivasan" 
> Cc: "Michael Kelley (EOSG)" 
> Cc: Mohammed Gamal 
> Cc: Paolo Bonzini 
> Cc: Radim Krčmář 
> Cc: Roman Kagan 
> Cc: Sasha Levin 
> Cc: Stephen Hemminger 
> Cc: Thomas Gleixner 
> Cc: Vitaly Kuznetsov 
> 
> Cc: de...@linuxdriverproject.org
> Cc: k...@vger.kernel.org
> Cc: linux-hyp...@vger.kernel.org
> Cc: x...@kernel.org
> Reported-by: Prasanna Panchamukhi 
> Signed-off-by: Dmitry Safonov 
> ---
>  arch/x86/hyperv/hv_init.c | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
> index 1608050e9df9..0bdd79ecbff8 100644
> --- a/arch/x86/hyperv/hv_init.c
> +++ b/arch/x86/hyperv/hv_init.c
> @@ -91,7 +91,7 @@ EXPORT_SYMBOL_GPL(hv_max_vp_index);
>  static int hv_cpu_init(unsigned int cpu)
>  {
>   u64 msr_vp_index;
> - struct hv_vp_assist_page **hvp = _vp_assist_page[smp_processor_id()];
> + struct hv_vp_assist_page **hvp = _vp_assist_page[cpu];
>   void **input_arg;
>   struct page *pg;
>  
> @@ -103,7 +103,7 @@ static int hv_cpu_init(unsigned int cpu)
>  
>   hv_get_vp_index(msr_vp_index);
>  
> - hv_vp_index[smp_processor_id()] = msr_vp_index;
> + hv_vp_index[cpu] = msr_vp_index;
>  
>   if (msr_vp_index > hv_max_vp_index)
>   hv_max_vp_index = msr_vp_index;
> @@ -182,7 +182,6 @@ void set_hv_tscchange_cb(void (*cb)(void))
>   struct hv_reenlightenment_control re_ctrl = {
>   .vector = HYPERV_REENLIGHTENMENT_VECTOR,
>   .enabled = 1,
> - .target_vp = hv_vp_index[smp_processor_id()]
>   };
>   struct hv_tsc_emulation_control emu_ctrl = {.enabled = 1};
>  
> @@ -196,7 +195,11 @@ void set_hv_tscchange_cb(void (*cb)(void))
>   /* Make sure callback is registered before we write to MSRs */
>   wmb();
>  
> + preempt_disable();
> + re_ctrl.target_vp = hv_vp_index[smp_processor_id()];
>   wrmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)_ctrl));
> + preempt_enable();
> +
>   wrmsrl(HV_X64_MSR_TSC_EMULATION_CONTROL, *((u64 *)_ctrl));
>  }
>  EXPORT_SYMBOL_GPL(set_hv_tscchange_cb);

This looks bogus, MSRs are a per-cpu resource, you had better know what
CPUs you're on and be stuck to it when you do wrmsr. This just fudges
the code to make the warning go away and doesn't fix the actual problem
afaict.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] x86/hyperv: Disable preemption while setting reenlightenment vector

2019-06-12 Thread Vitaly Kuznetsov
Peter Zijlstra  writes:

> On Tue, Jun 11, 2019 at 10:20:03PM +0100, Dmitry Safonov wrote:
>> KVM support may be compiled as dynamic module, which triggers the
>> following splat on modprobe:
>> 
>>  KVM: vmx: using Hyper-V Enlightened VMCS
>>  BUG: using smp_processor_id() in preemptible [] code: modprobe/466 
>> caller is debug_smp_processor_id+0x17/0x19
>>  CPU: 0 PID: 466 Comm: modprobe Kdump: loaded Not tainted 4.19.43 #1
>>  Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS 
>> 090007  06/02/2017
>>  Call Trace:
>>   dump_stack+0x61/0x7e
>>   check_preemption_disabled+0xd4/0xe6
>>   debug_smp_processor_id+0x17/0x19
>>   set_hv_tscchange_cb+0x1b/0x89
>>   kvm_arch_init+0x14a/0x163 [kvm]
>>   kvm_init+0x30/0x259 [kvm]
>>   vmx_init+0xed/0x3db [kvm_intel]
>>   do_one_initcall+0x89/0x1bc
>>   do_init_module+0x5f/0x207
>>   load_module+0x1b34/0x209b
>>   __ia32_sys_init_module+0x17/0x19
>>   do_fast_syscall_32+0x121/0x1fa
>>   entry_SYSENTER_compat+0x7f/0x91
>> 
>> The easiest solution seems to be disabling preemption while setting up
>> reenlightment MSRs. While at it, fix hv_cpu_*() callbacks.
>> 
>> Fixes: 93286261de1b4 ("x86/hyperv: Reenlightenment notifications
>> support")
>> 
>> Cc: Andy Lutomirski 
>> Cc: Borislav Petkov 
>> Cc: Cathy Avery 
>> Cc: Haiyang Zhang 
>> Cc: "H. Peter Anvin" 
>> Cc: Ingo Molnar 
>> Cc: "K. Y. Srinivasan" 
>> Cc: "Michael Kelley (EOSG)" 
>> Cc: Mohammed Gamal 
>> Cc: Paolo Bonzini 
>> Cc: Radim Krčmář 
>> Cc: Roman Kagan 
>> Cc: Sasha Levin 
>> Cc: Stephen Hemminger 
>> Cc: Thomas Gleixner 
>> Cc: Vitaly Kuznetsov 
>> 
>> Cc: de...@linuxdriverproject.org
>> Cc: k...@vger.kernel.org
>> Cc: linux-hyp...@vger.kernel.org
>> Cc: x...@kernel.org
>> Reported-by: Prasanna Panchamukhi 
>> Signed-off-by: Dmitry Safonov 
>> ---
>>  arch/x86/hyperv/hv_init.c | 9 ++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>> 
>> diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
>> index 1608050e9df9..0bdd79ecbff8 100644
>> --- a/arch/x86/hyperv/hv_init.c
>> +++ b/arch/x86/hyperv/hv_init.c
>> @@ -91,7 +91,7 @@ EXPORT_SYMBOL_GPL(hv_max_vp_index);
>>  static int hv_cpu_init(unsigned int cpu)
>>  {
>>  u64 msr_vp_index;
>> -struct hv_vp_assist_page **hvp = _vp_assist_page[smp_processor_id()];
>> +struct hv_vp_assist_page **hvp = _vp_assist_page[cpu];
>>  void **input_arg;
>>  struct page *pg;
>>  
>> @@ -103,7 +103,7 @@ static int hv_cpu_init(unsigned int cpu)
>>  
>>  hv_get_vp_index(msr_vp_index);
>>  
>> -hv_vp_index[smp_processor_id()] = msr_vp_index;
>> +hv_vp_index[cpu] = msr_vp_index;
>>  
>>  if (msr_vp_index > hv_max_vp_index)
>>  hv_max_vp_index = msr_vp_index;
>> @@ -182,7 +182,6 @@ void set_hv_tscchange_cb(void (*cb)(void))
>>  struct hv_reenlightenment_control re_ctrl = {
>>  .vector = HYPERV_REENLIGHTENMENT_VECTOR,
>>  .enabled = 1,
>> -.target_vp = hv_vp_index[smp_processor_id()]
>>  };
>>  struct hv_tsc_emulation_control emu_ctrl = {.enabled = 1};
>>  
>> @@ -196,7 +195,11 @@ void set_hv_tscchange_cb(void (*cb)(void))
>>  /* Make sure callback is registered before we write to MSRs */
>>  wmb();
>>  
>> +preempt_disable();
>> +re_ctrl.target_vp = hv_vp_index[smp_processor_id()];
>>  wrmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)_ctrl));
>> +preempt_enable();
>> +
>>  wrmsrl(HV_X64_MSR_TSC_EMULATION_CONTROL, *((u64 *)_ctrl));
>>  }
>>  EXPORT_SYMBOL_GPL(set_hv_tscchange_cb);
>
> This looks bogus, MSRs are a per-cpu resource, you had better know what
> CPUs you're on and be stuck to it when you do wrmsr. This just fudges
> the code to make the warning go away and doesn't fix the actual problem
> afaict.

Actually, we don't care which CPU will receive the reenlightenment
notification and TSC Emulation in Hyper-V is, of course, global. We have
code which re-assignes the notification to some other CPU in case the
one it's currently assigned to goes away (see hv_cpu_die()).

-- 
Vitaly
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH -next] media: meson: vdec: Add missing kthread.h

2019-06-12 Thread Maxime Jourdan
On Wed, Jun 12, 2019 at 12:05 PM YueHaibing  wrote:
>
> Fix building error:
>
> drivers/staging/media/meson/vdec/vdec.c: In function vdec_recycle_thread:
> drivers/staging/media/meson/vdec/vdec.c:59:10: error: implicit declaration
>  of function kthread_should_stop;
>  did you mean thread_saved_sp? [-Werror=implicit-function-declaration]
>
> Reported-by: Hulk Robot 
> Fixes: 3e7f51bd9607 ("media: meson: add v4l2 m2m video decoder driver")
> Signed-off-by: YueHaibing 
> ---
>  drivers/staging/media/meson/vdec/vdec.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/staging/media/meson/vdec/vdec.c 
> b/drivers/staging/media/meson/vdec/vdec.c
> index 4e4f9d6..0a1a04f 100644
> --- a/drivers/staging/media/meson/vdec/vdec.c
> +++ b/drivers/staging/media/meson/vdec/vdec.c
> @@ -12,6 +12,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> --
> 2.7.4
>
>

Thanks for the patch, sorry that this one slipped through.

Acked-by: Maxime Jourdan 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] x86/hyperv: Disable preemption while setting reenlightenment vector

2019-06-12 Thread Vitaly Kuznetsov
Dmitry Safonov  writes:

> KVM support may be compiled as dynamic module, which triggers the
> following splat on modprobe:
>
>  KVM: vmx: using Hyper-V Enlightened VMCS
>  BUG: using smp_processor_id() in preemptible [] code: modprobe/466 
> caller is debug_smp_processor_id+0x17/0x19
>  CPU: 0 PID: 466 Comm: modprobe Kdump: loaded Not tainted 4.19.43 #1
>  Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS 
> 090007  06/02/2017
>  Call Trace:
>   dump_stack+0x61/0x7e
>   check_preemption_disabled+0xd4/0xe6
>   debug_smp_processor_id+0x17/0x19
>   set_hv_tscchange_cb+0x1b/0x89
>   kvm_arch_init+0x14a/0x163 [kvm]
>   kvm_init+0x30/0x259 [kvm]
>   vmx_init+0xed/0x3db [kvm_intel]
>   do_one_initcall+0x89/0x1bc
>   do_init_module+0x5f/0x207
>   load_module+0x1b34/0x209b
>   __ia32_sys_init_module+0x17/0x19
>   do_fast_syscall_32+0x121/0x1fa
>   entry_SYSENTER_compat+0x7f/0x91

Hm, I never noticed this one, you probably need something like
CONFIG_PREEMPT enabled so see it.

>
> The easiest solution seems to be disabling preemption while setting up
> reenlightment MSRs. While at it, fix hv_cpu_*() callbacks.
>
> Fixes: 93286261de1b4 ("x86/hyperv: Reenlightenment notifications
> support")
>
> Cc: Andy Lutomirski 
> Cc: Borislav Petkov 
> Cc: Cathy Avery 
> Cc: Haiyang Zhang 
> Cc: "H. Peter Anvin" 
> Cc: Ingo Molnar 
> Cc: "K. Y. Srinivasan" 
> Cc: "Michael Kelley (EOSG)" 
> Cc: Mohammed Gamal 
> Cc: Paolo Bonzini 
> Cc: Radim Krčmář 
> Cc: Roman Kagan 
> Cc: Sasha Levin 
> Cc: Stephen Hemminger 
> Cc: Thomas Gleixner 
> Cc: Vitaly Kuznetsov 
>
> Cc: de...@linuxdriverproject.org
> Cc: k...@vger.kernel.org
> Cc: linux-hyp...@vger.kernel.org
> Cc: x...@kernel.org
> Reported-by: Prasanna Panchamukhi 
> Signed-off-by: Dmitry Safonov 
> ---
>  arch/x86/hyperv/hv_init.c | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
> index 1608050e9df9..0bdd79ecbff8 100644
> --- a/arch/x86/hyperv/hv_init.c
> +++ b/arch/x86/hyperv/hv_init.c
> @@ -91,7 +91,7 @@ EXPORT_SYMBOL_GPL(hv_max_vp_index);
>  static int hv_cpu_init(unsigned int cpu)
>  {
>   u64 msr_vp_index;
> - struct hv_vp_assist_page **hvp = _vp_assist_page[smp_processor_id()];
> + struct hv_vp_assist_page **hvp = _vp_assist_page[cpu];
>   void **input_arg;
>   struct page *pg;
>  
> @@ -103,7 +103,7 @@ static int hv_cpu_init(unsigned int cpu)
>  
>   hv_get_vp_index(msr_vp_index);
>  
> - hv_vp_index[smp_processor_id()] = msr_vp_index;
> + hv_vp_index[cpu] = msr_vp_index;
>  
>   if (msr_vp_index > hv_max_vp_index)
>   hv_max_vp_index = msr_vp_index;

The above is unrelated cleanup (as cpu == smp_processor_id() for
CPUHP_AP_ONLINE_DYN callbacks), right? As I'm pretty sure these can'd be
preempted.

> @@ -182,7 +182,6 @@ void set_hv_tscchange_cb(void (*cb)(void))
>   struct hv_reenlightenment_control re_ctrl = {
>   .vector = HYPERV_REENLIGHTENMENT_VECTOR,
>   .enabled = 1,
> - .target_vp = hv_vp_index[smp_processor_id()]
>   };
>   struct hv_tsc_emulation_control emu_ctrl = {.enabled = 1};
>  
> @@ -196,7 +195,11 @@ void set_hv_tscchange_cb(void (*cb)(void))
>   /* Make sure callback is registered before we write to MSRs */
>   wmb();
>  
> + preempt_disable();
> + re_ctrl.target_vp = hv_vp_index[smp_processor_id()];
>   wrmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)_ctrl));
> + preempt_enable();
> +

My personal preference would be to do something like
   int cpu = get_cpu();

   ... set things up ...

   put_cpu();

instead, there are no long-running things in the whole function. But
what you've done should work too, so

Reviewed-by: Vitaly Kuznetsov 

>   wrmsrl(HV_X64_MSR_TSC_EMULATION_CONTROL, *((u64 *)_ctrl));
>  }
>  EXPORT_SYMBOL_GPL(set_hv_tscchange_cb);

-- 
Vitaly
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] staging: kpc2000: remove unnecessary comments in kp2000_pcie_probe

2019-06-12 Thread Simon Sandström
On 12/06, Greg KH wrote:
> On Wed, Jun 12, 2019 at 10:39:36AM +0300, Dan Carpenter wrote:
> > On Mon, Jun 10, 2019 at 10:05:35PM +0200, Simon Sandström wrote:
> > > @@ -349,9 +340,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
> > >   goto err_remove_ida;
> > >   }
> > >  
> > > - /*
> > > -  * Step 4: Setup the Register BAR
> > > -  */
> > > + // Setup the Register BAR
> > 
> > Greg, are we moving the C++ style comments?  Linus is fine with them.  I
> > don't like them but whatever...
> 
> I don't like them either.  I'm only "ok" with them on the very first
> line of the file.  Linus chose // to make it "stand out" from the normal
> flow of the file, which is fine for an SPDX line.  So putting these in
> here like this is not ok to me.
> 
> thanks,
> 
> greg k-h

I changed them to C++ style so that they would match the other comments
in the file, which are C++ style, but I guess that it should have been
done the other way around with the C++ style changed to C style.

Good to know. I'll change them back and send a v2.

- Simon
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] media: meson: vdec: Add missing kthread.h

2019-06-12 Thread YueHaibing
Fix building error:

drivers/staging/media/meson/vdec/vdec.c: In function vdec_recycle_thread:
drivers/staging/media/meson/vdec/vdec.c:59:10: error: implicit declaration
 of function kthread_should_stop;
 did you mean thread_saved_sp? [-Werror=implicit-function-declaration]

Reported-by: Hulk Robot 
Fixes: 3e7f51bd9607 ("media: meson: add v4l2 m2m video decoder driver")
Signed-off-by: YueHaibing 
---
 drivers/staging/media/meson/vdec/vdec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/media/meson/vdec/vdec.c 
b/drivers/staging/media/meson/vdec/vdec.c
index 4e4f9d6..0a1a04f 100644
--- a/drivers/staging/media/meson/vdec/vdec.c
+++ b/drivers/staging/media/meson/vdec/vdec.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-- 
2.7.4


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] media: imx7-media-csi: get csi upstream endpoint

2019-06-12 Thread Rui Miguel Silva
When the upstream endpoint is neither a mux nor a CSI2 module, just get
the source pad directly upstream from the CSI.

Fixes: 05f634040c0d ("media: staging/imx7: add imx7 CSI subdev driver")
Reported-by: Sebastien Szymanski 
Signed-off-by: Rui Miguel Silva 
---
v1->v2:
Dan Carpenter:
  - s/in/is/
  - align code, and white space fix.

 drivers/staging/media/imx/imx7-media-csi.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/staging/media/imx/imx7-media-csi.c 
b/drivers/staging/media/imx/imx7-media-csi.c
index 9101566f3f67..f775870df7e0 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -442,6 +442,14 @@ static int imx7_csi_get_upstream_endpoint(struct imx7_csi 
*csi,
 
src = >src_sd->entity;
 
+   /*
+* if the source is neither a mux or csi2 get the one directly upstream
+* from this csi
+*/
+   if (src->function != MEDIA_ENT_F_VID_IF_BRIDGE &&
+   src->function != MEDIA_ENT_F_VID_MUX)
+   src = >sd.entity;
+
 skip_video_mux:
/* get source pad of entity directly upstream from src */
pad = imx_media_pipeline_pad(src, 0, 0, true);
-- 
2.22.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] media: imx7-media-csi: get csi upstream endpoint

2019-06-12 Thread Rui Miguel Silva
Hi Dan,
On Wed 12 Jun 2019 at 08:43, Dan Carpenter wrote:
> On Tue, Jun 11, 2019 at 04:09:55PM +0100, Rui Miguel Silva wrote:
>> When the upstream endpoint is neither a mux nor a CSI2 module, just get
>> the source pad directly upstream from the CSI.
>>
>> Fixes: 05f634040c0d ("media: staging/imx7: add imx7 CSI subdev driver")
>> Reported-by: Sebastien Szymanski 
>> Signed-off-by: Rui Miguel Silva 
>> ---
>>  drivers/staging/media/imx/imx7-media-csi.c | 8 
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/staging/media/imx/imx7-media-csi.c 
>> b/drivers/staging/media/imx/imx7-media-csi.c
>> index 9101566f3f67..8979ee0c8202 100644
>> --- a/drivers/staging/media/imx/imx7-media-csi.c
>> +++ b/drivers/staging/media/imx/imx7-media-csi.c
>> @@ -442,6 +442,14 @@ static int imx7_csi_get_upstream_endpoint(struct 
>> imx7_csi *csi,
>>
>>  src = >src_sd->entity;
>>
>> +/*
>> + * if the source in neither a mux or csi2 get the one directly upstream
>  ^^
> is?

yup.

>
>> + * from this csi
>> + */
>> +if (src->function != MEDIA_ENT_F_VID_IF_BRIDGE &&
>> +src->function != MEDIA_ENT_F_VID_MUX)
>> +src = >sd.entity;
>
> This would be easier to read if the white space were tweaked a little:
>
>   if (src->function != MEDIA_ENT_F_VID_IF_BRIDGE &&
>   src->function != MEDIA_ENT_F_VID_MUX)
>   src = >sd.entity;

Agreed, Thanks for the feedback.

---
Cheers,
Rui

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[driver-core:debugfs_cleanup 77/78] drivers/net/wireless/intel/iwlegacy/4965-rs.c:2779:42: error: void value not ignored as it ought to be

2019-06-12 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 
debugfs_cleanup
head:   0c2872ff925dd9b66e3f636d01221fb27859f3f3
commit: 2cd2d7ff48151c0a5326606dbc48a00df3a4d596 [77/78] debugfs: remove return 
value of debugfs_create_u8()
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.4.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 2cd2d7ff48151c0a5326606dbc48a00df3a4d596
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=sparc64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

   drivers/net/wireless/intel/iwlegacy/4965-rs.c: In function 
'il4965_rs_add_debugfs':
>> drivers/net/wireless/intel/iwlegacy/4965-rs.c:2779:42: error: void value not 
>> ignored as it ought to be
 lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file =
 ^

vim +2779 drivers/net/wireless/intel/iwlegacy/4965-rs.c

be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21  2765  
e7392364 drivers/net/wireless/iwlegacy/4965-rs.c   Stanislaw Gruszka 
2011-11-15  2766  static void
e7392364 drivers/net/wireless/iwlegacy/4965-rs.c   Stanislaw Gruszka 
2011-11-15  2767  il4965_rs_add_debugfs(void *il, void *il_sta, struct dentry 
*dir)
be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21  2768  {
46bc8d4b drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Stanislaw Gruszka 
2011-10-24  2769   struct il_lq_sta *lq_sta = il_sta;
be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21  2770   lq_sta->rs_sta_dbgfs_scale_table_file =
2ef00c53 drivers/net/wireless/intel/iwlegacy/4965-rs.c Joe Perches   
2018-03-23  2771   debugfs_create_file("rate_scale_table", 0600, dir,
be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21  2772   lq_sta, 
_sta_dbgfs_scale_table_ops);
be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21  2773   lq_sta->rs_sta_dbgfs_stats_table_file =
2ef00c53 drivers/net/wireless/intel/iwlegacy/4965-rs.c Joe Perches   
2018-03-23  2774   debugfs_create_file("rate_stats_table", 0400, dir, 
lq_sta,
e7392364 drivers/net/wireless/iwlegacy/4965-rs.c   Stanislaw Gruszka 
2011-11-15  2775   _sta_dbgfs_stats_table_ops);
be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21  2776   lq_sta->rs_sta_dbgfs_rate_scale_data_file =
2ef00c53 drivers/net/wireless/intel/iwlegacy/4965-rs.c Joe Perches   
2018-03-23  2777   debugfs_create_file("rate_scale_data", 0400, dir, 
lq_sta,
e7392364 drivers/net/wireless/iwlegacy/4965-rs.c   Stanislaw Gruszka 
2011-11-15  2778   
_sta_dbgfs_rate_scale_data_ops);
be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21 @2779   lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file =
2ef00c53 drivers/net/wireless/intel/iwlegacy/4965-rs.c Joe Perches   
2018-03-23  2780   debugfs_create_u8("tx_agg_tid_enable", 0600, dir,
be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21  2781 _sta->tx_agg_tid_en);
be663ab6 drivers/net/wireless/iwlegacy/iwl-4965-rs.c   Wey-Yi Guy
2011-02-21  2782  

:: The code at line 2779 was first introduced by commit
:: be663ab67077fac8e23eb8e231a8c1c94cb32e54 iwlwifi: split the drivers for 
agn and legacy devices 3945/4965

:: TO: Wey-Yi Guy 
:: CC: Wey-Yi Guy 

---
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


[PATCH] staging: most: register net and video config subsystems with configFS

2019-06-12 Thread Christian Gromm
This patch makes the core components net and video register their config
subsystems with configFS. It is needed to have the configuration interface
of the modules exposed to user space.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/net/net.c | 12 +++-
 drivers/staging/most/video/video.c | 12 +++-
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c
index c8a64e2..3fc80ad 100644
--- a/drivers/staging/most/net/net.c
+++ b/drivers/staging/most/net/net.c
@@ -507,9 +507,19 @@ static struct core_component comp = {
 
 static int __init most_net_init(void)
 {
+   int err;
+
spin_lock_init(_lock);
mutex_init(_disc_mt);
-   return most_register_component();
+   err = most_register_component();
+   if (err)
+   return err;
+   err = most_register_configfs_subsys();
+   if (err) {
+   most_deregister_component();
+   return err;
+   }
+   return 0;
 }
 
 static void __exit most_net_exit(void)
diff --git a/drivers/staging/most/video/video.c 
b/drivers/staging/most/video/video.c
index adca250..72622eb 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -540,8 +540,18 @@ static struct core_component comp = {
 
 static int __init comp_init(void)
 {
+   int err;
+
spin_lock_init(_lock);
-   return most_register_component();
+   err = most_register_component();
+   if (err)
+   return err;
+   err = most_register_configfs_subsys();
+   if (err) {
+   most_deregister_component();
+   return err;
+   }
+   return 0;
 }
 
 static void __exit comp_exit(void)
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[driver-core:debugfs_cleanup 77/78] drivers/net//wireless/intel/iwlwifi/dvm/rs.c:3283:42: error: void value not ignored as it ought to be

2019-06-12 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 
debugfs_cleanup
head:   0c2872ff925dd9b66e3f636d01221fb27859f3f3
commit: 2cd2d7ff48151c0a5326606dbc48a00df3a4d596 [77/78] debugfs: remove return 
value of debugfs_create_u8()
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.4.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 2cd2d7ff48151c0a5326606dbc48a00df3a4d596
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=sparc64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):


vim +3283 drivers/net//wireless/intel/iwlwifi/dvm/rs.c

38167459d drivers/net/wireless/iwlwifi/iwl-agn-rs.c   Wey-Yi Guy 2009-05-08 
 3269  
93dc646ad drivers/net/wireless/iwlwifi/iwl-4965-rs.c  Zhu Yi 2007-09-27 
 3270  static void rs_add_debugfs(void *priv, void *priv_sta,
93dc646ad drivers/net/wireless/iwlwifi/iwl-4965-rs.c  Zhu Yi 2007-09-27 
 3271   struct dentry *dir)
93dc646ad drivers/net/wireless/iwlwifi/iwl-4965-rs.c  Zhu Yi 2007-09-27 
 3272  {
e227ceac8 drivers/net/wireless/iwlwifi/iwl-agn-rs.c   Tomas Winkler  2008-07-18 
 3273   struct iwl_lq_sta *lq_sta = priv_sta;
c33104f0a drivers/net/wireless/iwlwifi/iwl-4965-rs.c  Tomas Winkler  2008-01-14 
 3274   lq_sta->rs_sta_dbgfs_scale_table_file =
2ef00c530 drivers/net/wireless/intel/iwlwifi/dvm/rs.c Joe Perches2018-03-23 
 3275   debugfs_create_file("rate_scale_table", 0600, dir,
c33104f0a drivers/net/wireless/iwlwifi/iwl-4965-rs.c  Tomas Winkler  2008-01-14 
 3276   lq_sta, _sta_dbgfs_scale_table_ops);
c33104f0a drivers/net/wireless/iwlwifi/iwl-4965-rs.c  Tomas Winkler  2008-01-14 
 3277   lq_sta->rs_sta_dbgfs_stats_table_file =
2ef00c530 drivers/net/wireless/intel/iwlwifi/dvm/rs.c Joe Perches2018-03-23 
 3278   debugfs_create_file("rate_stats_table", 0400, dir,
c33104f0a drivers/net/wireless/iwlwifi/iwl-4965-rs.c  Tomas Winkler  2008-01-14 
 3279   lq_sta, _sta_dbgfs_stats_table_ops);
38167459d drivers/net/wireless/iwlwifi/iwl-agn-rs.c   Wey-Yi Guy 2009-05-08 
 3280   lq_sta->rs_sta_dbgfs_rate_scale_data_file =
2ef00c530 drivers/net/wireless/intel/iwlwifi/dvm/rs.c Joe Perches2018-03-23 
 3281   debugfs_create_file("rate_scale_data", 0400, dir,
38167459d drivers/net/wireless/iwlwifi/iwl-agn-rs.c   Wey-Yi Guy 2009-05-08 
 3282   lq_sta, _sta_dbgfs_rate_scale_data_ops);
0c11b4de5 drivers/net/wireless/iwlwifi/iwl-4965-rs.c  Ron Rindjunsky 2008-01-28 
@3283   lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file =
2ef00c530 drivers/net/wireless/intel/iwlwifi/dvm/rs.c Joe Perches2018-03-23 
 3284   debugfs_create_u8("tx_agg_tid_enable", 0600, dir,
0c11b4de5 drivers/net/wireless/iwlwifi/iwl-4965-rs.c  Ron Rindjunsky 2008-01-28 
 3285 _sta->tx_agg_tid_en);
0c11b4de5 drivers/net/wireless/iwlwifi/iwl-4965-rs.c  Ron Rindjunsky 2008-01-28 
 3286  

:: The code at line 3283 was first introduced by commit
:: 0c11b4de5d81771ba0fdc8a5d13d59ed01d41252 iwlwifi: A-MPDU Tx activation 
by load measures

:: TO: Ron Rindjunsky 
:: CC: John W. Linville 

---
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


[PATCH RESEND] staging: kpc2000: removed DMA AIO implementation.

2019-06-12 Thread Jeremy Sowden
The existing implementation for doing DMA via asynchronous IO didn't
work and there was no longer a use-case for it.  Removed it.

Fixed a few checkpatch warnings about too-long lines and extraneous
braces in the process.

Reported-by: Matt Sickler 
Signed-off-by: Jeremy Sowden 
---

 I mucked up the arguments to git-send-email and so I have resent the patch.

 drivers/staging/kpc2000/TODO  |   3 -
 drivers/staging/kpc2000/kpc_dma/fileops.c | 102 --
 .../staging/kpc2000/kpc_dma/kpc_dma_driver.h  |   2 -
 3 files changed, 21 insertions(+), 86 deletions(-)

diff --git a/drivers/staging/kpc2000/TODO b/drivers/staging/kpc2000/TODO
index 47530e23e940..9b5ab37fb3a0 100644
--- a/drivers/staging/kpc2000/TODO
+++ b/drivers/staging/kpc2000/TODO
@@ -1,5 +1,2 @@
 - the kpc_spi driver doesn't seem to let multiple transactions (to different 
instances of the core) happen in parallel...
 - The kpc_i2c driver is a hot mess, it should probably be cleaned up a ton.  
It functions against current hardware though.
-- would be nice if the AIO fileops in kpc_dma could be made to work
-- probably want to add a CONFIG_ option to control compilation of the AIO 
functions
-- if the AIO fileops in kpc_dma start working, next would be making iov_count 
> 1 work too
diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c 
b/drivers/staging/kpc2000/kpc_dma/fileops.c
index f80b01715d93..7feb2fde0db2 100644
--- a/drivers/staging/kpc2000/kpc_dma/fileops.c
+++ b/drivers/staging/kpc2000/kpc_dma/fileops.c
@@ -9,7 +9,6 @@
 #include /* size_t */
 #include 
 #include   /* copy_*_user */
-#include   /* aio stuff */
 #include 
 #include 
 #include "kpc_dma_driver.h"
@@ -32,8 +31,8 @@ unsigned int  count_parts_for_sge(struct scatterlist *sg)
 }
 
 /**  Transfer Helpers  **/
-static
-int  kpc_dma_transfer(struct dev_private_data *priv, struct kiocb *kcb, 
unsigned long iov_base, size_t iov_len)
+static int kpc_dma_transfer(struct dev_private_data *priv,
+   unsigned long iov_base, size_t iov_len)
 {
unsigned int i = 0;
long rv = 0;
@@ -65,7 +64,6 @@ int  kpc_dma_transfer(struct dev_private_data *priv, struct 
kiocb *kcb, unsigned
acd->ldev = priv->ldev;
acd->cpl = 
acd->flags = 0;
-   acd->kcb = kcb;
acd->len = iov_len;
acd->page_count = count_pages(iov_base, iov_len);
 
@@ -173,21 +171,18 @@ int  kpc_dma_transfer(struct dev_private_data *priv, 
struct kiocb *kcb, unsigned
 
unlock_engine(ldev);
 
-   // If this is a synchronous kiocb, we need to put the calling process 
to sleep until the transfer is complete
-   if (kcb == NULL || is_sync_kiocb(kcb)) {
-   rv = wait_for_completion_interruptible();
-   // If the user aborted (rv == -ERESTARTSYS), we're no longer 
responsible for cleaning up the acd
-   if (rv == -ERESTARTSYS) {
-   acd->cpl = NULL;
-   }
-   if (rv == 0) {
-   rv = acd->len;
-   kfree(acd);
-   }
-   return rv;
+   rv = wait_for_completion_interruptible();
+   /*
+* If the user aborted (rv == -ERESTARTSYS), we're no longer responsible
+* for cleaning up the acd
+*/
+   if (rv == -ERESTARTSYS)
+   acd->cpl = NULL;
+   if (rv == 0) {
+   rv = acd->len;
+   kfree(acd);
}
-
-   return -EIOCBQUEUED;
+   return rv;
 
  err_descr_too_many:
unlock_engine(ldev);
@@ -234,17 +229,13 @@ void  transfer_complete_cb(struct aio_cb_data *acd, 
size_t xfr_count, u32 flags)
 
acd->flags = flags;
 
-   if (acd->kcb == NULL || is_sync_kiocb(acd->kcb)) {
-   if (acd->cpl) {
-   complete(acd->cpl);
-   } else {
-   // There's no completion, so we're responsible for 
cleaning up the acd
-   kfree(acd);
-   }
+   if (acd->cpl) {
+   complete(acd->cpl);
} else {
-#ifdef CONFIG_KPC_DMA_AIO
-   aio_complete(acd->kcb, acd->len, acd->flags);
-#endif
+   /*
+* There's no completion, so we're responsible for cleaning up
+* the acd
+*/
kfree(acd);
}
 }
@@ -308,53 +299,6 @@ int  kpc_dma_close(struct inode *inode, struct file *filp)
return 0;
 }
 
-#ifdef CONFIG_KPC_DMA_AIO
-static
-int  kpc_dma_aio_cancel(struct kiocb *kcb)
-{
-   struct dev_private_data *priv = (struct dev_private_data 
*)kcb->ki_filp->private_data;
-
-   dev_dbg(>ldev->pldev->dev, "%s(kcb = [%p]) priv = [%p], ldev = 
[%p]\n", __func__, kcb, priv, priv->ldev);
-   return 0;
-}
-
-static
-ssize_t   kpc_dma_aio_read(struct kiocb *kcb, const struct iovec *iov, 
unsigned long iov_count, loff_t pos)
-{
-   struct dev_private_data *priv = (struct 

Re: [PATCH 2/2] staging: kpc2000: remove unnecessary comments in kp2000_pcie_probe

2019-06-12 Thread Greg KH
On Wed, Jun 12, 2019 at 10:39:36AM +0300, Dan Carpenter wrote:
> On Mon, Jun 10, 2019 at 10:05:35PM +0200, Simon Sandström wrote:
> > @@ -349,9 +340,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
> > goto err_remove_ida;
> > }
> >  
> > -   /*
> > -* Step 4: Setup the Register BAR
> > -*/
> > +   // Setup the Register BAR
> 
> Greg, are we moving the C++ style comments?  Linus is fine with them.  I
> don't like them but whatever...

I don't like them either.  I'm only "ok" with them on the very first
line of the file.  Linus chose // to make it "stand out" from the normal
flow of the file, which is fine for an SPDX line.  So putting these in
here like this is not ok to me.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 0/6] staging: kpc2000_dma: fixes for AIO file-ops.

2019-06-12 Thread Jeremy Sowden
On 2019-06-11, at 23:43:19 +, Matt Sickler wrote:
> >-Original Message-
> > From: Jeremy Sowden 
> > I've had a go at getting the DMA AIO working.  It compiles, but I
> > don't have access to the hardware, so I have done no more testing
> > than that.
>
> Honestly, it'd probably be better to just remove the AIO support
> entirely.  The one use case we had that could possibly have benefitted
> from AIO has been switched away from DMA entirely.  We switched
> because the DMA buffer was a couple hundred bytes and the overhead of
> setting up the DMA was killing throughput.  AIO *might* have been able
> to help there, but the userspace side of AIO is a PITA to work with.
> IMO, if "AIO" for the kpc_dma driver were to make a come back, I think
> it would be better to use something like io_uring The other things
> that use DMA wouldn't benefit from AIO as they have to setup other
> parts of the hardware that can't coordinate with the DMA controllers
> (or at least not without a lot of work).
>
> TL;DR: it's probably better to just kill the AIO parts of the driver
> than to try to make them work.
>
> >The fifth patch removes the cancel call-back because it is empty and
> >so doesn't serve any purpose (AFAICS).  However, it doesn't appear to
> >be too tricky to implement something that would abort the transfer in
> >the same manner that kpc_dma_close() if this would be useful.
>
> It's empty because I didn't have time to figure out how to cancel the
> DMA operation on the hardware side.  Doing the same "reset the whole
> engine" type of cancel could work, but I'm not sure how well that
> would mesh with aio_cancel (the latter would kill *all* in-flight
> operations, the former is only killing the one).  As I said above,
> it's probably better to just remove all the AIO pieces.

Righto.  I'll take them out.

J.


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] media: imx7-media-csi: get csi upstream endpoint

2019-06-12 Thread Dan Carpenter
On Tue, Jun 11, 2019 at 04:09:55PM +0100, Rui Miguel Silva wrote:
> When the upstream endpoint is neither a mux nor a CSI2 module, just get
> the source pad directly upstream from the CSI.
> 
> Fixes: 05f634040c0d ("media: staging/imx7: add imx7 CSI subdev driver")
> Reported-by: Sebastien Szymanski 
> Signed-off-by: Rui Miguel Silva 
> ---
>  drivers/staging/media/imx/imx7-media-csi.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/staging/media/imx/imx7-media-csi.c 
> b/drivers/staging/media/imx/imx7-media-csi.c
> index 9101566f3f67..8979ee0c8202 100644
> --- a/drivers/staging/media/imx/imx7-media-csi.c
> +++ b/drivers/staging/media/imx/imx7-media-csi.c
> @@ -442,6 +442,14 @@ static int imx7_csi_get_upstream_endpoint(struct 
> imx7_csi *csi,
>  
>   src = >src_sd->entity;
>  
> + /*
> +  * if the source in neither a mux or csi2 get the one directly upstream
 ^^
is?

> +  * from this csi
> +  */
> + if (src->function != MEDIA_ENT_F_VID_IF_BRIDGE &&
> + src->function != MEDIA_ENT_F_VID_MUX)
> + src = >sd.entity;

This would be easier to read if the white space were tweaked a little:

if (src->function != MEDIA_ENT_F_VID_IF_BRIDGE &&
src->function != MEDIA_ENT_F_VID_MUX)
src = >sd.entity;

regards,
dan carpenter


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] staging: kpc2000: remove unnecessary comments in kp2000_pcie_probe

2019-06-12 Thread Dan Carpenter
On Mon, Jun 10, 2019 at 10:05:35PM +0200, Simon Sandström wrote:
> @@ -349,9 +340,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
>   goto err_remove_ida;
>   }
>  
> - /*
> -  * Step 4: Setup the Register BAR
> -  */
> + // Setup the Register BAR

Greg, are we moving the C++ style comments?  Linus is fine with them.  I
don't like them but whatever...

>   reg_bar_phys_addr = pci_resource_start(pcard->pdev, REG_BAR);
>   reg_bar_phys_len = pci_resource_len(pcard->pdev, REG_BAR);
>  

regards,
dan carpenter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] staging: kpc2000: improve label names in kp2000_pcie_probe

2019-06-12 Thread Dan Carpenter
Thanks!

Reviewed-by: Dan Carpenter 

Not related to your patch (IOW ignore if you want to) the error handling
is slightly more complicated than required:

drivers/staging/kpc2000/kpc2000/core.c
   356   * Step 4: Setup the Register BAR
   357   */
   358  reg_bar_phys_addr = pci_resource_start(pcard->pdev, REG_BAR);
   359  reg_bar_phys_len = pci_resource_len(pcard->pdev, REG_BAR);
   360  
   361  pcard->regs_bar_base = ioremap_nocache(reg_bar_phys_addr, 
PAGE_SIZE);
   362  if (!pcard->regs_bar_base) {
   363  dev_err(>pdev->dev,
   364  "probe: REG_BAR could not remap memory to 
virtual space\n");
   365  err = -ENODEV;
   366  goto err_disable_device;
   367  }
   368  dev_dbg(>pdev->dev,
   369  "probe: REG_BAR virt hardware address start [%p]\n",
   370  pcard->regs_bar_base);
   371  
   372  err = pci_request_region(pcard->pdev, REG_BAR, 
KP_DRIVER_NAME_KP2000);
   373  if (err) {
   374  iounmap(pcard->regs_bar_base);

We could move this to the bottom of the function.  We would need to
re-order it slightly to free things in the mirror of how they are
allocated.  (Always just free the most recent allocation).

   375  dev_err(>pdev->dev,
   376  "probe: failed to acquire PCI region (%d)\n",
   377  err);
   378  err = -ENODEV;
   379  goto err_disable_device;
   380  }
   381  
   382  pcard->regs_base_resource.start = reg_bar_phys_addr;
   383  pcard->regs_base_resource.end   = reg_bar_phys_addr +
   384reg_bar_phys_len - 1;
   385  pcard->regs_base_resource.flags = IORESOURCE_MEM;
   386  
   387  /*
   388   * Step 5: Setup the DMA BAR
   389   */
   390  dma_bar_phys_addr = pci_resource_start(pcard->pdev, DMA_BAR);
   391  dma_bar_phys_len = pci_resource_len(pcard->pdev, DMA_BAR);
   392  
   393  pcard->dma_bar_base = ioremap_nocache(dma_bar_phys_addr,
   394dma_bar_phys_len);
   395  if (!pcard->dma_bar_base) {
   396  dev_err(>pdev->dev,
   397  "probe: DMA_BAR could not remap memory to 
virtual space\n");
   398  err = -ENODEV;
   399  goto err_unmap_regs;
   400  }
   401  dev_dbg(>pdev->dev,
   402  "probe: DMA_BAR virt hardware address start [%p]\n",
   403  pcard->dma_bar_base);
   404  
   405  pcard->dma_common_regs = pcard->dma_bar_base + 
KPC_DMA_COMMON_OFFSET;
   406  
   407  err = pci_request_region(pcard->pdev, DMA_BAR, "kp2000_pcie");
   408  if (err) {
   409  iounmap(pcard->dma_bar_base);

Same.

   410  dev_err(>pdev->dev,
   411  "probe: failed to acquire PCI region (%d)\n", 
err);
   412  err = -ENODEV;
   413  goto err_unmap_regs;
   414  }
   415  
   416  pcard->dma_base_resource.start = dma_bar_phys_addr;

[ snip ]

   509  dev_dbg(>pdev->dev, "%s() complete!\n", __func__);
   510  mutex_unlock(>sem);
   511  return 0;
   512  
   513  err_remove_sysfs:
   514  sysfs_remove_files(>dev.kobj, kp_attr_list);
   515  err_free_irq:
   516  free_irq(pcard->pdev->irq, pcard);
   517  err_disable_msi:
   518  pci_disable_msi(pcard->pdev);
   519  err_unmap_dma:
   520  iounmap(pcard->dma_bar_base);
   521  pci_release_region(pdev, DMA_BAR);
   522  pcard->dma_bar_base = NULL;
   523  err_unmap_regs:
   524  iounmap(pcard->regs_bar_base);
   525  pci_release_region(pdev, REG_BAR);
   526  pcard->regs_bar_base = NULL;

err_release_dma:
pci_release_region(pdev, DMA_BAR);
err_unmap_dma:
iounmap(pcard->dma_bar_base);
err_release_reg:
pci_release_region(pdev, REG_BAR);
err_unmap_reg:
iounmap(pcard->regs_bar_base);

I moved swapped the pci_release_region() and the iounmap() order.  There
is no need to set "pcard->regs_bar_base = NULL;" so just remove that.

   527  err_disable_device:
   528  pci_disable_device(pcard->pdev);
   529  err_remove_ida:
   530  mutex_unlock(>sem);
   531  ida_simple_remove(_num_ida, pcard->card_num);
   532  err_free_pcard:
   533  kfree(pcard);
   534  return err;
   535  }

regards,
dan carpenter
___
devel mailing list
de...@linuxdriverproject.org

[PATCH] staging: rtl8188eu: Change type of rtw_get_sec_ie()

2019-06-12 Thread Nishka Dasgupta
Change return type of function rtw_get_sec_ie from int to void and
remove its return statement as the return value is never stored, checked
or otherwise used.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 4 +---
 drivers/staging/rtl8188eu/include/ieee80211.h  | 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c 
b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
index 797ffa6e64d5..28b3cdd10397 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
@@ -482,7 +482,7 @@ int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int 
*group_cipher, int *pairwi
return ret;
 }
 
-int rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 
*wpa_ie, u16 *wpa_len)
+void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 
*wpa_ie, u16 *wpa_len)
 {
u8 authmode, sec_idx, i;
u8 wpa_oui[4] = {0x0, 0x50, 0xf2, 0x01};
@@ -539,8 +539,6 @@ int rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 
*rsn_len, u8 *wpa_ie,
}
}
}
-
-   return *rsn_len + *wpa_len;
 }
 
 u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen)
diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h 
b/drivers/staging/rtl8188eu/include/ieee80211.h
index 42ee4ebe90eb..d569fe5ed8e6 100644
--- a/drivers/staging/rtl8188eu/include/ieee80211.h
+++ b/drivers/staging/rtl8188eu/include/ieee80211.h
@@ -743,8 +743,8 @@ int rtw_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int 
*group_cipher,
 int rtw_parse_wpa2_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
  int *pairwise_cipher, int *is_8021x);
 
-int rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len,
-  u8 *wpa_ie, u16 *wpa_len);
+void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len,
+   u8 *wpa_ie, u16 *wpa_len);
 
 u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen);
 u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen);
-- 
2.19.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel