public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: Guruswamy Senthilvadivu <svadivu@ti.com>
Cc: khilman@deeprootsystems.com, tomi.valkeinen@nokia.com,
	paul@pwsan.com, hvaibhav@ti.com, linux-omap@vger.kernel.org
Subject: Re: [PATCH v1 13/16] OMAP3: hwmod DSS: VENC Move init,exit to driver
Date: Thu, 7 Oct 2010 21:57:33 +0200	[thread overview]
Message-ID: <20101007215733.5ab1c091@surf> (raw)
In-Reply-To: <1286363699-9614-14-git-send-email-svadivu@ti.com>

Hello Senthil,

On Wed,  6 Oct 2010 16:44:56 +0530
Guruswamy Senthilvadivu <svadivu@ti.com> wrote:

> diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
> index ec17b28..3a121cb 100644
> --- a/drivers/video/omap2/dss/venc.c
> +++ b/drivers/video/omap2/dss/venc.c
> @@ -87,26 +87,6 @@
>  #define VENC_OUTPUT_TEST			0xC8
>  #define VENC_DAC_B__DAC_C			0xC8
>  
> -/* VENC HW IP initialisation */
> -static int omap_venchw_probe(struct platform_device *pdev)
> -{
> -	return 0;
> -}
> -
> -static int omap_venchw_remove(struct platform_device *pdev)
> -{
> -	return 0;
> -}
> -
> -static struct platform_driver omap_venchw_driver = {
> -	.probe          = omap_venchw_probe,
> -	.remove         = omap_venchw_remove,
> -	.driver         = {
> -		.name   = "dss_venc",
> -		.owner  = THIS_MODULE,
> -	},
> -};

Would be better in patch 7/16 to put this stuff at the correct place
(bottom of the file) so it does not need to be moved here.

> +/* VENC HW IP initialisation */
> +static int omap_venchw_probe(struct platform_device *pdev)
> +{
> +	int r;
> +	venc.pdev = pdev;
> +
> +	r = venc_init(pdev);
> +	if (r) {
> +		DSSERR("Failed to initialize venc\n");
> +		goto err_venc;
> +	}
> +
> +err_venc:
> +	return r;
> +}
> +
> +static int omap_venchw_remove(struct platform_device *pdev)
> +{
> +	venc_exit();
> +	return 0;
> +}

Same comment as before: include the code of venc_init() and venc_exit()
directly in the ->probe() and ->remove() hooks respectively.

> +struct regulator *dss_get_vdda_dac(void)
> +{
> +	struct regulator *reg;
> +
> +	if (venc.vdda_dac_reg != NULL)
> +		return venc.vdda_dac_reg;
> +
> +	reg = regulator_get(&venc.pdev->dev, "vdda_dac");
> +	if (!IS_ERR(reg))
> +		venc.vdda_dac_reg = reg;
>  
> +	return reg;
> +}

As far as I can see, this function is now only used in venc_init(),
which is in the same file, so the function should be static, and the
prototype removed from drivers/video/omap2/dss/core.h.

I'm also a bit skeptical about what this function does. It is called
this way in venc_init():

  venc.vdda_dac_reg = dss_get_vdda_dac();

so it is dss_get_vdda_dac() responsability to set venc.vdda_dac_reg, or
is it the caller responsability ?

Moreover, the logic in dss_get_vdda_dac() that tests whether
venc.vdda_dac_reg is already initialized seems to indicate that this
function could be called several times. However, I only see it called
from venc_init(), which as far as I understand is called only once.

Isn't it possible to simplify this by removing the dss_get_vdda_dac()
function and just doing:

  venc.vdda_dac_reg = regulator_get(&venc.pdev->dev, "vdda_dac");

in the venc_init() function (which should become the ->probe() method).

Thanks!

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  parent reply	other threads:[~2010-10-07 19:57 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-06 11:14 [PATCH v1 00/16] OMAP3: hwmod DSS Adaptation Guruswamy Senthilvadivu
2010-10-06 11:14 ` [PATCH v1 01/16] OMAP2420: hwmod data: add DSS DISPC RFBI VENC Guruswamy Senthilvadivu
2010-10-06 11:14   ` [PATCH v1 02/16] OMAP2430: " Guruswamy Senthilvadivu
2010-10-06 11:14     ` [PATCH v1 03/16] OMAP3: hwmod data: add DSS DISPC RFBI DSI VENC Guruswamy Senthilvadivu
2010-10-06 11:14       ` [PATCH v1 04/16] OMAP3: hwmod data: change dss_hwmod to dss_dss_hwmod Guruswamy Senthilvadivu
2010-10-06 11:14         ` [PATCH v1 05/16] OMAP3 DSS Driver register moved to mach_omap2 Guruswamy Senthilvadivu
2010-10-06 11:14           ` [PATCH v1 06/16] OMAP3: hwmod DSS: Build omap_device for each DSS HWIP Guruswamy Senthilvadivu
2010-10-06 11:14             ` [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP Guruswamy Senthilvadivu
2010-10-06 11:14               ` [PATCH v1 08/16] OMAP3: clock data: change dss driver name Guruswamy Senthilvadivu
2010-10-06 11:14                 ` [PATCH v1 09/16] OMAP3: hwmod DSS: Move clocks from core driver to dss driver Guruswamy Senthilvadivu
2010-10-06 11:14                   ` [PATCH v1 10/16] OMAP3: hwmod DSS: DSS Move init,exit to driver Guruswamy Senthilvadivu
2010-10-06 11:14                     ` [PATCH v1 11/16] OMAP3: hwmod DSS: RFBI " Guruswamy Senthilvadivu
2010-10-06 11:14                       ` [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC " Guruswamy Senthilvadivu
2010-10-06 11:14                         ` [PATCH v1 13/16] OMAP3: hwmod DSS: VENC " Guruswamy Senthilvadivu
2010-10-06 11:14                           ` [PATCH v1 14/16] OMAP3: hwmod DSS: DSI Move init, exit " Guruswamy Senthilvadivu
2010-10-06 11:14                             ` [PATCH v1 15/16] OMAP3: hwmod DSS: Use platform device to get baseaddr Guruswamy Senthilvadivu
2010-10-06 11:14                               ` [PATCH v1 16/16] OMAP3: hwmod DSS: Get DSS IRQ from platform device Guruswamy Senthilvadivu
2010-10-07 20:00                             ` [PATCH v1 14/16] OMAP3: hwmod DSS: DSI Move init, exit to driver Thomas Petazzoni
2010-10-07 19:57                           ` Thomas Petazzoni [this message]
2010-10-08  7:09                             ` [PATCH v1 13/16] OMAP3: hwmod DSS: VENC Move init,exit " Guruswamy, Senthilvadivu
2010-10-06 14:19                         ` [PATCH v1 12/16] OMAP3: hwmod DSS: DISPC " Premi, Sanjeev
2010-10-07  6:16                           ` Guruswamy, Senthilvadivu
2010-10-07  7:17                             ` Cousson, Benoit
2010-10-07  8:44                               ` Guruswamy, Senthilvadivu
2010-10-07  9:04                                 ` Cousson, Benoit
2010-10-07 19:48                         ` Thomas Petazzoni
2010-10-07 19:47                       ` [PATCH v1 11/16] OMAP3: hwmod DSS: RFBI " Thomas Petazzoni
2010-10-08  7:13                         ` Guruswamy, Senthilvadivu
2010-10-07 19:47               ` [PATCH v1 07/16] OMAP3: hwmod DSS: Create platform_driver for each DSS HW IP Thomas Petazzoni
2010-10-07 19:49               ` Thomas Petazzoni
2010-10-08  7:11                 ` Guruswamy, Senthilvadivu
2010-10-08  7:43                   ` Thomas Petazzoni
2010-10-07 19:30             ` [PATCH v1 06/16] OMAP3: hwmod DSS: Build omap_device for each DSS HWIP Thomas Petazzoni
2010-10-07 19:06           ` [PATCH v1 05/16] OMAP3 DSS Driver register moved to mach_omap2 Thomas Petazzoni
2010-10-08  6:54             ` Guruswamy, Senthilvadivu

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=20101007215733.5ab1c091@surf \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=hvaibhav@ti.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=paul@pwsan.com \
    --cc=svadivu@ti.com \
    --cc=tomi.valkeinen@nokia.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox