From: Christian Marangi Date: Mon, 8 May 2023 17:26:48 +0000 (+0200) Subject: layerscape: 5.15: fix compilation warning for fsl ppfe driver X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=0d4a547905d4;p=openwrt%2Fstaging%2Fxback.git 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 --- diff --git a/target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch b/target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch index 00c8e869be..9e60226083 100644 --- a/target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch +++ b/target/linux/layerscape/patches-5.15/701-staging-add-fsl_ppfe-driver.patch @@ -2507,7 +2507,7 @@ Signed-off-by: Pawel Dembicki +{ + int ret = 0; + -+ pr_info("PFE CDEV attempt copying (%lu) size of user.\n", ++ pr_info("PFE CDEV attempt copying (%zu) size of user.\n", + sizeof(link_states)); + + pr_debug("Dump link_state on screen before copy_to_user\n"); @@ -2520,14 +2520,14 @@ Signed-off-by: Pawel Dembicki + /* Copy to user the value in buffer sized len */ + ret = copy_to_user(buf, &link_states, sizeof(link_states)); + if (ret != 0) { -+ pr_err("Failed to send (%d)bytes of (%lu) requested.\n", ++ pr_err("Failed to send (%d)bytes of (%zu) requested.\n", + ret, len); + return -EFAULT; + } + + /* offset set back to 0 as there is contextual reading offset */ + *off = 0; -+ pr_debug("Read of (%lu) bytes performed.\n", sizeof(link_states)); ++ pr_debug("Read of (%zu) bytes performed.\n", sizeof(link_states)); + + return sizeof(link_states); +} @@ -6422,7 +6422,7 @@ Signed-off-by: Pawel Dembicki +#endif /* _PFE_FIRMWARE_H_ */ --- /dev/null +++ b/drivers/staging/fsl_ppfe/pfe_hal.c -@@ -0,0 +1,1517 @@ +@@ -0,0 +1,1516 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2015-2016 Freescale Semiconductor, Inc. @@ -7030,7 +7030,6 @@ Signed-off-by: Pawel Dembicki + util_pmem_memcpy(DDR_PHYS_TO_VIRT( + DDR_PFE_TO_PHYS(addr)), + data + offset, size); -+ } +#endif + } else { + pr_err( @@ -8060,11 +8059,11 @@ Signed-off-by: Pawel Dembicki + 0x33221100, 0xa8c05544, 0x00000301, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0xbe86c51f }; + -+ ddr_ptr = (void *)((u64)readl(BMU2_BASE_ADDR + BMU_ALLOC_CTRL)); ++ ddr_ptr = (void *)((uintptr_t)readl(BMU2_BASE_ADDR + BMU_ALLOC_CTRL)); + if (!ddr_ptr) + return; + -+ lmem_ptr = (void *)((u64)readl(BMU1_BASE_ADDR + BMU_ALLOC_CTRL)); ++ lmem_ptr = (void *)((uintptr_t)readl(BMU1_BASE_ADDR + BMU_ALLOC_CTRL)); + if (!lmem_ptr) + return; + @@ -8131,16 +8130,16 @@ Signed-off-by: Pawel Dembicki +void pfe_hif_desc_dump(struct pfe_hif *hif) +{ + struct hif_desc *desc; -+ unsigned long desc_p; ++ u64 desc_p; + int ii = 0; + + pr_info("%s\n", __func__); + + desc = hif->rx_base; -+ desc_p = (u32)((u64)desc - (u64)hif->descr_baseaddr_v + ++ desc_p = ((void *)desc - hif->descr_baseaddr_v + + hif->descr_baseaddr_p); + -+ pr_info("HIF Rx desc base %p physical %x\n", desc, (u32)desc_p); ++ pr_info("HIF Rx desc base %p physical %llx\n", desc, desc_p); + for (ii = 0; ii < hif->rx_ring_size; ii++) { + pr_info("status: %08x, ctrl: %08x, data: %08x, next: %x\n", + readl(&desc->status), readl(&desc->ctrl), @@ -8149,10 +8148,10 @@ Signed-off-by: Pawel Dembicki + } + + desc = hif->tx_base; -+ desc_p = ((u64)desc - (u64)hif->descr_baseaddr_v + ++ desc_p = ((void *)desc - hif->descr_baseaddr_v + + hif->descr_baseaddr_p); + -+ pr_info("HIF Tx desc base %p physical %x\n", desc, (u32)desc_p); ++ pr_info("HIF Tx desc base %p physical %llx\n", desc, desc_p); + for (ii = 0; ii < hif->tx_ring_size; ii++) { + pr_info("status: %08x, ctrl: %08x, data: %08x, next: %x\n", + readl(&desc->status), readl(&desc->ctrl), @@ -11479,7 +11478,7 @@ Signed-off-by: Pawel Dembicki +static ssize_t pfe_set_util(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ -+ util_do_clear = kstrtoul(buf, NULL, 0); ++ util_do_clear = kstrtoul(buf, 0, 0); + return count; +} +