提交 f2c9677b 编写于 作者: D Daniel Kurtz 提交者: Daniel Vetter

drm/i915/intel_i2c: allocate gmbus array as part of drm_i915_private

This memory is always allocated, and it is always a fixed size, so just
allocate it along with the rest of the driver state.
Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org>
Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
上级 2ed06c93
...@@ -326,7 +326,7 @@ typedef struct drm_i915_private { ...@@ -326,7 +326,7 @@ typedef struct drm_i915_private {
/** gt_lock is also taken in irq contexts. */ /** gt_lock is also taken in irq contexts. */
struct spinlock gt_lock; struct spinlock gt_lock;
struct intel_gmbus *gmbus; struct intel_gmbus gmbus[GMBUS_NUM_PORTS];
/** gmbus_mutex protects against concurrent usage of the single hw gmbus /** gmbus_mutex protects against concurrent usage of the single hw gmbus
* controller on different i2c buses. */ * controller on different i2c buses. */
......
...@@ -387,11 +387,6 @@ int intel_setup_gmbus(struct drm_device *dev) ...@@ -387,11 +387,6 @@ int intel_setup_gmbus(struct drm_device *dev)
else else
dev_priv->gpio_mmio_base = 0; dev_priv->gpio_mmio_base = 0;
dev_priv->gmbus = kcalloc(GMBUS_NUM_PORTS, sizeof(struct intel_gmbus),
GFP_KERNEL);
if (dev_priv->gmbus == NULL)
return -ENOMEM;
mutex_init(&dev_priv->gmbus_mutex); mutex_init(&dev_priv->gmbus_mutex);
for (i = 0; i < GMBUS_NUM_PORTS; i++) { for (i = 0; i < GMBUS_NUM_PORTS; i++) {
...@@ -428,8 +423,6 @@ int intel_setup_gmbus(struct drm_device *dev) ...@@ -428,8 +423,6 @@ int intel_setup_gmbus(struct drm_device *dev)
struct intel_gmbus *bus = &dev_priv->gmbus[i]; struct intel_gmbus *bus = &dev_priv->gmbus[i];
i2c_del_adapter(&bus->adapter); i2c_del_adapter(&bus->adapter);
} }
kfree(dev_priv->gmbus);
dev_priv->gmbus = NULL;
return ret; return ret;
} }
...@@ -468,7 +461,4 @@ void intel_teardown_gmbus(struct drm_device *dev) ...@@ -468,7 +461,4 @@ void intel_teardown_gmbus(struct drm_device *dev)
struct intel_gmbus *bus = &dev_priv->gmbus[i]; struct intel_gmbus *bus = &dev_priv->gmbus[i];
i2c_del_adapter(&bus->adapter); i2c_del_adapter(&bus->adapter);
} }
kfree(dev_priv->gmbus);
dev_priv->gmbus = NULL;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册