Skip to content

Commit bd4edba

Browse files
jwrdegoedeIngo Molnar
authored andcommitted
x86/rtc: Simplify PNP ids check
compare_pnp_id() already iterates over the single linked pnp_ids list starting with the id past to it. So there is no need for add_rtc_cmos() to call compare_pnp_id() for each id on the list. No change in functionality intended. Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Cc: [email protected]
1 parent 41c03ba commit bd4edba

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

arch/x86/kernel/rtc.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,12 @@ static __init int add_rtc_cmos(void)
138138
static const char * const ids[] __initconst =
139139
{ "PNP0b00", "PNP0b01", "PNP0b02", };
140140
struct pnp_dev *dev;
141-
struct pnp_id *id;
142141
int i;
143142

144143
pnp_for_each_dev(dev) {
145-
for (id = dev->id; id; id = id->next) {
146-
for (i = 0; i < ARRAY_SIZE(ids); i++) {
147-
if (compare_pnp_id(id, ids[i]) != 0)
148-
return 0;
149-
}
144+
for (i = 0; i < ARRAY_SIZE(ids); i++) {
145+
if (compare_pnp_id(dev->id, ids[i]) != 0)
146+
return 0;
150147
}
151148
}
152149
#endif

0 commit comments

Comments
 (0)