Commit 9dd2d6c5 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller

netcp: add more __le32 annotations

The handling of epib and psdata remains a bit unclear in the driver,
as we access the same fields both as CPU-endian and through DMA
from the device.

Sparse warns about this:
ti/netcp_core.c:1147:21: warning: incorrect type in assignment (different base types)
ti/netcp_core.c:1147:21:    expected unsigned int [usertype] *[assigned] epib
ti/netcp_core.c:1147:21:    got restricted __le32 *<noident>

This uses __le32 types in a few places and uses __force where the code
looks fishy. The previous patch should really have produced the correct
behavior, but this second patch is needed to shut up the warnings about
it. Ideally it would be slightly rewritten to not need those casts,
but I don't dare do that without access to the hardware for proper
testing.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 89907779
...@@ -113,7 +113,7 @@ struct netcp_intf { ...@@ -113,7 +113,7 @@ struct netcp_intf {
#define NETCP_PSDATA_LEN KNAV_DMA_NUM_PS_WORDS #define NETCP_PSDATA_LEN KNAV_DMA_NUM_PS_WORDS
struct netcp_packet { struct netcp_packet {
struct sk_buff *skb; struct sk_buff *skb;
u32 *epib; __le32 *epib;
u32 *psdata; u32 *psdata;
unsigned int psdata_len; unsigned int psdata_len;
struct netcp_intf *netcp; struct netcp_intf *netcp;
......
...@@ -1145,8 +1145,8 @@ static int netcp_tx_submit_skb(struct netcp_intf *netcp, ...@@ -1145,8 +1145,8 @@ static int netcp_tx_submit_skb(struct netcp_intf *netcp,
p_info.ts_context = NULL; p_info.ts_context = NULL;
p_info.txtstamp_complete = NULL; p_info.txtstamp_complete = NULL;
p_info.epib = desc->epib; p_info.epib = desc->epib;
p_info.psdata = desc->psdata; p_info.psdata = (u32 __force *)desc->psdata;
memset(p_info.epib, 0, KNAV_DMA_NUM_EPIB_WORDS * sizeof(u32)); memset(p_info.epib, 0, KNAV_DMA_NUM_EPIB_WORDS * sizeof(__le32));
/* Find out where to inject the packet for transmission */ /* Find out where to inject the packet for transmission */
list_for_each_entry(tx_hook, &netcp->txhook_list_head, list) { list_for_each_entry(tx_hook, &netcp->txhook_list_head, list) {
...@@ -1170,11 +1170,12 @@ static int netcp_tx_submit_skb(struct netcp_intf *netcp, ...@@ -1170,11 +1170,12 @@ static int netcp_tx_submit_skb(struct netcp_intf *netcp,
/* update descriptor */ /* update descriptor */
if (p_info.psdata_len) { if (p_info.psdata_len) {
u32 *psdata = p_info.psdata; /* psdata points to both native-endian and device-endian data */
__le32 *psdata = (void __force *)p_info.psdata;
memmove(p_info.psdata, p_info.psdata + p_info.psdata_len, memmove(p_info.psdata, p_info.psdata + p_info.psdata_len,
p_info.psdata_len); p_info.psdata_len);
set_words(psdata, p_info.psdata_len, psdata); set_words(p_info.psdata, p_info.psdata_len, psdata);
tmp |= (p_info.psdata_len & KNAV_DMA_DESC_PSLEN_MASK) << tmp |= (p_info.psdata_len & KNAV_DMA_DESC_PSLEN_MASK) <<
KNAV_DMA_DESC_PSLEN_SHIFT; KNAV_DMA_DESC_PSLEN_SHIFT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment