staging: fsl-mc/dpio: Fix sparse warnings
cover staging: fsl-mc/dpio: Fix sparse warnings
Some code cleanup and bug fixes based on warnings reported by sparse when building on x86.
Ioana Radulescu (5):
staging: fsl-mc/dpio: Fix incorrect cast
staging: fsl-mc/dpio: Fix cast truncate warning
staging: fsl-mc/dpio: Use __leXX types where needed
staging: fsl-mc/dpio: Fix incorrect masking
staging: fsl-dpaa2/dpio: Remove dead code
drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 23 +++++++++-------------- drivers/staging/fsl-mc/bus/dpio/qbman-portal.h | 24 ++++++++++++------------ drivers/staging/fsl-mc/include/dpaa2-fd.h | 6 +++--- 3 files changed, 24 insertions(+), 29 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/5 staging: fsl-mc/dpio: Fix incorrect cast
Move the cast in dpaa2_sg_get_addr() to the right place.
--- drivers/staging/fsl-mc/include/dpaa2-fd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fsl-mc/include/dpaa2-fd.h +1 -1
@@ -287,7 +287,7 @@ enum dpaa2_sg_format {*/ static inline dma_addr_t dpaa2_sg_get_addr (const struct dpaa2_sg_entry *sg) { -return le64_to_cpu ((dma_addr_t )sg->addr); +return (dma_addr_t )le64_to_cpu (sg->addr); }/**
Signature · 1 line
2.7.4
PATCH 2/5 staging: fsl-mc/dpio: Fix cast truncate warning
In reply to Ioana RadulescuSparse reports the following warning:drivers/staging/fsl-mc/include/dpaa2-fd.h:421:30:
warning: cast truncates bits from constant value (ffff7fff becomes 7fff)
Fix this by explicitly masking the value with 0xffff.
--- drivers/staging/fsl-mc/include/dpaa2-fd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/fsl-mc/include/dpaa2-fd.h +2 -2
@@ -418,8 +418,8 @@ static inline bool dpaa2_sg_is_final(const struct dpaa2_sg_entry *sg)*/ static inline void dpaa2_sg_set_final (struct dpaa2_sg_entry *sg,bool final) { - sg->format_offset &=cpu_to_le16 (~(SG_FINAL_FLAG_MASK - <<SG_FINAL_FLAG_SHIFT )); + sg->format_offset &=cpu_to_le16 ((~(SG_FINAL_FLAG_MASK + <<SG_FINAL_FLAG_SHIFT )) &0xFFFF ); sg->format_offset |=cpu_to_le16 (final <<SG_FINAL_FLAG_SHIFT ); }
Signature · 1 line
2.7.4
PATCH 3/5 staging: fsl-mc/dpio: Use __leXX types where needed
In reply to Ioana RadulescuStructures that are mapped to hardware registers should explicitly specify the expected endianness for fields larger than 1 byte.
--- drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 16 ++++++++-------- drivers/staging/fsl-mc/bus/dpio/qbman-portal.h | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 20 deletions(-)
drivers/staging/fsl-mc/bus/dpio/qbman-portal.c +8 -8
@@ -830,7 +830,7 @@ int qbman_swp_release(struct qbman_swp *s, const struct qbman_release_desc *d,struct qbman_acquire_desc {u8 verb;u8 reserved; -u16 bpid; +__le16 bpid;u8 num;u8 reserved2[59 ]; };
@@ -838,10 +838,10 @@ struct qbman_acquire_desc {struct qbman_acquire_rslt {u8 verb;u8 rslt; -u16 reserved; +__le16 reserved;u8 num;u8 reserved2[3 ]; -u64 buf[7 ]; +__le64 buf[7 ]; };/**
@@ -904,7 +904,7 @@ int qbman_swp_acquire(struct qbman_swp *s, u16 bpid, u64 *buffers,struct qbman_alt_fq_state_desc {u8 verb;u8 reserved[3 ]; -u32 fqid; +__le32 fqid;u8 reserved2[56 ]; };
@@ -953,11 +953,11 @@ int qbman_swp_alt_fq_state(struct qbman_swp *s, u32 fqid,struct qbman_cdan_ctrl_desc {u8 verb;u8 reserved; -u16 ch; +__le16 ch;u8 we;u8 ctrl; -u16 reserved2; -u64 cdan_ctx; +__le16 reserved2; +__le64 cdan_ctx;u8 reserved3[48 ]; };
@@ -965,7 +965,7 @@ struct qbman_cdan_ctrl_desc {struct qbman_cdan_ctrl_rslt {u8 verb;u8 rslt; -u16 ch; +__le16 ch;u8 reserved[60 ]; };
drivers/staging/fsl-mc/bus/dpio/qbman-portal.h +12 -12
@@ -32,8 +32,8 @@ struct qbman_pull_desc {u8 numf;u8 tok;u8 reserved; -u32 dq_src; -u64 rsp_addr; +__le32 dq_src; +__le64 rsp_addr;u64 rsp_addr_virt;u8 padding[40 ]; };
@@ -70,17 +70,17 @@ enum qbman_pull_type_e {struct qbman_eq_desc {u8 verb;u8 dca; -u16 seqnum; -u16 orpid; -u16 reserved1; -u32 tgtid; -u32 tag; -u16 qdbin; +__le16 seqnum; +__le16 orpid; +__le16 reserved1; +__le32 tgtid; +__le32 tag; +__le16 qdbin;u8 qpri;u8 reserved[3 ];u8 wae;u8 rspid; -u64 rsp_addr; +__le64 rsp_addr;u8 fd[32 ]; };
@@ -88,9 +88,9 @@ struct qbman_eq_desc {struct qbman_release_desc {u8 verb;u8 reserved; -u16 bpid; -u32 reserved2; -u64 buf[7 ]; +__le16 bpid; +__le32 reserved2; +__le64 buf[7 ]; };/* Management command result codes */
Signature · 1 line
2.7.4
PATCH 4/5 staging: fsl-mc/dpio: Fix incorrect masking
In reply to Ioana RadulescuIn qbman_swp_alt_fq_state(), we need to mask the fqid value before converting it to little endian, otherwise we write a wrong value to hardware when running in big endian mode.
--- drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fsl-mc/bus/dpio/qbman-portal.c +1 -1
@@ -927,7 +927,7 @@ int qbman_swp_alt_fq_state(struct qbman_swp *s, u32 fqid,if (!p)return -EBUSY ; - p->fqid =cpu_to_le32 (fqid) &ALT_FQ_FQID_MASK ; + p->fqid =cpu_to_le32 (fqid &ALT_FQ_FQID_MASK );/* Complete the management command */ r =qbman_swp_mc_complete (s, p, alt_fq_verb);
Signature · 1 line
2.7.4
PATCH 5/5 staging: fsl-mc/dpio: Remove dead code
In reply to Ioana RadulescuFunction qbman_pull_desc_set_token() is not used at all, so remove it.
--- drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/staging/fsl-mc/bus/dpio/qbman-portal.c +0 -5
@@ -522,11 +522,6 @@ void qbman_pull_desc_set_numframes(struct qbman_pull_desc *d, u8 numframes) d->numf = numframes -1 ; } -static void qbman_pull_desc_set_token (struct qbman_pull_desc *d,u8 token) -{ - d->tok = token; -} -/* * Exactly one of the following descriptor "actions" should be set. (Calling any * one of these will replace the effect of any prior call to one of these.)
Signature · 1 line
2.7.4
RE: [PATCH 5/5] staging: fsl-mc/dpio: Remove dead code
Quoted 8 lines
-----Original Message-----
From: Ruxandra Ioana Ciocoi Radulescu
Sent: Tuesday, March 6, 2018 7:44 PM
To: [email protected]
Cc: [email protected]; [email protected]; Roy Pledge <[email protected]>; Laurentiu Tudor <[email protected]>
Subject: [PATCH 5/5] staging: fsl-mc/dpio: Remove dead code
Quoted 6 lines
Function
qbman_pull_desc_set_token()is not used at all, so remove it.Signed-off-by Ioana Radulescu <[email protected]>--- drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 5 ----- 1 file changed, 5 deletions(-)
Hi Greg,
Please ignore this patch, I've just noticed you already applied another patch with the same content a couple of hours ago.
Thanks,
Ioana
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[email protected]
maintainerRe: [PATCH 5/5] staging: fsl-mc/dpio: Remove dead code
Quoted 15 lines · Ruxandra Ioana Ciocoi Radulescu
Quoted 8 lines
-----Original Message-----
From: Ruxandra Ioana Ciocoi Radulescu
Sent: Tuesday, March 6, 2018 7:44 PM
To: [email protected]
Cc: [email protected]; [email protected]; Roy Pledge <[email protected]>; Laurentiu Tudor <[email protected]>
Subject: [PATCH 5/5] staging: fsl-mc/dpio: Remove dead codeQuoted 6 lines
Function
qbman_pull_desc_set_token()is not used at all, so remove it.Signed-off-by Ioana Radulescu <[email protected]>--- drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 5 ----- 1 file changed, 5 deletions(-)
Quoted 4 lines
Hi Greg,
Please ignore this patch, I've just noticed you already applied another patch with the same content a couple of hours ago.
Not a problem, now ignored :)
greg k-h
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel