Fix sparse warnings for common qe library code
Subsystems (2)
cover Fix sparse warnings for common qe library code
The QE code was previously only supported on big-endian PowerPC systems that use the same endian as the QE device. The endian transfer code is not really exercised. Recent updates extended the QE drivers to little-endian ARM/ARM64 systems which makes the endian transfer really meaningful and hence triggered more sparse warnings for the endian mismatch. Some of these endian issues are real issues that need to be fixed.
While at it, fixed some direct de-references of IO memory space and suppressed other __iomem address space mismatch issues by adding correct address space attributes.
Li Yang (6):
soc: fsl: qe: fix sparse warnings for qe.c
soc: fsl: qe: fix sparse warning for qe_common.c
soc: fsl: qe: fix sparse warnings for ucc.c
soc: fsl: qe: fix sparse warnings for qe_ic.c
soc: fsl: qe: fix sparse warnings for ucc_fast.c
soc: fsl: qe: fix sparse warnings for ucc_slow.c
drivers/soc/fsl/qe/qe.c | 4 ++-- drivers/soc/fsl/qe/qe_common.c | 2 +- drivers/soc/fsl/qe/qe_ic.c | 2 +- drivers/soc/fsl/qe/ucc.c | 2 +- drivers/soc/fsl/qe/ucc_slow.c | 33 +++++++++++++-------------------- include/soc/fsl/qe/ucc_fast.h | 6 +++--- include/soc/fsl/qe/ucc_slow.h | 13 ++++++------- 7 files changed, 27 insertions(+), 35 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/6 soc: fsl: qe: fix sparse warnings for qe.c
Fixes the following sparse warnings:drivers/soc/fsl/qe/qe.c:426:9: warning: cast to restricted __be32 drivers/soc/fsl/qe/qe.c:528:41: warning: incorrect type in assignment (different base types)drivers/soc/fsl/qe/qe.c:528:41: expected unsigned long long static [addressable] [toplevel] [usertype] extended_modesdrivers/soc/fsl/qe/qe.c:528:41: got restricted __be64 const [usertype] extended_modes
--- drivers/soc/fsl/qe/qe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soc/fsl/qe/qe.c +2 -2
@@ -423,7 +423,7 @@ static void qe_upload_microcode(const void *base,qe_iowrite32be (be32_to_cpu (code[i]), &qe_immr->iram.idata);/* Set I-RAM Ready Register */ -qe_iowrite32be (be32_to_cpu (QE_IRAM_READY ), &qe_immr->iram.iready); +qe_iowrite32be (QE_IRAM_READY , &qe_immr->iram.iready); }/*
@@ -525,7 +525,7 @@ int qe_upload_firmware(const struct qe_firmware *firmware)*/ memset (&qe_firmware_info,0 ,sizeof (qe_firmware_info));strlcpy (qe_firmware_info.id, firmware->id,sizeof (qe_firmware_info.id)); - qe_firmware_info.extended_modes = firmware->extended_modes; + qe_firmware_info.extended_modes =be64_to_cpu (firmware->extended_modes);memcpy (qe_firmware_info.vtraps, firmware->vtraps,sizeof (firmware->vtraps));
Signature · 1 line
2.17.1
PATCH 2/6 soc: fsl: qe: fix sparse warning for qe_common.c
In reply to Li YangFixes the following sparse warning:
drivers/soc/fsl/qe/qe_common.c:75:48: warning: incorrect type in argument 2 (different base types)drivers/soc/fsl/qe/qe_common.c:75:48: expected restricted __be32 const [usertype] *addrdrivers/soc/fsl/qe/qe_common.c:75:48: got unsigned int *
--- drivers/soc/fsl/qe/qe_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/fsl/qe/qe_common.c +1 -1
@@ -46,7 +46,7 @@ int cpm_muram_init(void) {struct device_node *np;struct resource r; -u32 zero[OF_MAX_ADDR_CELLS ] = {}; +__be32 zero[OF_MAX_ADDR_CELLS ] = {};resource_size_t max =0 ;int i =0 ;int ret =0 ;
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 3/6 soc: fsl: qe: fix sparse warnings for ucc.c
In reply to Li YangFixes the following sparse warnings:
drivers/soc/fsl/qe/ucc.c:637:20: warning: incorrect type in assignment (different address spaces)drivers/soc/fsl/qe/ucc.c:637:20: expected struct qe_mux *qe_mux_regdrivers/soc/fsl/qe/ucc.c:637:20: got struct qe_mux [noderef] <asn:2> *drivers/soc/fsl/qe/ucc.c:652:9: warning: incorrect type in argument 1 (different address spaces)drivers/soc/fsl/qe/ucc.c:652:9: expected void const volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc.c:652:9: got restricted __be32 *drivers/soc/fsl/qe/ucc.c:652:9: warning: incorrect type in argument 2 (different address spaces)drivers/soc/fsl/qe/ucc.c:652:9: expected void volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc.c:652:9: got restricted __be32 *
--- drivers/soc/fsl/qe/ucc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/fsl/qe/ucc.c +1 -1
@@ -632,7 +632,7 @@ int ucc_set_tdm_rxtx_sync(u32 tdm_num, enum qe_clock clock, {int source;u32 shift; -struct qe_mux *qe_mux_reg; +struct qe_mux __iomem *qe_mux_reg; qe_mux_reg = &qe_immr->qmx;
Signature · 1 line
2.17.1
PATCH 4/6 soc: fsl: qe: fix sparse warnings for qe_ic.c
In reply to Li YangFixes the following sparse warnings:
drivers/soc/fsl/qe/qe_ic.c:253:32: warning: incorrect type in argument 1 (different base types)drivers/soc/fsl/qe/qe_ic.c:253:32: expected restricted __be32 [noderef] [usertype] <asn:2> *basedrivers/soc/fsl/qe/qe_ic.c:253:32: got unsigned int [noderef] [usertype] <asn:2> *regsdrivers/soc/fsl/qe/qe_ic.c:254:26: warning: incorrect type in argument 1 (different base types)drivers/soc/fsl/qe/qe_ic.c:254:26: expected restricted __be32 [noderef] [usertype] <asn:2> *basedrivers/soc/fsl/qe/qe_ic.c:254:26: got unsigned int [noderef] [usertype] <asn:2> *regsdrivers/soc/fsl/qe/qe_ic.c:269:32: warning: incorrect type in argument 1 (different base types)drivers/soc/fsl/qe/qe_ic.c:269:32: expected restricted __be32 [noderef] [usertype] <asn:2> *basedrivers/soc/fsl/qe/qe_ic.c:269:32: got unsigned int [noderef] [usertype] <asn:2> *regsdrivers/soc/fsl/qe/qe_ic.c:270:26: warning: incorrect type in argument 1 (different base types)drivers/soc/fsl/qe/qe_ic.c:270:26: expected restricted __be32 [noderef] [usertype] <asn:2> *basedrivers/soc/fsl/qe/qe_ic.c:270:26: got unsigned int [noderef] [usertype] <asn:2> *regsdrivers/soc/fsl/qe/qe_ic.c:341:31: warning: incorrect type in argument 1 (different base types)drivers/soc/fsl/qe/qe_ic.c:341:31: expected restricted __be32 [noderef] [usertype] <asn:2> *basedrivers/soc/fsl/qe/qe_ic.c:341:31: got unsigned int [noderef] [usertype] <asn:2> *regsdrivers/soc/fsl/qe/qe_ic.c:357:31: warning: incorrect type in argument 1 (different base types)drivers/soc/fsl/qe/qe_ic.c:357:31: expected restricted __be32 [noderef] [usertype] <asn:2> *basedrivers/soc/fsl/qe/qe_ic.c:357:31: got unsigned int [noderef] [usertype] <asn:2> *regsdrivers/soc/fsl/qe/qe_ic.c:450:26: warning: incorrect type in argument 1 (different base types)drivers/soc/fsl/qe/qe_ic.c:450:26: expected restricted __be32 [noderef] [usertype] <asn:2> *basedrivers/soc/fsl/qe/qe_ic.c:450:26: got unsigned int [noderef] [usertype] <asn:2> *regs
--- drivers/soc/fsl/qe/qe_ic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/fsl/qe/qe_ic.c +1 -1
@@ -44,7 +44,7 @@struct qe_ic {/* Control registers offset */ -u32 __iomem *regs; +__be32 __iomem *regs;/* The remapper for this QEIC */ struct irq_domain *irqhost;
Signature · 1 line
2.17.1
PATCH 5/6 soc: fsl: qe: fix sparse warnings for ucc_fast.c
In reply to Li YangFixes the following sparse warnings:
drivers/soc/fsl/qe/ucc_fast.c:218:22: warning: incorrect type in assignment (different base types)drivers/soc/fsl/qe/ucc_fast.c:218:22: expected unsigned int [noderef] [usertype] <asn:2> *p_uccedrivers/soc/fsl/qe/ucc_fast.c:218:22: got restricted __be32 [noderef] <asn:2> *drivers/soc/fsl/qe/ucc_fast.c:219:22: warning: incorrect type in assignment (different base types)drivers/soc/fsl/qe/ucc_fast.c:219:22: expected unsigned int [noderef] [usertype] <asn:2> *p_uccmdrivers/soc/fsl/qe/ucc_fast.c:219:22: got restricted __be32 [noderef] <asn:2> *
--- include/soc/fsl/qe/ucc_fast.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/soc/fsl/qe/ucc_fast.h +3 -3
@@ -178,10 +178,10 @@ struct ucc_fast_info {struct ucc_fast_private {struct ucc_fast_info *uf_info;struct ucc_fast __iomem *uf_regs;/* a pointer to the UCC regs. */ -u32 __iomem *p_ucce;/* a pointer to the event register in memory. */ -u32 __iomem *p_uccm;/* a pointer to the mask register in memory. */ +__be32 __iomem *p_ucce;/* a pointer to the event register in memory. */ +__be32 __iomem *p_uccm;/* a pointer to the mask register in memory. */ #ifdef CONFIG_UGETH_TX_ON_DEMAND -u16 __iomem *p_utodr;/* pointer to the transmit on demand register */ +__be16 __iomem *p_utodr;/* pointer to the transmit on demand register */ #endif int enabled_tx;/* Whether channel is enabled for Tx (ENT) */ int enabled_rx;/* Whether channel is enabled for Rx (ENR) */
Signature · 1 line
2.17.1
PATCH 6/6 soc: fsl: qe: fix sparse warnings for ucc_slow.c
In reply to Li YangFixes the following sparse warnings:
drivers/soc/fsl/qe/ucc_slow.c:78:17: warning: incorrect type in assignment (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:78:17: expected struct ucc_slow *us_regsdrivers/soc/fsl/qe/ucc_slow.c:78:17: got struct ucc_slow [noderef] <asn:2> *us_regsdrivers/soc/fsl/qe/ucc_slow.c:81:18: warning: incorrect type in argument 1 (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:81:18: expected void const volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc_slow.c:81:18: got restricted __be32 *drivers/soc/fsl/qe/ucc_slow.c:90:9: warning: incorrect type in argument 2 (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:90:9: expected void volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc_slow.c:90:9: got restricted __be32 *drivers/soc/fsl/qe/ucc_slow.c:99:17: warning: incorrect type in assignment (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:99:17: expected struct ucc_slow *us_regsdrivers/soc/fsl/qe/ucc_slow.c:99:17: got struct ucc_slow [noderef] <asn:2> *us_regsdrivers/soc/fsl/qe/ucc_slow.c:102:18: warning: incorrect type in argument 1 (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:102:18: expected void const volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc_slow.c:102:18: got restricted __be32 *drivers/soc/fsl/qe/ucc_slow.c:111:9: warning: incorrect type in argument 2 (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:111:9: expected void volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc_slow.c:111:9: got restricted __be32 *drivers/soc/fsl/qe/ucc_slow.c:172:28: warning: Using plain integer as NULL pointer drivers/soc/fsl/qe/ucc_slow.c:174:25: warning: cast removes address space '<asn:2>' of expression drivers/soc/fsl/qe/ucc_slow.c:175:25: warning: cast removes address space '<asn:2>' of expression drivers/soc/fsl/qe/ucc_slow.c:194:23: warning: incorrect type in assignment (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:194:23: expected struct ucc_slow_pram *us_pramdrivers/soc/fsl/qe/ucc_slow.c:194:23: got void [noderef] <asn:2> *drivers/soc/fsl/qe/ucc_slow.c:204:9: warning: incorrect type in argument 2 (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:204:9: expected void volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc_slow.c:204:9: got restricted __be16 *drivers/soc/fsl/qe/ucc_slow.c:229:41: warning: incorrect type in assignment (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:229:41: expected struct qe_bd *tx_bddrivers/soc/fsl/qe/ucc_slow.c:229:41: got void [noderef] <asn:2> *drivers/soc/fsl/qe/ucc_slow.c:232:17: warning: incorrect type in argument 2 (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:232:17: expected void volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc_slow.c:232:17: got restricted __be32 *drivers/soc/fsl/qe/ucc_slow.c:234:17: warning: incorrect type in argument 2 (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:234:17: expected void volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc_slow.c:234:17: got unsigned int [usertype] *drivers/soc/fsl/qe/ucc_slow.c:238:9: warning: incorrect type in argument 2 (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:238:9: expected void volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc_slow.c:238:9: got restricted __be32 *drivers/soc/fsl/qe/ucc_slow.c:239:9: warning: cast from restricted __be32 drivers/soc/fsl/qe/ucc_slow.c:239:9: warning: incorrect type in argument 1 (different base types)drivers/soc/fsl/qe/ucc_slow.c:239:9: expected unsigned int [usertype] valdrivers/soc/fsl/qe/ucc_slow.c:239:9: got restricted __be32 [usertype]drivers/soc/fsl/qe/ucc_slow.c:239:9: warning: cast from restricted __be32 drivers/soc/fsl/qe/ucc_slow.c:239:9: warning: incorrect type in argument 2 (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:239:9: expected void volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc_slow.c:239:9: got unsigned int [usertype] *drivers/soc/fsl/qe/ucc_slow.c:242:26: warning: incorrect type in assignment (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:242:26: expected struct qe_bd *rx_bddrivers/soc/fsl/qe/ucc_slow.c:242:26: got void [noderef] <asn:2> *drivers/soc/fsl/qe/ucc_slow.c:245:17: warning: incorrect type in argument 2 (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:245:17: expected void volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc_slow.c:245:17: got unsigned int [usertype] *drivers/soc/fsl/qe/ucc_slow.c:247:17: warning: incorrect type in argument 2 (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:247:17: expected void volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc_slow.c:247:17: got restricted __be32 *drivers/soc/fsl/qe/ucc_slow.c:251:9: warning: cast from restricted __be32 drivers/soc/fsl/qe/ucc_slow.c:251:9: warning: incorrect type in argument 1 (different base types)drivers/soc/fsl/qe/ucc_slow.c:251:9: expected unsigned int [usertype] valdrivers/soc/fsl/qe/ucc_slow.c:251:9: got restricted __be32 [usertype]drivers/soc/fsl/qe/ucc_slow.c:251:9: warning: cast from restricted __be32 drivers/soc/fsl/qe/ucc_slow.c:251:9: warning: incorrect type in argument 2 (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:251:9: expected void volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc_slow.c:251:9: got unsigned int [usertype] *drivers/soc/fsl/qe/ucc_slow.c:252:9: warning: incorrect type in argument 2 (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:252:9: expected void volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc_slow.c:252:9: got restricted __be32 *drivers/soc/fsl/qe/ucc_slow.c:276:39: warning: mixing different enum types:drivers/soc/fsl/qe/ucc_slow.c:276:39: unsigned int enum ucc_slow_tx_oversampling_ratedrivers/soc/fsl/qe/ucc_slow.c:276:39: unsigned int enum ucc_slow_rx_oversampling_ratedrivers/soc/fsl/qe/ucc_slow.c:296:9: warning: incorrect type in argument 2 (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:296:9: expected void volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc_slow.c:296:9: got restricted __be16 *drivers/soc/fsl/qe/ucc_slow.c:297:9: warning: incorrect type in argument 2 (different address spaces)drivers/soc/fsl/qe/ucc_slow.c:297:9: expected void volatile [noderef] <asn:2> *addrdrivers/soc/fsl/qe/ucc_slow.c:297:9: got restricted __be16 *
Also removed the unneccessary clearing for kzalloc'ed structure.
--- drivers/soc/fsl/qe/ucc_slow.c | 33 +++++++++++++-------------------- include/soc/fsl/qe/ucc_slow.h | 13 ++++++------- 2 files changed, 19 insertions(+), 27 deletions(-)
drivers/soc/fsl/qe/ucc_slow.c +13 -20
@@ -72,7 +72,7 @@ EXPORT_SYMBOL(ucc_slow_restart_tx);void ucc_slow_enable (struct ucc_slow_private * uccs,enum comm_dir mode) { -struct ucc_slow *us_regs; +struct ucc_slow __iomem *us_regs;u32 gumr_l; us_regs = uccs->us_regs;
@@ -93,7 +93,7 @@ EXPORT_SYMBOL(ucc_slow_enable);void ucc_slow_disable (struct ucc_slow_private * uccs,enum comm_dir mode) { -struct ucc_slow *us_regs; +struct ucc_slow __iomem *us_regs;u32 gumr_l; us_regs = uccs->us_regs;
@@ -122,7 +122,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** uccu32 i;struct ucc_slow __iomem *us_regs;u32 gumr; -struct qe_bd *bd; +struct qe_bd __iomem *bd;u32 id;u32 command;int ret =0 ;
@@ -168,16 +168,9 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** uccreturn -ENOMEM ; } - uccs->saved_uccm =0 ; - uccs->p_rx_frame =0 ; us_regs = uccs->us_regs; - uccs->p_ucce = (u16 *) & (us_regs->ucce); - uccs->p_uccm = (u16 *) & (us_regs->uccm); -#ifdef STATISTICS - uccs->rx_frames =0 ; - uccs->tx_frames =0 ; - uccs->rx_discarded =0 ; -#endif /* STATISTICS */ + uccs->p_ucce = &us_regs->ucce; + uccs->p_uccm = &us_regs->uccm;/* Get PRAM base */ uccs->us_pram_offset =
@@ -231,24 +224,24 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc/* clear bd buffer */ qe_iowrite32be (0 , &bd->buf);/* set bd status and length */ -qe_iowrite32be (0 , (u32 *)bd); +qe_iowrite32be (0 , (u32 __iomem *)bd); bd++; }/* for last BD set Wrap bit */ qe_iowrite32be (0 , &bd->buf); -qe_iowrite32be (cpu_to_be32 (T_W ), (u32 *)bd); +qe_iowrite32be (T_W , (u32 __iomem *)bd);/* Init Rx bds */ bd = uccs->rx_bd =qe_muram_addr (uccs->rx_base_offset);for (i =0 ; i < us_info->rx_bd_ring_len -1 ; i++) {/* set bd status and length */ -qe_iowrite32be (0 , (u32 *)bd); +qe_iowrite32be (0 , (u32 __iomem *)bd);/* clear bd buffer */ qe_iowrite32be (0 , &bd->buf); bd++; }/* for last BD set Wrap bit */ -qe_iowrite32be (cpu_to_be32 (R_W ), (u32 *)bd); +qe_iowrite32be (R_W , (u32 __iomem *)bd);qe_iowrite32be (0 , &bd->buf);/* Set GUMR (For more details see the hardware spec.). */
@@ -273,8 +266,8 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** uccqe_iowrite32be (gumr, &us_regs->gumr_h);/* gumr_l */ - gumr = us_info->tdcr | us_info->rdcr | us_info->tenc | us_info->renc | - us_info->diag | us_info->mode; + gumr = (u32 )us_info->tdcr | (u32 )us_info->rdcr | (u32 )us_info->tenc | + (u32 )us_info->renc | (u32 )us_info->diag | (u32 )us_info->mode;if (us_info->tci) gumr |=UCC_SLOW_GUMR_L_TCI ;if (us_info->rinv)
@@ -289,8 +282,8 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc/* if the data is in cachable memory, the 'global' */ /* in the function code should be set. */ - uccs->us_pram->tbmr =UCC_BMR_BO_BE ; - uccs->us_pram->rbmr =UCC_BMR_BO_BE ; +qe_iowrite8 (UCC_BMR_BO_BE , &uccs->us_pram->tbmr); +qe_iowrite8 (UCC_BMR_BO_BE , &uccs->us_pram->rbmr);/* rbase, tbase are offsets from MURAM base */ qe_iowrite16be (uccs->rx_base_offset, &uccs->us_pram->rbase);
include/soc/fsl/qe/ucc_slow.h +6 -7
@@ -184,7 +184,7 @@ struct ucc_slow_info {struct ucc_slow_private {struct ucc_slow_info *us_info;struct ucc_slow __iomem *us_regs;/* Ptr to memory map of UCC regs */ -struct ucc_slow_pram *us_pram;/* a pointer to the parameter RAM */ +struct ucc_slow_pram __iomem *us_pram;/* a pointer to the parameter RAM */ s32 us_pram_offset;int enabled_tx;/* Whether channel is enabled for Tx (ENT) */ int enabled_rx;/* Whether channel is enabled for Rx (ENR) */
@@ -196,13 +196,12 @@ struct ucc_slow_private {and length for first BD in a frame */ s32 tx_base_offset;/* first BD in Tx BD table offset (In MURAM) */ s32 rx_base_offset;/* first BD in Rx BD table offset (In MURAM) */ -struct qe_bd *confBd;/* next BD for confirm after Tx */ -struct qe_bd *tx_bd;/* next BD for new Tx request */ -struct qe_bd *rx_bd;/* next BD to collect after Rx */ +struct qe_bd __iomem *confBd;/* next BD for confirm after Tx */ +struct qe_bd __iomem *tx_bd;/* next BD for new Tx request */ +struct qe_bd __iomem *rx_bd;/* next BD to collect after Rx */ void *p_rx_frame;/* accumulating receive frame */ -u16 *p_ucce;/* a pointer to the event register in memory. -*/ -u16 *p_uccm;/* a pointer to the mask register in memory */ +__be16 __iomem *p_ucce;/* a pointer to the event register in memory */ +__be16 __iomem *p_uccm;/* a pointer to the mask register in memory */ u16 saved_uccm;/* a saved mask for the RX Interrupt bits */ #ifdef STATISTICS u32 tx_frames;/* Transmitted frames counters */
Signature · 1 line
2.17.1
kbuild test robot
build botRe: [PATCH 6/6] soc: fsl: qe: fix sparse warnings for ucc_slow.c
I love your patch! Perhaps something to improve:
Hi Li,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.6-rc6 next-20200316]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Li-Yang/Fix-sparse-warnings-for-common-qe-library-code/20200313-071045 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 807f030b44ccbb26a346df6f6438628315d9ad98 reproduce: # apt-get install sparse # sparse version: v0.6.1-175-g9d31ee5f-dirty make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag
sparse warnings: (new ones prefixed by >>)
drivers/tty/serial/ucc_uart.c:626:17: sparse: got restricted __be32 *
drivers/tty/serial/ucc_uart.c:627:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:627:17: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:627:17: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:637:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:637:9: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:637:9: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:638:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:638:9: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:638:9: sparse: got restricted __be32 *
drivers/tty/serial/ucc_uart.c:639:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:639:9: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:639:9: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:653:46: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct ucc_uart_pram *uccup @@ got struct ucc_uart_prstruct ucc_uart_pram *uccup @@
drivers/tty/serial/ucc_uart.c:653:46: sparse: expected struct ucc_uart_pram *uccup
drivers/tty/serial/ucc_uart.c:653:46: sparse: got struct ucc_uart_pram [noderef] <asn:2> *uccup
drivers/tty/serial/ucc_uart.c:661:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got eref] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:661:9: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:661:9: sparse: got unsigned char *
drivers/tty/serial/ucc_uart.c:662:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got eref] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:662:9: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:662:9: sparse: got unsigned char *
drivers/tty/serial/ucc_uart.c:663:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:663:9: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:663:9: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:664:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:664:9: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:664:9: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:665:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:665:9: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:665:9: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:666:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:666:9: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:666:9: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:667:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:667:9: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:667:9: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:668:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:668:9: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:668:9: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:669:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:669:9: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:669:9: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:670:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:670:9: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:670:9: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:671:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:671:9: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:671:9: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:672:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:672:9: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:672:9: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:674:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:674:17: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:674:17: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:675:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:675:9: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:675:9: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:713:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:713:17: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:713:17: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:714:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:714:17: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:714:17: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:715:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:715:17: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:715:17: sparse: got restricted __be32 *
drivers/tty/serial/ucc_uart.c:716:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:716:17: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:716:17: sparse: got restricted __be32 *
drivers/tty/serial/ucc_uart.c:717:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got eref] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:717:17: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:717:17: sparse: got unsigned char *
drivers/tty/serial/ucc_uart.c:718:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got eref] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:718:17: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:718:17: sparse: got unsigned char *
drivers/tty/serial/ucc_uart.c:719:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:719:17: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:719:17: sparse: got restricted __be32 *
drivers/tty/serial/ucc_uart.c:720:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got eref] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:720:17: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:720:17: sparse: got unsigned char *
drivers/tty/serial/ucc_uart.c:721:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:721:17: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:721:17: sparse: got restricted __be32 *
drivers/tty/serial/ucc_uart.c:722:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got eref] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:722:17: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:722:17: sparse: got unsigned char *
drivers/tty/serial/ucc_uart.c:724:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got eref] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:724:17: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:724:17: sparse: got unsigned char *
drivers/tty/serial/ucc_uart.c:726:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:726:17: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:726:17: sparse: got restricted __be16 *
drivers/tty/serial/ucc_uart.c:727:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got eref] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:727:17: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:727:17: sparse: got unsigned char *
drivers/tty/serial/ucc_uart.c:728:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:2> * @@ got [noderef] <asn:2> * @@
drivers/tty/serial/ucc_uart.c:728:17: sparse: expected void [noderef] <asn:2> *
drivers/tty/serial/ucc_uart.c:728:17: sparse: got restricted __be16 *
>> drivers/tty/serial/ucc_uart.c:1000:27: sparse: sparse: cast removes address space '<asn:2>' of expression drivers/tty/serial/ucc_uart.c:1000:24: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct ucc_uart_pram [noderef] <asn:2> *uccup @@ got am [noderef] <asn:2> *uccup @@ drivers/tty/serial/ucc_uart.c:1000:24: sparse: expected struct ucc_uart_pram [noderef] <asn:2> *uccup drivers/tty/serial/ucc_uart.c:1000:24: sparse: got struct ucc_uart_pram * >> drivers/tty/serial/ucc_uart.c:1001:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct qe_bd *rx_bd_base @@ got struct qe_bd [nodestruct qe_bd *rx_bd_base @@ >> drivers/tty/serial/ucc_uart.c:1001:29: sparse: expected struct qe_bd *rx_bd_base >> drivers/tty/serial/ucc_uart.c:1001:29: sparse: got struct qe_bd [noderef] <asn:2> *rx_bd >> drivers/tty/serial/ucc_uart.c:1002:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct qe_bd *tx_bd_base @@ got struct qe_bd [nodestruct qe_bd *tx_bd_base @@ >> drivers/tty/serial/ucc_uart.c:1002:29: sparse: expected struct qe_bd *tx_bd_base >> drivers/tty/serial/ucc_uart.c:1002:29: sparse: got struct qe_bd [noderef] <asn:2> *tx_bd
vim +1000 drivers/tty/serial/ucc_uart.c
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 976
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 977 /*
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 978 * Allocate any memory and I/O resources required by the port.
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 979 */
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 980 static int qe_uart_request_port(struct uart_port *port)
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 981 {
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 982 int ret;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 983 struct uart_qe_port *qe_port =
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 984 container_of(port, struct uart_qe_port, port);
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 985 struct ucc_slow_info *us_info = &qe_port->us_info;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 986 struct ucc_slow_private *uccs;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 987 unsigned int rx_size, tx_size;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 988 void *bd_virt;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 989 dma_addr_t bd_dma_addr = 0;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 990
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 991 ret = ucc_slow_init(us_info, &uccs);
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 992 if (ret) {
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 993 dev_err(port->dev, "could not initialize UCC%u\n",
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 994 qe_port->ucc_num);
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 995 return ret;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 996 }
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 997
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 998 qe_port->us_private = uccs;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 999 qe_port->uccp = uccs->us_regs;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 @1000 qe_port->uccup = (struct ucc_uart_pram *) uccs->us_pram;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 @1001 qe_port->rx_bd_base = uccs->rx_bd;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 @1002 qe_port->tx_bd_base = uccs->tx_bd;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1003
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1004 /*
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1005 * Allocate the transmit and receive data buffers.
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1006 */
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1007
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1008 rx_size = L1_CACHE_ALIGN(qe_port->rx_nrfifos * qe_port->rx_fifosize);
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1009 tx_size = L1_CACHE_ALIGN(qe_port->tx_nrfifos * qe_port->tx_fifosize);
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1010
8b05cefca73bfb drivers/serial/ucc_uart.c Becky Bruce 2008-09-12 1011 bd_virt = dma_alloc_coherent(port->dev, rx_size + tx_size, &bd_dma_addr,
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1012 GFP_KERNEL);
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1013 if (!bd_virt) {
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1014 dev_err(port->dev, "could not allocate buffer descriptors\n");
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1015 return -ENOMEM;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1016 }
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1017
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1018 qe_port->bd_virt = bd_virt;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1019 qe_port->bd_dma_addr = bd_dma_addr;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1020 qe_port->bd_size = rx_size + tx_size;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1021
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1022 qe_port->rx_buf = bd_virt;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1023 qe_port->tx_buf = qe_port->rx_buf + rx_size;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1024
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1025 return 0;
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1026 }
d7584ed2b994a5 drivers/serial/ucc_uart.c Timur Tabi 2008-01-15 1027 :::::: The code at line 1000 was first introduced by commit
:::::: d7584ed2b994a572326650b0c4d2c25961e6f49d [POWERPC] qe-uart: add support for Freescale QUICCEngine UART
:::::: TO: Timur Tabi <[email protected]>
:::::: CC: Kumar Gala <[email protected]>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Re: [PATCH 6/6] soc: fsl: qe: fix sparse warnings for ucc_slow.c
In reply to Li YangQuoted 2 lines · Li Yang
Fixes the following sparse warnings:
[snip]
Quoted 2 lines
Also removed the unneccessary clearing for kzalloc'ed structure.
Please don't mix that in the same patch, do it in a preparatory patch. That makes reviewing much easier.
drivers/soc/fsl/qe/ucc_slow.c int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc · line 227
Quoted 9 lines
drivers/soc/fsl/qe/ucc_slow.c +1
-1/* Get PRAM base */ uccs->us_pram_offset =@@ -231,24 +224,24 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc/* clear bd buffer */ qe_iowrite32be (0 , &bd->buf);/* set bd status and length */ -qe_iowrite32be (0 , (u32 *)bd); +qe_iowrite32be (0 , (u32 __iomem *)bd);
It's cleaner to do two qe_iowrite16be to &bd->status and &bd->length, that avoids the casting altogether.
drivers/soc/fsl/qe/ucc_slow.c int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc · line 232
Quoted 6 lines
drivers/soc/fsl/qe/ucc_slow.c +1
-1bd++; }/* for last BD set Wrap bit */ qe_iowrite32be (0 , &bd->buf); -qe_iowrite32be (cpu_to_be32 (T_W ), (u32 *)bd); +qe_iowrite32be (T_W , (u32 __iomem *)bd);
Yeah, and this is why. Who can actually keep track of where that bit ends up being set with that casting going on. Please use qe_iowrite16be() with an appropriately modified constant to the appropriate field instead of these games.
And if the hardware doesn't support 16 bit writes, the definition of struct qe_bd is wrong and should have a single __be32 status_length field, with appropriate accessors defined.
drivers/soc/fsl/qe/ucc_slow.c int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc · line 238
Quoted 6 lines
drivers/soc/fsl/qe/ucc_slow.c +1
-1/* Init Rx bds */ bd = uccs->rx_bd =qe_muram_addr (uccs->rx_base_offset);for (i =0 ; i < us_info->rx_bd_ring_len -1 ; i++) {/* set bd status and length */ -qe_iowrite32be (0 , (u32 *)bd); +qe_iowrite32be (0 , (u32 __iomem *)bd);
Same.
drivers/soc/fsl/qe/ucc_slow.c int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc · line 244
Quoted 7 lines
drivers/soc/fsl/qe/ucc_slow.c +1
-1/* clear bd buffer */ qe_iowrite32be (0 , &bd->buf); bd++; }/* for last BD set Wrap bit */ -qe_iowrite32be (cpu_to_be32 (R_W ), (u32 *)bd); +qe_iowrite32be (R_W , (u32 __iomem *)bd);
Same.
drivers/soc/fsl/qe/ucc_slow.c int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc · line 270
Quoted 11 lines
drivers/soc/fsl/qe/ucc_slow.c +2
-2qe_iowrite32be (0 , &bd->buf);/* Set GUMR (For more details see the hardware spec.). */ @@ -273,8 +266,8 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** uccqe_iowrite32be (gumr, &us_regs->gumr_h);/* gumr_l */ - gumr = us_info->tdcr | us_info->rdcr | us_info->tenc | us_info->renc | - us_info->diag | us_info->mode; + gumr = (u32 )us_info->tdcr | (u32 )us_info->rdcr | (u32 )us_info->tenc | + (u32 )us_info->renc | (u32 )us_info->diag | (u32 )us_info->mode;
Are the tdcr, rdcr, tenc, renc fields actually set anywhere (the same for the diag and mode, but word-grepping for those give way too many false positives)? They seem to be a somewhat pointless split out of the bitfields of gumr_l, and not populated anywhere?. That's not directly related to this patch, of course, but getting rid of them first (if they are indeed completely unused) might make the sparse cleanup a little simpler.
Rasmus
Re: [PATCH 6/6] soc: fsl: qe: fix sparse warnings for ucc_slow.c
Quoted 10 lines · Rasmus Villemoes
Quoted 2 lines · Li Yang
Fixes the following sparse warnings:
[snip]
Quoted 2 lines
Also removed the unneccessary clearing for kzalloc'ed structure.
Please don't mix that in the same patch, do it in a preparatory patch. That makes reviewing much easier.
Thanks for the review.
One of the few lines removed are actually causing sparse warning, that's why I changed this together with the sparse fixes. I can add all the lines removed in the log for better record.
Quoted 13 lines
drivers/soc/fsl/qe/ucc_slow.c int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc · line 227
Quoted 10 lines
/* Get PRAM base */ uccs->us_pram_offset =drivers/soc/fsl/qe/ucc_slow.c +1
-1@@ -231,24 +224,24 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc/* clear bd buffer */ qe_iowrite32be (0 , &bd->buf);/* set bd status and length */ -qe_iowrite32be (0 , (u32 *)bd); +qe_iowrite32be (0 , (u32 __iomem *)bd);It's cleaner to do two
qe_iowrite16beto&bd->statusand&bd->length, that avoids the casting altogether.
It probably is cleaner, but also slower for the bd manipulation that can be in the hot path. The QE code has been using this way to access/update the bd status and length together for a long time. And I remembered that it could help to prevent synchronization issues for accessing status and length separately.
It is probably cleaner to change the data structure to use union for accessing status and length together. But that will need a big change to update all the current users of the structure which I don't have the time to do right now.
Quoted 8 lines
drivers/soc/fsl/qe/ucc_slow.c int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc · line 232
Quoted 7 lines
drivers/soc/fsl/qe/ucc_slow.c +1
-1bd++; }/* for last BD set Wrap bit */ qe_iowrite32be (0 , &bd->buf); -qe_iowrite32be (cpu_to_be32 (T_W ), (u32 *)bd); +qe_iowrite32be (T_W , (u32 __iomem *)bd);
Quoted 8 lines
Yeah, and this is why. Who can actually keep track of where that bit ends up being set with that casting going on. Please use
qe_iowrite16be()with an appropriately modified constant to the appropriate field instead of these games.And if the hardware doesn't support 16 bit writes, the definition of struct
qe_bdis wrong and should have a single__be32status_lengthfield, with appropriate accessors defined.
Same comment as above.
Quoted 26 lines
drivers/soc/fsl/qe/ucc_slow.c int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc · line 238
Quoted 7 lines
drivers/soc/fsl/qe/ucc_slow.c +1
-1/* Init Rx bds */ bd = uccs->rx_bd =qe_muram_addr (uccs->rx_base_offset);for (i =0 ; i < us_info->rx_bd_ring_len -1 ; i++) {/* set bd status and length */ -qe_iowrite32be (0 , (u32 *)bd); +qe_iowrite32be (0 , (u32 __iomem *)bd);Same.
drivers/soc/fsl/qe/ucc_slow.c int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc · line 244
Quoted 7 lines
drivers/soc/fsl/qe/ucc_slow.c +1
-1/* clear bd buffer */ qe_iowrite32be (0 , &bd->buf); bd++; }/* for last BD set Wrap bit */ -qe_iowrite32be (cpu_to_be32 (R_W ), (u32 *)bd); +qe_iowrite32be (R_W , (u32 __iomem *)bd);Same.
Quoted 6 lines
drivers/soc/fsl/qe/ucc_slow.c +0
-0qe_iowrite32be (0 , &bd->buf);/* Set GUMR (For more details see the hardware spec.). */ @@ -273,8 +266,8 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** uccqe_iowrite32be (gumr, &us_regs->gumr_h);
Quoted 13 lines
drivers/soc/fsl/qe/ucc_slow.c int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc · line 270
Quoted 5 lines
drivers/soc/fsl/qe/ucc_slow.c +2
-2/* gumr_l */ - gumr = us_info->tdcr | us_info->rdcr | us_info->tenc | us_info->renc | - us_info->diag | us_info->mode; + gumr = (u32 )us_info->tdcr | (u32 )us_info->rdcr | (u32 )us_info->tenc | + (u32 )us_info->renc | (u32 )us_info->diag | (u32 )us_info->mode;Are the tdcr, rdcr, tenc, renc fields actually set anywhere (the same for the diag and mode, but word-grepping for those give way too many false positives)? They seem to be a somewhat pointless split out of the bitfields of
gumr_l, and not populated anywhere?. That's not directly related to this patch, of course, but getting rid of them first (if they are indeed completely unused) might make the sparse cleanup a little simpler.
I would agree with you that is not neccessary to create different enum types for these bits in the same register in the first place. But I would like to prevent aggressive cleanups of this driver for old hardware that is becoming harder and harder to be thoroughly tested right now. These fields are probably not used by the in tree ucc_uart driver right now. But as a generic library for QE, I think it is harmless to keep these simple code there for potentially customized version of the uart driver or other ucc slow drivers.
Regards,
Leo
Quoted 12 lines · Li Yang
The QE code was previously only supported on big-endian PowerPC systems that use the same endian as the QE device. The endian transfer code is not really exercised. Recent updates extended the QE drivers to little-endian ARM/ARM64 systems which makes the endian transfer really meaningful and hence triggered more sparse warnings for the endian mismatch. Some of these endian issues are real issues that need to be fixed.
While at it, fixed some direct de-references of IO memory space and suppressed other
__iomemaddress space mismatch issues by adding correct address space attributes.
Quoted 7 lines
Li Yang (6):
soc: fsl: qe: fix sparse warnings forqe.c
soc: fsl: qe: fix sparse warning forqe_common.c
soc: fsl: qe: fix sparse warnings forucc.c
soc: fsl: qe: fix sparse warnings forqe_ic.c
soc: fsl: qe: fix sparse warnings forucc_fast.c
soc: fsl: qe: fix sparse warnings forucc_slow.c
Patches 2-5 should not change the generated code, whether LE or BE host, as they merely add sparse annotations (please double-check with objdump that that is indeed the case), so for those you may add
I think patch 1 is also correct, but I don't have hardware to test it on ATM. I'd like to see patch 6 split into smaller pieces, most of it seems obviously correct.
Rasmus