[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20221001165218.2689122-1-gregkh@linuxfoundation.org>
Date: Sat, 1 Oct 2022 18:52:18 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: [PATCH] driver core: make kobj_to_dev() take a const pointer
Doing pointer math does not modify the pointer itself, so it is safe to
say that the kobject passed into kobj_to_dev() is const. Now the
pointer passed out of it does loose the const capability, but for now
that's ok, we are allowing this so that const kobjects can call this
function successfully.
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
include/linux/device.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/device.h b/include/linux/device.h
index 424b55df0272..b855b2e74cd3 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -680,7 +680,7 @@ struct device_link {
bool supplier_preactivated; /* Owned by consumer probe. */
};
-static inline struct device *kobj_to_dev(struct kobject *kobj)
+static inline struct device *kobj_to_dev(const struct kobject *kobj)
{
return container_of(kobj, struct device, kobj);
}
--
2.37.3
Powered by blists - more mailing lists