All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel Marjamäki" <daniel.marjamaki@comhem.se>
To: kernel-janitors@vger.kernel.org
Subject: [KJ] polling in drivers/cdrom/aztcd.c
Date: Fri, 18 Nov 2005 11:57:18 +0000	[thread overview]
Message-ID: <437DC19E.70407@comhem.se> (raw)


Hello!

I saw this in version 2.6.14.1 of linux.
Does anybody have any input on this matter?

In the file there are several polling routines like the one below, and they are repeatedly called.
The loop will repeat 8 million times before it times out!
I suspect we can make huge improvements here. I'm having 3 improvements in mind:
1. Time out based on actual time rather than on repetitions.
2. Sleep between each repetition. How can I sleep say.. 10-50 us? Is it possible?
3. On time out, return an error code. The callers always assume that the polling succeeded!


static void pa_ok(void)
{
         aztTimeOutCount = 0;
         do {
                 aztIndatum = inb(DATA_PORT);
                 aztTimeOutCount++;
                 if (aztTimeOutCount >= AZT_TIMEOUT) {
                         printk("aztcd: Error Wait PA_OK\n");
                         break;
                 }
         } while (aztIndatum != AFL_PA_OK);
}


Best Regards,
Daniel Marjamäki


_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

             reply	other threads:[~2005-11-18 11:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-18 11:57 Daniel Marjamäki [this message]
2005-11-26 20:27 ` [KJ] polling in drivers/cdrom/aztcd.c Alexey Dobriyan

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=437DC19E.70407@comhem.se \
    --to=daniel.marjamaki@comhem.se \
    --cc=kernel-janitors@vger.kernel.org \
    /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.