Message ID | 20201224132254.30961-1-zhengyongjun3@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [v2,-next] dma: idxd: use DEFINE_MUTEX() for mutex lock | expand |
On Thu, 24 Dec 2020 21:22:54 +0800 Zheng Yongjun <zhengyongjun3@huawei.com> wrote: > mutex lock can be initialized automatically with DEFINE_MUTEX() > rather than explicitly calling mutex_init(). > > Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com> Acked-by: Dave Jiang <dave.jiang@intel.com> > --- > drivers/dma/idxd/init.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c > index 0a4432b063b5..2297c93dd527 100644 > --- a/drivers/dma/idxd/init.c > +++ b/drivers/dma/idxd/init.c > @@ -27,7 +27,7 @@ MODULE_AUTHOR("Intel Corporation"); > #define DRV_NAME "idxd" > > static struct idr idxd_idrs[IDXD_TYPE_MAX]; > -static struct mutex idxd_idr_lock; > +static DEFINE_MUTEX(idxd_idr_lock); > > static struct pci_device_id idxd_pci_tbl[] = { > /* DSA ver 1.0 platforms */ > @@ -481,7 +481,6 @@ static int __init idxd_init_module(void) > pr_info("%s: Intel(R) Accelerator Devices Driver %s\n", > DRV_NAME, IDXD_DRIVER_VERSION); > > - mutex_init(&idxd_idr_lock); > for (i = 0; i < IDXD_TYPE_MAX; i++) > idr_init(&idxd_idrs[i]); >
On 24-12-20, 21:22, Zheng Yongjun wrote: > mutex lock can be initialized automatically with DEFINE_MUTEX() > rather than explicitly calling mutex_init(). Applied, thanks
diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c index 0a4432b063b5..2297c93dd527 100644 --- a/drivers/dma/idxd/init.c +++ b/drivers/dma/idxd/init.c @@ -27,7 +27,7 @@ MODULE_AUTHOR("Intel Corporation"); #define DRV_NAME "idxd" static struct idr idxd_idrs[IDXD_TYPE_MAX]; -static struct mutex idxd_idr_lock; +static DEFINE_MUTEX(idxd_idr_lock); static struct pci_device_id idxd_pci_tbl[] = { /* DSA ver 1.0 platforms */ @@ -481,7 +481,6 @@ static int __init idxd_init_module(void) pr_info("%s: Intel(R) Accelerator Devices Driver %s\n", DRV_NAME, IDXD_DRIVER_VERSION); - mutex_init(&idxd_idr_lock); for (i = 0; i < IDXD_TYPE_MAX; i++) idr_init(&idxd_idrs[i]);
mutex lock can be initialized automatically with DEFINE_MUTEX() rather than explicitly calling mutex_init(). Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com> --- drivers/dma/idxd/init.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)