[PATCH] udev: behave like 80-drivers.rules

Tom Gundersen teg at jklm.no
Wed Mar 14 13:12:25 EDT 2012


 1) Apply the rules also to 'change' events. This should do no harm
    and makes sure that the rules are run whenever the 80-drivers.rules
    are.
 2) Don't try to load modules when a driver is already loaded.
 3) Use builtins for loading modules. Notice that this means that
    blacklisting is applied (I assume the lack of '-b' was a bug?).

Cc: Dominik Brodowski <linux at dominikbrodowski.net>
Signed-off-by: Tom Gundersen <teg at jklm.no>
---
 udev/rules-base     |    4 ++--
 udev/rules-modprobe |    4 ++--
 udev/rules-start    |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/udev/rules-base b/udev/rules-base
index f9c411f..34a5b9f 100644
--- a/udev/rules-base
+++ b/udev/rules-base
@@ -13,5 +13,5 @@ SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", ATTR{allow_func_id_match}="1"
 # PCMCIA sockets:
 #
 # modprobe the pcmcia bus module so that 16-bit PCMCIA devices work
-SUBSYSTEM=="pcmcia_socket", \
-		RUN+="/sbin/modprobe -b pcmcia"
+SUBSYSTEM=="pcmcia_socket", DRIVER!="?*", \
+		IMPORT{builtin}="kmod load $env{MODALIAS}"
diff --git a/udev/rules-modprobe b/udev/rules-modprobe
index 7fb03f4..51ec882 100644
--- a/udev/rules-modprobe
+++ b/udev/rules-modprobe
@@ -1,3 +1,3 @@
 # modprobe $env{MODALIAS} loads all possibly appropriate modules
-SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", \
-		RUN+="/sbin/modprobe $env{MODALIAS}"
+SUBSYSTEM=="pcmcia", DRIVER!="?*", ENV{MODALIAS}=="?*", \
+		IMPORT{builtin}="kmod load $env{MODALIAS}"
diff --git a/udev/rules-start b/udev/rules-start
index b67d35d..3349711 100644
--- a/udev/rules-start
+++ b/udev/rules-start
@@ -1,3 +1,3 @@
 # PCMCIA devices:
 #
-ACTION!="add", GOTO="pcmciautils_end"
+ACTION=="remove", GOTO="pcmciautils_end"
-- 
1.7.9.4




More information about the linux-pcmcia mailing list