memory: omap-gpmc: Fix -Wunused-function warnings
authorYueHaibing <yuehaibing@huawei.com>
Tue, 1 Sep 2020 11:28:32 +0000 (19:28 +0800)
committerKrzysztof Kozlowski <krzk@kernel.org>
Wed, 2 Sep 2020 15:29:11 +0000 (17:29 +0200)
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]
  drivers/memory/omap-gpmc.c:926:20: warning: ‘gpmc_cs_get_name’ defined but not used [-Wunused-function]
  drivers/memory/omap-gpmc.c:919:13: warning: ‘gpmc_cs_set_name’ defined but not used [-Wunused-function]

Move them to #ifdef CONFIG_OF block to fix this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Link: https://lore.kernel.org/r/20200901112832.3084-1-yuehaibing%40huawei.com
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
drivers/memory/omap-gpmc.c

index 8932c5b..bd989b8 100644 (file)
@@ -917,20 +917,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;
@@ -976,49 +962,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];
@@ -1942,6 +1885,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