From: rmk+kernel@armlinux.org.uk (Russell King)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/6] drm/i2c: tda998x: allocate tda998x_priv inside tda998x_create()
Date: Fri, 06 Jul 2018 15:59:09 +0100 [thread overview]
Message-ID: <E1fbSCT-00076w-SL@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20180706145748.GA17271@n2100.armlinux.org.uk>
Move the tda998x_priv allocation inside tda998x_create() and simplify
the tda998x_create()'s arguments. Pass the same to tda998x_destroy().
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/gpu/drm/i2c/tda998x_drv.c | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 53f110e7d433..08ccaf8cf852 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1562,8 +1562,10 @@ static const struct drm_bridge_funcs tda998x_bridge_funcs = {
.enable = tda998x_bridge_enable,
};
-static void tda998x_destroy(struct tda998x_priv *priv)
+static void tda998x_destroy(struct device *dev)
{
+ struct tda998x_priv *priv = dev_get_drvdata(dev);
+
drm_bridge_remove(&priv->bridge);
/* disable all IRQs and free the IRQ handler */
@@ -1648,13 +1650,21 @@ static void tda998x_set_config(struct tda998x_priv *priv,
priv->audio_params = p->audio_params;
}
-static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
+static int tda998x_create(struct device *dev)
{
+ struct i2c_client *client = to_i2c_client(dev);
struct device_node *np = client->dev.of_node;
struct i2c_board_info cec_info;
+ struct tda998x_priv *priv;
u32 video;
int rev_lo, rev_hi, ret;
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
+ dev_set_drvdata(dev, priv);
+
mutex_init(&priv->mutex); /* protect the page access */
mutex_init(&priv->audio_mutex); /* protect access from audio thread */
mutex_init(&priv->edid_mutex);
@@ -1831,7 +1841,7 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
return 0;
fail:
- tda998x_destroy(priv);
+ tda998x_destroy(dev);
err_irq:
return ret;
}
@@ -1883,30 +1893,22 @@ static int tda998x_encoder_init(struct device *dev, struct drm_device *drm)
static int tda998x_bind(struct device *dev, struct device *master, void *data)
{
- struct i2c_client *client = to_i2c_client(dev);
struct drm_device *drm = data;
- struct tda998x_priv *priv;
int ret;
- priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
- if (!priv)
- return -ENOMEM;
-
- dev_set_drvdata(dev, priv);
-
- ret = tda998x_create(client, priv);
+ ret = tda998x_create(dev);
if (ret)
return ret;
ret = tda998x_encoder_init(dev, drm);
if (ret) {
- tda998x_destroy(priv);
+ tda998x_destroy(dev);
return ret;
}
return 0;
err_encoder:
- tda998x_destroy(priv);
+ tda998x_destroy(dev);
return ret;
}
@@ -1917,7 +1919,7 @@ static void tda998x_unbind(struct device *dev, struct device *master,
drm_connector_cleanup(&priv->connector);
drm_encoder_cleanup(&priv->encoder);
- tda998x_destroy(priv);
+ tda998x_destroy(dev);
}
static const struct component_ops tda998x_ops = {
--
2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: Russell King <rmk+kernel@armlinux.org.uk>
To: Peter Rosin <peda@axentia.se>
Cc: Mark Rutland <mark.rutland@arm.com>,
devicetree@vger.kernel.org,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Andrzej Hajda <a.hajda@samsung.com>,
David Airlie <airlied@linux.ie>, Jyri Sarha <jsarha@ti.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Boris Brezillon <boris.brezillon@bootlin.com>,
Rob Herring <robh+dt@kernel.org>,
Jacopo Mondi <jacopo+renesas@jmondi.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Daniel Vetter <daniel@ffwll.ch>,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/6] drm/i2c: tda998x: allocate tda998x_priv inside tda998x_create()
Date: Fri, 06 Jul 2018 15:59:09 +0100 [thread overview]
Message-ID: <E1fbSCT-00076w-SL@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20180706145748.GA17271@n2100.armlinux.org.uk>
Move the tda998x_priv allocation inside tda998x_create() and simplify
the tda998x_create()'s arguments. Pass the same to tda998x_destroy().
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/gpu/drm/i2c/tda998x_drv.c | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 53f110e7d433..08ccaf8cf852 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1562,8 +1562,10 @@ static const struct drm_bridge_funcs tda998x_bridge_funcs = {
.enable = tda998x_bridge_enable,
};
-static void tda998x_destroy(struct tda998x_priv *priv)
+static void tda998x_destroy(struct device *dev)
{
+ struct tda998x_priv *priv = dev_get_drvdata(dev);
+
drm_bridge_remove(&priv->bridge);
/* disable all IRQs and free the IRQ handler */
@@ -1648,13 +1650,21 @@ static void tda998x_set_config(struct tda998x_priv *priv,
priv->audio_params = p->audio_params;
}
-static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
+static int tda998x_create(struct device *dev)
{
+ struct i2c_client *client = to_i2c_client(dev);
struct device_node *np = client->dev.of_node;
struct i2c_board_info cec_info;
+ struct tda998x_priv *priv;
u32 video;
int rev_lo, rev_hi, ret;
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
+ dev_set_drvdata(dev, priv);
+
mutex_init(&priv->mutex); /* protect the page access */
mutex_init(&priv->audio_mutex); /* protect access from audio thread */
mutex_init(&priv->edid_mutex);
@@ -1831,7 +1841,7 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
return 0;
fail:
- tda998x_destroy(priv);
+ tda998x_destroy(dev);
err_irq:
return ret;
}
@@ -1883,30 +1893,22 @@ static int tda998x_encoder_init(struct device *dev, struct drm_device *drm)
static int tda998x_bind(struct device *dev, struct device *master, void *data)
{
- struct i2c_client *client = to_i2c_client(dev);
struct drm_device *drm = data;
- struct tda998x_priv *priv;
int ret;
- priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
- if (!priv)
- return -ENOMEM;
-
- dev_set_drvdata(dev, priv);
-
- ret = tda998x_create(client, priv);
+ ret = tda998x_create(dev);
if (ret)
return ret;
ret = tda998x_encoder_init(dev, drm);
if (ret) {
- tda998x_destroy(priv);
+ tda998x_destroy(dev);
return ret;
}
return 0;
err_encoder:
- tda998x_destroy(priv);
+ tda998x_destroy(dev);
return ret;
}
@@ -1917,7 +1919,7 @@ static void tda998x_unbind(struct device *dev, struct device *master,
drm_connector_cleanup(&priv->connector);
drm_encoder_cleanup(&priv->encoder);
- tda998x_destroy(priv);
+ tda998x_destroy(dev);
}
static const struct component_ops tda998x_ops = {
--
2.7.4
next prev parent reply other threads:[~2018-07-06 14:59 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-23 9:31 [PATCH v5 0/7] Add tda998x (HDMI) support to atmel-hlcdc Peter Rosin
2018-05-23 9:31 ` Peter Rosin
2018-05-23 9:31 ` [PATCH v5 1/7] dt-bindings: display: bridge: lvds-transmitter: add ti, ds90c185 Peter Rosin
2018-05-23 9:31 ` [PATCH v5 1/7] dt-bindings: display: bridge: lvds-transmitter: add ti,ds90c185 Peter Rosin
2018-05-23 9:31 ` [PATCH v5 1/7] dt-bindings: display: bridge: lvds-transmitter: add ti, ds90c185 Peter Rosin
2018-05-23 9:31 ` [PATCH v5 2/7] dt-bindings: display: atmel: optional video-interface of endpoints Peter Rosin
2018-05-23 9:31 ` Peter Rosin
2018-05-23 9:31 ` [PATCH v5 3/7] drm/atmel-hlcdc: support bus-width (12/16/18/24) in endpoint nodes Peter Rosin
2018-05-23 9:31 ` Peter Rosin
2018-05-23 9:31 ` [PATCH v5 4/7] drm/i2c: tda998x: find the drm_device via the drm_connector Peter Rosin
2018-05-23 9:31 ` Peter Rosin
2018-05-23 9:31 ` [PATCH v5 5/7] drm/i2c: tda998x: split tda998x_encoder_dpms into enable/disable Peter Rosin
2018-05-23 9:31 ` Peter Rosin
2018-07-06 10:57 ` Russell King - ARM Linux
2018-07-06 10:57 ` Russell King - ARM Linux
2018-05-23 9:31 ` [PATCH v5 6/7] drm/i2c: tda998x: split encoder and component functions from the work Peter Rosin
2018-05-23 9:31 ` Peter Rosin
2018-05-23 9:31 ` [PATCH v5 7/7] drm/i2c: tda998x: register as a drm bridge Peter Rosin
2018-05-23 9:31 ` Peter Rosin
2018-07-06 13:36 ` Russell King - ARM Linux
2018-07-06 13:36 ` Russell King - ARM Linux
2018-07-06 14:57 ` Russell King - ARM Linux
2018-07-06 14:57 ` Russell King - ARM Linux
2018-07-06 14:58 ` [PATCH 1/6] drm/i2c: tda998x: find the drm_device via the drm_connector Russell King
2018-07-06 14:58 ` Russell King
2018-07-06 14:58 ` [PATCH 2/6] drm/i2c: tda998x: split tda998x_encoder_dpms into enable/disable Russell King
2018-07-06 14:58 ` Russell King
2018-07-06 14:58 ` [PATCH 3/6] drm/i2c: tda998x: move tda998x_set_config() into tda998x_create() Russell King
2018-07-06 14:58 ` Russell King
2018-07-06 14:59 ` [PATCH 4/6] drm/i2c: tda998x: convert to bridge driver Russell King
2018-07-06 14:59 ` Russell King
2018-07-07 6:19 ` kbuild test robot
2018-07-07 6:19 ` kbuild test robot
2018-07-07 6:19 ` kbuild test robot
2018-07-07 7:08 ` kbuild test robot
2018-07-07 7:08 ` kbuild test robot
2018-07-07 7:08 ` kbuild test robot
2018-07-06 14:59 ` Russell King [this message]
2018-07-06 14:59 ` [PATCH 5/6] drm/i2c: tda998x: allocate tda998x_priv inside tda998x_create() Russell King
2018-07-06 14:59 ` [PATCH 6/6] drm/i2c: tda998x: cleanup from previous changes Russell King
2018-07-06 14:59 ` Russell King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1fbSCT-00076w-SL@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.