Skip to content

Commit bd1a7b4

Browse files
committed
drivers/net: cris: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: "David S. Miller" <[email protected]> Cc: Kalle Valo <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: "[email protected]" <[email protected]> Cc: Paul Gortmaker <[email protected]> Cc: Philippe Reynes <[email protected]> Cc: [email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent 0078730 commit bd1a7b4

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

drivers/net/cris/eth_v10.c

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -165,17 +165,23 @@ static unsigned int network_rec_config_shadow = 0;
165165

166166
static unsigned int network_tr_ctrl_shadow = 0;
167167

168+
/* Timers */
169+
static void e100_check_speed(struct timer_list *unused);
170+
static void e100_clear_network_leds(struct timer_list *unused);
171+
static void e100_check_duplex(struct timer_list *unused);
172+
static DEFINE_TIMER(speed_timer, e100_check_speed);
173+
static DEFINE_TIMER(clear_led_timer, e100_clear_network_leds);
174+
static DEFINE_TIMER(duplex_timer, e100_check_duplex);
175+
static struct net_device *timer_dev;
176+
168177
/* Network speed indication. */
169-
static DEFINE_TIMER(speed_timer, NULL);
170-
static DEFINE_TIMER(clear_led_timer, NULL);
171178
static int current_speed; /* Speed read from transceiver */
172179
static int current_speed_selection; /* Speed selected by user */
173180
static unsigned long led_next_time;
174181
static int led_active;
175182
static int rx_queue_len;
176183

177184
/* Duplex */
178-
static DEFINE_TIMER(duplex_timer, NULL);
179185
static int full_duplex;
180186
static enum duplex current_duplex;
181187

@@ -200,9 +206,7 @@ static void update_rx_stats(struct net_device_stats *);
200206
static void update_tx_stats(struct net_device_stats *);
201207
static int e100_probe_transceiver(struct net_device* dev);
202208

203-
static void e100_check_speed(unsigned long priv);
204209
static void e100_set_speed(struct net_device* dev, unsigned long speed);
205-
static void e100_check_duplex(unsigned long priv);
206210
static void e100_set_duplex(struct net_device* dev, enum duplex);
207211
static void e100_negotiate(struct net_device* dev);
208212

@@ -214,7 +218,6 @@ static void e100_send_mdio_bit(unsigned char bit);
214218
static unsigned char e100_receive_mdio_bit(void);
215219
static void e100_reset_transceiver(struct net_device* net);
216220

217-
static void e100_clear_network_leds(unsigned long dummy);
218221
static void e100_set_network_leds(int active);
219222

220223
static const struct ethtool_ops e100_ethtool_ops;
@@ -381,17 +384,12 @@ etrax_ethernet_init(void)
381384
current_speed = 10;
382385
current_speed_selection = 0; /* Auto */
383386
speed_timer.expires = jiffies + NET_LINK_UP_CHECK_INTERVAL;
384-
speed_timer.data = (unsigned long)dev;
385-
speed_timer.function = e100_check_speed;
386-
387-
clear_led_timer.function = e100_clear_network_leds;
388-
clear_led_timer.data = (unsigned long)dev;
389387

390388
full_duplex = 0;
391389
current_duplex = autoneg;
392390
duplex_timer.expires = jiffies + NET_DUPLEX_CHECK_INTERVAL;
393-
duplex_timer.data = (unsigned long)dev;
394-
duplex_timer.function = e100_check_duplex;
391+
392+
timer_dev = dev;
395393

396394
/* Initialize mii interface */
397395
np->mii_if.phy_id_mask = 0x1f;
@@ -680,9 +678,9 @@ intel_check_speed(struct net_device* dev)
680678
}
681679
#endif
682680
static void
683-
e100_check_speed(unsigned long priv)
681+
e100_check_speed(struct timer_list *unused)
684682
{
685-
struct net_device* dev = (struct net_device*)priv;
683+
struct net_device* dev = timer_dev;
686684
struct net_local *np = netdev_priv(dev);
687685
static int led_initiated = 0;
688686
unsigned long data;
@@ -799,9 +797,9 @@ e100_set_speed(struct net_device* dev, unsigned long speed)
799797
}
800798

801799
static void
802-
e100_check_duplex(unsigned long priv)
800+
e100_check_duplex(struct timer_list *unused)
803801
{
804-
struct net_device *dev = (struct net_device *)priv;
802+
struct net_device *dev = timer_dev;
805803
struct net_local *np = netdev_priv(dev);
806804
int old_duplex;
807805

@@ -1669,9 +1667,9 @@ e100_hardware_send_packet(struct net_local *np, char *buf, int length)
16691667
}
16701668

16711669
static void
1672-
e100_clear_network_leds(unsigned long dummy)
1670+
e100_clear_network_leds(struct timer_list *unused)
16731671
{
1674-
struct net_device *dev = (struct net_device *)dummy;
1672+
struct net_device *dev = timer_dev;
16751673
struct net_local *np = netdev_priv(dev);
16761674

16771675
spin_lock(&np->led_lock);

0 commit comments

Comments
 (0)