aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/firmware_class.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-06-04 11:48:15 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-08 18:24:39 -0400
commit5a1379e8748a5cfa3eb068f812d61bde849ef76c (patch)
treeefc293b5fb2e124d485eb329a37685a20b14150b /drivers/base/firmware_class.c
parent3c3b177a9369b26890ced004867fb32708e8ef5b (diff)
firmware loader: allow disabling of udev as firmware loader
[The patch was originally proposed by Tom Gundersen, and rewritten afterwards by me; most of changelogs below borrowed from Tom's original patch -- tiwai] Currently (at least) the dell-rbu driver selects FW_LOADER_USER_HELPER, which means that distros can't really stop loading firmware through udev without breaking other users (though some have). Ideally we would remove/disable the udev firmware helper in both the kernel and in udev, but if we were to disable it in udev and not the kernel, the result would be (seemingly) hung kernels as no one would be around to cancel firmware requests. This patch allows udev firmware loading to be disabled while still allowing non-udev firmware loading, as done by the dell-rbu driver, to continue working. This is achieved by only using the fallback mechanism when the uevent is suppressed. The patch renames the user-selectable Kconfig from FW_LOADER_USER_HELPER to FW_LOADER_USER_HELPER_FALLBACK, and the former is reverse-selected by the latter or the drivers that need userhelper like dell-rbu. Also, the "default y" is removed together with this change, since it's been deprecated in udev upstream, thus rather better to disable it nowadays. Tested with FW_LOADER_USER_HELPER=n LATTICE_ECP3_CONFIG=y DELL_RBU=y and udev without the firmware loading support, but I don't have the hardware to test the lattice/dell drivers, so additional testing would be appreciated. Reviewed-by: Tom Gundersen <teg@jklm.no> Cc: Ming Lei <ming.lei@canonical.com> Cc: Abhay Salunke <Abhay_Salunke@dell.com> Cc: Stefan Roese <sr@denx.de> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Kay Sievers <kay@vrfy.org> Tested-by: Balaji Singh <B_B_Singh@DELL.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/firmware_class.c')
-rw-r--r--drivers/base/firmware_class.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index d276e33880be..46ea5f4c3bb5 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -100,9 +100,14 @@ static inline long firmware_loading_timeout(void)
100#define FW_OPT_UEVENT (1U << 0) 100#define FW_OPT_UEVENT (1U << 0)
101#define FW_OPT_NOWAIT (1U << 1) 101#define FW_OPT_NOWAIT (1U << 1)
102#ifdef CONFIG_FW_LOADER_USER_HELPER 102#ifdef CONFIG_FW_LOADER_USER_HELPER
103#define FW_OPT_FALLBACK (1U << 2) 103#define FW_OPT_USERHELPER (1U << 2)
104#else 104#else
105#define FW_OPT_FALLBACK 0 105#define FW_OPT_USERHELPER 0
106#endif
107#ifdef CONFIG_FW_LOADER_USER_HELPER_FALLBACK
108#define FW_OPT_FALLBACK FW_OPT_USERHELPER
109#else
110#define FW_OPT_FALLBACK 0
106#endif 111#endif
107 112
108struct firmware_cache { 113struct firmware_cache {
@@ -1111,7 +1116,7 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
1111 1116
1112 ret = fw_get_filesystem_firmware(device, fw->priv); 1117 ret = fw_get_filesystem_firmware(device, fw->priv);
1113 if (ret) { 1118 if (ret) {
1114 if (opt_flags & FW_OPT_FALLBACK) { 1119 if (opt_flags & FW_OPT_USERHELPER) {
1115 dev_warn(device, 1120 dev_warn(device,
1116 "Direct firmware load failed with error %d\n", 1121 "Direct firmware load failed with error %d\n",
1117 ret); 1122 ret);
@@ -1171,7 +1176,7 @@ request_firmware(const struct firmware **firmware_p, const char *name,
1171} 1176}
1172EXPORT_SYMBOL(request_firmware); 1177EXPORT_SYMBOL(request_firmware);
1173 1178
1174#ifdef CONFIG_FW_LOADER_USER_HELPER 1179#ifdef CONFIG_FW_LOADER_USER_HELPER_FALLBACK
1175/** 1180/**
1176 * request_firmware: - load firmware directly without usermode helper 1181 * request_firmware: - load firmware directly without usermode helper
1177 * @firmware_p: pointer to firmware image 1182 * @firmware_p: pointer to firmware image
@@ -1277,7 +1282,7 @@ request_firmware_nowait(
1277 fw_work->context = context; 1282 fw_work->context = context;
1278 fw_work->cont = cont; 1283 fw_work->cont = cont;
1279 fw_work->opt_flags = FW_OPT_NOWAIT | FW_OPT_FALLBACK | 1284 fw_work->opt_flags = FW_OPT_NOWAIT | FW_OPT_FALLBACK |
1280 (uevent ? FW_OPT_UEVENT : 0); 1285 (uevent ? FW_OPT_UEVENT : FW_OPT_USERHELPER);
1281 1286
1282 if (!try_module_get(module)) { 1287 if (!try_module_get(module)) {
1283 kfree(fw_work); 1288 kfree(fw_work);