mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 15:18:19 +00:00
drm/imx: imx-tve: move initialization into probe
Parts of the initialization that do not require the drm device can be done once during probe instead of possibly multiple times during bind. The bind function only creates the encoder. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
396852df02
commit
a91cfaf6e6
1 changed files with 19 additions and 23 deletions
|
@ -438,6 +438,9 @@ static int imx_tve_register(struct drm_device *drm, struct imx_tve *tve)
|
|||
encoder_type = tve->mode == TVE_MODE_VGA ?
|
||||
DRM_MODE_ENCODER_DAC : DRM_MODE_ENCODER_TVDAC;
|
||||
|
||||
memset(connector, 0, sizeof(*connector));
|
||||
memset(encoder, 0, sizeof(*encoder));
|
||||
|
||||
ret = imx_drm_encoder_parse_of(drm, encoder, tve->dev->of_node);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
@ -503,8 +506,19 @@ static int of_get_tve_mode(struct device_node *np)
|
|||
|
||||
static int imx_tve_bind(struct device *dev, struct device *master, void *data)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct drm_device *drm = data;
|
||||
struct imx_tve *tve = dev_get_drvdata(dev);
|
||||
|
||||
return imx_tve_register(drm, tve);
|
||||
}
|
||||
|
||||
static const struct component_ops imx_tve_ops = {
|
||||
.bind = imx_tve_bind,
|
||||
};
|
||||
|
||||
static int imx_tve_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *np = dev->of_node;
|
||||
struct device_node *ddc_node;
|
||||
struct imx_tve *tve;
|
||||
|
@ -514,8 +528,9 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data)
|
|||
int irq;
|
||||
int ret;
|
||||
|
||||
tve = dev_get_drvdata(dev);
|
||||
memset(tve, 0, sizeof(*tve));
|
||||
tve = devm_kzalloc(dev, sizeof(*tve), GFP_KERNEL);
|
||||
if (!tve)
|
||||
return -ENOMEM;
|
||||
|
||||
tve->dev = dev;
|
||||
|
||||
|
@ -622,28 +637,9 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = imx_tve_register(drm, tve);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct component_ops imx_tve_ops = {
|
||||
.bind = imx_tve_bind,
|
||||
};
|
||||
|
||||
static int imx_tve_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct imx_tve *tve;
|
||||
|
||||
tve = devm_kzalloc(&pdev->dev, sizeof(*tve), GFP_KERNEL);
|
||||
if (!tve)
|
||||
return -ENOMEM;
|
||||
|
||||
platform_set_drvdata(pdev, tve);
|
||||
|
||||
return component_add(&pdev->dev, &imx_tve_ops);
|
||||
return component_add(dev, &imx_tve_ops);
|
||||
}
|
||||
|
||||
static int imx_tve_remove(struct platform_device *pdev)
|
||||
|
|
Loading…
Reference in a new issue