Re: [PATCH] imx-drm: imx-hdmi: move memory and resource allocation into probe function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 14, 2014 at 11:24:14PM +0200, Philipp Zabel wrote:
> Move memory allocation and resource acquisition from the bind function into
> the probe function. This calls the devres managed functions once instead of
> possibly multiple times in the bind function and avoids leaking memory (as
> long as the hdmi platform device stays bound).
> 
> While at it, request the irq only after the interrupt handler mutes are
> set up, to avoid spurious interrupts.
> 
> Signed-off-by: Philipp Zabel <philipp.zabel@xxxxxxxxx>
> ---
>  drivers/staging/imx-drm/imx-hdmi.c | 163 +++++++++++++++++++------------------
>  1 file changed, 83 insertions(+), 80 deletions(-)

Very nice. I like it. One comment below, though it's unrelated to what
you're trying to achieve here. It's primarily a note to myself.

> diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c
[...]
>  static int imx_hdmi_platform_probe(struct platform_device *pdev)
>  {
[...]
> +	ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
> +	if (ddc_node) {
> +		hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
> +		if (!hdmi->ddc)
> +			dev_dbg(hdmi->dev, "failed to read ddc node\n");
> +
> +		of_node_put(ddc_node);
> +	} else {
> +		dev_dbg(hdmi->dev, "no ddc property found\n");
> +	}

This seems to be emerging as a common pattern. Perhaps we should add a
common helper for this.

Thierry

Attachment: pgpPs1MQIajci.pgp
Description: PGP signature

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux