#if defined(CONFIG_FB_CORE) || (defined(CONFIG_FB_CORE_MODULE) && \
                                defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE))
+static void backlight_notify_blank(struct backlight_device *bd,
+                                  struct device *display_dev,
+                                  bool fb_on, bool prev_fb_on)
+{
+       guard(mutex)(&bd->ops_lock);
+
+       if (!bd->ops)
+               return;
+       if (bd->ops->controls_device && !bd->ops->controls_device(bd, display_dev))
+               return;
+
+       if (fb_on && (!prev_fb_on || !bd->use_count)) {
+               if (!bd->use_count++) {
+                       bd->props.state &= ~BL_CORE_FBBLANK;
+                       backlight_update_status(bd);
+               }
+       } else if (!fb_on && prev_fb_on && bd->use_count) {
+               if (!(--bd->use_count)) {
+                       bd->props.state |= BL_CORE_FBBLANK;
+                       backlight_update_status(bd);
+               }
+       }
+}
+
 /*
  * fb_notifier_callback
  *
                return 0;
 
        bd = container_of(self, struct backlight_device, fb_notif);
-       mutex_lock(&bd->ops_lock);
 
-       if (!bd->ops)
-               goto out;
-       if (bd->ops->controls_device && !bd->ops->controls_device(bd, info->device))
-               goto out;
        if (fb_bd && fb_bd != bd)
-               goto out;
+               return 0;
 
        fb_on = fb_blank[0] == FB_BLANK_UNBLANK;
        prev_fb_on = fb_blank[1] == FB_BLANK_UNBLANK;
 
-       if (fb_on && (!prev_fb_on || !bd->use_count)) {
-               if (!bd->use_count++) {
-                       bd->props.state &= ~BL_CORE_FBBLANK;
-                       backlight_update_status(bd);
-               }
-       } else if (!fb_on && prev_fb_on && bd->use_count) {
-               if (!(--bd->use_count)) {
-                       bd->props.state |= BL_CORE_FBBLANK;
-                       backlight_update_status(bd);
-               }
-       }
-out:
-       mutex_unlock(&bd->ops_lock);
+       backlight_notify_blank(bd, info->device, fb_on, prev_fb_on);
+
        return 0;
 }