Re: [PATCH v3 2/5] efi: Add embedded peripheral firmware support
From: Hans de Goede
Date: Tue Apr 17 2018 - 05:19:24 EST
Hi,
On 17-04-18 02:17, Luis R. Rodriguez wrote:
On Sun, Apr 08, 2018 at 07:40:11PM +0200, Hans de Goede wrote:
static void firmware_free_data(const struct firmware *fw)
{
@@ -576,6 +600,15 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
goto out;
ret = fw_get_filesystem_firmware(device, fw->priv);
+#ifdef CONFIG_EFI_EMBEDDED_FIRMWARE
+ if (ret && device &&
+ device_property_read_bool(device, "efi-embedded-firmware")) {
+ ret = fw_get_efi_embedded_fw(device, fw->priv, ret);
+ if (ret == 0)
+ ret = assign_fw(fw, device, opt_flags | FW_OPT_NOCACHE);
+ goto out;
+ }
+#endif
So thinking some more about this, I can put the device_property check
inside the fw_get_efi_embedded_fw() call, as well as modify opt_flags
there to or in FW_OPT_NOCACHE on success, then together with the discussed
changed to drop the #ifdef, the code would look like this:
ret = fw_get_filesystem_firmware(device, fw->priv);
if (ret)
fw_get_efi_embedded_fw(device, fw->priv, &opt_flags, ret);
if (ret)
if (!(opt_flags & FW_OPT_NO_WARN))
dev_warn(device,
...
With just these 2 lines being new:
if (ret)
fw_get_efi_embedded_fw(device, fw->priv, &opt_flags, ret);
So the main.c changes will be nice and clean then.
Regards,
Hans