]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: add dev_priv to intel_gmbus
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 14 Feb 2012 21:37:19 +0000 (22:37 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 29 Feb 2012 19:44:48 +0000 (20:44 +0100)
This way we can free up the bus->adaptor.algo_data pointer and make it
available for use with the bitbanging fallback algo.

Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_i2c.c

index 35833fc350de9c03550bdccc16f2cbfd77c92015..3cc2694a2b933be3f9c289088819a275727a4766 100644 (file)
@@ -298,6 +298,13 @@ enum intel_pch {
 struct intel_fbdev;
 struct intel_fbc_work;
 
+struct intel_gmbus {
+       struct i2c_adapter adapter;
+       struct i2c_adapter *force_bit;
+       u32 reg0;
+       struct drm_i915_private *dev_priv;
+};
+
 typedef struct drm_i915_private {
        struct drm_device *dev;
 
@@ -315,11 +322,7 @@ typedef struct drm_i915_private {
        /** gt_lock is also taken in irq contexts. */
        struct spinlock gt_lock;
 
-       struct intel_gmbus {
-               struct i2c_adapter adapter;
-               struct i2c_adapter *force_bit;
-               u32 reg0;
-       } *gmbus;
+       struct intel_gmbus *gmbus;
 
        /** gmbus_mutex protects against concurrent usage of the single hw gmbus
         * controller on different i2c buses. */
index 4e4ddd5d1f516037106edc9214944aaa5144b942..89346cc0bc4b0febb5630d5e83f0774001add785 100644 (file)
@@ -232,7 +232,7 @@ gmbus_xfer(struct i2c_adapter *adapter,
        struct intel_gmbus *bus = container_of(adapter,
                                               struct intel_gmbus,
                                               adapter);
-       struct drm_i915_private *dev_priv = adapter->algo_data;
+       struct drm_i915_private *dev_priv = bus->dev_priv;
        int i, reg_offset, ret;
 
        mutex_lock(&dev_priv->gmbus_mutex);
@@ -406,7 +406,7 @@ int intel_setup_gmbus(struct drm_device *dev)
                         names[i]);
 
                bus->adapter.dev.parent = &dev->pdev->dev;
-               bus->adapter.algo_data  = dev_priv;
+               bus->dev_priv = dev_priv;
 
                bus->adapter.algo = &gmbus_algorithm;
                ret = i2c_add_adapter(&bus->adapter);
@@ -447,7 +447,7 @@ void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit)
 
        if (force_bit) {
                if (bus->force_bit == NULL) {
-                       struct drm_i915_private *dev_priv = adapter->algo_data;
+                       struct drm_i915_private *dev_priv = bus->dev_priv;
                        bus->force_bit = intel_gpio_create(dev_priv,
                                                           bus->reg0 & 0xff);
                }