@@ -1172,34 +1172,11 @@ static void request_firmware_work_func(struct work_struct *work)
1172
1172
kfree (fw_work );
1173
1173
}
1174
1174
1175
- /**
1176
- * request_firmware_nowait() - asynchronous version of request_firmware
1177
- * @module: module requesting the firmware
1178
- * @uevent: sends uevent to copy the firmware image if this flag
1179
- * is non-zero else the firmware copy must be done manually.
1180
- * @name: name of firmware file
1181
- * @device: device for which firmware is being loaded
1182
- * @gfp: allocation flags
1183
- * @context: will be passed over to @cont, and
1184
- * @fw may be %NULL if firmware request fails.
1185
- * @cont: function will be called asynchronously when the firmware
1186
- * request is over.
1187
- *
1188
- * Caller must hold the reference count of @device.
1189
- *
1190
- * Asynchronous variant of request_firmware() for user contexts:
1191
- * - sleep for as small periods as possible since it may
1192
- * increase kernel boot time of built-in device drivers
1193
- * requesting firmware in their ->probe() methods, if
1194
- * @gfp is GFP_KERNEL.
1195
- *
1196
- * - can't sleep at all if @gfp is GFP_ATOMIC.
1197
- **/
1198
- int
1199
- request_firmware_nowait (
1175
+
1176
+ static int _request_firmware_nowait (
1200
1177
struct module * module , bool uevent ,
1201
1178
const char * name , struct device * device , gfp_t gfp , void * context ,
1202
- void (* cont )(const struct firmware * fw , void * context ))
1179
+ void (* cont )(const struct firmware * fw , void * context ), bool nowarn )
1203
1180
{
1204
1181
struct firmware_work * fw_work ;
1205
1182
@@ -1217,7 +1194,8 @@ request_firmware_nowait(
1217
1194
fw_work -> context = context ;
1218
1195
fw_work -> cont = cont ;
1219
1196
fw_work -> opt_flags = FW_OPT_NOWAIT |
1220
- (uevent ? FW_OPT_UEVENT : FW_OPT_USERHELPER );
1197
+ (uevent ? FW_OPT_UEVENT : FW_OPT_USERHELPER ) |
1198
+ (nowarn ? FW_OPT_NO_WARN : 0 );
1221
1199
1222
1200
if (!uevent && fw_cache_is_setup (device , name )) {
1223
1201
kfree_const (fw_work -> name );
@@ -1236,8 +1214,66 @@ request_firmware_nowait(
1236
1214
schedule_work (& fw_work -> work );
1237
1215
return 0 ;
1238
1216
}
1217
+
1218
+ /**
1219
+ * request_firmware_nowait() - asynchronous version of request_firmware
1220
+ * @module: module requesting the firmware
1221
+ * @uevent: sends uevent to copy the firmware image if this flag
1222
+ * is non-zero else the firmware copy must be done manually.
1223
+ * @name: name of firmware file
1224
+ * @device: device for which firmware is being loaded
1225
+ * @gfp: allocation flags
1226
+ * @context: will be passed over to @cont, and
1227
+ * @fw may be %NULL if firmware request fails.
1228
+ * @cont: function will be called asynchronously when the firmware
1229
+ * request is over.
1230
+ *
1231
+ * Caller must hold the reference count of @device.
1232
+ *
1233
+ * Asynchronous variant of request_firmware() for user contexts:
1234
+ * - sleep for as small periods as possible since it may
1235
+ * increase kernel boot time of built-in device drivers
1236
+ * requesting firmware in their ->probe() methods, if
1237
+ * @gfp is GFP_KERNEL.
1238
+ *
1239
+ * - can't sleep at all if @gfp is GFP_ATOMIC.
1240
+ **/
1241
+ int request_firmware_nowait (
1242
+ struct module * module , bool uevent ,
1243
+ const char * name , struct device * device , gfp_t gfp , void * context ,
1244
+ void (* cont )(const struct firmware * fw , void * context ))
1245
+ {
1246
+ return _request_firmware_nowait (module , uevent , name , device , gfp ,
1247
+ context , cont , false);
1248
+
1249
+ }
1239
1250
EXPORT_SYMBOL (request_firmware_nowait );
1240
1251
1252
+ /**
1253
+ * firmware_request_nowait_nowarn() - async version of request_firmware_nowarn
1254
+ * @module: module requesting the firmware
1255
+ * @name: name of firmware file
1256
+ * @device: device for which firmware is being loaded
1257
+ * @gfp: allocation flags
1258
+ * @context: will be passed over to @cont, and
1259
+ * @fw may be %NULL if firmware request fails.
1260
+ * @cont: function will be called asynchronously when the firmware
1261
+ * request is over.
1262
+ *
1263
+ * Similar in function to request_firmware_nowait(), but doesn't print a warning
1264
+ * when the firmware file could not be found and always sends a uevent to copy
1265
+ * the firmware image.
1266
+ */
1267
+ int firmware_request_nowait_nowarn (
1268
+ struct module * module , const char * name ,
1269
+ struct device * device , gfp_t gfp , void * context ,
1270
+ void (* cont )(const struct firmware * fw , void * context ))
1271
+ {
1272
+ return _request_firmware_nowait (module , FW_ACTION_UEVENT , name , device ,
1273
+ gfp , context , cont , true);
1274
+ }
1275
+ EXPORT_SYMBOL_GPL (firmware_request_nowait_nowarn );
1276
+
1241
1277
#ifdef CONFIG_FW_CACHE
1242
1278
static ASYNC_DOMAIN_EXCLUSIVE (fw_cache_domain );
1243
1279
0 commit comments