linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] memory: omap-gpmc: Fix -Wunused-function warnings
@ 2020-09-01  3:56 YueHaibing
  2020-09-01  6:52 ` Krzysztof Kozlowski
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: YueHaibing @ 2020-09-01  3:56 UTC (permalink / raw)
  To: rogerq, tony, krzk; +Cc: linux-omap, linux-kernel, YueHaibing

drivers/memory/omap-gpmc.c:987:12: warning: ‘gpmc_cs_remap’ defined but not used [-Wunused-function]
 static int gpmc_cs_remap(int cs, u32 base)
            ^~~~~~~~~~~~~
drivers/memory/omap-gpmc.c:926:20: warning: ‘gpmc_cs_get_name’ defined but not used [-Wunused-function]
 static const char *gpmc_cs_get_name(int cs)
                    ^~~~~~~~~~~~~~~~
drivers/memory/omap-gpmc.c:919:13: warning: ‘gpmc_cs_set_name’ defined but not used [-Wunused-function]
 static void gpmc_cs_set_name(int cs, const char *name)
             ^~~~~~~~~~~~~~~~
Make them as  __maybe_unused to fix this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/memory/omap-gpmc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index ac0f577a51a1..24372254986e 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -916,14 +916,14 @@ static bool gpmc_cs_reserved(int cs)
 	return gpmc->flags & GPMC_CS_RESERVED;
 }
 
-static void gpmc_cs_set_name(int cs, const char *name)
+static void __maybe_unused gpmc_cs_set_name(int cs, const char *name)
 {
 	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
 
 	gpmc->name = name;
 }
 
-static const char *gpmc_cs_get_name(int cs)
+static const __maybe_unused char *gpmc_cs_get_name(int cs)
 {
 	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
 
@@ -984,7 +984,7 @@ static int gpmc_cs_delete_mem(int cs)
  * "base". Returns 0 on success and appropriate negative error code
  * on failure.
  */
-static int gpmc_cs_remap(int cs, u32 base)
+static int __maybe_unused gpmc_cs_remap(int cs, u32 base)
 {
 	int ret;
 	u32 old_base, size;
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH -next] memory: omap-gpmc: Fix -Wunused-function warnings
  2020-09-01  3:56 [PATCH -next] memory: omap-gpmc: Fix -Wunused-function warnings YueHaibing
@ 2020-09-01  6:52 ` Krzysztof Kozlowski
  2020-09-01  6:58   ` Yuehaibing
  2020-09-01  7:07 ` YueHaibing
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2020-09-01  6:52 UTC (permalink / raw)
  To: YueHaibing; +Cc: rogerq, tony, linux-omap, linux-kernel

On Tue, Sep 01, 2020 at 11:56:42AM +0800, YueHaibing wrote:
> drivers/memory/omap-gpmc.c:987:12: warning: ‘gpmc_cs_remap’ defined but not used [-Wunused-function]
>  static int gpmc_cs_remap(int cs, u32 base)
>             ^~~~~~~~~~~~~
> drivers/memory/omap-gpmc.c:926:20: warning: ‘gpmc_cs_get_name’ defined but not used [-Wunused-function]
>  static const char *gpmc_cs_get_name(int cs)
>                     ^~~~~~~~~~~~~~~~
> drivers/memory/omap-gpmc.c:919:13: warning: ‘gpmc_cs_set_name’ defined but not used [-Wunused-function]
>  static void gpmc_cs_set_name(int cs, const char *name)
>              ^~~~~~~~~~~~~~~~
> Make them as  __maybe_unused to fix this.

Hi,

Do you know what configuration triggers these warnings? What has to be
disabled (e.g. CONFIG_OF)? Such information is useful in the commit
message.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH -next] memory: omap-gpmc: Fix -Wunused-function warnings
  2020-09-01  6:52 ` Krzysztof Kozlowski
@ 2020-09-01  6:58   ` Yuehaibing
  0 siblings, 0 replies; 10+ messages in thread
From: Yuehaibing @ 2020-09-01  6:58 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: rogerq, tony, linux-omap, linux-kernel

On 2020/9/1 14:52, Krzysztof Kozlowski wrote:
> On Tue, Sep 01, 2020 at 11:56:42AM +0800, YueHaibing wrote:
>> drivers/memory/omap-gpmc.c:987:12: warning: ‘gpmc_cs_remap’ defined but not used [-Wunused-function]
>>  static int gpmc_cs_remap(int cs, u32 base)
>>             ^~~~~~~~~~~~~
>> drivers/memory/omap-gpmc.c:926:20: warning: ‘gpmc_cs_get_name’ defined but not used [-Wunused-function]
>>  static const char *gpmc_cs_get_name(int cs)
>>                     ^~~~~~~~~~~~~~~~
>> drivers/memory/omap-gpmc.c:919:13: warning: ‘gpmc_cs_set_name’ defined but not used [-Wunused-function]
>>  static void gpmc_cs_set_name(int cs, const char *name)
>>              ^~~~~~~~~~~~~~~~
>> Make them as  __maybe_unused to fix this.
> 
> Hi,
> 
> Do you know what configuration triggers these warnings? What has to be
> disabled (e.g. CONFIG_OF)? Such information is useful in the commit
> message.

Yes, this is triggered by disable CONFIG_OF, I will update the commit log.
> 
> Best regards,
> Krzysztof
> 
> .
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH -next] memory: omap-gpmc: Fix -Wunused-function warnings
  2020-09-01  3:56 [PATCH -next] memory: omap-gpmc: Fix -Wunused-function warnings YueHaibing
  2020-09-01  6:52 ` Krzysztof Kozlowski
@ 2020-09-01  7:07 ` YueHaibing
  2020-09-01  7:11   ` Yuehaibing
  2020-09-01  7:09 ` [PATCH v2 " YueHaibing
  2020-09-01 11:28 ` [PATCH v3 " YueHaibing
  3 siblings, 1 reply; 10+ messages in thread
From: YueHaibing @ 2020-09-01  7:07 UTC (permalink / raw)
  To: rogerq, tony, krzk; +Cc: linux-omap, linux-kernel, YueHaibing

drivers/memory/omap-gpmc.c:987:12: warning: ‘gpmc_cs_remap’ defined but not used [-Wunused-function]
 static int gpmc_cs_remap(int cs, u32 base)
            ^~~~~~~~~~~~~
drivers/memory/omap-gpmc.c:926:20: warning: ‘gpmc_cs_get_name’ defined but not used [-Wunused-function]
 static const char *gpmc_cs_get_name(int cs)
                    ^~~~~~~~~~~~~~~~
drivers/memory/omap-gpmc.c:919:13: warning: ‘gpmc_cs_set_name’ defined but not used [-Wunused-function]
 static void gpmc_cs_set_name(int cs, const char *name)
             ^~~~~~~~~~~~~~~~
Make them as  __maybe_unused to fix this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/memory/omap-gpmc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index ac0f577a51a1..24372254986e 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -916,14 +916,14 @@ static bool gpmc_cs_reserved(int cs)
 	return gpmc->flags & GPMC_CS_RESERVED;
 }
 
-static void gpmc_cs_set_name(int cs, const char *name)
+static void __maybe_unused gpmc_cs_set_name(int cs, const char *name)
 {
 	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
 
 	gpmc->name = name;
 }
 
-static const char *gpmc_cs_get_name(int cs)
+static const __maybe_unused char *gpmc_cs_get_name(int cs)
 {
 	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
 
@@ -984,7 +984,7 @@ static int gpmc_cs_delete_mem(int cs)
  * "base". Returns 0 on success and appropriate negative error code
  * on failure.
  */
-static int gpmc_cs_remap(int cs, u32 base)
+static int __maybe_unused gpmc_cs_remap(int cs, u32 base)
 {
 	int ret;
 	u32 old_base, size;
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 -next] memory: omap-gpmc: Fix -Wunused-function warnings
  2020-09-01  3:56 [PATCH -next] memory: omap-gpmc: Fix -Wunused-function warnings YueHaibing
  2020-09-01  6:52 ` Krzysztof Kozlowski
  2020-09-01  7:07 ` YueHaibing
@ 2020-09-01  7:09 ` YueHaibing
  2020-09-01 11:14   ` Roger Quadros
  2020-09-01 11:28 ` [PATCH v3 " YueHaibing
  3 siblings, 1 reply; 10+ messages in thread
From: YueHaibing @ 2020-09-01  7:09 UTC (permalink / raw)
  To: rogerq, tony, krzk; +Cc: linux-omap, linux-kernel, YueHaibing

If CONFIG_OF is not set, make W=1 warns:

drivers/memory/omap-gpmc.c:987:12: warning: ‘gpmc_cs_remap’ defined but not used [-Wunused-function]
 static int gpmc_cs_remap(int cs, u32 base)
            ^~~~~~~~~~~~~
drivers/memory/omap-gpmc.c:926:20: warning: ‘gpmc_cs_get_name’ defined but not used [-Wunused-function]
 static const char *gpmc_cs_get_name(int cs)
                    ^~~~~~~~~~~~~~~~
drivers/memory/omap-gpmc.c:919:13: warning: ‘gpmc_cs_set_name’ defined but not used [-Wunused-function]
 static void gpmc_cs_set_name(int cs, const char *name)
             ^~~~~~~~~~~~~~~~
Make them as  __maybe_unused to fix this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
v2: update commit log
---
 drivers/memory/omap-gpmc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index ac0f577a51a1..24372254986e 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -916,14 +916,14 @@ static bool gpmc_cs_reserved(int cs)
 	return gpmc->flags & GPMC_CS_RESERVED;
 }
 
-static void gpmc_cs_set_name(int cs, const char *name)
+static void __maybe_unused gpmc_cs_set_name(int cs, const char *name)
 {
 	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
 
 	gpmc->name = name;
 }
 
-static const char *gpmc_cs_get_name(int cs)
+static const __maybe_unused char *gpmc_cs_get_name(int cs)
 {
 	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
 
@@ -984,7 +984,7 @@ static int gpmc_cs_delete_mem(int cs)
  * "base". Returns 0 on success and appropriate negative error code
  * on failure.
  */
-static int gpmc_cs_remap(int cs, u32 base)
+static int __maybe_unused gpmc_cs_remap(int cs, u32 base)
 {
 	int ret;
 	u32 old_base, size;
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH -next] memory: omap-gpmc: Fix -Wunused-function warnings
  2020-09-01  7:07 ` YueHaibing
@ 2020-09-01  7:11   ` Yuehaibing
  0 siblings, 0 replies; 10+ messages in thread
From: Yuehaibing @ 2020-09-01  7:11 UTC (permalink / raw)
  To: rogerq, tony, krzk; +Cc: linux-omap, linux-kernel

Pls ignore this.

On 2020/9/1 15:07, YueHaibing wrote:
> drivers/memory/omap-gpmc.c:987:12: warning: ‘gpmc_cs_remap’ defined but not used [-Wunused-function]
>  static int gpmc_cs_remap(int cs, u32 base)
>             ^~~~~~~~~~~~~
> drivers/memory/omap-gpmc.c:926:20: warning: ‘gpmc_cs_get_name’ defined but not used [-Wunused-function]
>  static const char *gpmc_cs_get_name(int cs)
>                     ^~~~~~~~~~~~~~~~
> drivers/memory/omap-gpmc.c:919:13: warning: ‘gpmc_cs_set_name’ defined but not used [-Wunused-function]
>  static void gpmc_cs_set_name(int cs, const char *name)
>              ^~~~~~~~~~~~~~~~
> Make them as  __maybe_unused to fix this.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/memory/omap-gpmc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
> index ac0f577a51a1..24372254986e 100644
> --- a/drivers/memory/omap-gpmc.c
> +++ b/drivers/memory/omap-gpmc.c
> @@ -916,14 +916,14 @@ static bool gpmc_cs_reserved(int cs)
>  	return gpmc->flags & GPMC_CS_RESERVED;
>  }
>  
> -static void gpmc_cs_set_name(int cs, const char *name)
> +static void __maybe_unused gpmc_cs_set_name(int cs, const char *name)
>  {
>  	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
>  
>  	gpmc->name = name;
>  }
>  
> -static const char *gpmc_cs_get_name(int cs)
> +static const __maybe_unused char *gpmc_cs_get_name(int cs)
>  {
>  	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
>  
> @@ -984,7 +984,7 @@ static int gpmc_cs_delete_mem(int cs)
>   * "base". Returns 0 on success and appropriate negative error code
>   * on failure.
>   */
> -static int gpmc_cs_remap(int cs, u32 base)
> +static int __maybe_unused gpmc_cs_remap(int cs, u32 base)
>  {
>  	int ret;
>  	u32 old_base, size;
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 -next] memory: omap-gpmc: Fix -Wunused-function warnings
  2020-09-01  7:09 ` [PATCH v2 " YueHaibing
@ 2020-09-01 11:14   ` Roger Quadros
  0 siblings, 0 replies; 10+ messages in thread
From: Roger Quadros @ 2020-09-01 11:14 UTC (permalink / raw)
  To: YueHaibing, tony, krzk; +Cc: linux-omap, linux-kernel

Hi,

On 01/09/2020 10:09, YueHaibing wrote:
> If CONFIG_OF is not set, make W=1 warns:
> 
> drivers/memory/omap-gpmc.c:987:12: warning: ‘gpmc_cs_remap’ defined but not used [-Wunused-function]
>   static int gpmc_cs_remap(int cs, u32 base)
>              ^~~~~~~~~~~~~
> drivers/memory/omap-gpmc.c:926:20: warning: ‘gpmc_cs_get_name’ defined but not used [-Wunused-function]
>   static const char *gpmc_cs_get_name(int cs)
>                      ^~~~~~~~~~~~~~~~
> drivers/memory/omap-gpmc.c:919:13: warning: ‘gpmc_cs_set_name’ defined but not used [-Wunused-function]
>   static void gpmc_cs_set_name(int cs, const char *name)
>               ^~~~~~~~~~~~~~~~
> Make them as  __maybe_unused to fix this.

Instead of that how about moving those 3 functions to within
#ifdef CONFIG_OF
#endif

like gpmc_probe_generic_child()

We are absolutely sure they are not required if CONFIG_OF isn't defined.

cheers,
-roger

> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> v2: update commit log
> ---
>   drivers/memory/omap-gpmc.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
> index ac0f577a51a1..24372254986e 100644
> --- a/drivers/memory/omap-gpmc.c
> +++ b/drivers/memory/omap-gpmc.c
> @@ -916,14 +916,14 @@ static bool gpmc_cs_reserved(int cs)
>   	return gpmc->flags & GPMC_CS_RESERVED;
>   }
>   
> -static void gpmc_cs_set_name(int cs, const char *name)
> +static void __maybe_unused gpmc_cs_set_name(int cs, const char *name)
>   {
>   	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
>   
>   	gpmc->name = name;
>   }
>   
> -static const char *gpmc_cs_get_name(int cs)
> +static const __maybe_unused char *gpmc_cs_get_name(int cs)
>   {
>   	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
>   
> @@ -984,7 +984,7 @@ static int gpmc_cs_delete_mem(int cs)
>    * "base". Returns 0 on success and appropriate negative error code
>    * on failure.
>    */
> -static int gpmc_cs_remap(int cs, u32 base)
> +static int __maybe_unused gpmc_cs_remap(int cs, u32 base)
>   {
>   	int ret;
>   	u32 old_base, size;
> 

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3 -next] memory: omap-gpmc: Fix -Wunused-function warnings
  2020-09-01  3:56 [PATCH -next] memory: omap-gpmc: Fix -Wunused-function warnings YueHaibing
                   ` (2 preceding siblings ...)
  2020-09-01  7:09 ` [PATCH v2 " YueHaibing
@ 2020-09-01 11:28 ` YueHaibing
  2020-09-01 12:11   ` Roger Quadros
  2020-09-02 15:29   ` Krzysztof Kozlowski
  3 siblings, 2 replies; 10+ messages in thread
From: YueHaibing @ 2020-09-01 11:28 UTC (permalink / raw)
  To: rogerq, tony, krzk; +Cc: linux-omap, linux-kernel, YueHaibing

If CONFIG_OF is not set, make W=1 warns:

drivers/memory/omap-gpmc.c:987:12: warning: ‘gpmc_cs_remap’ defined but not used [-Wunused-function]
 static int gpmc_cs_remap(int cs, u32 base)
            ^~~~~~~~~~~~~
drivers/memory/omap-gpmc.c:926:20: warning: ‘gpmc_cs_get_name’ defined but not used [-Wunused-function]
 static const char *gpmc_cs_get_name(int cs)
                    ^~~~~~~~~~~~~~~~
drivers/memory/omap-gpmc.c:919:13: warning: ‘gpmc_cs_set_name’ defined but not used [-Wunused-function]
 static void gpmc_cs_set_name(int cs, const char *name)
             ^~~~~~~~~~~~~~~~
Move them to #ifdef CONFIG_OF block to fix this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
v3: move the functions to #ifdef block
v2: update commit log
---
 drivers/memory/omap-gpmc.c | 114 ++++++++++++++++++-------------------
 1 file changed, 57 insertions(+), 57 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index ac0f577a51a1..cfa730cfd145 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -916,20 +916,6 @@ static bool gpmc_cs_reserved(int cs)
 	return gpmc->flags & GPMC_CS_RESERVED;
 }
 
-static void gpmc_cs_set_name(int cs, const char *name)
-{
-	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
-
-	gpmc->name = name;
-}
-
-static const char *gpmc_cs_get_name(int cs)
-{
-	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
-
-	return gpmc->name;
-}
-
 static unsigned long gpmc_mem_align(unsigned long size)
 {
 	int order;
@@ -975,49 +961,6 @@ static int gpmc_cs_delete_mem(int cs)
 	return r;
 }
 
-/**
- * gpmc_cs_remap - remaps a chip-select physical base address
- * @cs:		chip-select to remap
- * @base:	physical base address to re-map chip-select to
- *
- * Re-maps a chip-select to a new physical base address specified by
- * "base". Returns 0 on success and appropriate negative error code
- * on failure.
- */
-static int gpmc_cs_remap(int cs, u32 base)
-{
-	int ret;
-	u32 old_base, size;
-
-	if (cs >= gpmc_cs_num) {
-		pr_err("%s: requested chip-select is disabled\n", __func__);
-		return -ENODEV;
-	}
-
-	/*
-	 * Make sure we ignore any device offsets from the GPMC partition
-	 * allocated for the chip select and that the new base confirms
-	 * to the GPMC 16MB minimum granularity.
-	 */
-	base &= ~(SZ_16M - 1);
-
-	gpmc_cs_get_memconf(cs, &old_base, &size);
-	if (base == old_base)
-		return 0;
-
-	ret = gpmc_cs_delete_mem(cs);
-	if (ret < 0)
-		return ret;
-
-	ret = gpmc_cs_insert_mem(cs, base, size);
-	if (ret < 0)
-		return ret;
-
-	ret = gpmc_cs_set_memconf(cs, base, size);
-
-	return ret;
-}
-
 int gpmc_cs_request(int cs, unsigned long size, unsigned long *base)
 {
 	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
@@ -1941,6 +1884,63 @@ static const struct of_device_id gpmc_dt_ids[] = {
 	{ }
 };
 
+static void gpmc_cs_set_name(int cs, const char *name)
+{
+	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
+
+	gpmc->name = name;
+}
+
+static const char *gpmc_cs_get_name(int cs)
+{
+	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
+
+	return gpmc->name;
+}
+
+/**
+ * gpmc_cs_remap - remaps a chip-select physical base address
+ * @cs:		chip-select to remap
+ * @base:	physical base address to re-map chip-select to
+ *
+ * Re-maps a chip-select to a new physical base address specified by
+ * "base". Returns 0 on success and appropriate negative error code
+ * on failure.
+ */
+static int gpmc_cs_remap(int cs, u32 base)
+{
+	int ret;
+	u32 old_base, size;
+
+	if (cs >= gpmc_cs_num) {
+		pr_err("%s: requested chip-select is disabled\n", __func__);
+		return -ENODEV;
+	}
+
+	/*
+	 * Make sure we ignore any device offsets from the GPMC partition
+	 * allocated for the chip select and that the new base confirms
+	 * to the GPMC 16MB minimum granularity.
+	 */
+	base &= ~(SZ_16M - 1);
+
+	gpmc_cs_get_memconf(cs, &old_base, &size);
+	if (base == old_base)
+		return 0;
+
+	ret = gpmc_cs_delete_mem(cs);
+	if (ret < 0)
+		return ret;
+
+	ret = gpmc_cs_insert_mem(cs, base, size);
+	if (ret < 0)
+		return ret;
+
+	ret = gpmc_cs_set_memconf(cs, base, size);
+
+	return ret;
+}
+
 /**
  * gpmc_read_settings_dt - read gpmc settings from device-tree
  * @np:		pointer to device-tree node for a gpmc child device
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 -next] memory: omap-gpmc: Fix -Wunused-function warnings
  2020-09-01 11:28 ` [PATCH v3 " YueHaibing
@ 2020-09-01 12:11   ` Roger Quadros
  2020-09-02 15:29   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 10+ messages in thread
From: Roger Quadros @ 2020-09-01 12:11 UTC (permalink / raw)
  To: YueHaibing, tony, krzk; +Cc: linux-omap, linux-kernel



On 01/09/2020 14:28, YueHaibing wrote:
> If CONFIG_OF is not set, make W=1 warns:
> 
> drivers/memory/omap-gpmc.c:987:12: warning: ‘gpmc_cs_remap’ defined but not used [-Wunused-function]
>   static int gpmc_cs_remap(int cs, u32 base)
>              ^~~~~~~~~~~~~
> drivers/memory/omap-gpmc.c:926:20: warning: ‘gpmc_cs_get_name’ defined but not used [-Wunused-function]
>   static const char *gpmc_cs_get_name(int cs)
>                      ^~~~~~~~~~~~~~~~
> drivers/memory/omap-gpmc.c:919:13: warning: ‘gpmc_cs_set_name’ defined but not used [-Wunused-function]
>   static void gpmc_cs_set_name(int cs, const char *name)
>               ^~~~~~~~~~~~~~~~
> Move them to #ifdef CONFIG_OF block to fix this.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Acked-by: Roger Quadros <rogerq@ti.com>

> ---
> v3: move the functions to #ifdef block
> v2: update commit log
> ---
>   drivers/memory/omap-gpmc.c | 114 ++++++++++++++++++-------------------
>   1 file changed, 57 insertions(+), 57 deletions(-)
> 
> diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
> index ac0f577a51a1..cfa730cfd145 100644
> --- a/drivers/memory/omap-gpmc.c
> +++ b/drivers/memory/omap-gpmc.c
> @@ -916,20 +916,6 @@ static bool gpmc_cs_reserved(int cs)
>   	return gpmc->flags & GPMC_CS_RESERVED;
>   }
>   
> -static void gpmc_cs_set_name(int cs, const char *name)
> -{
> -	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
> -
> -	gpmc->name = name;
> -}
> -
> -static const char *gpmc_cs_get_name(int cs)
> -{
> -	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
> -
> -	return gpmc->name;
> -}
> -
>   static unsigned long gpmc_mem_align(unsigned long size)
>   {
>   	int order;
> @@ -975,49 +961,6 @@ static int gpmc_cs_delete_mem(int cs)
>   	return r;
>   }
>   
> -/**
> - * gpmc_cs_remap - remaps a chip-select physical base address
> - * @cs:		chip-select to remap
> - * @base:	physical base address to re-map chip-select to
> - *
> - * Re-maps a chip-select to a new physical base address specified by
> - * "base". Returns 0 on success and appropriate negative error code
> - * on failure.
> - */
> -static int gpmc_cs_remap(int cs, u32 base)
> -{
> -	int ret;
> -	u32 old_base, size;
> -
> -	if (cs >= gpmc_cs_num) {
> -		pr_err("%s: requested chip-select is disabled\n", __func__);
> -		return -ENODEV;
> -	}
> -
> -	/*
> -	 * Make sure we ignore any device offsets from the GPMC partition
> -	 * allocated for the chip select and that the new base confirms
> -	 * to the GPMC 16MB minimum granularity.
> -	 */
> -	base &= ~(SZ_16M - 1);
> -
> -	gpmc_cs_get_memconf(cs, &old_base, &size);
> -	if (base == old_base)
> -		return 0;
> -
> -	ret = gpmc_cs_delete_mem(cs);
> -	if (ret < 0)
> -		return ret;
> -
> -	ret = gpmc_cs_insert_mem(cs, base, size);
> -	if (ret < 0)
> -		return ret;
> -
> -	ret = gpmc_cs_set_memconf(cs, base, size);
> -
> -	return ret;
> -}
> -
>   int gpmc_cs_request(int cs, unsigned long size, unsigned long *base)
>   {
>   	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
> @@ -1941,6 +1884,63 @@ static const struct of_device_id gpmc_dt_ids[] = {
>   	{ }
>   };
>   
> +static void gpmc_cs_set_name(int cs, const char *name)
> +{
> +	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
> +
> +	gpmc->name = name;
> +}
> +
> +static const char *gpmc_cs_get_name(int cs)
> +{
> +	struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
> +
> +	return gpmc->name;
> +}
> +
> +/**
> + * gpmc_cs_remap - remaps a chip-select physical base address
> + * @cs:		chip-select to remap
> + * @base:	physical base address to re-map chip-select to
> + *
> + * Re-maps a chip-select to a new physical base address specified by
> + * "base". Returns 0 on success and appropriate negative error code
> + * on failure.
> + */
> +static int gpmc_cs_remap(int cs, u32 base)
> +{
> +	int ret;
> +	u32 old_base, size;
> +
> +	if (cs >= gpmc_cs_num) {
> +		pr_err("%s: requested chip-select is disabled\n", __func__);
> +		return -ENODEV;
> +	}
> +
> +	/*
> +	 * Make sure we ignore any device offsets from the GPMC partition
> +	 * allocated for the chip select and that the new base confirms
> +	 * to the GPMC 16MB minimum granularity.
> +	 */
> +	base &= ~(SZ_16M - 1);
> +
> +	gpmc_cs_get_memconf(cs, &old_base, &size);
> +	if (base == old_base)
> +		return 0;
> +
> +	ret = gpmc_cs_delete_mem(cs);
> +	if (ret < 0)
> +		return ret;
> +
> +	ret = gpmc_cs_insert_mem(cs, base, size);
> +	if (ret < 0)
> +		return ret;
> +
> +	ret = gpmc_cs_set_memconf(cs, base, size);
> +
> +	return ret;
> +}
> +
>   /**
>    * gpmc_read_settings_dt - read gpmc settings from device-tree
>    * @np:		pointer to device-tree node for a gpmc child device
> 

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 -next] memory: omap-gpmc: Fix -Wunused-function warnings
  2020-09-01 11:28 ` [PATCH v3 " YueHaibing
  2020-09-01 12:11   ` Roger Quadros
@ 2020-09-02 15:29   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2020-09-02 15:29 UTC (permalink / raw)
  To: YueHaibing; +Cc: rogerq, tony, linux-omap, linux-kernel

On Tue, Sep 01, 2020 at 07:28:32PM +0800, YueHaibing wrote:
> If CONFIG_OF is not set, make W=1 warns:
> 
> drivers/memory/omap-gpmc.c:987:12: warning: ‘gpmc_cs_remap’ defined but not used [-Wunused-function]
>  static int gpmc_cs_remap(int cs, u32 base)
>             ^~~~~~~~~~~~~
> drivers/memory/omap-gpmc.c:926:20: warning: ‘gpmc_cs_get_name’ defined but not used [-Wunused-function]
>  static const char *gpmc_cs_get_name(int cs)
>                     ^~~~~~~~~~~~~~~~
> drivers/memory/omap-gpmc.c:919:13: warning: ‘gpmc_cs_set_name’ defined but not used [-Wunused-function]
>  static void gpmc_cs_set_name(int cs, const char *name)
>              ^~~~~~~~~~~~~~~~
> Move them to #ifdef CONFIG_OF block to fix this.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> v3: move the functions to #ifdef block
> v2: update commit log
> ---
>  drivers/memory/omap-gpmc.c | 114 ++++++++++++++++++-------------------

Thanks, applied.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-09-02 15:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01  3:56 [PATCH -next] memory: omap-gpmc: Fix -Wunused-function warnings YueHaibing
2020-09-01  6:52 ` Krzysztof Kozlowski
2020-09-01  6:58   ` Yuehaibing
2020-09-01  7:07 ` YueHaibing
2020-09-01  7:11   ` Yuehaibing
2020-09-01  7:09 ` [PATCH v2 " YueHaibing
2020-09-01 11:14   ` Roger Quadros
2020-09-01 11:28 ` [PATCH v3 " YueHaibing
2020-09-01 12:11   ` Roger Quadros
2020-09-02 15:29   ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).