Commit 17e571fe authored by Jani Nikula's avatar Jani Nikula

drm/i915/gmbus: use to_intel_gmbus() instead of open coding

We have a helper for getting at the enclosing gmbus struct from the
embedded i2c_adapter, use it.
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220304101426.1891347-2-jani.nikula@intel.com
parent 71abfcbe
...@@ -300,9 +300,7 @@ static void set_data(void *data, int state_high) ...@@ -300,9 +300,7 @@ static void set_data(void *data, int state_high)
static int static int
intel_gpio_pre_xfer(struct i2c_adapter *adapter) intel_gpio_pre_xfer(struct i2c_adapter *adapter)
{ {
struct intel_gmbus *bus = container_of(adapter, struct intel_gmbus *bus = to_intel_gmbus(adapter);
struct intel_gmbus,
adapter);
struct drm_i915_private *dev_priv = bus->dev_priv; struct drm_i915_private *dev_priv = bus->dev_priv;
intel_gmbus_reset(dev_priv); intel_gmbus_reset(dev_priv);
...@@ -319,9 +317,7 @@ intel_gpio_pre_xfer(struct i2c_adapter *adapter) ...@@ -319,9 +317,7 @@ intel_gpio_pre_xfer(struct i2c_adapter *adapter)
static void static void
intel_gpio_post_xfer(struct i2c_adapter *adapter) intel_gpio_post_xfer(struct i2c_adapter *adapter)
{ {
struct intel_gmbus *bus = container_of(adapter, struct intel_gmbus *bus = to_intel_gmbus(adapter);
struct intel_gmbus,
adapter);
struct drm_i915_private *dev_priv = bus->dev_priv; struct drm_i915_private *dev_priv = bus->dev_priv;
set_data(bus, 1); set_data(bus, 1);
...@@ -619,9 +615,7 @@ static int ...@@ -619,9 +615,7 @@ static int
do_gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num, do_gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num,
u32 gmbus0_source) u32 gmbus0_source)
{ {
struct intel_gmbus *bus = container_of(adapter, struct intel_gmbus *bus = to_intel_gmbus(adapter);
struct intel_gmbus,
adapter);
struct drm_i915_private *dev_priv = bus->dev_priv; struct drm_i915_private *dev_priv = bus->dev_priv;
int i = 0, inc, try = 0; int i = 0, inc, try = 0;
int ret = 0; int ret = 0;
...@@ -751,8 +745,7 @@ do_gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num, ...@@ -751,8 +745,7 @@ do_gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num,
static int static int
gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num) gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
{ {
struct intel_gmbus *bus = struct intel_gmbus *bus = to_intel_gmbus(adapter);
container_of(adapter, struct intel_gmbus, adapter);
struct drm_i915_private *dev_priv = bus->dev_priv; struct drm_i915_private *dev_priv = bus->dev_priv;
intel_wakeref_t wakeref; intel_wakeref_t wakeref;
int ret; int ret;
...@@ -776,8 +769,7 @@ gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num) ...@@ -776,8 +769,7 @@ gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
int intel_gmbus_output_aksv(struct i2c_adapter *adapter) int intel_gmbus_output_aksv(struct i2c_adapter *adapter)
{ {
struct intel_gmbus *bus = struct intel_gmbus *bus = to_intel_gmbus(adapter);
container_of(adapter, struct intel_gmbus, adapter);
struct drm_i915_private *dev_priv = bus->dev_priv; struct drm_i915_private *dev_priv = bus->dev_priv;
u8 cmd = DRM_HDCP_DDC_AKSV; u8 cmd = DRM_HDCP_DDC_AKSV;
u8 buf[DRM_HDCP_KSV_LEN] = { 0 }; u8 buf[DRM_HDCP_KSV_LEN] = { 0 };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment