From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: linux-kernel@vger.kernel.org, torvalds@transmeta.com
Subject: PATCH: update ymfpci for new ac97
Date: Fri, 11 Jul 2003 19:18:22 +0100 [thread overview]
Message-ID: <200307111818.h6BIIM9c017416@hraefn.swansea.linux.org.uk> (raw)
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.75/sound/oss/ymfpci.c linux-2.5.75-ac1/sound/oss/ymfpci.c
--- linux-2.5.75/sound/oss/ymfpci.c 2003-07-10 21:11:35.000000000 +0100
+++ linux-2.5.75-ac1/sound/oss/ymfpci.c 2003-07-11 16:59:04.000000000 +0100
@@ -177,15 +177,16 @@
ymfpci_t *codec = dev->private_data;
u32 cmd;
+ spin_lock(&codec->ac97_lock);
/* XXX Do make use of dev->id */
ymfpci_codec_ready(codec, 0, 0);
cmd = ((YDSXG_AC97WRITECMD | reg) << 16) | val;
ymfpci_writel(codec, YDSXGR_AC97CMDDATA, cmd);
+ spin_unlock(&codec->ac97_lock);
}
-static u16 ymfpci_codec_read(struct ac97_codec *dev, u8 reg)
+static u16 _ymfpci_codec_read(ymfpci_t *unit, u8 reg)
{
- ymfpci_t *unit = dev->private_data;
int i;
if (ymfpci_codec_ready(unit, 0, 0))
@@ -200,6 +201,18 @@
return ymfpci_readw(unit, YDSXGR_PRISTATUSDATA);
}
+static u16 ymfpci_codec_read(struct ac97_codec *dev, u8 reg)
+{
+ ymfpci_t *unit = dev->private_data;
+ u16 ret;
+
+ spin_lock(&unit->ac97_lock);
+ ret = _ymfpci_codec_read(unit, reg);
+ spin_unlock(&unit->ac97_lock);
+
+ return ret;
+}
+
/*
* Misc routines
*/
@@ -2444,9 +2457,8 @@
struct ac97_codec *codec;
u16 eid;
- if ((codec = kmalloc(sizeof(struct ac97_codec), GFP_KERNEL)) == NULL)
+ if ((codec = ac97_alloc_codec()) == NULL)
return -ENOMEM;
- memset(codec, 0, sizeof(struct ac97_codec));
/* initialize some basic codec information, other fields will be filled
in ac97_probe_codec */
@@ -2462,7 +2474,7 @@
}
eid = ymfpci_codec_read(codec, AC97_EXTENDED_ID);
- if (eid==0xFFFFFF) {
+ if (eid==0xFFFF) {
printk(KERN_WARNING "ymfpci: no codec attached ?\n");
goto out_kfree;
}
@@ -2478,7 +2490,7 @@
return 0;
out_kfree:
- kfree(codec);
+ ac97_release_codec(codec);
return -ENODEV;
}
@@ -2517,6 +2529,7 @@
spin_lock_init(&codec->reg_lock);
spin_lock_init(&codec->voice_lock);
+ spin_lock_init(&codec->ac97_lock);
init_MUTEX(&codec->open_sem);
INIT_LIST_HEAD(&codec->states);
codec->pci = pcidev;
@@ -2615,7 +2628,7 @@
out_release_region:
release_mem_region(pci_resource_start(pcidev, 0), 0x8000);
out_free:
- kfree(codec);
+ ac97_release_codec(codec->ac97_codec[0]);
return -ENODEV;
}
@@ -2628,7 +2641,7 @@
list_del(&codec->ymf_devs);
unregister_sound_mixer(codec->ac97_codec[0]->dev_mixer);
- kfree(codec->ac97_codec[0]);
+ ac97_release_codec(codec->ac97_codec[0]);
unregister_sound_dsp(codec->dev_audio);
free_irq(pcidev->irq, codec);
ymfpci_memfree(codec);
@@ -2643,7 +2656,6 @@
unload_uart401(&codec->mpu_data);
}
#endif /* CONFIG_SOUND_YMFPCI_LEGACY */
- kfree(codec);
}
MODULE_AUTHOR("Jaroslav Kysela");
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.75/sound/oss/ymfpci.h linux-2.5.75-ac1/sound/oss/ymfpci.h
--- linux-2.5.75/sound/oss/ymfpci.h 2003-07-10 21:08:14.000000000 +0100
+++ linux-2.5.75-ac1/sound/oss/ymfpci.h 2003-07-11 16:59:13.000000000 +0100
@@ -275,6 +275,7 @@
spinlock_t reg_lock;
spinlock_t voice_lock;
+ spinlock_t ac97_lock;
/* soundcore stuff */
int dev_audio;
next reply other threads:[~2003-07-11 18:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-11 18:18 Alan Cox [this message]
[not found] <mailman.1057949943.19028.linux-kernel2news@redhat.com>
2003-07-12 1:59 ` PATCH: update ymfpci for new ac97 Pete Zaitcev
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=200307111818.h6BIIM9c017416@hraefn.swansea.linux.org.uk \
--to=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.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).