[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [mdev] Telling the kernel that there was no firmware.
From:       Christoph Lohmann <20h () r-36 ! net>
Date:       2012-04-28 17:27:58
Message-ID: 4F9C289E.6070706 () r-36 ! net
[Download RAW message or body]

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

["0001-mdev-Telling-the-kernel-that-we-didn-t-find-the-firm.patch" (text/x-patch)]

From a7b42f8dbc08d278cd082bda32d6241da9dd24d7 Mon Sep 17 00:00:00 2001
From: Christoph Lohmann <20h@r-36.net>
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
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic