summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2001-03-20 18:10:19 +0000
committeriedowse <iedowse@FreeBSD.org>2001-03-20 18:10:19 +0000
commitebd6ae3e698b396be69e6680b62601a931178567 (patch)
treecf44e68ecc439a1c440acdcb28ffdc027c2ca153
parenta23a98f93775337b71a7091ec9f7ca246cb401fe (diff)
downloadFreeBSD-src-ebd6ae3e698b396be69e6680b62601a931178567.zip
FreeBSD-src-ebd6ae3e698b396be69e6680b62601a931178567.tar.gz
Place the call to pccard_insert_beep() in the inserted() timeout
routine instead of pccard_event(). This avoids spurious extra calls to pccard_insert_beep() at insert or remove time which could occur due to noise on the card-present lines. Clean up some code in pccard_beep.c; we were depending on the order of evaluation of function arguments, which is undefined in C. Also, use `0' rather than `NULL' for integer values. Reviewed by: sanpei, imp
-rw-r--r--sys/pccard/pccard.c2
-rw-r--r--sys/pccard/pccard_beep.c24
2 files changed, 13 insertions, 13 deletions
diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c
index 62f0f73..98a820e 100644
--- a/sys/pccard/pccard.c
+++ b/sys/pccard/pccard.c
@@ -293,6 +293,7 @@ inserted(void *arg)
slt->ctrl->power(slt);
printf("pccard: card inserted, slot %d\n", slt->slotnum);
+ pccard_insert_beep();
/*
* Now start resetting the card.
*/
@@ -325,7 +326,6 @@ pccard_event(struct slot *slt, enum card_event event)
case card_inserted:
slt->insert_seq = 1;
slt->insert_ch = timeout(inserted, (void *)slt, hz/4);
- pccard_insert_beep();
break;
}
}
diff --git a/sys/pccard/pccard_beep.c b/sys/pccard/pccard_beep.c
index 6336be9..ca4b2cb 100644
--- a/sys/pccard/pccard_beep.c
+++ b/sys/pccard/pccard_beep.c
@@ -26,30 +26,30 @@ struct tone {
static struct tone silent_beep[] = {
- {NULL, NULL}
+ {0, 0}
};
static struct tone success_beep[] = {
- {1200, 40}, {NULL, NULL}
+ {1200, 40}, {0, 0}
};
static struct tone failure_beep[] = {
- {3200, 40}, {NULL, NULL}
+ {3200, 40}, {0, 0}
};
static struct tone insert_remove_beep[] = {
- {1600, 20}, {NULL, NULL}
+ {1600, 20}, {0, 0}
};
static struct tone success_melody_beep[] = {
- {1200, 7}, {1000, 7}, { 800, 15}, {NULL, NULL}
+ {1200, 7}, {1000, 7}, { 800, 15}, {0, 0}
};
static struct tone failure_melody_beep[] = {
- {2000, 7}, {2400, 7}, {2800, 15}, {NULL, NULL}
+ {2000, 7}, {2400, 7}, {2800, 15}, {0, 0}
};
static struct tone insert_melody_beep[] = {
- {1600, 10}, {1200, 5}, {NULL, NULL}
+ {1600, 10}, {1200, 5}, {0, 0}
};
static struct tone remove_melody_beep[] = {
- {1200, 10}, {1600, 5}, {NULL, NULL}
+ {1200, 10}, {1600, 5}, {0, 0}
};
static struct tone *melody_table[MAX_TONE_MODE][MAX_STATE] = {
@@ -73,9 +73,9 @@ pccard_beep_sub(void *arg)
struct tone *melody;
melody = (struct tone *)arg;
- if (melody->pitch != NULL) {
+ if (melody->pitch != 0) {
sysbeep(melody->pitch, melody->duration);
- timeout(pccard_beep_sub, ++melody, melody->duration);
+ timeout(pccard_beep_sub, melody + 1, melody->duration);
} else
allow_beep = BEEP_ON;
}
@@ -86,10 +86,10 @@ pccard_beep_start(void *arg)
struct tone *melody;
melody = (struct tone *)arg;
- if (allow_beep == BEEP_ON && melody->pitch != NULL) {
+ if (allow_beep == BEEP_ON && melody->pitch != 0) {
allow_beep = BEEP_OFF;
sysbeep(melody->pitch, melody->duration);
- timeout(pccard_beep_sub, ++melody, melody->duration);
+ timeout(pccard_beep_sub, melody + 1, melody->duration);
}
}
OpenPOWER on IntegriCloud