On 25/07/13(Thu) 01:15, Nathan Goings wrote:
> On 7/24/2013 6:11 PM, Artturi Alm wrote:
> >Hi,
> >
> >No //-comments, { on the same line as if/else, and else after }, but
> >since both have only one statement, no braces needed.
> >Same goes for the for-loops, I suggest reading style(9).
> >
> >
> >- Artturi
> Whoops, completely forgot.  This should be correct:
> 
> --- /home/nathan/scratch/rt2860.c    Wed Jul 24 15:26:24 2013
> +++ /usr/src/sys/dev/ic/rt2860.c    Thu Jul 25 01:10:57 2013

You might want to use "cvs diff" instead of keeping a copy, see cvs(1).

> @@ -199,6 +199,13 @@
>      RT3070_DEF_RF
>  };
> 
> +static const struct {
> +    uint8_t    reg;
> +    uint8_t    val;
> +}  rt3572_def_rf[] = {
> +    RT3572_DEF_RF
> +};

Fine, you can even reuse the ``rf'' struct, like it is done in
sys/dev/usb/if_run.c :)

> +
>  int
>  rt2860_attach(void *xsc, int id)
>  {
> @@ -2367,10 +2374,14 @@
>      RAL_WRITE(sc, RT3070_GPIO_SWITCH, tmp & ~0x20);
> 
>      /* initialize RF registers to default value */
> -    for (i = 0; i < nitems(rt3090_def_rf); i++) {
> -        rt3090_rf_write(sc, rt3090_def_rf[i].reg,
> -            rt3090_def_rf[i].val);
> -    }
> +    if (sc->mac_ver == 0x3572)
> +        for (i = 0; i < nitems(rt3572_def_rf); i++)
> +            rt3090_rf_write(sc, rt3572_def_rf[i].reg,
> +                rt3572_def_rf[i].val);
> +    else
> +        for (i = 0; i < nitems(rt3090_def_rf); i++)
> +            rt3090_rf_write(sc, rt3090_def_rf[i].reg,
> +                rt3090_def_rf[i].val);

Look fine to me, I would also add some "{" and "}" to not diverge too
much from run_rt3070_rf_init(), you may also want to check for any
other setup specific to your mac version.

M.

Reply via email to