2021-02-12 00:37:22

by Rob Herring

[permalink] [raw]
Subject: [PATCH v2 0/2] of: of_device.h cleanups

This is a couple of cleanups for of_device.h. They fell out from my
attempt at decoupling of_device.h and of_platform.h which is a mess
and I haven't finished, but there's no reason to wait on these.

Rob

Rob Herring (2):
of: Remove of_dev_{get,put}()
driver core: platform: Drop of_device_node_put() wrapper

arch/powerpc/platforms/pseries/ibmebus.c | 4 ++--
drivers/base/platform.c | 2 +-
drivers/net/ethernet/ibm/emac/core.c | 15 ++++++++-------
drivers/of/device.c | 21 ---------------------
drivers/of/platform.c | 4 ++--
drivers/of/unittest.c | 2 +-
drivers/usb/dwc3/dwc3-st.c | 2 +-
include/linux/of_device.h | 10 ----------
scripts/coccinelle/free/put_device.cocci | 1 -
9 files changed, 15 insertions(+), 46 deletions(-)

--
2.27.0


2021-02-12 00:38:51

by Rob Herring

[permalink] [raw]
Subject: [PATCH v2 2/2] driver core: platform: Drop of_device_node_put() wrapper

of_device_node_put() is just a wrapper for of_node_put(). The platform
driver core is already polluted with of_node pointers and the only 'get'
already uses of_node_get() (though typically the get would happen in
of_device_alloc()).

Cc: Greg Kroah-Hartman <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Frank Rowand <[email protected]>
Signed-off-by: Rob Herring <[email protected]>
---
v2:
- Fix build
---
drivers/base/platform.c | 2 +-
include/linux/of_device.h | 7 -------
2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 95fd1549f87d..9d5171e5f967 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -571,7 +571,7 @@ static void platform_device_release(struct device *dev)
struct platform_object *pa = container_of(dev, struct platform_object,
pdev.dev);

- of_device_node_put(&pa->pdev.dev);
+ of_node_put(pa->pdev.dev.of_node);
kfree(pa->pdev.dev.platform_data);
kfree(pa->pdev.mfd_cell);
kfree(pa->pdev.resource);
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index d7a407dfeecb..1d7992a02e36 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -38,11 +38,6 @@ extern int of_device_request_module(struct device *dev);
extern void of_device_uevent(struct device *dev, struct kobj_uevent_env *env);
extern int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env);

-static inline void of_device_node_put(struct device *dev)
-{
- of_node_put(dev->of_node);
-}
-
static inline struct device_node *of_cpu_device_node_get(int cpu)
{
struct device *cpu_dev;
@@ -94,8 +89,6 @@ static inline int of_device_uevent_modalias(struct device *dev,
return -ENODEV;
}

-static inline void of_device_node_put(struct device *dev) { }
-
static inline const struct of_device_id *of_match_device(
const struct of_device_id *matches, const struct device *dev)
{
--
2.27.0

2021-02-12 07:42:24

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] of: of_device.h cleanups

On Thu, Feb 11, 2021 at 05:27:43PM -0600, Rob Herring wrote:
> This is a couple of cleanups for of_device.h. They fell out from my
> attempt at decoupling of_device.h and of_platform.h which is a mess
> and I haven't finished, but there's no reason to wait on these.

Reviewed-by: Greg Kroah-Hartman <[email protected]>