Hello,

attached is a patch that changes the way how mdev handles the firmware
loading. When the firmware isn't found mdev will tell the kernel this
by writing »-1« to the »loading« file.


Sincerely,

Christoph Lohmann
>From a7b42f8dbc08d278cd082bda32d6241da9dd24d7 Mon Sep 17 00:00:00 2001
From: Christoph Lohmann <[email protected]>
Date: Sat, 28 Apr 2012 19:16:47 +0200
Subject: [PATCH] mdev: Telling the kernel that we didn't find the firmware.

---
 util-linux/mdev.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 0a34122..16c43cd 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -663,12 +663,10 @@ static void load_firmware(const char *firmware, const char *sysfs_path)
 	int cnt;
 	int firmware_fd, loading_fd, data_fd;
 
-	/* check for /lib/firmware/$FIRMWARE */
-	xchdir("/lib/firmware");
-	firmware_fd = xopen(firmware, O_RDONLY);
-
 	/* in case we goto out ... */
 	data_fd = -1;
+	firmware_fd = -1;
+	loading_fd = -1;
 
 	/* check for /sys/$DEVPATH/loading ... give 30 seconds to appear */
 	xchdir(sysfs_path);
@@ -681,6 +679,16 @@ static void load_firmware(const char *firmware, const char *sysfs_path)
 	goto out;
 
  loading:
+	/* check for /lib/firmware/$FIRMWARE */
+	xchdir("/lib/firmware");
+	firmware_fd = open(firmware, O_RDONLY);
+	if (firmware_fd < 0) {
+		/* tell the kernel to stop waiting for us */
+		full_write(loading_fd, "-1", 2);
+		goto out;
+	}
+	xchdir(sysfs_path);
+
 	/* tell kernel we're loading by "echo 1 > /sys/$DEVPATH/loading" */
 	if (full_write(loading_fd, "1", 1) != 1)
 		goto out;
-- 
1.7.10

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to