@@ -54,6 +54,7 @@ static const char driver_name[] = "pegasus";
54
54
#undef PEGASUS_WRITE_EEPROM
55
55
#define BMSR_MEDIA (BMSR_10HALF | BMSR_10FULL | BMSR_100HALF | \
56
56
BMSR_100FULL | BMSR_ANEGCAPABLE)
57
+ #define CARRIER_CHECK_DELAY (2 * HZ)
57
58
58
59
static bool loopback ;
59
60
static bool mii_mode ;
@@ -1089,17 +1090,12 @@ static inline void setup_pegasus_II(pegasus_t *pegasus)
1089
1090
set_register (pegasus , Reg81 , 2 );
1090
1091
}
1091
1092
1092
-
1093
- static int pegasus_count ;
1094
- static struct workqueue_struct * pegasus_workqueue ;
1095
- #define CARRIER_CHECK_DELAY (2 * HZ)
1096
-
1097
1093
static void check_carrier (struct work_struct * work )
1098
1094
{
1099
1095
pegasus_t * pegasus = container_of (work , pegasus_t , carrier_check .work );
1100
1096
set_carrier (pegasus -> net );
1101
1097
if (!(pegasus -> flags & PEGASUS_UNPLUG )) {
1102
- queue_delayed_work (pegasus_workqueue , & pegasus -> carrier_check ,
1098
+ queue_delayed_work (system_long_wq , & pegasus -> carrier_check ,
1103
1099
CARRIER_CHECK_DELAY );
1104
1100
}
1105
1101
}
@@ -1120,18 +1116,6 @@ static int pegasus_blacklisted(struct usb_device *udev)
1120
1116
return 0 ;
1121
1117
}
1122
1118
1123
- /* we rely on probe() and remove() being serialized so we
1124
- * don't need extra locking on pegasus_count.
1125
- */
1126
- static void pegasus_dec_workqueue (void )
1127
- {
1128
- pegasus_count -- ;
1129
- if (pegasus_count == 0 ) {
1130
- destroy_workqueue (pegasus_workqueue );
1131
- pegasus_workqueue = NULL ;
1132
- }
1133
- }
1134
-
1135
1119
static int pegasus_probe (struct usb_interface * intf ,
1136
1120
const struct usb_device_id * id )
1137
1121
{
@@ -1144,14 +1128,6 @@ static int pegasus_probe(struct usb_interface *intf,
1144
1128
if (pegasus_blacklisted (dev ))
1145
1129
return - ENODEV ;
1146
1130
1147
- if (pegasus_count == 0 ) {
1148
- pegasus_workqueue = alloc_workqueue ("pegasus" , WQ_MEM_RECLAIM ,
1149
- 0 );
1150
- if (!pegasus_workqueue )
1151
- return - ENOMEM ;
1152
- }
1153
- pegasus_count ++ ;
1154
-
1155
1131
net = alloc_etherdev (sizeof (struct pegasus ));
1156
1132
if (!net )
1157
1133
goto out ;
@@ -1209,7 +1185,7 @@ static int pegasus_probe(struct usb_interface *intf,
1209
1185
res = register_netdev (net );
1210
1186
if (res )
1211
1187
goto out3 ;
1212
- queue_delayed_work (pegasus_workqueue , & pegasus -> carrier_check ,
1188
+ queue_delayed_work (system_long_wq , & pegasus -> carrier_check ,
1213
1189
CARRIER_CHECK_DELAY );
1214
1190
dev_info (& intf -> dev , "%s, %s, %pM\n" , net -> name ,
1215
1191
usb_dev_id [dev_index ].name , net -> dev_addr );
@@ -1222,7 +1198,6 @@ static int pegasus_probe(struct usb_interface *intf,
1222
1198
out1 :
1223
1199
free_netdev (net );
1224
1200
out :
1225
- pegasus_dec_workqueue ();
1226
1201
return res ;
1227
1202
}
1228
1203
@@ -1237,7 +1212,7 @@ static void pegasus_disconnect(struct usb_interface *intf)
1237
1212
}
1238
1213
1239
1214
pegasus -> flags |= PEGASUS_UNPLUG ;
1240
- cancel_delayed_work (& pegasus -> carrier_check );
1215
+ cancel_delayed_work_sync (& pegasus -> carrier_check );
1241
1216
unregister_netdev (pegasus -> net );
1242
1217
unlink_all_urbs (pegasus );
1243
1218
free_all_urbs (pegasus );
@@ -1246,15 +1221,14 @@ static void pegasus_disconnect(struct usb_interface *intf)
1246
1221
pegasus -> rx_skb = NULL ;
1247
1222
}
1248
1223
free_netdev (pegasus -> net );
1249
- pegasus_dec_workqueue ();
1250
1224
}
1251
1225
1252
1226
static int pegasus_suspend (struct usb_interface * intf , pm_message_t message )
1253
1227
{
1254
1228
struct pegasus * pegasus = usb_get_intfdata (intf );
1255
1229
1256
1230
netif_device_detach (pegasus -> net );
1257
- cancel_delayed_work (& pegasus -> carrier_check );
1231
+ cancel_delayed_work_sync (& pegasus -> carrier_check );
1258
1232
if (netif_running (pegasus -> net )) {
1259
1233
usb_kill_urb (pegasus -> rx_urb );
1260
1234
usb_kill_urb (pegasus -> intr_urb );
@@ -1276,7 +1250,7 @@ static int pegasus_resume(struct usb_interface *intf)
1276
1250
pegasus -> intr_urb -> actual_length = 0 ;
1277
1251
intr_callback (pegasus -> intr_urb );
1278
1252
}
1279
- queue_delayed_work (pegasus_workqueue , & pegasus -> carrier_check ,
1253
+ queue_delayed_work (system_long_wq , & pegasus -> carrier_check ,
1280
1254
CARRIER_CHECK_DELAY );
1281
1255
return 0 ;
1282
1256
}
0 commit comments