[1/7] dm: clk: add missing stub when CONFIG_CLK is deactivated

Message ID 20220928084509.2758974-2-dario.binacchi@amarulasolutions.com
State New
Headers show
Series
  • Support NAND ONFI EDO mode for imx8mn architecture
Related show

Commit Message

Dario Binacchi Sept. 28, 2022, 8:45 a.m. UTC
Add missing stub for functions [devm_]clk_...() when CONFIG_CLK is
deactivated.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---

 include/clk.h | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

Comments

Sean Anderson Sept. 28, 2022, 4:41 p.m. UTC | #1
On 9/28/22 04:45, Dario Binacchi wrote:
> Add missing stub for functions [devm_]clk_...() when CONFIG_CLK is
> deactivated.
> 
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> ---
> 
>   include/clk.h | 32 +++++++++++++++++++++++++++++++-
>   1 file changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/include/clk.h b/include/clk.h
> index 76bb64bb5ee0..407513e0fa29 100644
> --- a/include/clk.h
> +++ b/include/clk.h
> @@ -88,8 +88,9 @@ struct clk_bulk {
>   	unsigned int count;
>   };
>   
> -#if CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(CLK)
>   struct phandle_1_arg;
> +
> +#if CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(CLK)
>   /**
>    * clk_get_by_phandle() - Get a clock by its phandle information (of-platadata)
>    * @dev: Device containing the phandle
> @@ -258,12 +259,26 @@ int clk_release_all(struct clk *clk, int count);
>   void devm_clk_put(struct udevice *dev, struct clk *clk);
>   
>   #else
> +
> +static inline int clk_get_by_phandle(struct udevice *dev, const
> +				     struct phandle_1_arg *cells,
> +				     struct clk *clk)
> +{
> +	return -ENOSYS;
> +}
> +
>   static inline int clk_get_by_index(struct udevice *dev, int index,
>   				   struct clk *clk)
>   {
>   	return -ENOSYS;
>   }
>   
> +static inline int clk_get_by_index_nodev(ofnode node, int index,
> +					 struct clk *clk)
> +{
> +	return -ENOSYS;
> +}
> +
>   static inline int clk_get_bulk(struct udevice *dev, struct clk_bulk *bulk)
>   {
>   	return -ENOSYS;
> @@ -275,6 +290,17 @@ static inline int clk_get_by_name(struct udevice *dev, const char *name,
>   	return -ENOSYS;
>   }
>   
> +static inline struct clk *devm_clk_get(struct udevice *dev, const char *id)
> +{
> +	return ERR_PTR(-ENOSYS);
> +}
> +
> +static inline struct clk *devm_clk_get_optional(struct udevice *dev,
> +						const char *id)
> +{
> +	return ERR_PTR(-ENOSYS);
> +}
> +
>   static inline int
>   clk_get_by_name_nodev(ofnode node, const char *name, struct clk *clk)
>   {
> @@ -285,6 +311,10 @@ static inline int clk_release_all(struct clk *clk, int count)
>   {
>   	return -ENOSYS;
>   }
> +
> +static inline void devm_clk_put(struct udevice *dev, struct clk *clk)
> +{
> +}
>   #endif
>   
>   /**

Reviewed-by: Sean Anderson <seanga2@gmail.com>

Patch

diff --git a/include/clk.h b/include/clk.h
index 76bb64bb5ee0..407513e0fa29 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -88,8 +88,9 @@  struct clk_bulk {
 	unsigned int count;
 };
 
-#if CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(CLK)
 struct phandle_1_arg;
+
+#if CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(CLK)
 /**
  * clk_get_by_phandle() - Get a clock by its phandle information (of-platadata)
  * @dev: Device containing the phandle
@@ -258,12 +259,26 @@  int clk_release_all(struct clk *clk, int count);
 void devm_clk_put(struct udevice *dev, struct clk *clk);
 
 #else
+
+static inline int clk_get_by_phandle(struct udevice *dev, const
+				     struct phandle_1_arg *cells,
+				     struct clk *clk)
+{
+	return -ENOSYS;
+}
+
 static inline int clk_get_by_index(struct udevice *dev, int index,
 				   struct clk *clk)
 {
 	return -ENOSYS;
 }
 
+static inline int clk_get_by_index_nodev(ofnode node, int index,
+					 struct clk *clk)
+{
+	return -ENOSYS;
+}
+
 static inline int clk_get_bulk(struct udevice *dev, struct clk_bulk *bulk)
 {
 	return -ENOSYS;
@@ -275,6 +290,17 @@  static inline int clk_get_by_name(struct udevice *dev, const char *name,
 	return -ENOSYS;
 }
 
+static inline struct clk *devm_clk_get(struct udevice *dev, const char *id)
+{
+	return ERR_PTR(-ENOSYS);
+}
+
+static inline struct clk *devm_clk_get_optional(struct udevice *dev,
+						const char *id)
+{
+	return ERR_PTR(-ENOSYS);
+}
+
 static inline int
 clk_get_by_name_nodev(ofnode node, const char *name, struct clk *clk)
 {
@@ -285,6 +311,10 @@  static inline int clk_release_all(struct clk *clk, int count)
 {
 	return -ENOSYS;
 }
+
+static inline void devm_clk_put(struct udevice *dev, struct clk *clk)
+{
+}
 #endif
 
 /**