@@ -141,10 +141,10 @@ static int altera_tse_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
141
141
static int altera_tse_mdio_create (struct net_device * dev , unsigned int id )
142
142
{
143
143
struct altera_tse_private * priv = netdev_priv (dev );
144
- int ret ;
145
144
struct device_node * mdio_node = NULL ;
146
- struct mii_bus * mdio = NULL ;
147
145
struct device_node * child_node = NULL ;
146
+ struct mii_bus * mdio = NULL ;
147
+ int ret ;
148
148
149
149
for_each_child_of_node (priv -> device -> of_node , child_node ) {
150
150
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,
236
236
static void tse_free_rx_buffer (struct altera_tse_private * priv ,
237
237
struct tse_buffer * rxbuffer )
238
238
{
239
- struct sk_buff * skb = rxbuffer -> skb ;
240
239
dma_addr_t dma_addr = rxbuffer -> dma_addr ;
240
+ struct sk_buff * skb = rxbuffer -> skb ;
241
241
242
242
if (skb != NULL ) {
243
243
if (dma_addr )
@@ -358,6 +358,7 @@ static inline void tse_rx_vlan(struct net_device *dev, struct sk_buff *skb)
358
358
{
359
359
struct ethhdr * eth_hdr ;
360
360
u16 vid ;
361
+
361
362
if ((dev -> features & NETIF_F_HW_VLAN_CTAG_RX ) &&
362
363
!__vlan_get_tag (skb , & vid )) {
363
364
eth_hdr = (struct ethhdr * )skb -> data ;
@@ -371,10 +372,10 @@ static inline void tse_rx_vlan(struct net_device *dev, struct sk_buff *skb)
371
372
*/
372
373
static int tse_rx (struct altera_tse_private * priv , int limit )
373
374
{
374
- unsigned int count = 0 ;
375
+ unsigned int entry = priv -> rx_cons % priv -> rx_ring_size ;
375
376
unsigned int next_entry ;
377
+ unsigned int count = 0 ;
376
378
struct sk_buff * skb ;
377
- unsigned int entry = priv -> rx_cons % priv -> rx_ring_size ;
378
379
u32 rxstatus ;
379
380
u16 pktlength ;
380
381
u16 pktstatus ;
@@ -448,10 +449,10 @@ static int tse_rx(struct altera_tse_private *priv, int limit)
448
449
static int tse_tx_complete (struct altera_tse_private * priv )
449
450
{
450
451
unsigned int txsize = priv -> tx_ring_size ;
451
- u32 ready ;
452
- unsigned int entry ;
453
452
struct tse_buffer * tx_buff ;
453
+ unsigned int entry ;
454
454
int txcomplete = 0 ;
455
+ u32 ready ;
455
456
456
457
spin_lock (& priv -> tx_lock );
457
458
@@ -497,8 +498,8 @@ static int tse_poll(struct napi_struct *napi, int budget)
497
498
{
498
499
struct altera_tse_private * priv =
499
500
container_of (napi , struct altera_tse_private , napi );
500
- int rxcomplete = 0 ;
501
501
unsigned long int flags ;
502
+ int rxcomplete = 0 ;
502
503
503
504
tse_tx_complete (priv );
504
505
@@ -561,13 +562,13 @@ static irqreturn_t altera_isr(int irq, void *dev_id)
561
562
static netdev_tx_t tse_start_xmit (struct sk_buff * skb , struct net_device * dev )
562
563
{
563
564
struct altera_tse_private * priv = netdev_priv (dev );
565
+ unsigned int nopaged_len = skb_headlen (skb );
564
566
unsigned int txsize = priv -> tx_ring_size ;
565
- unsigned int entry ;
566
- struct tse_buffer * buffer = NULL ;
567
567
int nfrags = skb_shinfo (skb )-> nr_frags ;
568
- unsigned int nopaged_len = skb_headlen ( skb ) ;
568
+ struct tse_buffer * buffer = NULL ;
569
569
netdev_tx_t ret = NETDEV_TX_OK ;
570
570
dma_addr_t dma_addr ;
571
+ unsigned int entry ;
571
572
572
573
spin_lock_bh (& priv -> tx_lock );
573
574
@@ -696,8 +697,8 @@ static void altera_tse_adjust_link(struct net_device *dev)
696
697
static struct phy_device * connect_local_phy (struct net_device * dev )
697
698
{
698
699
struct altera_tse_private * priv = netdev_priv (dev );
699
- struct phy_device * phydev = NULL ;
700
700
char phy_id_fmt [MII_BUS_ID_SIZE + 3 ];
701
+ struct phy_device * phydev = NULL ;
701
702
702
703
if (priv -> phy_addr != POLL_PHY ) {
703
704
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)
773
774
static int init_phy (struct net_device * dev )
774
775
{
775
776
struct altera_tse_private * priv = netdev_priv (dev );
776
- struct phy_device * phydev ;
777
777
struct device_node * phynode ;
778
+ struct phy_device * phydev ;
778
779
bool fixed_link = false;
779
780
int rc = 0 ;
780
781
@@ -1012,8 +1013,8 @@ static int tse_change_mtu(struct net_device *dev, int new_mtu)
1012
1013
static void altera_tse_set_mcfilter (struct net_device * dev )
1013
1014
{
1014
1015
struct altera_tse_private * priv = netdev_priv (dev );
1015
- int i ;
1016
1016
struct netdev_hw_addr * ha ;
1017
+ int i ;
1017
1018
1018
1019
/* clear the hash filter */
1019
1020
for (i = 0 ; i < 64 ; i ++ )
@@ -1152,9 +1153,9 @@ static int init_sgmii_pcs(struct net_device *dev)
1152
1153
static int tse_open (struct net_device * dev )
1153
1154
{
1154
1155
struct altera_tse_private * priv = netdev_priv (dev );
1156
+ unsigned long flags ;
1155
1157
int ret = 0 ;
1156
1158
int i ;
1157
- unsigned long int flags ;
1158
1159
1159
1160
/* Reset and configure TSE MAC and probe associated PHY */
1160
1161
ret = priv -> dmaops -> init_dma (priv );
@@ -1265,8 +1266,8 @@ static int tse_open(struct net_device *dev)
1265
1266
static int tse_shutdown (struct net_device * dev )
1266
1267
{
1267
1268
struct altera_tse_private * priv = netdev_priv (dev );
1268
- int ret ;
1269
1269
unsigned long int flags ;
1270
+ int ret ;
1270
1271
1271
1272
/* Stop the PHY */
1272
1273
if (dev -> phydev )
@@ -1320,8 +1321,8 @@ static struct net_device_ops altera_tse_netdev_ops = {
1320
1321
static int request_and_map (struct platform_device * pdev , const char * name ,
1321
1322
struct resource * * res , void __iomem * * ptr )
1322
1323
{
1323
- struct resource * region ;
1324
1324
struct device * device = & pdev -> dev ;
1325
+ struct resource * region ;
1325
1326
1326
1327
* res = platform_get_resource_byname (pdev , IORESOURCE_MEM , name );
1327
1328
if (* res == NULL ) {
@@ -1350,13 +1351,13 @@ static int request_and_map(struct platform_device *pdev, const char *name,
1350
1351
*/
1351
1352
static int altera_tse_probe (struct platform_device * pdev )
1352
1353
{
1353
- struct net_device * ndev ;
1354
- int ret = - ENODEV ;
1354
+ const struct of_device_id * of_id = NULL ;
1355
+ struct altera_tse_private * priv ;
1355
1356
struct resource * control_port ;
1356
1357
struct resource * dma_res ;
1357
- struct altera_tse_private * priv ;
1358
+ struct net_device * ndev ;
1358
1359
void __iomem * descmap ;
1359
- const struct of_device_id * of_id = NULL ;
1360
+ int ret = - ENODEV ;
1360
1361
1361
1362
ndev = alloc_etherdev (sizeof (struct altera_tse_private ));
1362
1363
if (!ndev ) {
0 commit comments