> > > + case IIO_CHAN_INFO_FREQUENCY:
> > > +         switch (chan->channel) {
> > > +         case AD9910_CHANNEL_PROFILE_0 ... AD9910_CHANNEL_PROFILE_7:
> > > +                 tmp32 = chan->channel - AD9910_CHANNEL_PROFILE_0;
> > > +                 tmp64 = FIELD_GET(AD9910_PROFILE_ST_FTW_MSK,
> > > +                                   
> > > st->reg[AD9910_REG_PROFILE(tmp32)].val64);
> > > +                 break;
> > > +         default:
> > > +                 return -EINVAL;
> > > +         }
> > > +         tmp64 *= st->data.sysclk_freq_hz;
> > > +         *val = tmp64 >> 32;
> > > +         *val2 = ((tmp64 & GENMASK_ULL(31, 0)) * MICRO) >> 32;  
> > 
> > Why in this particular case have this outside the switch / case whereas in 
> > others
> > you do the full maths and set inside? I'd put it inside and not worry about 
> > slightly
> > long lines.  
> 
> for frequency, those calculations are going to be common for the other 
> channels that are
> going to be populated by other patches...
> 
> DRG up/down and RAM will have tmp64 populated with a FTW value.

Makes sense. Thanks,

Reply via email to