Skip to contentSkip to conversation

rules: avoid reading DRIVER for devices without modalias

PATCH In review Alan Jenkins 3 participants 6 messages Jun 3, 2009 – Aug 16, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rules: avoid reading DRIVER for devices without modalias

DRIVER requires a readlink() in sysfs. The MODALIAS key is provided by uevent and requires no additional read. Test MODALIAS first.

rules/rules.d/80-drivers.rules +1 -1
index 7e13e80..2b68ddc 100644
@@ -2,7 +2,7 @@
 
 ACTION!="add", GOTO="drivers_end"
 
-DRIVER!="?*", ENV{MODALIAS}="?*", RUN{ignore_error}+="/sbin/modprobe -b $env{MODALIAS}"
+ENV{MODALIAS}="?*", DRIVER!="?*", RUN{ignore_error}+="/sbin/modprobe -b $env{MODALIAS}"
 SUBSYSTEM="tifm", ENV{TIFM_CARD_TYPE}="SD", RUN+="/sbin/modprobe -b tifm_sd"
 SUBSYSTEM="tifm", ENV{TIFM_CARD_TYPE}="MS", RUN+="/sbin/modprobe -b tifm_ms"
 SUBSYSTEM="memstick", RUN+="/sbin/modprobe -b --all ms_block mspro_block"
#1 lore raw
Quoted 2 lines · Alan Jenkins

DRIVER requires a readlink() in sysfs.  The MODALIAS key is provided by uevent and requires no additional read.  Test MODALIAS first.

Are you sure that makes a difference? We *should* sort the keys while parsing, and run the cheaper ones before the more expensive ones. At least that's how it was before the rewrite of the parser, and it *should* be still the same today.

Thanks,
Kay

#2 lore raw
In reply to Alan Jenkins
Quoted 6 lines · Kay Sievers
Quoted 3 lines · Alan Jenkins

DRIVER requires a readlink() in sysfs. The MODALIAS key is provided by uevent and requires no additional read. Test MODALIAS first.

Quoted 8 lines

Are you sure that makes a difference? We *should* sort the keys while parsing, and run the cheaper ones before the more expensive ones. At least that's how it was before the rewrite of the parser, and it *should* be still the same today.

Thanks,
Kay

Sorry, I'd forgotten that. You're right it makes no difference.

#3 lore raw

Re: [PATCH] rules: avoid reading DRIVER for devices without

In reply to Alan Jenkins
Quoted 2 lines · Alan Jenkins

DRIVER requires a readlink() in sysfs. The MODALIAS key is provided by uevent and requires no additional read. Test MODALIAS first.

What is the point of checking both DRIVER and ENV{MODALIAS}? The Debian rules files always checked only ENV{MODALIAS}.

Signature · 2 lines
ciao,
Marco
#4 lore raw
In reply to Alan Jenkins
Quoted 9 lines · Marco d'Itri
Quoted 3 lines · Alan Jenkins

DRIVER requires a readlink() in sysfs. The MODALIAS key is provided by uevent and requires no additional read. Test MODALIAS first.

What is the point of checking both DRIVER and ENV{MODALIAS}? The Debian rules files always checked only ENV{MODALIAS}.

I think the idea is to avoid calling modprobe if the driver was built into the kernel (or the module is already loaded).

Alan

#5 lore raw

Re: [PATCH] rules: avoid reading DRIVER for devices without

In reply to Alan Jenkins
Quoted 2 lines · Alan Jenkins
Quoted 2 lines

What is the point of checking both DRIVER and ENV{MODALIAS}? The Debian rules files always checked only ENV{MODALIAS}.

Nevermind, this is not true...

Signature · 2 lines
ciao,
Marco