Re: [PATCH 26/31] clk: Drop dm.h header file in clk-provider.h
On Sun, Jul 19, 2020 at 10:15:56AM -0600, Simon Glass wrote: > This header file should not be included in other header files. Remove it > and use a forward declaration and un-inlining of dev_get_clk_ptr() > instead. > > Fix up the kendryte header files to avoid build errors. > > Signed-off-by: Simon Glass > Reviewed-by: Sean Anderson Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 26/31] clk: Drop dm.h header file in clk-provider.h
On 7/19/20 12:15 PM, Simon Glass wrote: > This header file should not be included in other header files. Remove it > and use a forward declaration and un-inlining of dev_get_clk_ptr() > instead. > > Fix up the kendryte header files to avoid build errors. > > Signed-off-by: Simon Glass > --- > > drivers/clk/clk-uclass.c | 5 + > drivers/clk/kendryte/bypass.c | 7 +-- > drivers/clk/kendryte/pll.c| 10 ++ > include/kendryte/bypass.h | 2 +- > include/linux/clk-provider.h | 8 +++- > 5 files changed, 20 insertions(+), 12 deletions(-) > > diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c > index 15656f5973..934cd5787a 100644 > --- a/drivers/clk/clk-uclass.c > +++ b/drivers/clk/clk-uclass.c > @@ -25,6 +25,11 @@ static inline const struct clk_ops *clk_dev_ops(struct > udevice *dev) > return (const struct clk_ops *)dev->driver->ops; > } > > +struct clk *dev_get_clk_ptr(struct udevice *dev) > +{ > + return (struct clk *)dev_get_uclass_priv(dev); > +} > + > #if CONFIG_IS_ENABLED(OF_CONTROL) > # if CONFIG_IS_ENABLED(OF_PLATDATA) > int clk_get_by_driver_info(struct udevice *dev, struct phandle_1_arg *cells, > diff --git a/drivers/clk/kendryte/bypass.c b/drivers/clk/kendryte/bypass.c > index d1fd28175b..5f1986f2cb 100644 > --- a/drivers/clk/kendryte/bypass.c > +++ b/drivers/clk/kendryte/bypass.c > @@ -4,12 +4,15 @@ > */ > > #define LOG_CATEGORY UCLASS_CLK > -#include > > +#include > +#include > #include > +#include > +#include > +#include > #include > #include > -#include > > #define CLK_K210_BYPASS "k210_clk_bypass" > > diff --git a/drivers/clk/kendryte/pll.c b/drivers/clk/kendryte/pll.c > index 19e358856a..ab6d75d585 100644 > --- a/drivers/clk/kendryte/pll.c > +++ b/drivers/clk/kendryte/pll.c > @@ -3,18 +3,20 @@ > * Copyright (C) 2019-20 Sean Anderson > */ > #define LOG_CATEGORY UCLASS_CLK > -#include > > -#include > +#include > +#include > /* For DIV_ROUND_DOWN_ULL, defined in linux/kernel.h */ > #include > +#include > +#include > +#include > #include > +#include > #include > #include > #include > #include > -#include > -#include > > #define CLK_K210_PLL "k210_clk_pll" > > diff --git a/include/kendryte/bypass.h b/include/kendryte/bypass.h > index a081cbd12f..ab85bbcbfc 100644 > --- a/include/kendryte/bypass.h > +++ b/include/kendryte/bypass.h > @@ -5,7 +5,7 @@ > #ifndef K210_BYPASS_H > #define K210_BYPASS_H > > -#include > +struct clk; > > struct k210_bypass { > struct clk clk; > diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h > index 8a20743ad8..79dce8f0ad 100644 > --- a/include/linux/clk-provider.h > +++ b/include/linux/clk-provider.h > @@ -9,12 +9,13 @@ > #ifndef __LINUX_CLK_PROVIDER_H > #define __LINUX_CLK_PROVIDER_H > > -#include > #include > #include > #include > #include > > +struct udevice; > + > static inline void clk_dm(ulong id, struct clk *clk) > { > if (!IS_ERR(clk)) > @@ -188,8 +189,5 @@ struct clk *clk_register_mux(struct device *dev, const > char *name, > const char *clk_hw_get_name(const struct clk *hw); > ulong clk_generic_get_rate(struct clk *clk); > > -static inline struct clk *dev_get_clk_ptr(struct udevice *dev) > -{ > - return (struct clk *)dev_get_uclass_priv(dev); > -} > +struct clk *dev_get_clk_ptr(struct udevice *dev); > #endif /* __LINUX_CLK_PROVIDER_H */ > Reviewed-by: Sean Anderson
[PATCH 26/31] clk: Drop dm.h header file in clk-provider.h
This header file should not be included in other header files. Remove it and use a forward declaration and un-inlining of dev_get_clk_ptr() instead. Fix up the kendryte header files to avoid build errors. Signed-off-by: Simon Glass --- drivers/clk/clk-uclass.c | 5 + drivers/clk/kendryte/bypass.c | 7 +-- drivers/clk/kendryte/pll.c| 10 ++ include/kendryte/bypass.h | 2 +- include/linux/clk-provider.h | 8 +++- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 15656f5973..934cd5787a 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -25,6 +25,11 @@ static inline const struct clk_ops *clk_dev_ops(struct udevice *dev) return (const struct clk_ops *)dev->driver->ops; } +struct clk *dev_get_clk_ptr(struct udevice *dev) +{ + return (struct clk *)dev_get_uclass_priv(dev); +} + #if CONFIG_IS_ENABLED(OF_CONTROL) # if CONFIG_IS_ENABLED(OF_PLATDATA) int clk_get_by_driver_info(struct udevice *dev, struct phandle_1_arg *cells, diff --git a/drivers/clk/kendryte/bypass.c b/drivers/clk/kendryte/bypass.c index d1fd28175b..5f1986f2cb 100644 --- a/drivers/clk/kendryte/bypass.c +++ b/drivers/clk/kendryte/bypass.c @@ -4,12 +4,15 @@ */ #define LOG_CATEGORY UCLASS_CLK -#include +#include +#include #include +#include +#include +#include #include #include -#include #define CLK_K210_BYPASS "k210_clk_bypass" diff --git a/drivers/clk/kendryte/pll.c b/drivers/clk/kendryte/pll.c index 19e358856a..ab6d75d585 100644 --- a/drivers/clk/kendryte/pll.c +++ b/drivers/clk/kendryte/pll.c @@ -3,18 +3,20 @@ * Copyright (C) 2019-20 Sean Anderson */ #define LOG_CATEGORY UCLASS_CLK -#include -#include +#include +#include /* For DIV_ROUND_DOWN_ULL, defined in linux/kernel.h */ #include +#include +#include +#include #include +#include #include #include #include #include -#include -#include #define CLK_K210_PLL "k210_clk_pll" diff --git a/include/kendryte/bypass.h b/include/kendryte/bypass.h index a081cbd12f..ab85bbcbfc 100644 --- a/include/kendryte/bypass.h +++ b/include/kendryte/bypass.h @@ -5,7 +5,7 @@ #ifndef K210_BYPASS_H #define K210_BYPASS_H -#include +struct clk; struct k210_bypass { struct clk clk; diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 8a20743ad8..79dce8f0ad 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -9,12 +9,13 @@ #ifndef __LINUX_CLK_PROVIDER_H #define __LINUX_CLK_PROVIDER_H -#include #include #include #include #include +struct udevice; + static inline void clk_dm(ulong id, struct clk *clk) { if (!IS_ERR(clk)) @@ -188,8 +189,5 @@ struct clk *clk_register_mux(struct device *dev, const char *name, const char *clk_hw_get_name(const struct clk *hw); ulong clk_generic_get_rate(struct clk *clk); -static inline struct clk *dev_get_clk_ptr(struct udevice *dev) -{ - return (struct clk *)dev_get_uclass_priv(dev); -} +struct clk *dev_get_clk_ptr(struct udevice *dev); #endif /* __LINUX_CLK_PROVIDER_H */ -- 2.28.0.rc0.105.gf9edc3c819-goog