All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: "Harsha, Priya" <priya.harsha@intel.com>
Cc: "Koul, Vinod" <vinod.koul@intel.com>,
	Linux-ALSA <alsa-devel@alsa-project.org>,
	".lrg"@slimlogic.co.uk
Subject: Re: regarding references taken on platform and codec driver modules
Date: Tue, 4 Jan 2011 15:48:26 +0000	[thread overview]
Message-ID: <20110104154825.GF24774@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <98769532B4BB14429434178695419EAE053BF51BC3@bgsmsx501.gar.corp.intel.com>

On Mon, Jan 03, 2011 at 11:26:34PM +0530, Harsha, Priya wrote:

> Please provide your comments on the patch below that makes this change

Please follow Documentation/SubmittingPatches - remember to CC
maintainers (I've added Liam) and don't bury your patches in the middle
of another e-mail.

> From: Harsha Priya <priya.harsha@intel.com>
> Date: Mon, 3 Jan 2011 22:36:05 +0530
> Subject: [PATCH] Fix the reference to codec and platform driver to where they are probed
> 
> The soc-core take the platform and codec driver reference and does not free
> them all. This cause the module unload to fail.

Please explain in which circumstances this happens in the changelog; 

> This patch fixes by the taking one reference to platform and codec module and 
> free the same.This allows load/unload properly

This looks reasonable, though we're now not counting CODEC DAIs
individually as we do with platform DAIs which is a bit asymmetric, it
might be nicer to change to free all the references we're currently
taking to the CODEC.  I'm not too fussed, though.

> free the same.This allows load/unload properly
> 
> Signed-off-by: Harsha Priya <priya.harsha@intel.com>
> Signed-off-by: Vinod Koul<vinod.koul@intel.com>
> 
> 	modified:   sound/soc/soc-core.c

No need for this in the patch either.  Leaving the patch content for Liam:

> 
> ---
>  sound/soc/soc-core.c |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 606281a..97f9d3e 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -1259,9 +1259,6 @@ find_codec:
>  		if (!strcmp(codec->name, dai_link->codec_name)) {
>  			rtd->codec = codec;
>  
> -			if (!try_module_get(codec->dev->driver->owner))
> -				return -ENODEV;
> -
>  			/* CODEC found, so find CODEC DAI from registered DAIs from this CODEC*/
>  			list_for_each_entry(codec_dai, &dai_list, list) {
>  				if (codec->dev == codec_dai->dev && @@ -1287,10 +1284,6 @@ find_platform:
>  	/* no, then find CPU DAI from registered DAIs*/
>  	list_for_each_entry(platform, &platform_list, list) {
>  		if (!strcmp(platform->name, dai_link->platform_name)) {
> -
> -			if (!try_module_get(platform->dev->driver->owner))
> -				return -ENODEV;
> -
>  			rtd->platform = platform;
>  			goto out;
>  		}
> @@ -1425,6 +1418,9 @@ static int soc_probe_codec(struct snd_soc_card *card,
>  	soc_init_codec_debugfs(codec);
>  
>  	/* mark codec as probed and add to card codec list */
> +	if (!try_module_get(codec->dev->driver->owner))
> +		return -ENODEV;
> +
>  	codec->probed = 1;
>  	list_add(&codec->card_list, &card->codec_dev_list);
>  	list_add(&codec->dapm.list, &card->dapm_list); @@ -1556,6 +1552,10 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num)
>  			}
>  		}
>  		/* mark platform as probed and add to card platform list */
> +
> +		if (!try_module_get(platform->dev->driver->owner))
> +			return -ENODEV;
> +
>  		platform->probed = 1;
>  		list_add(&platform->card_list, &card->platform_dev_list);
>  	}
> --
> 1.7.2.3
> 

  reply	other threads:[~2011-01-04 15:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-03 11:00 regarding references taken on platform and codec driver modules Harsha, Priya
2011-01-03 15:54 ` Mark Brown
2011-01-03 16:27   ` Harsha, Priya
2011-01-03 16:35     ` Mark Brown
2011-01-03 17:56       ` Harsha, Priya
2011-01-04 15:48         ` Mark Brown [this message]
2011-01-05  6:00           ` Harsha, Priya
2011-01-05 17:19             ` Koul, Vinod
2011-01-06  9:11             ` Koul, Vinod
2011-01-10 19:01               ` Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2011-01-03  8:26 Harsha, Priya
2011-01-03  7:09 Harsha, Priya

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=20110104154825.GF24774@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=".lrg"@slimlogic.co.uk \
    --cc=alsa-devel@alsa-project.org \
    --cc=priya.harsha@intel.com \
    --cc=vinod.koul@intel.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 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.