}
 
 static bool slidebar_i8042_filter(unsigned char data, unsigned char str,
-                                 struct serio *port)
+                                 struct serio *port, void *context)
 {
        static bool extended = false;
 
        input_set_capability(slidebar_input_dev, EV_ABS, ABS_X);
        input_set_abs_params(slidebar_input_dev, ABS_X, 0, 0xff, 0, 0);
 
-       err = i8042_install_filter(slidebar_i8042_filter);
+       err = i8042_install_filter(slidebar_i8042_filter, NULL);
        if (err) {
                dev_err(&pdev->dev,
                        "Failed to install i8042 filter: %d\n", err);
 
 static struct notifier_block i8042_kbd_bind_notifier_block;
 
 static bool i8042_handle_data(int irq);
-static bool (*i8042_platform_filter)(unsigned char data, unsigned char str,
-                                    struct serio *serio);
+static i8042_filter_t i8042_platform_filter;
+static void *i8042_platform_filter_context;
 
 void i8042_lock_chip(void)
 {
 }
 EXPORT_SYMBOL(i8042_unlock_chip);
 
-int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
-                                       struct serio *serio))
+int i8042_install_filter(i8042_filter_t filter, void *context)
 {
        guard(spinlock_irqsave)(&i8042_lock);
 
                return -EBUSY;
 
        i8042_platform_filter = filter;
+       i8042_platform_filter_context = context;
        return 0;
 }
 EXPORT_SYMBOL(i8042_install_filter);
 
-int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
-                                      struct serio *port))
+int i8042_remove_filter(i8042_filter_t filter)
 {
        guard(spinlock_irqsave)(&i8042_lock);
 
                return -EINVAL;
 
        i8042_platform_filter = NULL;
+       i8042_platform_filter_context = NULL;
        return 0;
 }
 EXPORT_SYMBOL(i8042_remove_filter);
                }
        }
 
-       if (i8042_platform_filter && i8042_platform_filter(data, str, serio)) {
+       if (!i8042_platform_filter)
+               return false;
+
+       if (i8042_platform_filter(data, str, serio, i8042_platform_filter_context)) {
                dbg("Filtered out by platform filter\n");
                return true;
        }
 
 static struct quirk_entry *quirks;
 static bool atkbd_reports_vol_keys;
 
-static bool asus_i8042_filter(unsigned char data, unsigned char str, struct serio *port)
+static bool asus_i8042_filter(unsigned char data, unsigned char str, struct serio *port,
+                             void *context)
 {
        static bool extended_e0;
        static bool extended_e1;
 
        }
 
        if (asus->driver->i8042_filter) {
-               err = i8042_install_filter(asus->driver->i8042_filter);
+               err = i8042_install_filter(asus->driver->i8042_filter, NULL);
                if (err)
                        pr_warn("Unable to install key filter - %d\n", err);
        }
 
        void (*key_filter) (struct asus_wmi_driver *driver, int *code,
                            unsigned int *value, bool *autorelease);
        /* Optional standard i8042 filter */
-       bool (*i8042_filter)(unsigned char data, unsigned char str,
-                            struct serio *serio);
+       i8042_filter_t          i8042_filter;
 
        int (*probe) (struct platform_device *device);
        void (*detect_quirks) (struct asus_wmi_driver *driver);
 
 }
 static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill);
 
-static bool dell_laptop_i8042_filter(unsigned char data, unsigned char str,
-                             struct serio *port)
+static bool dell_laptop_i8042_filter(unsigned char data, unsigned char str, struct serio *port,
+                                    void *context)
 {
        static bool extended;
 
                pr_warn("Unable to register dell rbtn notifier\n");
                goto err_filter;
        } else {
-               ret = i8042_install_filter(dell_laptop_i8042_filter);
+               ret = i8042_install_filter(dell_laptop_i8042_filter, NULL);
                if (ret) {
                        pr_warn("Unable to install key filter\n");
                        goto err_filter;
 
 };
 
 static bool hp_accel_i8042_filter(unsigned char data, unsigned char str,
-                                 struct serio *port)
+                                 struct serio *port, void *context)
 {
        static bool extended;
 
        /* filter to remove HPQ6000 accelerometer data
         * from keyboard bus stream */
        if (strstr(dev_name(&device->dev), "HPQ6000"))
-               i8042_install_filter(hp_accel_i8042_filter);
+               i8042_install_filter(hp_accel_i8042_filter, NULL);
 
        INIT_WORK(&hpled_led.work, delayed_set_status_worker);
        ret = led_classdev_register(NULL, &hpled_led.led_classdev);
 
 }
 static DECLARE_DELAYED_WORK(msi_touchpad_dwork, msi_send_touchpad_key);
 
-static bool msi_laptop_i8042_filter(unsigned char data, unsigned char str,
-                               struct serio *port)
+static bool msi_laptop_i8042_filter(unsigned char data, unsigned char str, struct serio *port,
+                                   void *context)
 {
        static bool extended;
 
        if (result)
                goto fail_input;
 
-       result = i8042_install_filter(msi_laptop_i8042_filter);
+       result = i8042_install_filter(msi_laptop_i8042_filter, NULL);
        if (result) {
                pr_err("Unable to install key filter\n");
                goto fail_filter;
 
  * keypress events over the PS/2 kbd interface, filter these out.
  */
 static bool panasonic_i8042_filter(unsigned char data, unsigned char str,
-                                  struct serio *port)
+                                  struct serio *port, void *context)
 {
        static bool extended;
 
                pcc->platform = NULL;
        }
 
-       i8042_install_filter(panasonic_i8042_filter);
+       i8042_install_filter(panasonic_i8042_filter, NULL);
        return 0;
 
 out_platform:
 
 }
 
 static bool toshiba_acpi_i8042_filter(unsigned char data, unsigned char str,
-                                     struct serio *port)
+                                     struct serio *port, void *context)
 {
        if (str & I8042_STR_AUXDATA)
                return false;
        if (ec_handle && acpi_has_method(ec_handle, "NTFY")) {
                INIT_WORK(&dev->hotkey_work, toshiba_acpi_hotkey_work);
 
-               error = i8042_install_filter(toshiba_acpi_i8042_filter);
+               error = i8042_install_filter(toshiba_acpi_i8042_filter, NULL);
                if (error) {
                        pr_err("Error installing key filter\n");
                        goto err_free_dev;
 
 
 struct serio;
 
+/**
+ * typedef i8042_filter_t - i8042 filter callback
+ * @data: Data received by the i8042 controller
+ * @str: Status register of the i8042 controller
+ * @serio: Serio of the i8042 controller
+ * @context: Context pointer associated with this callback
+ *
+ * This represents a i8042 filter callback which can be used with i8042_install_filter()
+ * and i8042_remove_filter() to filter the i8042 input for platform-specific key codes.
+ *
+ * Context: Interrupt context.
+ * Returns: true if the data should be filtered out, false if otherwise.
+ */
+typedef bool (*i8042_filter_t)(unsigned char data, unsigned char str, struct serio *serio,
+                              void *context);
+
 #if defined(CONFIG_SERIO_I8042) || defined(CONFIG_SERIO_I8042_MODULE)
 
 void i8042_lock_chip(void);
 void i8042_unlock_chip(void);
 int i8042_command(unsigned char *param, int command);
-int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
-                                       struct serio *serio));
-int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
-                                      struct serio *serio));
+int i8042_install_filter(i8042_filter_t filter, void *context);
+int i8042_remove_filter(i8042_filter_t filter);
 
 #else
 
        return -ENODEV;
 }
 
-static inline int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
-                                       struct serio *serio))
+static inline int i8042_install_filter(i8042_filter_t filter, void *context)
 {
        return -ENODEV;
 }
 
-static inline int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
-                                      struct serio *serio))
+static inline int i8042_remove_filter(i8042_filter_t filter)
 {
        return -ENODEV;
 }