polling in drivers/cdrom/aztcd.c
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
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 2 lines · Daniel Marjam?ki
I saw this in version 2.6.14.1 of linux.
Does anybody have any input on this matter?
Bzzrt... The thing was commented out 19 months ago.
# 2004/05/19 16:39:03-07:00 akpm
# [PATCH] drivers/cdrom/aztcd.c warning fix.
#
# From: "Luiz Fernando N. Capitulino"
#
# drivers/cdrom/azctd.c:379: warning: `pa_ok' defined but not used
Quoted 12 lines
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); }
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors