diff mbox series

[01/15] gpio: Disable functions not used with of-platdata

Message ID 20210115140500.846307-2-sjg@chromium.org
State Superseded
Delegated to: Simon Glass
Headers show
Series gpio: Update and simplify the uclass API | expand

Commit Message

Simon Glass Jan. 15, 2021, 2:04 p.m. UTC
These functions use devicetree and cannot wprl with of-platdata, which has
no runtime devicetree.

If they are used, the current linker error is confusing, since it talks
about missing functions in the bowels of driver model.

Avoid compiling these functions at all with of-platdata, so that a
straightforward link error points to the problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/gpio/gpio-uclass.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Pratyush Yadav Jan. 18, 2021, 9:17 p.m. UTC | #1
On 15/01/21 07:04AM, Simon Glass wrote:
> These functions use devicetree and cannot wprl with of-platdata, which has
					    ^^^^
Your right hand's offset is off by one ;-)

> no runtime devicetree.
> 
> If they are used, the current linker error is confusing, since it talks
> about missing functions in the bowels of driver model.
> 
> Avoid compiling these functions at all with of-platdata, so that a
> straightforward link error points to the problem.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  drivers/gpio/gpio-uclass.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
> index bad6b71e0c3..e84b68db772 100644
> --- a/drivers/gpio/gpio-uclass.c
> +++ b/drivers/gpio/gpio-uclass.c
> @@ -1023,6 +1023,7 @@ err:
>  	return ret;
>  }
>  
> +#if !CONFIG_IS_ENABLED(OF_PLATDATA)
>  static int _gpio_request_by_name_nodev(ofnode node, const char *list_name,
>  				       int index, struct gpio_desc *desc,
>  				       int flags, bool add_index)
> @@ -1109,6 +1110,7 @@ int gpio_get_list_count(struct udevice *dev, const char *list_name)
>  
>  	return ret;
>  }
> +#endif /* OF_PLATDATA */
>  
>  int dm_gpio_free(struct udevice *dev, struct gpio_desc *desc)
>  {
> -- 
> 2.30.0.284.gd98b1dd5eaa7-goog
>
Patrick Delaunay Jan. 21, 2021, 8:59 a.m. UTC | #2
Hi Simon,

On 1/15/21 3:04 PM, Simon Glass wrote:
> These functions use devicetree and cannot wprl with of-platdata, which has

wprl

> no runtime devicetree.
>
> If they are used, the current linker error is confusing, since it talks
> about missing functions in the bowels of driver model.
>
> Avoid compiling these functions at all with of-platdata, so that a
> straightforward link error points to the problem.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>   drivers/gpio/gpio-uclass.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
> index bad6b71e0c3..e84b68db772 100644
> --- a/drivers/gpio/gpio-uclass.c
> +++ b/drivers/gpio/gpio-uclass.c
> @@ -1023,6 +1023,7 @@ err:
>   	return ret;
>   }
>   
> +#if !CONFIG_IS_ENABLED(OF_PLATDATA)
>   static int _gpio_request_by_name_nodev(ofnode node, const char *list_name,
>   				       int index, struct gpio_desc *desc,
>   				       int flags, bool add_index)
> @@ -1109,6 +1110,7 @@ int gpio_get_list_count(struct udevice *dev, const char *list_name)
>   
>   	return ret;
>   }
> +#endif /* OF_PLATDATA */
>   
>   int dm_gpio_free(struct udevice *dev, struct gpio_desc *desc)
>   {


Except the commit message


Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

Thanks

Patrick
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index bad6b71e0c3..e84b68db772 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -1023,6 +1023,7 @@  err:
 	return ret;
 }
 
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
 static int _gpio_request_by_name_nodev(ofnode node, const char *list_name,
 				       int index, struct gpio_desc *desc,
 				       int flags, bool add_index)
@@ -1109,6 +1110,7 @@  int gpio_get_list_count(struct udevice *dev, const char *list_name)
 
 	return ret;
 }
+#endif /* OF_PLATDATA */
 
 int dm_gpio_free(struct udevice *dev, struct gpio_desc *desc)
 {