Skip to content

Commit

Permalink
Merge branch 'sh_eth-fix-and-clean-up-sh_eth_soft_swap'
Browse files Browse the repository at this point in the history
Sergei Shtylyov says:

====================
sh_eth: fix & clean up sh_eth_soft_swap()

Here's a set of 3 patches against DaveM's 'net-next.git' repo. First one fixes an
old buffer endiannes issue (luckily, the ARM SoCs are smart enough to not actually
care) plus couple clean ups around sh_eth_soft_swap()...
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jun 4, 2018
2 parents 2067710 + 1100149 commit 4cd328f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
11 changes: 11 additions & 0 deletions drivers/net/ethernet/renesas/sh_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,17 @@ static u32 sh_eth_tsu_read(struct sh_eth_private *mdp, int enum_index)
return ioread32(mdp->tsu_addr + offset);
}

static void sh_eth_soft_swap(char *src, int len)
{
#ifdef __LITTLE_ENDIAN
u32 *p = (u32 *)src;
u32 *maxp = p + DIV_ROUND_UP(len, sizeof(u32));

for (; p < maxp; p++)
*p = swab32(*p);
#endif
}

static void sh_eth_select_mii(struct net_device *ndev)
{
struct sh_eth_private *mdp = netdev_priv(ndev);
Expand Down
12 changes: 0 additions & 12 deletions drivers/net/ethernet/renesas/sh_eth.h
Original file line number Diff line number Diff line change
Expand Up @@ -560,18 +560,6 @@ struct sh_eth_private {
unsigned wol_enabled:1;
};

static inline void sh_eth_soft_swap(char *src, int len)
{
#ifdef __LITTLE_ENDIAN__
u32 *p = (u32 *)src;
u32 *maxp;
maxp = p + ((len + sizeof(u32) - 1) / sizeof(u32));

for (; p < maxp; p++)
*p = swab32(*p);
#endif
}

static inline void *sh_eth_tsu_get_offset(struct sh_eth_private *mdp,
int enum_index)
{
Expand Down

0 comments on commit 4cd328f

Please sign in to comment.