x86/rtc: Simplify PNP ids check
authorHans de Goede <hdegoede@redhat.com>
Wed, 14 Dec 2022 21:24:47 +0000 (22:24 +0100)
committerIngo Molnar <mingo@kernel.org>
Fri, 6 Jan 2023 03:22:34 +0000 (04:22 +0100)
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 <hdegoede@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: linux-kernel@vger.kernel.org
arch/x86/kernel/rtc.c

index 34904643451332f88de1f62a2a34a01833d4a304..1309b9b053386b8470619511d9c435b9d7ab68d0 100644 (file)
@@ -138,15 +138,12 @@ static __init int add_rtc_cmos(void)
        static const char * const ids[] __initconst =
            { "PNP0b00", "PNP0b01", "PNP0b02", };
        struct pnp_dev *dev;
-       struct pnp_id *id;
        int i;
 
        pnp_for_each_dev(dev) {
-               for (id = dev->id; id; id = id->next) {
-                       for (i = 0; i < ARRAY_SIZE(ids); i++) {
-                               if (compare_pnp_id(id, ids[i]) != 0)
-                                       return 0;
-                       }
+               for (i = 0; i < ARRAY_SIZE(ids); i++) {
+                       if (compare_pnp_id(dev->id, ids[i]) != 0)
+                               return 0;
                }
        }
 #endif