From: Doug Ledford <dledford@redhat.com>
To: Andris Pavenis <pavenis@latnet.lv>
Cc: Nathan Bryant <nbryant@optonline.net>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i810_audio fix for version 0.11
Date: Sat, 08 Dec 2001 04:36:21 -0500 [thread overview]
Message-ID: <3C11DF15.1020107@redhat.com> (raw)
In-Reply-To: <Pine.A41.4.05.10112081022560.23064-100000@ieva06> <200112080925.fB89PJ200926@hal.astr.lu.lv>
Andris Pavenis wrote:
>On Saturday 08 December 2001 10:39, Andris Pavenis wrote:
>
>>Sorry, but this patch is still not OK. It still causes system
>>locking up for me.
>>
>>In some cases I have (I added printk in __start_dac):
>> dmabuf->count = 0
>> dmabuf->ready = 1
>> dmabuf->enable = 1
>> PCM_ENABLE_OUTPUT set in dmabuf->triger
>>
Actually, since the problem is that there are obviously some "just in
case" type calls if i810_update_lvi(), the best answer is not to even go
through all those motions when dmabuf->count == 0. So, I would add a
line to i810_update_lvi() that makes it return without doing anything
when dmabuf->count == 0. That one line should solve your lockups (and
finalize the 0.12 version).
>>
>>in __start_dac(). As result nothing was done in this procedure
>>and I got system locking in __i810_update_lvi() immediatelly after
>>that. This was reason why I added return code to __start_dac,
>>__start_adc to skip the loop if there is nothing to wait for.
>>Perhaps checking return code is more efficient and less error prone
>>that repeating all conditions in __i810_update_lvi.
>>
>>Maybe really we should use wait_event_interruptible() instead
>>of plain loop in __i810_update_lvi(). This happens not so often,
>>so I don't think it could cause too big delays. At least we could
>>avoid kernel freezing in this way.
>>
>
>Here is my updated patch against v0.12 (I changed version to 0.12a to point
>a version against which is the patch)
>
>Andris
>
>
>------------------------------------------------------------------------
>
>--- i810_audio.c-0.12 Sat Dec 8 10:24:24 2001
>+++ i810_audio.c Sat Dec 8 11:14:16 2001
>@@ -198,7 +198,7 @@
> #define INT_MASK (INT_SEC|INT_PRI|INT_MC|INT_PO|INT_PI|INT_MO|INT_NI|INT_GPI)
>
>
>-#define DRIVER_VERSION "0.12"
>+#define DRIVER_VERSION "0.12a"
>
> /* magic numbers to protect our data structures */
> #define I810_CARD_MAGIC 0x5072696E /* "Prin" */
>@@ -690,25 +690,30 @@
> spin_unlock_irqrestore(&card->lock, flags);
> }
>
>-static inline void __start_adc(struct i810_state *state)
>+static inline int __start_adc(struct i810_state *state)
> {
>+ int ret = 0;
> struct dmabuf *dmabuf = &state->dmabuf;
>
> if (dmabuf->count < dmabuf->dmasize && dmabuf->ready && !dmabuf->enable &&
> (dmabuf->trigger & PCM_ENABLE_INPUT)) {
>+ ret = 1;
> dmabuf->enable |= ADC_RUNNING;
> outb((1<<4) | (1<<2) | 1, state->card->iobase + PI_CR);
> }
>+ return ret;
> }
>
>-static void start_adc(struct i810_state *state)
>+static int start_adc(struct i810_state *state)
> {
>+ int ret;
> struct i810_card *card = state->card;
> unsigned long flags;
>
> spin_lock_irqsave(&card->lock, flags);
>- __start_adc(state);
>+ ret = __start_adc(state);
> spin_unlock_irqrestore(&card->lock, flags);
>+ return ret;
> }
>
> /* stop playback (lock held) */
>@@ -736,24 +741,29 @@
> spin_unlock_irqrestore(&card->lock, flags);
> }
>
>-static inline void __start_dac(struct i810_state *state)
>+static inline int __start_dac(struct i810_state *state)
> {
>+ int ret = 0;
> struct dmabuf *dmabuf = &state->dmabuf;
>
> if (dmabuf->count > 0 && dmabuf->ready && !dmabuf->enable &&
> (dmabuf->trigger & PCM_ENABLE_OUTPUT)) {
>+ ret = 1;
> dmabuf->enable |= DAC_RUNNING;
> outb((1<<4) | (1<<2) | 1, state->card->iobase + PO_CR);
> }
>+ return ret;
> }
>-static void start_dac(struct i810_state *state)
>+static int start_dac(struct i810_state *state)
> {
>+ int ret;
> struct i810_card *card = state->card;
> unsigned long flags;
>
> spin_lock_irqsave(&card->lock, flags);
>- __start_dac(state);
>+ ret = __start_dac(state);
> spin_unlock_irqrestore(&card->lock, flags);
>+ return ret;
> }
>
> #define DMABUF_DEFAULTORDER (16-PAGE_SHIFT)
>@@ -936,7 +946,7 @@
> static void __i810_update_lvi(struct i810_state *state, int rec)
> {
> struct dmabuf *dmabuf = &state->dmabuf;
>- int x, port;
>+ int x, port, ok;
>
> port = state->card->iobase;
> if(rec)
>@@ -955,11 +965,12 @@
> if (!dmabuf->enable && dmabuf->trigger) {
> outb((inb(port+OFF_CIV)+1)&31, port+OFF_LVI);
> if(rec) {
>- __start_adc(state);
>+ ok = __start_adc(state);
> } else {
>- __start_dac(state);
>+ ok = __start_dac(state);
> }
>- while( !(inb(port + OFF_CR) & ((1<<4) | (1<<2))) ) ;
>+
>+ if (ok) while( !(inb(port + OFF_CR) & ((1<<4) | (1<<2))) ) ;
> }
>
> /* swptr - 1 is the tail of our transfer */
>
next prev parent reply other threads:[~2001-12-08 9:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-07 16:03 [PATCH] i810_audio fix for version 0.11 Andris Pavenis
2001-12-07 17:18 ` Nathan Bryant
2001-12-07 17:37 ` Andris Pavenis
2001-12-07 17:55 ` Doug Ledford
2001-12-07 18:36 ` Doug Ledford
2001-12-08 8:39 ` Andris Pavenis
2001-12-08 9:25 ` Andris Pavenis
2001-12-08 9:36 ` Doug Ledford [this message]
2001-12-08 9:45 ` Andris Pavenis
2001-12-11 0:42 ` Doug Ledford
2001-12-11 6:59 ` Andris Pavenis
2001-12-27 11:10 ` i810_audio driver version 0.13 still broken Andris Pavenis
2001-12-27 21:44 ` Nathan Bryant
2001-12-28 7:16 ` Andris Pavenis
2001-12-28 20:14 ` Nathan Bryant
2002-01-05 12:29 ` Andris Pavenis
2001-12-31 4:06 ` Nick Papadonis
-- strict thread matches above, loose matches on Subject: below --
2001-12-07 2:44 [PATCH] i810_audio fix for version 0.11 Nathan Bryant
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=3C11DF15.1020107@redhat.com \
--to=dledford@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nbryant@optonline.net \
--cc=pavenis@latnet.lv \
/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.