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: 13930 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id B6A0523E33 for ; Wed, 9 Jan 2013 04:09:31 +0000 (UTC) Received: from mail-vb0-f41.google.com (mail-vb0-f41.google.com [209.85.212.41]) by fiordland.canonical.com (Postfix) with ESMTP id 3D7D8A18EA5 for ; Wed, 9 Jan 2013 04:09:31 +0000 (UTC) Received: by mail-vb0-f41.google.com with SMTP id l22so1152278vbn.14 for ; Tue, 08 Jan 2013 20:09:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:dkim-signature:x-received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references:x-gm-message-state; bh=qz/SFhFC092l6EENXNBPxK0B3isjA41dOvf4CfMmQXs=; b=j+opBJgRutTXRw9IkdUC0oZ2f2yFMP+jQxtY1oheDVekbwYP94ACoHnJ8K2gPAxe2b oZg3aR6aiymQBkFFJdUN1zw9FiMvUS847KE1xEPWcV2w/mTam1ewyuzg7CNQzmtwK+v0 NJcvCgWpjNj/IOuOF4j2PXnCE0uWD8qI2dsQe9J2A/CjhbTlPZIjVOqrpkZv58/4faA/ h74nJSfgdkLNc1EygeGR5wcl6Gnxnja0KOl6iKh/TG/afT3+czov0IHWfyOyj4HOdU+e 0xc1vozfHTEr3Jgd0BlYI9W9d/pmIQhTAB2/Icu9/TDcXDhFVPRmqJx4vqGN+FjdMfNd Il7w== X-Received: by 10.52.176.6 with SMTP id ce6mr77061404vdc.57.1357704570700; Tue, 08 Jan 2013 20:09:30 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp144877veb; Tue, 8 Jan 2013 20:09:29 -0800 (PST) X-Received: by 10.68.226.230 with SMTP id rv6mr28896025pbc.90.1357704568927; Tue, 08 Jan 2013 20:09:28 -0800 (PST) Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) by mx.google.com with ESMTPS id zn8si64713308pbc.352.2013.01.08.20.09.28 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Jan 2013 20:09:28 -0800 (PST) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 209.85.220.41 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass header.i=@gmail.com Received: by mail-pa0-f41.google.com with SMTP id bj3so759454pad.14 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 Cc: patches@linaro.org, Rob Clark 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> X-Gm-Message-State: ALoCoQkto5K4X/GhAtdTdKIEhYaGI5WsaU8uy6f8ImhodJUNwKhXlO1KVds9pEC/6zFyYwdeepMX 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; }