[PATCH] devres: Simplify devm_percpu_match() implementation

Zijun Hu posted 1 patch 1 year, 5 months ago
There is a newer version of this series
drivers/base/devres.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
[PATCH] devres: Simplify devm_percpu_match() implementation
Posted by Zijun Hu 1 year, 5 months ago
From: Zijun Hu <zijuhu@qti.qualcomm.com>

Simplify devm_percpu_match() implementation by removing redundant
conversions.

Signed-off-by: Zijun Hu <zijuhu@qti.qualcomm.com>
---
Previous discussion link:
https://lore.kernel.org/lkml/1719496036-24642-1-git-send-email-quic_zijuhu@quicinc.com/

 drivers/base/devres.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/base/devres.c b/drivers/base/devres.c
index 3beedeaa0ffc..050d7fcd0634 100644
--- a/drivers/base/devres.c
+++ b/drivers/base/devres.c
@@ -1173,9 +1173,8 @@ static void devm_percpu_release(struct device *dev, void *pdata)
 
 static int devm_percpu_match(struct device *dev, void *data, void *p)
 {
-	struct devres *devr = container_of(data, struct devres, data);
-
-	return *(void **)devr->data == p;
+	/* @data is already and must be (void *)devr->data */
+	return *(void **)data == p;
 }
 
 /**
-- 
2.7.4