Skip to content

Commit

Permalink
drm/i915/intel_i2c: allocate gmbus array as part of drm_i915_private
Browse files Browse the repository at this point in the history
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: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Daniel Kurtz authored and Daniel Vetter committed Mar 28, 2012
1 parent 2ed06c9 commit f2c9677
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ typedef struct drm_i915_private {
/** gt_lock is also taken in irq contexts. */
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
* controller on different i2c buses. */
Expand Down
10 changes: 0 additions & 10 deletions drivers/gpu/drm/i915/intel_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,6 @@ int intel_setup_gmbus(struct drm_device *dev)
else
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);

for (i = 0; i < GMBUS_NUM_PORTS; i++) {
Expand Down Expand Up @@ -428,8 +423,6 @@ int intel_setup_gmbus(struct drm_device *dev)
struct intel_gmbus *bus = &dev_priv->gmbus[i];
i2c_del_adapter(&bus->adapter);
}
kfree(dev_priv->gmbus);
dev_priv->gmbus = NULL;
return ret;
}

Expand Down Expand Up @@ -468,7 +461,4 @@ void intel_teardown_gmbus(struct drm_device *dev)
struct intel_gmbus *bus = &dev_priv->gmbus[i];
i2c_del_adapter(&bus->adapter);
}

kfree(dev_priv->gmbus);
dev_priv->gmbus = NULL;
}

0 comments on commit f2c9677

Please sign in to comment.