[PATCH -next] dca: use DEFINE_SPINLOCK() for spinlock and DEFINE_IDR() for idr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
Signed-off-by: Ye Bin <yebin10@xxxxxxxxxx>
---
 drivers/dca/dca-sysfs.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/dca/dca-sysfs.c b/drivers/dca/dca-sysfs.c
index 21ebd0af268b..c56e917f0f19 100644
--- a/drivers/dca/dca-sysfs.c
+++ b/drivers/dca/dca-sysfs.c
@@ -14,8 +14,8 @@
 #include <linux/export.h>
 
 static struct class *dca_class;
-static struct idr dca_idr;
-static spinlock_t dca_idr_lock;
+static DEFINE_IDR(dca_idr);
+static DEFINE_SPINLOCK(dca_idr_lock);
 
 int dca_sysfs_add_req(struct dca_provider *dca, struct device *dev, int slot)
 {
@@ -71,9 +71,6 @@ void dca_sysfs_remove_provider(struct dca_provider *dca)
 
 int __init dca_sysfs_init(void)
 {
-	idr_init(&dca_idr);
-	spin_lock_init(&dca_idr_lock);
-
 	dca_class = class_create(THIS_MODULE, "dca");
 	if (IS_ERR(dca_class)) {
 		idr_destroy(&dca_idr);




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux