Re: [PATCH net-next v2 2/9] net: ethernet: oa_tc6: implement mac-phy software reset

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

 



> >> +     ret = oa_tc6_perform_ctrl(tc6, STATUS0, &regval, 1, false, false);
> >> +     if (ret)
> >> +             return ret;
> >> +
> >> +     /* Check for reset complete interrupt status */
> >> +     if (regval & RESETC) {
> >> +             regval = RESETC;
> > 
> > People don't always agree, but i found STATUS0_RESETC easier to see
> > you have the correct bit for the register you just read.
> Do you want me to define STATUS0_RESETC instead of RESETC or is my 
> understanding wrong?

Correct, STATUS0_RESETC. It avoids silly typos like:

     ret = oa_tc6_perform_ctrl(tc6, STATUS0, &regval, 1, false, false);
     if (ret)
             return ret;

     /* Check for reset complete interrupt status */
     if (regval & RESET) {
             regval = RESETC;

where RESET is a valid register name, but not a bit. Or say:

     ret = oa_tc6_perform_ctrl(tc6, STATUS0, &regval, 1, false, false);
     if (ret)
             return ret;

     /* Check for reset complete interrupt status */
     if (regval & SWRESET) {
             regval = STATUS0_;

where SWRESET is a valid bit, but not for STATUS0.

I've made silly mistakes like this, and learnt that good naming helps
to avoid it.

     Andrew




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux