All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next 1/2] mISDN: Use DEFINE_SPINLOCK() for spinlock
@ 2021-03-29  9:40 Shixin Liu
  2021-03-29  9:40 ` [PATCH -next 2/2] mISDN: Use LIST_HEAD() for list_head Shixin Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Shixin Liu @ 2021-03-29  9:40 UTC (permalink / raw)
  To: Karsten Keil; +Cc: netdev, linux-kernel, Shixin Liu

spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().

Signed-off-by: Shixin Liu <liushixin2@huawei.com>
---
 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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH -next 2/2] mISDN: Use LIST_HEAD() for list_head
  2021-03-29  9:40 [PATCH -next 1/2] mISDN: Use DEFINE_SPINLOCK() for spinlock Shixin Liu
@ 2021-03-29  9:40 ` Shixin Liu
  2021-03-29 14:06     ` kernel test robot
  0 siblings, 1 reply; 4+ messages in thread
From: Shixin Liu @ 2021-03-29  9:40 UTC (permalink / raw)
  To: Karsten Keil; +Cc: netdev, linux-kernel, Shixin Liu

There's no need to declare a list and then init it manually,
just use the LIST_HEAD() macro.

Signed-off-by: Shixin Liu <liushixin2@huawei.com>
---
 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..d541b487176a 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;
+struct LIST_HEAD(dsp_ilist);
+struct 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;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -next 2/2] mISDN: Use LIST_HEAD() for list_head
  2021-03-29  9:40 ` [PATCH -next 2/2] mISDN: Use LIST_HEAD() for list_head Shixin Liu
@ 2021-03-29 14:06     ` kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2021-03-29 14:06 UTC (permalink / raw)
  To: Shixin Liu, Karsten Keil; +Cc: kbuild-all, netdev, linux-kernel, Shixin Liu

[-- Attachment #1: Type: text/plain, Size: 3015 bytes --]

Hi Shixin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20210326]

url:    https://github.com/0day-ci/linux/commits/Shixin-Liu/mISDN-Use-DEFINE_SPINLOCK-for-spinlock/20210329-174318
base:    931294922e65a23e1aad6398b9ae02df74044679
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/84af06fb48f2fff97ae6c5788eb4c572ee2c64e6
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Shixin-Liu/mISDN-Use-DEFINE_SPINLOCK-for-spinlock/20210329-174318
        git checkout 84af06fb48f2fff97ae6c5788eb4c572ee2c64e6
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/preempt.h:11,
                    from include/linux/spinlock.h:51,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:6,
                    from drivers/isdn/mISDN/dsp_core.c:155:
>> include/linux/list.h:24:2: error: expected '{' before 'struct'
      24 |  struct list_head name = LIST_HEAD_INIT(name)
         |  ^~~~~~
   drivers/isdn/mISDN/dsp_core.c:180:8: note: in expansion of macro 'LIST_HEAD'
     180 | struct LIST_HEAD(dsp_ilist);
         |        ^~~~~~~~~
>> include/linux/list.h:24:2: error: two or more data types in declaration specifiers
      24 |  struct list_head name = LIST_HEAD_INIT(name)
         |  ^~~~~~
   drivers/isdn/mISDN/dsp_core.c:180:8: note: in expansion of macro 'LIST_HEAD'
     180 | struct LIST_HEAD(dsp_ilist);
         |        ^~~~~~~~~
>> include/linux/list.h:24:2: error: expected '{' before 'struct'
      24 |  struct list_head name = LIST_HEAD_INIT(name)
         |  ^~~~~~
   drivers/isdn/mISDN/dsp_core.c:181:8: note: in expansion of macro 'LIST_HEAD'
     181 | struct LIST_HEAD(conf_ilist);
         |        ^~~~~~~~~
>> include/linux/list.h:24:2: error: two or more data types in declaration specifiers
      24 |  struct list_head name = LIST_HEAD_INIT(name)
         |  ^~~~~~
   drivers/isdn/mISDN/dsp_core.c:181:8: note: in expansion of macro 'LIST_HEAD'
     181 | struct LIST_HEAD(conf_ilist);
         |        ^~~~~~~~~


vim +24 include/linux/list.h

^1da177e4c3f41 Linus Torvalds 2005-04-16  22  
^1da177e4c3f41 Linus Torvalds 2005-04-16  23  #define LIST_HEAD(name) \
^1da177e4c3f41 Linus Torvalds 2005-04-16 @24  	struct list_head name = LIST_HEAD_INIT(name)
^1da177e4c3f41 Linus Torvalds 2005-04-16  25  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 67772 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next 2/2] mISDN: Use LIST_HEAD() for list_head
@ 2021-03-29 14:06     ` kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2021-03-29 14:06 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3083 bytes --]

Hi Shixin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20210326]

url:    https://github.com/0day-ci/linux/commits/Shixin-Liu/mISDN-Use-DEFINE_SPINLOCK-for-spinlock/20210329-174318
base:    931294922e65a23e1aad6398b9ae02df74044679
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/84af06fb48f2fff97ae6c5788eb4c572ee2c64e6
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Shixin-Liu/mISDN-Use-DEFINE_SPINLOCK-for-spinlock/20210329-174318
        git checkout 84af06fb48f2fff97ae6c5788eb4c572ee2c64e6
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/preempt.h:11,
                    from include/linux/spinlock.h:51,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:6,
                    from drivers/isdn/mISDN/dsp_core.c:155:
>> include/linux/list.h:24:2: error: expected '{' before 'struct'
      24 |  struct list_head name = LIST_HEAD_INIT(name)
         |  ^~~~~~
   drivers/isdn/mISDN/dsp_core.c:180:8: note: in expansion of macro 'LIST_HEAD'
     180 | struct LIST_HEAD(dsp_ilist);
         |        ^~~~~~~~~
>> include/linux/list.h:24:2: error: two or more data types in declaration specifiers
      24 |  struct list_head name = LIST_HEAD_INIT(name)
         |  ^~~~~~
   drivers/isdn/mISDN/dsp_core.c:180:8: note: in expansion of macro 'LIST_HEAD'
     180 | struct LIST_HEAD(dsp_ilist);
         |        ^~~~~~~~~
>> include/linux/list.h:24:2: error: expected '{' before 'struct'
      24 |  struct list_head name = LIST_HEAD_INIT(name)
         |  ^~~~~~
   drivers/isdn/mISDN/dsp_core.c:181:8: note: in expansion of macro 'LIST_HEAD'
     181 | struct LIST_HEAD(conf_ilist);
         |        ^~~~~~~~~
>> include/linux/list.h:24:2: error: two or more data types in declaration specifiers
      24 |  struct list_head name = LIST_HEAD_INIT(name)
         |  ^~~~~~
   drivers/isdn/mISDN/dsp_core.c:181:8: note: in expansion of macro 'LIST_HEAD'
     181 | struct LIST_HEAD(conf_ilist);
         |        ^~~~~~~~~


vim +24 include/linux/list.h

^1da177e4c3f41 Linus Torvalds 2005-04-16  22  
^1da177e4c3f41 Linus Torvalds 2005-04-16  23  #define LIST_HEAD(name) \
^1da177e4c3f41 Linus Torvalds 2005-04-16 @24  	struct list_head name = LIST_HEAD_INIT(name)
^1da177e4c3f41 Linus Torvalds 2005-04-16  25  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 67772 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-29 14:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29  9:40 [PATCH -next 1/2] mISDN: Use DEFINE_SPINLOCK() for spinlock Shixin Liu
2021-03-29  9:40 ` [PATCH -next 2/2] mISDN: Use LIST_HEAD() for list_head Shixin Liu
2021-03-29 14:06   ` kernel test robot
2021-03-29 14:06     ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.