@@ -1172,34 +1172,11 @@ static void request_firmware_work_func(struct work_struct *work)
11721172 kfree (fw_work );
11731173}
11741174
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 (
12001177 struct module * module , bool uevent ,
12011178 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 )
12031180{
12041181 struct firmware_work * fw_work ;
12051182
@@ -1217,7 +1194,8 @@ request_firmware_nowait(
12171194 fw_work -> context = context ;
12181195 fw_work -> cont = cont ;
12191196 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 );
12211199
12221200 if (!uevent && fw_cache_is_setup (device , name )) {
12231201 kfree_const (fw_work -> name );
@@ -1236,8 +1214,66 @@ request_firmware_nowait(
12361214 schedule_work (& fw_work -> work );
12371215 return 0 ;
12381216}
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+ }
12391250EXPORT_SYMBOL (request_firmware_nowait );
12401251
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+
12411277#ifdef CONFIG_FW_CACHE
12421278static ASYNC_DOMAIN_EXCLUSIVE (fw_cache_domain );
12431279
0 commit comments