summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2022-09-09 04:36:04 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2022-09-09 04:36:04 +0000
commitad0ddb38a53989caf92b361a64d1205822b3847b (patch)
tree6d426c273b97134c17e2ae68dd8d72d4abb952ca /sys/dev
parent20e0aa3b92de098fae7c4ef544b968dd14e9087e (diff)
drm/i915/display: avoid warnings when registering dual panel backlight
From Arun R Murthy 7828b5d0080a4621973ab5c680c4df0bc6d96437 in linux 5.15.y/5.15.66 868e8e5156a1f8d92ca83fdbac6fd52798650792 in mainline linux
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/i915/display/intel_backlight.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/sys/dev/pci/drm/i915/display/intel_backlight.c b/sys/dev/pci/drm/i915/display/intel_backlight.c
index 7d9415f064c..26e38894171 100644
--- a/sys/dev/pci/drm/i915/display/intel_backlight.c
+++ b/sys/dev/pci/drm/i915/display/intel_backlight.c
@@ -979,26 +979,26 @@ int intel_backlight_device_register(struct intel_connector *connector)
if (!name)
return -ENOMEM;
- bd = backlight_device_register(name, connector->base.kdev, connector,
- &intel_backlight_device_ops, &props);
-
- /*
- * Using the same name independent of the drm device or connector
- * prevents registration of multiple backlight devices in the
- * driver. However, we need to use the default name for backward
- * compatibility. Use unique names for subsequent backlight devices as a
- * fallback when the default name already exists.
- */
- if (IS_ERR(bd) && PTR_ERR(bd) == -EEXIST) {
+ bd = backlight_device_get_by_name(name);
+ if (bd) {
+#ifdef __linux__
+ put_device(&bd->dev);
+#endif
+ /*
+ * Using the same name independent of the drm device or connector
+ * prevents registration of multiple backlight devices in the
+ * driver. However, we need to use the default name for backward
+ * compatibility. Use unique names for subsequent backlight devices as a
+ * fallback when the default name already exists.
+ */
kfree(name);
name = kasprintf(GFP_KERNEL, "card%d-%s-backlight",
i915->drm.primary->index, connector->base.name);
if (!name)
return -ENOMEM;
-
- bd = backlight_device_register(name, connector->base.kdev, connector,
- &intel_backlight_device_ops, &props);
}
+ bd = backlight_device_register(name, connector->base.kdev, connector,
+ &intel_backlight_device_ops, &props);
if (IS_ERR(bd)) {
drm_err(&i915->drm,