linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linuxppc-dev@ozlabs.org, alsa-devel@alsa-project.org,
	netstar@gatheringofgray.com
Subject: Re: [Alsa-devel] [RFC 05/12] snd-aoa: add i2sbus
Date: Wed, 07 Jun 2006 20:44:05 +0200	[thread overview]
Message-ID: <s5hfyig4xhm.wl%tiwai@suse.de> (raw)
In-Reply-To: <20060607130913.414650000@sipsolutions.net>

At Wed, 07 Jun 2006 15:09:14 +0200,
Johannes Berg wrote:
> 
> --- /dev/null
> +++ b/sound/aoa/soundbus/i2sbus/i2sbus-pcm.c
> +static int clock_and_divisors(int mclk, int sclk, int rate, int *out)
> +{
> +	/* sclk must be derived from mclk! */
> +	if (mclk % sclk)
> +		return -1;
> +	/* derive sclk register value */
> +	if (i2s_sf_sclkdiv(mclk / sclk, out))
> +		return -1;
> +
> +	if (I2S_CLOCK_SPEED_18MHz % (rate * mclk) == 0) {
> +		if (!i2s_sf_mclkdiv(I2S_CLOCK_SPEED_18MHz / rate / mclk, out)) {

I'd use "I2S_CLOCK_SPEED_18MHZ / (rate * mclk)"


> --- /dev/null
> +++ b/sound/aoa/soundbus/i2sbus/i2sbus-core.c
> +static void i2sbus_release_dev(struct device *dev)
> +{
> +	struct i2sbus_dev *i2sdev;
> +	int i;
> +
> +	i2sdev = container_of(dev, struct i2sbus_dev, sound.ofdev.dev);
> +
> + 	if (i2sdev->intfregs) iounmap(i2sdev->intfregs);
> + 	if (i2sdev->out.dbdma) iounmap(i2sdev->out.dbdma);
> + 	if (i2sdev->in.dbdma) iounmap(i2sdev->in.dbdma);
> +	for (i=0;i<3;i++)
> +		if (i2sdev->allocated_resource[i])
> +			release_resource(i2sdev->allocated_resource[i]);

release_resource() doesn't kfree the record returned from
request_mem_region().  ALSA has a helper function
release_and_free_resource() that also does NULL check and kfree:

	for (i = 0; i < 3; i++)
		release_and_free_resource(i2sdev->allocated_resource[i]);

> +/* FIXME: look at device node refcounting */
> +static int i2sbus_add_dev(struct macio_dev *macio,
> +			  struct i2sbus_control *control,
> +			  struct device_node *np)
> +{
(snip)
> +	for (i=0;i<3;i++)
> +		if (dev->allocated_resource[i])
> +			release_resource(dev->allocated_resource[i]);

Ditto.


Takashi

  reply	other threads:[~2006-06-07 18:44 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-07 13:09 [RFC 00/12] snd-aoa: add snd-aoa Johannes Berg
2006-06-07 13:09 ` [RFC 01/12] snd-powermac: no longer handle anything with a layout-id property Johannes Berg
2006-06-26 20:49   ` Andreas Schwab
2006-06-27 14:29     ` [Alsa-devel] " Takashi Iwai
2006-06-27 15:32       ` Andreas Schwab
2006-06-29 21:03         ` Andreas Schwab
2006-06-29 22:26           ` Lee Revell
2006-06-29 23:16             ` Andreas Schwab
2006-06-30  9:35               ` Takashi Iwai
2006-07-07  5:38               ` Benjamin Herrenschmidt
2006-07-07  8:04                 ` Johannes Berg
2006-07-07  8:13                   ` Benjamin Herrenschmidt
2006-07-07  8:22                     ` Johannes Berg
2006-07-07  8:27                       ` Benjamin Herrenschmidt
2006-07-07  8:40                         ` Johannes Berg
2006-07-07  9:51                 ` Takashi Iwai
2006-07-07  9:55                   ` Johannes Berg
2006-06-27 17:40       ` Johannes Berg
2006-06-27 17:30     ` Johannes Berg
2006-06-07 13:09 ` [RFC 02/12] snd-aoa: add aoa header files Johannes Berg
2006-06-07 13:09 ` [RFC 03/12] snd-aoa: add aoa core Johannes Berg
2006-06-07 18:13   ` [Alsa-devel] " Takashi Iwai
2006-06-09 12:10     ` Johannes Berg
2006-06-07 13:09 ` [RFC 04/12] snd-aoa: add soundbus Johannes Berg
2006-06-07 13:09 ` [RFC 05/12] snd-aoa: add i2sbus Johannes Berg
2006-06-07 18:44   ` Takashi Iwai [this message]
2006-06-09 12:13     ` [Alsa-devel] " Johannes Berg
2006-06-09 12:23       ` Takashi Iwai
2006-06-07 13:09 ` [RFC 06/12] snd-aoa: add onyx codec Johannes Berg
2006-06-07 13:09 ` [RFC 07/12] snd-aoa: add tas codec Johannes Berg
2006-06-07 15:42   ` Johannes Berg
2006-06-07 13:09 ` [RFC 08/12] snd-aoa: add toonie codec Johannes Berg
2006-06-07 13:09 ` [RFC 09/12] snd-aoa: add build files for codecs Johannes Berg
2006-06-07 13:09 ` [RFC 10/12] snd-aoa: add layout-id fabric Johannes Berg
2006-06-07 13:09 ` [RFC 11/12] snd-aoa: add Kconfig and Makefile Johannes Berg
2006-06-07 18:50   ` [Alsa-devel] " Takashi Iwai
2006-06-09 12:10     ` Johannes Berg
2006-06-07 13:09 ` [RFC 12/12] snd-aoa: wire up aoa in sound/ Johannes Berg
2006-06-07 18:22 ` [Alsa-devel] [RFC 00/12] snd-aoa: add snd-aoa Takashi Iwai
2006-06-09 12:22   ` Johannes Berg
2006-06-09 12:34     ` Takashi Iwai

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=s5hfyig4xhm.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=johannes@sipsolutions.net \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=netstar@gatheringofgray.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;
as well as URLs for NNTP newsgroup(s).