[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20210409095149.2294378-1-yebin10@huawei.com>
Date: Fri, 9 Apr 2021 17:51:49 +0800
From: Ye Bin <yebin10@...wei.com>
To: <yebin10@...wei.com>,
Zhang Shengju <zhangshengju@...s.chinamobile.com>,
Tang Bin <tangbin@...s.chinamobile.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC: <linux-kernel@...r.kernel.org>, <kernel-janitors@...r.kernel.org>,
"Hulk Robot" <hulkci@...wei.com>
Subject: [PATCH -next] dca: use DEFINE_SPINLOCK() for spinlock and DEFINE_IDR() for idr
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@...wei.com>
Signed-off-by: Ye Bin <yebin10@...wei.com>
---
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);
Powered by blists - more mailing lists