From patchwork Tue Mar 30 02:24:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Shixin X-Patchwork-Id: 12171441 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F428C433E1 for ; Tue, 30 Mar 2021 02:25:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1651361990 for ; Tue, 30 Mar 2021 02:25:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231283AbhC3CY7 (ORCPT ); Mon, 29 Mar 2021 22:24:59 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:15388 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230337AbhC3CYm (ORCPT ); Mon, 29 Mar 2021 22:24:42 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4F8YBp1hwNzmVBQ; Tue, 30 Mar 2021 10:22:58 +0800 (CST) Received: from huawei.com (10.175.113.32) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.498.0; Tue, 30 Mar 2021 10:24:28 +0800 From: Shixin Liu To: Karsten Keil CC: , , Shixin Liu Subject: [PATCH -next v2 1/2] mISDN: Use DEFINE_SPINLOCK() for spinlock Date: Tue, 30 Mar 2021 10:24:14 +0800 Message-ID: <20210330022416.528300-1-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org spinlock can be initialized automatically with DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init(). Changelog: From v1: 1. fix the mistake reported by kernel test robot. Signed-off-by: Shixin Liu --- drivers/isdn/hardware/mISDN/hfcmulti.c | 7 ++----- drivers/isdn/mISDN/dsp_core.c | 3 +-- drivers/isdn/mISDN/l1oip_core.c | 3 +-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c index 14092152b786..4f7eaa17fb27 100644 --- a/drivers/isdn/hardware/mISDN/hfcmulti.c +++ b/drivers/isdn/hardware/mISDN/hfcmulti.c @@ -173,13 +173,13 @@ #define MAX_FRAGS (32 * MAX_CARDS) static LIST_HEAD(HFClist); -static spinlock_t HFClock; /* global hfc list lock */ +static DEFINE_SPINLOCK(HFClock); /* global hfc list lock */ static void ph_state_change(struct dchannel *); static struct hfc_multi *syncmaster; static int plxsd_master; /* if we have a master card (yet) */ -static spinlock_t plx_lock; /* may not acquire other lock inside */ +static DEFINE_SPINLOCK(plx_lock); /* may not acquire other lock inside */ #define TYP_E1 1 #define TYP_4S 4 @@ -5480,9 +5480,6 @@ HFCmulti_init(void) printk(KERN_DEBUG "%s: IRQ_DEBUG IS ENABLED!\n", __func__); #endif - spin_lock_init(&HFClock); - spin_lock_init(&plx_lock); - if (debug & DEBUG_HFCMULTI_INIT) printk(KERN_DEBUG "%s: init entered\n", __func__); diff --git a/drivers/isdn/mISDN/dsp_core.c b/drivers/isdn/mISDN/dsp_core.c index 4946ea14bf74..8766095cd6e7 100644 --- a/drivers/isdn/mISDN/dsp_core.c +++ b/drivers/isdn/mISDN/dsp_core.c @@ -176,7 +176,7 @@ MODULE_LICENSE("GPL"); /*int spinnest = 0;*/ -spinlock_t dsp_lock; /* global dsp lock */ +DEFINE_SPINLOCK(dsp_lock); /* global dsp lock */ struct list_head dsp_ilist; struct list_head conf_ilist; int dsp_debug; @@ -1169,7 +1169,6 @@ static int __init dsp_init(void) printk(KERN_INFO "mISDN_dsp: DSP clocks every %d samples. This equals " "%d jiffies.\n", dsp_poll, dsp_tics); - spin_lock_init(&dsp_lock); INIT_LIST_HEAD(&dsp_ilist); INIT_LIST_HEAD(&conf_ilist); diff --git a/drivers/isdn/mISDN/l1oip_core.c b/drivers/isdn/mISDN/l1oip_core.c index facbd886ee1c..62fad8f1fc42 100644 --- a/drivers/isdn/mISDN/l1oip_core.c +++ b/drivers/isdn/mISDN/l1oip_core.c @@ -229,7 +229,7 @@ static const char *l1oip_revision = "2.00"; static int l1oip_cnt; -static spinlock_t l1oip_lock; +static DEFINE_SPINLOCK(l1oip_lock); static struct list_head l1oip_ilist; #define MAX_CARDS 16 @@ -1441,7 +1441,6 @@ l1oip_init(void) l1oip_revision); INIT_LIST_HEAD(&l1oip_ilist); - spin_lock_init(&l1oip_lock); if (l1oip_4bit_alloc(ulaw)) return -ENOMEM; From patchwork Tue Mar 30 02:24:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Shixin X-Patchwork-Id: 12171443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83402C433E2 for ; Tue, 30 Mar 2021 02:25:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5223661989 for ; Tue, 30 Mar 2021 02:25:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231295AbhC3CZA (ORCPT ); Mon, 29 Mar 2021 22:25:00 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:15387 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231289AbhC3CYn (ORCPT ); Mon, 29 Mar 2021 22:24:43 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4F8YBp1vN5zmVBS; Tue, 30 Mar 2021 10:22:58 +0800 (CST) Received: from huawei.com (10.175.113.32) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.498.0; Tue, 30 Mar 2021 10:24:29 +0800 From: Shixin Liu To: Karsten Keil CC: , , Shixin Liu Subject: [PATCH -next v2 2/2] mISDN: Use LIST_HEAD() for list_head Date: Tue, 30 Mar 2021 10:24:15 +0800 Message-ID: <20210330022416.528300-2-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210330022416.528300-1-liushixin2@huawei.com> References: <20210330022416.528300-1-liushixin2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org There's no need to declare a list and then init it manually, just use the LIST_HEAD() macro. Signed-off-by: Shixin Liu --- drivers/isdn/mISDN/dsp_core.c | 7 ++----- drivers/isdn/mISDN/l1oip_core.c | 4 +--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/isdn/mISDN/dsp_core.c b/drivers/isdn/mISDN/dsp_core.c index 8766095cd6e7..386084530c2f 100644 --- a/drivers/isdn/mISDN/dsp_core.c +++ b/drivers/isdn/mISDN/dsp_core.c @@ -177,8 +177,8 @@ MODULE_LICENSE("GPL"); /*int spinnest = 0;*/ DEFINE_SPINLOCK(dsp_lock); /* global dsp lock */ -struct list_head dsp_ilist; -struct list_head conf_ilist; +LIST_HEAD(dsp_ilist); +LIST_HEAD(conf_ilist); int dsp_debug; int dsp_options; int dsp_poll, dsp_tics; @@ -1169,9 +1169,6 @@ static int __init dsp_init(void) printk(KERN_INFO "mISDN_dsp: DSP clocks every %d samples. This equals " "%d jiffies.\n", dsp_poll, dsp_tics); - INIT_LIST_HEAD(&dsp_ilist); - INIT_LIST_HEAD(&conf_ilist); - /* init conversion tables */ dsp_audio_generate_law_tables(); dsp_silence = (dsp_options & DSP_OPT_ULAW) ? 0xff : 0x2a; diff --git a/drivers/isdn/mISDN/l1oip_core.c b/drivers/isdn/mISDN/l1oip_core.c index 62fad8f1fc42..2c40412466e6 100644 --- a/drivers/isdn/mISDN/l1oip_core.c +++ b/drivers/isdn/mISDN/l1oip_core.c @@ -230,7 +230,7 @@ static const char *l1oip_revision = "2.00"; static int l1oip_cnt; static DEFINE_SPINLOCK(l1oip_lock); -static struct list_head l1oip_ilist; +static LIST_HEAD(l1oip_ilist); #define MAX_CARDS 16 static u_int type[MAX_CARDS]; @@ -1440,8 +1440,6 @@ l1oip_init(void) printk(KERN_INFO "mISDN: Layer-1-over-IP driver Rev. %s\n", l1oip_revision); - INIT_LIST_HEAD(&l1oip_ilist); - if (l1oip_4bit_alloc(ulaw)) return -ENOMEM;