Skip to content

Commit 5adb0ed

Browse files
minimaxwelldavem330
authored andcommitted
net: altera: tse: cosmetic change to use reverse xmas tree ordering
Make the driver code cleaner through a strictly cosmetic change, using he reverse xmas tree variable declaration ordering. Signed-off-by: Maxime Chevallier <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b0155d9 commit 5adb0ed

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

drivers/net/ethernet/altera/altera_tse_ethtool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ static int tse_reglen(struct net_device *dev)
199199
static void tse_get_regs(struct net_device *dev, struct ethtool_regs *regs,
200200
void *regbuf)
201201
{
202-
int i;
203202
struct altera_tse_private *priv = netdev_priv(dev);
204203
u32 *buf = regbuf;
204+
int i;
205205

206206
/* Set version to a known value, so ethtool knows
207207
* how to do any special formatting of this data.

drivers/net/ethernet/altera/altera_tse_main.c

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ static int altera_tse_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
141141
static int altera_tse_mdio_create(struct net_device *dev, unsigned int id)
142142
{
143143
struct altera_tse_private *priv = netdev_priv(dev);
144-
int ret;
145144
struct device_node *mdio_node = NULL;
146-
struct mii_bus *mdio = NULL;
147145
struct device_node *child_node = NULL;
146+
struct mii_bus *mdio = NULL;
147+
int ret;
148148

149149
for_each_child_of_node(priv->device->of_node, child_node) {
150150
if (of_device_is_compatible(child_node, "altr,tse-mdio")) {
@@ -236,8 +236,8 @@ static int tse_init_rx_buffer(struct altera_tse_private *priv,
236236
static void tse_free_rx_buffer(struct altera_tse_private *priv,
237237
struct tse_buffer *rxbuffer)
238238
{
239-
struct sk_buff *skb = rxbuffer->skb;
240239
dma_addr_t dma_addr = rxbuffer->dma_addr;
240+
struct sk_buff *skb = rxbuffer->skb;
241241

242242
if (skb != NULL) {
243243
if (dma_addr)
@@ -358,6 +358,7 @@ static inline void tse_rx_vlan(struct net_device *dev, struct sk_buff *skb)
358358
{
359359
struct ethhdr *eth_hdr;
360360
u16 vid;
361+
361362
if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
362363
!__vlan_get_tag(skb, &vid)) {
363364
eth_hdr = (struct ethhdr *)skb->data;
@@ -371,10 +372,10 @@ static inline void tse_rx_vlan(struct net_device *dev, struct sk_buff *skb)
371372
*/
372373
static int tse_rx(struct altera_tse_private *priv, int limit)
373374
{
374-
unsigned int count = 0;
375+
unsigned int entry = priv->rx_cons % priv->rx_ring_size;
375376
unsigned int next_entry;
377+
unsigned int count = 0;
376378
struct sk_buff *skb;
377-
unsigned int entry = priv->rx_cons % priv->rx_ring_size;
378379
u32 rxstatus;
379380
u16 pktlength;
380381
u16 pktstatus;
@@ -448,10 +449,10 @@ static int tse_rx(struct altera_tse_private *priv, int limit)
448449
static int tse_tx_complete(struct altera_tse_private *priv)
449450
{
450451
unsigned int txsize = priv->tx_ring_size;
451-
u32 ready;
452-
unsigned int entry;
453452
struct tse_buffer *tx_buff;
453+
unsigned int entry;
454454
int txcomplete = 0;
455+
u32 ready;
455456

456457
spin_lock(&priv->tx_lock);
457458

@@ -497,8 +498,8 @@ static int tse_poll(struct napi_struct *napi, int budget)
497498
{
498499
struct altera_tse_private *priv =
499500
container_of(napi, struct altera_tse_private, napi);
500-
int rxcomplete = 0;
501501
unsigned long int flags;
502+
int rxcomplete = 0;
502503

503504
tse_tx_complete(priv);
504505

@@ -561,13 +562,13 @@ static irqreturn_t altera_isr(int irq, void *dev_id)
561562
static netdev_tx_t tse_start_xmit(struct sk_buff *skb, struct net_device *dev)
562563
{
563564
struct altera_tse_private *priv = netdev_priv(dev);
565+
unsigned int nopaged_len = skb_headlen(skb);
564566
unsigned int txsize = priv->tx_ring_size;
565-
unsigned int entry;
566-
struct tse_buffer *buffer = NULL;
567567
int nfrags = skb_shinfo(skb)->nr_frags;
568-
unsigned int nopaged_len = skb_headlen(skb);
568+
struct tse_buffer *buffer = NULL;
569569
netdev_tx_t ret = NETDEV_TX_OK;
570570
dma_addr_t dma_addr;
571+
unsigned int entry;
571572

572573
spin_lock_bh(&priv->tx_lock);
573574

@@ -696,8 +697,8 @@ static void altera_tse_adjust_link(struct net_device *dev)
696697
static struct phy_device *connect_local_phy(struct net_device *dev)
697698
{
698699
struct altera_tse_private *priv = netdev_priv(dev);
699-
struct phy_device *phydev = NULL;
700700
char phy_id_fmt[MII_BUS_ID_SIZE + 3];
701+
struct phy_device *phydev = NULL;
701702

702703
if (priv->phy_addr != POLL_PHY) {
703704
snprintf(phy_id_fmt, MII_BUS_ID_SIZE + 3, PHY_ID_FMT,
@@ -773,8 +774,8 @@ static int altera_tse_phy_get_addr_mdio_create(struct net_device *dev)
773774
static int init_phy(struct net_device *dev)
774775
{
775776
struct altera_tse_private *priv = netdev_priv(dev);
776-
struct phy_device *phydev;
777777
struct device_node *phynode;
778+
struct phy_device *phydev;
778779
bool fixed_link = false;
779780
int rc = 0;
780781

@@ -1012,8 +1013,8 @@ static int tse_change_mtu(struct net_device *dev, int new_mtu)
10121013
static void altera_tse_set_mcfilter(struct net_device *dev)
10131014
{
10141015
struct altera_tse_private *priv = netdev_priv(dev);
1015-
int i;
10161016
struct netdev_hw_addr *ha;
1017+
int i;
10171018

10181019
/* clear the hash filter */
10191020
for (i = 0; i < 64; i++)
@@ -1152,9 +1153,9 @@ static int init_sgmii_pcs(struct net_device *dev)
11521153
static int tse_open(struct net_device *dev)
11531154
{
11541155
struct altera_tse_private *priv = netdev_priv(dev);
1156+
unsigned long flags;
11551157
int ret = 0;
11561158
int i;
1157-
unsigned long int flags;
11581159

11591160
/* Reset and configure TSE MAC and probe associated PHY */
11601161
ret = priv->dmaops->init_dma(priv);
@@ -1265,8 +1266,8 @@ static int tse_open(struct net_device *dev)
12651266
static int tse_shutdown(struct net_device *dev)
12661267
{
12671268
struct altera_tse_private *priv = netdev_priv(dev);
1268-
int ret;
12691269
unsigned long int flags;
1270+
int ret;
12701271

12711272
/* Stop the PHY */
12721273
if (dev->phydev)
@@ -1320,8 +1321,8 @@ static struct net_device_ops altera_tse_netdev_ops = {
13201321
static int request_and_map(struct platform_device *pdev, const char *name,
13211322
struct resource **res, void __iomem **ptr)
13221323
{
1323-
struct resource *region;
13241324
struct device *device = &pdev->dev;
1325+
struct resource *region;
13251326

13261327
*res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
13271328
if (*res == NULL) {
@@ -1350,13 +1351,13 @@ static int request_and_map(struct platform_device *pdev, const char *name,
13501351
*/
13511352
static int altera_tse_probe(struct platform_device *pdev)
13521353
{
1353-
struct net_device *ndev;
1354-
int ret = -ENODEV;
1354+
const struct of_device_id *of_id = NULL;
1355+
struct altera_tse_private *priv;
13551356
struct resource *control_port;
13561357
struct resource *dma_res;
1357-
struct altera_tse_private *priv;
1358+
struct net_device *ndev;
13581359
void __iomem *descmap;
1359-
const struct of_device_id *of_id = NULL;
1360+
int ret = -ENODEV;
13601361

13611362
ndev = alloc_etherdev(sizeof(struct altera_tse_private));
13621363
if (!ndev) {

0 commit comments

Comments
 (0)