layerscape: 5.15: fix compilation warning for fsl ppfe driver
authorChristian Marangi <ansuelsmth@gmail.com>
Mon, 8 May 2023 17:26:48 +0000 (19:26 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Fri, 12 May 2023 01:15:41 +0000 (03:15 +0200)
commit0d4a547905d4ad020596a35f5e170e9ade78eea7
tree8039ccf32d4dfe98895d4c286e3aa5d07d077167
parente28196c4aac733ed23a8fcabe22c1e4dbfac3b5f
layerscape: 5.15: fix compilation warning for fsl ppfe driver

Rework some desc dump and dummy pkt function to fix compilation warning.
Fix compilation warning:
drivers/staging/fsl_ppfe/pfe_hif.c: In function 'send_dummy_pkt_to_hif':
drivers/staging/fsl_ppfe/pfe_hif.c:118:19: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  118 |         ddr_ptr = (void *)((u64)readl(BMU2_BASE_ADDR + BMU_ALLOC_CTRL));
      |                   ^
drivers/staging/fsl_ppfe/pfe_hif.c:122:20: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  122 |         lmem_ptr = (void *)((u64)readl(BMU1_BASE_ADDR + BMU_ALLOC_CTRL));
      |                    ^
drivers/staging/fsl_ppfe/pfe_hif.c: In function 'pfe_hif_desc_dump':
drivers/staging/fsl_ppfe/pfe_hif.c:195:24: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  195 |         desc_p = (u32)((u64)desc - (u64)hif->descr_baseaddr_v +
      |                        ^
drivers/staging/fsl_ppfe/pfe_hif.c:195:36: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  195 |         desc_p = (u32)((u64)desc - (u64)hif->descr_baseaddr_v +
      |                                    ^
drivers/staging/fsl_ppfe/pfe_hif.c:207:19: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  207 |         desc_p = ((u64)desc - (u64)hif->descr_baseaddr_v +
      |                   ^
drivers/staging/fsl_ppfe/pfe_hif.c:207:31: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  207 |         desc_p = ((u64)desc - (u64)hif->descr_baseaddr_v +
      |                               ^
cc1: all warnings being treated as errors

In file included from ./include/linux/kernel.h:19,
                 from ./include/linux/list.h:9,
                 from ./include/linux/wait.h:7,
                 from ./include/linux/eventfd.h:13,
                 from drivers/staging/fsl_ppfe/pfe_cdev.c:11:
drivers/staging/fsl_ppfe/pfe_cdev.c: In function 'pfe_cdev_read':
./include/linux/kern_levels.h:5:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Werror=format=]
    5 | #define KERN_SOH        "\001"          /* ASCII Start Of Header */
      |                         ^~~~~~
./include/linux/printk.h:422:25: note: in definition of macro 'printk_index_wrap'
  422 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
      |                         ^~~~
./include/linux/printk.h:132:17: note: in expansion of macro 'printk'
  132 |                 printk(fmt, ##__VA_ARGS__);             \
      |                 ^~~~~~
./include/linux/printk.h:580:9: note: in expansion of macro 'no_printk'
  580 |         no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
      |         ^~~~~~~~~
./include/linux/kern_levels.h:15:25: note: in expansion of macro 'KERN_SOH'
   15 | #define KERN_DEBUG      KERN_SOH "7"    /* debug-level messages */
      |                         ^~~~~~~~
./include/linux/printk.h:580:19: note: in expansion of macro 'KERN_DEBUG'
  580 |         no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
      |                   ^~~~~~~~~~
drivers/staging/fsl_ppfe/pfe_cdev.c:42:17: note: in expansion of macro 'pr_debug'
   42 |                 pr_debug("%u  %lu", link_states[ret].phy_id,
      |                 ^~~~~~~~
./include/linux/kern_levels.h:5:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=]
    5 | #define KERN_SOH        "\001"          /* ASCII Start Of Header */
      |                         ^~~~~~
./include/linux/printk.h:422:25: note: in definition of macro 'printk_index_wrap'
  422 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
      |                         ^~~~
./include/linux/printk.h:493:9: note: in expansion of macro 'printk'
  493 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
      |         ^~~~~~
./include/linux/kern_levels.h:11:25: note: in expansion of macro 'KERN_SOH'
   11 | #define KERN_ERR        KERN_SOH "3"    /* error conditions */
      |                         ^~~~~~~~
./include/linux/printk.h:493:16: note: in expansion of macro 'KERN_ERR'
  493 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
      |                ^~~~~~~~
drivers/staging/fsl_ppfe/pfe_cdev.c:50:17: note: in expansion of macro 'pr_err'
   50 |                 pr_err("Failed to send (%d)bytes of (%lu) requested.\n",
      |                 ^~~~~~
./include/linux/kern_levels.h:5:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'unsigned int' [-Werror=format=]
    5 | #define KERN_SOH        "\001"          /* ASCII Start Of Header */
      |                         ^~~~~~
./include/linux/printk.h:422:25: note: in definition of macro 'printk_index_wrap'
  422 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
      |                         ^~~~
./include/linux/printk.h:132:17: note: in expansion of macro 'printk'
  132 |                 printk(fmt, ##__VA_ARGS__);             \
      |                 ^~~~~~
./include/linux/printk.h:580:9: note: in expansion of macro 'no_printk'
  580 |         no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
      |         ^~~~~~~~~
./include/linux/kern_levels.h:15:25: note: in expansion of macro 'KERN_SOH'
   15 | #define KERN_DEBUG      KERN_SOH "7"    /* debug-level messages */
      |                         ^~~~~~~~
./include/linux/printk.h:580:19: note: in expansion of macro 'KERN_DEBUG'
  580 |         no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
      |                   ^~~~~~~~~~
drivers/staging/fsl_ppfe/pfe_cdev.c:57:9: note: in expansion of macro 'pr_debug'
   57 |         pr_debug("Read of (%lu) bytes performed.\n", sizeof(link_states));
      |         ^~~~~~~~
cc1: all warnings being treated as errors

In file included from ./include/uapi/linux/posix_types.h:5,
                 from ./include/uapi/linux/types.h:14,
                 from ./include/linux/types.h:6,
                 from ./include/linux/list.h:5,
                 from ./include/linux/module.h:12,
                 from drivers/staging/fsl_ppfe/pfe_sysfs.c:7:
drivers/staging/fsl_ppfe/pfe_sysfs.c: In function 'pfe_set_util':
./include/linux/stddef.h:8:14: error: passing argument 2 of 'kstrtoul' makes integer from pointer without a cast [-Werror=int-conversion]
    8 | #define NULL ((void *)0)
      |              ^~~~~~~~~~~
      |              |
      |              void *
drivers/staging/fsl_ppfe/pfe_sysfs.c:538:39: note: in expansion of macro 'NULL'
  538 |         util_do_clear = kstrtoul(buf, NULL, 0);
      |                                       ^~~~
In file included from ./include/linux/kernel.h:13,
                 from ./include/linux/list.h:9:
./include/linux/kstrtox.h:30:69: note: expected 'unsigned int' but argument is of type 'void *'
   30 | static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
      |                                                        ~~~~~~~~~~~~~^~~~
cc1: all warnings being treated as errors

With UTIL compiled on, fix compilation warning:
drivers/staging/fsl_ppfe/pfe_hal.c: In function 'pe_load_ddr_section':
drivers/staging/fsl_ppfe/pfe_hal.c:617:19: error: 'else' without a previous 'if'
  617 |                 } else {
      |                   ^~~~
drivers/staging/fsl_ppfe/pfe_hal.c:622:17: error: break statement not within loop or switch
  622 |                 break;
      |                 ^~~~~
drivers/staging/fsl_ppfe/pfe_hal.c:624:9: error: case label not within a switch statement
  624 |         case SHT_NOBITS:
      |         ^~~~
drivers/staging/fsl_ppfe/pfe_hal.c:627:17: error: break statement not within loop or switch
  627 |                 break;
      |                 ^~~~~
drivers/staging/fsl_ppfe/pfe_hal.c:629:9: error: 'default' label not within a switch statement
  629 |         default:
      |         ^~~~~~~
drivers/staging/fsl_ppfe/pfe_hal.c: At top level:
drivers/staging/fsl_ppfe/pfe_hal.c:635:9: error: expected identifier or '(' before 'return'
  635 |         return 0;
      |         ^~~~~~
drivers/staging/fsl_ppfe/pfe_hal.c:636:1: error: expected identifier or '(' before '}' token
  636 | }

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch