From patchwork Wed Jan 9 04:08:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 1951051 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id ECA3DDF25A for ; Wed, 9 Jan 2013 07:58:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D1C57E6AE4 for ; Tue, 8 Jan 2013 23:58:55 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-da0-f42.google.com (mail-da0-f42.google.com [209.85.210.42]) by gabe.freedesktop.org (Postfix) with ESMTP id D1ADAE6550 for ; Tue, 8 Jan 2013 20:09:28 -0800 (PST) Received: by mail-da0-f42.google.com with SMTP id z17so532236dal.1 for ; Tue, 08 Jan 2013 20:09:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=qz/SFhFC092l6EENXNBPxK0B3isjA41dOvf4CfMmQXs=; b=GMf+24AiRYV8qRZ8ff0ni77puHdM14xSOUGbEb1bPkEfd8epWKZxDPP8CGBsmSBpaH lpbH6GESWdZABlpXrJOeFGmQ+Bv6ZRin/crlpdbRdNA6ZTFbePYXb3kagAYh8J2Oxnjj qU4sDJ9dHWupAGZgEJ4aFaDY6MaQVmrVY8eJ8BSBCcsopDHL7P7Dd/D679HXgfaGkLSe LIzCBaruQsxNKUK6VWJ61DBGuyxcGl+MeXX33l6Q9ESxm83r1jMveOEjBRVqFiR0fUSN 8SJpi8TKGFrklEIiXKQeua4Qxxa2xcqKHeOEeNYnL76CzNZw7/alFf8JcgocG+etIV3+ jcQg== X-Received: by 10.66.73.230 with SMTP id o6mr185689645pav.57.1357704568555; Tue, 08 Jan 2013 20:09:28 -0800 (PST) Received: from localhost (pool-74-100-87-234.lsanca.fios.verizon.net. [74.100.87.234]) by mx.google.com with ESMTPS id mt15sm40811838pbc.49.2013.01.08.20.09.27 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Jan 2013 20:09:27 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/4] drm/nouveau: use i2c encoder helper wrappers Date: Tue, 8 Jan 2013 22:08:46 -0600 Message-Id: <1357704526-3447-5-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 1.8.0.2 In-Reply-To: <1357704526-3447-1-git-send-email-robdclark@gmail.com> References: <1357704526-3447-1-git-send-email-robdclark@gmail.com> Cc: patches@linaro.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Signed-off-by: Rob Clark Reviewed-by: Daniel Vetter --- drivers/gpu/drm/nouveau/nv04_tv.c | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nv04_tv.c b/drivers/gpu/drm/nouveau/nv04_tv.c index 62e826a..4a69ccd 100644 --- a/drivers/gpu/drm/nouveau/nv04_tv.c +++ b/drivers/gpu/drm/nouveau/nv04_tv.c @@ -184,14 +184,23 @@ static const struct drm_encoder_funcs nv04_tv_funcs = { .destroy = nv04_tv_destroy, }; +static const struct drm_encoder_helper_funcs nv04_tv_helper_funcs = { + .dpms = nv04_tv_dpms, + .save = drm_i2c_encoder_save, + .restore = drm_i2c_encoder_restore, + .mode_fixup = drm_i2c_encoder_mode_fixup, + .prepare = nv04_tv_prepare, + .commit = nv04_tv_commit, + .mode_set = nv04_tv_mode_set, + .detect = drm_i2c_encoder_detect, +}; + int nv04_tv_create(struct drm_connector *connector, struct dcb_output *entry) { struct nouveau_encoder *nv_encoder; struct drm_encoder *encoder; struct drm_device *dev = connector->dev; - struct drm_encoder_helper_funcs *hfuncs; - struct drm_encoder_slave_funcs *sfuncs; struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_i2c *i2c = nouveau_i2c(drm->device); struct nouveau_i2c_port *port = i2c->find(i2c, entry->i2c_index); @@ -207,17 +216,11 @@ nv04_tv_create(struct drm_connector *connector, struct dcb_output *entry) if (!nv_encoder) return -ENOMEM; - hfuncs = kzalloc(sizeof(*hfuncs), GFP_KERNEL); - if (!hfuncs) { - ret = -ENOMEM; - goto fail_free; - } - /* Initialize the common members */ encoder = to_drm_encoder(nv_encoder); drm_encoder_init(dev, encoder, &nv04_tv_funcs, DRM_MODE_ENCODER_TVDAC); - drm_encoder_helper_add(encoder, hfuncs); + drm_encoder_helper_add(encoder, &nv04_tv_helper_funcs); encoder->possible_crtcs = entry->heads; encoder->possible_clones = 0; @@ -230,30 +233,14 @@ nv04_tv_create(struct drm_connector *connector, struct dcb_output *entry) if (ret < 0) goto fail_cleanup; - /* Fill the function pointers */ - sfuncs = get_slave_funcs(encoder); - - *hfuncs = (struct drm_encoder_helper_funcs) { - .dpms = nv04_tv_dpms, - .save = sfuncs->save, - .restore = sfuncs->restore, - .mode_fixup = sfuncs->mode_fixup, - .prepare = nv04_tv_prepare, - .commit = nv04_tv_commit, - .mode_set = nv04_tv_mode_set, - .detect = sfuncs->detect, - }; - /* Attach it to the specified connector. */ - sfuncs->create_resources(encoder, connector); + get_slave_funcs(encoder)->create_resources(encoder, connector); drm_mode_connector_attach_encoder(connector, encoder); return 0; fail_cleanup: drm_encoder_cleanup(encoder); - kfree(hfuncs); -fail_free: kfree(nv_encoder); return ret; }