}
 }
 
+static bool hotkey_notify_extended_hotkey(const u32 hkey)
+{
+       unsigned int scancode;
+
+       /* Extended keycodes start at 0x300 and our offset into the map
+        * TP_ACPI_HOTKEYSCAN_EXTENDED_START. The calculated scancode
+        * will be positive, but might not be in the correct range.
+        */
+       scancode = (hkey & 0xfff) - (0x300 - TP_ACPI_HOTKEYSCAN_EXTENDED_START);
+       if (scancode >= TP_ACPI_HOTKEYSCAN_EXTENDED_START &&
+           scancode < TPACPI_HOTKEY_MAP_LEN) {
+               tpacpi_input_send_key(scancode);
+               return true;
+       }
+
+       return false;
+}
+
 static bool hotkey_notify_hotkey(const u32 hkey,
                                 bool *send_acpi_ev,
                                 bool *ignore_acpi_ev)
                return adaptive_keyboard_hotkey_notify_hotkey(scancode);
 
        case 3:
-               /* Extended keycodes start at 0x300 and our offset into the map
-                * TP_ACPI_HOTKEYSCAN_EXTENDED_START. The calculated scancode
-                * will be positive, but might not be in the correct range.
-                */
-               scancode -= (0x300 - TP_ACPI_HOTKEYSCAN_EXTENDED_START);
-               if (scancode >= TP_ACPI_HOTKEYSCAN_EXTENDED_START &&
-                   scancode < TPACPI_HOTKEY_MAP_LEN) {
-                       tpacpi_input_send_key(scancode);
-                       return true;
-               }
-               break;
+               return hotkey_notify_extended_hotkey(hkey);
        }
 
        return false;