diff mbox series

[2/5] drm/i915/gmbus: reduce gmbus pin lookups in gmbus setup

Message ID 20220303181931.1661767-2-jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/5] drm/i915/gmbus: combine gmbus pin lookups to one function | expand

Commit Message

Jani Nikula March 3, 2022, 6:19 p.m. UTC
Avoid separate pin lookups for validity and name.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_gmbus.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_gmbus.c b/drivers/gpu/drm/i915/display/intel_gmbus.c
index 9cbf7f9a1e2e..9dc66447d308 100644
--- a/drivers/gpu/drm/i915/display/intel_gmbus.c
+++ b/drivers/gpu/drm/i915/display/intel_gmbus.c
@@ -876,7 +876,10 @@  int intel_gmbus_setup(struct drm_i915_private *dev_priv)
 	init_waitqueue_head(&dev_priv->gmbus_wait_queue);
 
 	for (pin = 0; pin < ARRAY_SIZE(dev_priv->gmbus); pin++) {
-		if (!intel_gmbus_is_valid_pin(dev_priv, pin))
+		const struct gmbus_pin *gmbus_pin;
+
+		gmbus_pin = get_gmbus_pin(dev_priv, pin);
+		if (!gmbus_pin)
 			continue;
 
 		bus = &dev_priv->gmbus[pin];
@@ -885,8 +888,7 @@  int intel_gmbus_setup(struct drm_i915_private *dev_priv)
 		bus->adapter.class = I2C_CLASS_DDC;
 		snprintf(bus->adapter.name,
 			 sizeof(bus->adapter.name),
-			 "i915 gmbus %s",
-			 get_gmbus_pin(dev_priv, pin)->name);
+			 "i915 gmbus %s", gmbus_pin->name);
 
 		bus->adapter.dev.parent = &pdev->dev;
 		bus->dev_priv = dev_priv;