diff mbox series

[-next] intel/iwlwifi: use DEFINE_MUTEX (and mutex_init() had been too late)

Message ID 20201223141152.32564-1-zhengyongjun3@huawei.com
State New
Delegated to: Luca Coelho
Headers show
Series [-next] intel/iwlwifi: use DEFINE_MUTEX (and mutex_init() had been too late) | expand

Commit Message

Zheng Yongjun Dec. 23, 2020, 2:11 p.m. UTC
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Heiner Kallweit Dec. 23, 2020, 3:02 p.m. UTC | #1
On 23.12.2020 15:11, Zheng Yongjun wrote:
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> ---
>  drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
> index 9dcd2e990c9c..71119044382f 100644
> --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
> +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
> @@ -133,7 +133,7 @@ enum {
>  };
>  
>  /* Protects the table contents, i.e. the ops pointer & drv list */
> -static struct mutex iwlwifi_opmode_table_mtx;
> +static DEFINE_MUTEX(iwlwifi_opmode_table_mtx);
>  static struct iwlwifi_opmode_table {
>  	const char *name;			/* name: iwldvm, iwlmvm, etc */
>  	const struct iwl_op_mode_ops *ops;	/* pointer to op_mode ops */
> @@ -1786,8 +1786,6 @@ static int __init iwl_drv_init(void)
>  {
>  	int i, err;
>  
> -	mutex_init(&iwlwifi_opmode_table_mtx);
> -
>  	for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++)
>  		INIT_LIST_HEAD(&iwlwifi_opmode_table[i].drv);
>  
> 
The change itself is ok, but:
- commit message is missing (did you run checkpatch?)
- Why should the current mutex_init() call be too late?
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index 9dcd2e990c9c..71119044382f 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -133,7 +133,7 @@  enum {
 };
 
 /* Protects the table contents, i.e. the ops pointer & drv list */
-static struct mutex iwlwifi_opmode_table_mtx;
+static DEFINE_MUTEX(iwlwifi_opmode_table_mtx);
 static struct iwlwifi_opmode_table {
 	const char *name;			/* name: iwldvm, iwlmvm, etc */
 	const struct iwl_op_mode_ops *ops;	/* pointer to op_mode ops */
@@ -1786,8 +1786,6 @@  static int __init iwl_drv_init(void)
 {
 	int i, err;
 
-	mutex_init(&iwlwifi_opmode_table_mtx);
-
 	for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++)
 		INIT_LIST_HEAD(&iwlwifi_opmode_table[i].drv);