Thread (41 messages) flat view 41 messages, 5 authors, 2006-07-07

Re: [Alsa-devel] [RFC 05/12] snd-aoa: add i2sbus

From: Takashi Iwai <hidden>
Date: 2006-06-07 18:44:09

At Wed, 07 Jun 2006 15:09:14 +0200,
Johannes Berg wrote:
quoted hunk ↗ jump to hunk
--- /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)"

quoted hunk ↗ jump to hunk
--- /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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help