[PATCH -next] iommu: amd: Use DEFINE_SPINLOCK() for spinlock

2020-12-28 Thread Zheng Yongjun
spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().

Signed-off-by: Zheng Yongjun 
---
 drivers/iommu/amd/iommu_v2.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/iommu/amd/iommu_v2.c b/drivers/iommu/amd/iommu_v2.c
index 5ecc0bc608ec..f8d4ad421e07 100644
--- a/drivers/iommu/amd/iommu_v2.c
+++ b/drivers/iommu/amd/iommu_v2.c
@@ -77,7 +77,7 @@ struct fault {
 };
 
 static LIST_HEAD(state_list);
-static spinlock_t state_lock;
+static DEFINE_SPINLOCK(state_lock);
 
 static struct workqueue_struct *iommu_wq;
 
@@ -938,8 +938,6 @@ static int __init amd_iommu_v2_init(void)
return 0;
}
 
-   spin_lock_init(_lock);
-
ret = -ENOMEM;
iommu_wq = alloc_workqueue("amd_iommu_v2", WQ_MEM_RECLAIM, 0);
if (iommu_wq == NULL)
-- 
2.22.0

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH -next] iommu/amd/init: convert comma to semicolon

2020-12-14 Thread Zheng Yongjun
Replace a comma between expression statements by a semicolon.

Signed-off-by: Zheng Yongjun 
---
 drivers/iommu/amd/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index 23a790f8f550..dad011e88268 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -2053,8 +2053,8 @@ static int iommu_init_intcapxt(struct amd_iommu *iommu)
 * whenever the irq affinity is changed from user-space.
 */
notify->irq = iommu->dev->irq;
-   notify->notify = _irq_notifier_notify,
-   notify->release = _irq_notifier_release,
+   notify->notify = _irq_notifier_notify;
+   notify->release = _irq_notifier_release;
ret = irq_set_affinity_notifier(iommu->dev->irq, notify);
if (ret) {
pr_err("Failed to register irq affinity notifier (devid=%#x, 
irq %d)\n",
-- 
2.22.0

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


[PATCH -next] iommu: msm_iommu: Delete useless kfree code

2020-12-14 Thread Zheng Yongjun
The parameter of kfree function is NULL, so kfree code is useless, delete it.

Signed-off-by: Zheng Yongjun 
---
 drivers/iommu/msm_iommu.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
index 3615cd6241c4..1286674a1322 100644
--- a/drivers/iommu/msm_iommu.c
+++ b/drivers/iommu/msm_iommu.c
@@ -319,7 +319,7 @@ static struct iommu_domain *msm_iommu_domain_alloc(unsigned 
type)
 
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv)
-   goto fail_nomem;
+   return NULL;
 
INIT_LIST_HEAD(>list_attached);
 
@@ -328,10 +328,6 @@ static struct iommu_domain 
*msm_iommu_domain_alloc(unsigned type)
priv->domain.geometry.force_aperture = true;
 
return >domain;
-
-fail_nomem:
-   kfree(priv);
-   return NULL;
 }
 
 static void msm_iommu_domain_free(struct iommu_domain *domain)
-- 
2.22.0

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu