Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Cosmetic changes



details:   https://anonhg.NetBSD.org/src/rev/1b8ba752acc6
branches:  trunk
changeset: 555575:1b8ba752acc6
user:      kent <kent%NetBSD.org@localhost>
date:      Sat Nov 22 05:40:48 2003 +0000

description:
Cosmetic changes
 - ANSIfy
 - no argument names in prototypes
 - variable declaration with initialization

diffstat:

 sys/dev/ic/ac97.c |  218 +++++++++++++++++++++++++----------------------------
 1 files changed, 101 insertions(+), 117 deletions(-)

diffs (truncated from 445 to 300 lines):

diff -r 1f5e97d7a8bb -r 1b8ba752acc6 sys/dev/ic/ac97.c
--- a/sys/dev/ic/ac97.c Sat Nov 22 04:01:01 2003 +0000
+++ b/sys/dev/ic/ac97.c Sat Nov 22 05:40:48 2003 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: ac97.c,v 1.49 2003/09/28 22:24:09 cube Exp $ */
+/*      $NetBSD: ac97.c,v 1.50 2003/11/22 05:40:48 kent Exp $ */
 /*     $OpenBSD: ac97.c,v 1.8 2000/07/19 09:01:35 csapuntz Exp $       */
 
 /*
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.49 2003/09/28 22:24:09 cube Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.50 2003/11/22 05:40:48 kent Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -77,45 +77,64 @@
 #include <dev/ic/ac97reg.h>
 #include <dev/ic/ac97var.h>
 
+struct ac97_softc;
+struct ac97_source_info;
+int ac97_mixer_get_port(struct ac97_codec_if *, mixer_ctrl_t *);
+int ac97_mixer_set_port(struct ac97_codec_if *, mixer_ctrl_t *);
+int ac97_query_devinfo(struct ac97_codec_if *, mixer_devinfo_t *);
+int ac97_get_portnum_by_name(struct ac97_codec_if *, const char *,
+                            const char *, const char *);
+void ac97_restore_shadow(struct ac97_codec_if *);
+int ac97_set_rate(struct ac97_codec_if *, int, u_long *);
+void ac97_set_clock(struct ac97_codec_if *, unsigned int);
+u_int16_t ac97_get_extcaps(struct ac97_codec_if *);
+int ac97_add_port(struct ac97_softc *, const struct ac97_source_info *);
+int ac97_str_equal(const char *, const char *);
+int ac97_check_capability(struct ac97_softc *, int);
+void ac97_setup_source_info(struct ac97_softc *);
+void ac97_read(struct ac97_softc *, u_int8_t, u_int16_t *);
+void ac97_setup_defaults(struct ac97_softc *);
+int ac97_write(struct ac97_softc *, u_int8_t, u_int16_t);
+
+static void ac97_ad1980_init(struct ac97_softc *);
+static void ac97_alc650_init(struct ac97_softc *);
+static void ac97_vt1616_init(struct ac97_softc *);
+
 #define Ac97Ntone      "tone"
 #define Ac97Nphone     "phone"
 
-static const struct audio_mixer_enum ac97_on_off = { 2,
-                                              { { { AudioNoff } , 0 },
-                                                { { AudioNon }  , 1 } }};
+static const struct audio_mixer_enum
+ac97_on_off = { 2, { { { AudioNoff } , 0 },
+                    { { AudioNon }  , 1 } } };
 
-static const struct audio_mixer_enum ac97_mic_select = { 2,
-                                              { { { AudioNmicrophone "0" },
-                                                  0 },
-                                                { { AudioNmicrophone "1" },
-                                                  1 } }};
+static const struct audio_mixer_enum
+ac97_mic_select = { 2, { { { AudioNmicrophone "0" }, 0 },
+                        { { AudioNmicrophone "1" }, 1 } } };
 
-static const struct audio_mixer_enum ac97_mono_select = { 2,
-                                              { { { AudioNmixerout },
-                                                  0 },
-                                                { { AudioNmicrophone },
-                                                  1 } }};
+static const struct audio_mixer_enum
+ac97_mono_select = { 2, { { { AudioNmixerout }, 0 },
+                         { { AudioNmicrophone }, 1 } } };
 
-static const struct audio_mixer_enum ac97_source = { 8,
-                                              { { { AudioNmicrophone } , 0 },
-                                                { { AudioNcd }, 1 },
-                                                { { AudioNvideo }, 2 },
-                                                { { AudioNaux }, 3 },
-                                                { { AudioNline }, 4 },
-                                                { { AudioNmixerout }, 5 },
-                                                { { AudioNmixerout AudioNmono }, 6 },
-                                                { { Ac97Nphone }, 7 }}};
+static const struct audio_mixer_enum
+ac97_source = { 8, { { { AudioNmicrophone } , 0 },
+                    { { AudioNcd }, 1 },
+                    { { AudioNvideo }, 2 },
+                    { { AudioNaux }, 3 },
+                    { { AudioNline }, 4 },
+                    { { AudioNmixerout }, 5 },
+                    { { AudioNmixerout AudioNmono }, 6 },
+                    { { Ac97Nphone }, 7 } } };
 
 /*
  * Due to different values for each source that uses these structures,
  * the ac97_query_devinfo function sets delta in mixer_devinfo_t using
  * ac97_source_info.bits.
  */
-static const struct audio_mixer_value ac97_volume_stereo = { { AudioNvolume },
-                                                      2 };
+static const struct audio_mixer_value
+ac97_volume_stereo = { { AudioNvolume }, 2 };
 
-static const struct audio_mixer_value ac97_volume_mono = { { AudioNvolume },
-                                                    1 };
+static const struct audio_mixer_value
+ac97_volume_mono = { { AudioNvolume }, 1 };
 
 #define WRAP(a)  &a, sizeof(a)
 
@@ -313,21 +332,6 @@
        u_int16_t shadow_reg[128];
 };
 
-int ac97_mixer_get_port __P((struct ac97_codec_if *self, mixer_ctrl_t *cp));
-int ac97_mixer_set_port __P((struct ac97_codec_if *self, mixer_ctrl_t *));
-int ac97_query_devinfo __P((struct ac97_codec_if *self, mixer_devinfo_t *));
-int ac97_get_portnum_by_name __P((struct ac97_codec_if *, const char *,
-                                 const char *, const char *));
-void ac97_restore_shadow __P((struct ac97_codec_if *self));
-int ac97_set_rate(struct ac97_codec_if *codec_if, int target, u_long *rate);
-void ac97_set_clock(struct ac97_codec_if *codec_if, unsigned int clock);
-u_int16_t ac97_get_extcaps(struct ac97_codec_if *codec_if);
-int ac97_add_port(struct ac97_softc *as, const struct ac97_source_info *src);
-
-static void ac97_ad1980_init(struct ac97_softc *);
-static void ac97_alc650_init(struct ac97_softc *);
-static void ac97_vt1616_init(struct ac97_softc *);
-
 struct ac97_codec_if_vtbl ac97civ = {
        ac97_mixer_get_port,
        ac97_mixer_set_port,
@@ -641,13 +645,6 @@
 };
 
 
-int ac97_str_equal __P((const char *, const char *));
-int ac97_check_capability(struct ac97_softc *, int);
-void ac97_setup_source_info __P((struct ac97_softc *));
-void ac97_read __P((struct ac97_softc *, u_int8_t, u_int16_t *));
-void ac97_setup_defaults __P((struct ac97_softc *));
-int ac97_write __P((struct ac97_softc *, u_int8_t, u_int16_t));
-
 /* #define AC97_DEBUG 10 */
 
 #ifdef AUDIO_DEBUG
@@ -664,12 +661,8 @@
 #endif
 
 void
-ac97_read(as, reg, val)
-       struct ac97_softc *as;
-       u_int8_t reg;
-       u_int16_t *val;
+ac97_read(struct ac97_softc *as, u_int8_t reg, u_int16_t *val)
 {
-
        if (as->host_flags & AC97_HOST_DONT_READ &&
            (reg != AC97_REG_VENDOR_ID1 && reg != AC97_REG_VENDOR_ID2 &&
             reg != AC97_REG_RESET)) {
@@ -683,20 +676,14 @@
 }
 
 int
-ac97_write(as, reg, val)
-       struct ac97_softc *as;
-       u_int8_t reg;
-       u_int16_t val;
+ac97_write(struct ac97_softc *as, u_int8_t reg, u_int16_t val)
 {
-
        as->shadow_reg[reg >> 1] = val;
-
-       return (as->host_if->write(as->host_if->arg, reg, val));
+       return as->host_if->write(as->host_if->arg, reg, val);
 }
 
 void
-ac97_setup_defaults(as)
-       struct ac97_softc *as;
+ac97_setup_defaults(struct ac97_softc *as)
 {
        int idx;
        const struct ac97_source_info *si;
@@ -710,13 +697,13 @@
 }
 
 void
-ac97_restore_shadow(self)
-       struct ac97_codec_if *self;
+ac97_restore_shadow(struct ac97_codec_if *self)
 {
-       struct ac97_softc *as = (struct ac97_softc *) self;
+       struct ac97_softc *as;
+       const struct ac97_source_info *si;
        int idx;
-       const struct ac97_source_info *si;
 
+       as = (struct ac97_softc *) self;
        for (idx = 0; idx < SOURCE_INFO_SIZE; idx++) {
                si = &source_info[idx];
                ac97_write(as, si->reg, as->shadow_reg[si->reg >> 1]);
@@ -732,10 +719,9 @@
 }
 
 int
-ac97_str_equal(a, b)
-       const char *a, *b;
+ac97_str_equal(const char *a, const char *b)
 {
-       return ((a == b) || (a && b && (!strcmp(a, b))));
+       return (a == b) || (a && b && (!strcmp(a, b)));
 }
 
 int
@@ -767,8 +753,7 @@
 }
 
 void
-ac97_setup_source_info(as)
-       struct ac97_softc *as;
+ac97_setup_source_info(struct ac97_softc *as)
 {
        int idx, ouridx;
        struct ac97_source_info *si, *si2;
@@ -865,11 +850,10 @@
 }
 
 int
-ac97_attach(host_if)
-       struct ac97_host_if *host_if;
+ac97_attach(struct ac97_host_if *host_if)
 {
        struct ac97_softc *as;
-       struct device *sc_dev = (struct device *)host_if->arg;
+       struct device *sc_dev;
        int error, i, j;
        u_int32_t id;
        u_int16_t id1, id2;
@@ -879,18 +863,19 @@
 #define FLAGBUFLEN     140
        char flagbuf[FLAGBUFLEN];
 
+       sc_dev = (struct device *)host_if->arg;
        initfunc = NULL;
        as = malloc(sizeof(struct ac97_softc), M_DEVBUF, M_WAITOK|M_ZERO);
 
        if (as == NULL)
-               return (ENOMEM);
+               return ENOMEM;
 
        as->codec_if.vtbl = &ac97civ;
        as->host_if = host_if;
 
        if ((error = host_if->attach(host_if->arg, &as->codec_if))) {
                free(as, M_DEVBUF);
-               return (error);
+               return error;
        }
 
        host_if->reset(host_if->arg);
@@ -936,7 +921,7 @@
        aprint_normal(" codec; ");
        for (i = j = 0; i < 10; i++) {
                if (as->caps & (1 << i)) {
-                       aprint_normal("%s%s", j? ", " : "", ac97feature[i]);
+                       aprint_normal("%s%s", j ? ", " : "", ac97feature[i]);
                        j++;
                }
        }
@@ -1064,21 +1049,20 @@
 
        if (initfunc != NULL)
                initfunc(as);
-       return (0);
+       return 0;
 }
 
 
 int
-ac97_query_devinfo(codec_if, dip)
-       struct ac97_codec_if *codec_if;
-       mixer_devinfo_t *dip;
+ac97_query_devinfo(struct ac97_codec_if *codec_if, mixer_devinfo_t *dip)
 {
-       struct ac97_softc *as = (struct ac97_softc *)codec_if;
+       struct ac97_softc *as;
+       struct ac97_source_info *si;
+       const char *name;
 
+       as = (struct ac97_softc *)codec_if;
        if (dip->index < as->num_source_info) {
-               struct ac97_source_info *si = &as->source_info[dip->index];
-               const char *name;
-
+               si = &as->source_info[dip->index];
                dip->type = si->type;
                dip->mixer_class = si->mixer_class;
                dip->prev = si->prev;
@@ -1102,30 +1086,30 @@
                if (dip->type == AUDIO_MIXER_VALUE)



Home | Main Index | Thread Index | Old Index