Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753395AbbEHL00 (ORCPT ); Fri, 8 May 2015 07:26:26 -0400 Received: from smtp5-g21.free.fr ([212.27.42.5]:54639 "EHLO smtp5-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753331AbbEHL0W (ORCPT ); Fri, 8 May 2015 07:26:22 -0400 X-Mailbox-Line: From 3021578d7e7a53b1932578aa36451aa8c93cb78a Mon Sep 17 00:00:00 2001 Message-Id: <3021578d7e7a53b1932578aa36451aa8c93cb78a.1431083916.git.moinejf@free.fr> In-Reply-To: References: From: Jean-Francois Moine Date: Fri, 8 May 2015 10:23:24 +0200 Subject: [PATCH v12 5/6] drm/i2c: tda998x: Change drvdata for audio extension To: Mark Brown , Russell King - ARM Linux Cc: Dave Airlie , Andrew Jackson , Jyri Sarha , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1841 Lines: 52 The device drvdata is used for component bind, but points to the encoder/connector structure which is hidden from the slave encoder. For audio extension, the slave encoder private data must be accessible, so, this patch changes drvdata to the slave encoder private data and sets it in case of slave encoder use. Signed-off-by: Jean-Francois Moine --- drivers/gpu/drm/i2c/tda998x_drv.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index bcf96f7..7a9d9a7 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -1450,6 +1450,8 @@ static int tda998x_encoder_init(struct i2c_client *client, encoder_slave->slave_priv = priv; encoder_slave->slave_funcs = &tda998x_encoder_slave_funcs; + dev_set_drvdata(&client->dev, priv); + return 0; } @@ -1577,7 +1579,7 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data) if (!priv) return -ENOMEM; - dev_set_drvdata(dev, priv); + dev_set_drvdata(dev, &priv->base); if (dev->of_node) crtcs = drm_of_find_possible_crtcs(drm, dev->of_node); @@ -1636,7 +1638,9 @@ err_encoder: static void tda998x_unbind(struct device *dev, struct device *master, void *data) { - struct tda998x_priv2 *priv = dev_get_drvdata(dev); + struct tda998x_priv *priv_s = dev_get_drvdata(dev); + struct tda998x_priv2 *priv = + container_of(priv_s, struct tda998x_priv2, base); drm_connector_cleanup(&priv->connector); drm_encoder_cleanup(&priv->encoder); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/