lkml.org 
[lkml]   [2008]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH 4/5] ntp.c code flow clenaups (from Ingo)
    Date
    Hi John,

    On Saturday 15 March 2008, john stultz wrote:
    > Index: linux-2.6/kernel/time/ntp.c
    > ===================================================================
    > --- linux-2.6.orig/kernel/time/ntp.c 2008-03-14 20:10:41.000000000 -0700
    > +++ linux-2.6/kernel/time/ntp.c 2008-03-14 20:43:48.000000000 -0700
    > @@ -275,6 +275,87 @@ static void notify_cmos_timer(void)
    > static inline void notify_cmos_timer(void) { }
    > #endif
    >
    > +static inline void process_adjtimex_adj_offset(struct timex *txc, long sec)
    > +{
    > + if (txc->modes & ADJ_STATUS) {
    > + if ((time_status & STA_PLL) && !(txc->status & STA_PLL)) {
    > + time_state = TIME_OK;
    > + time_status = STA_UNSYNC;
    > + }
    > + /* only set allowed bits */
    > + time_status &= STA_RONLY;
    > + time_status |= txc->status & ~STA_RONLY;
    > +
    > + switch (time_state) {
    > + case TIME_OK:
    > + start_timer:
    > + if (time_status & STA_INS) {
    > + time_state = TIME_INS;
    > + sec += 86400 - sec % 86400;
    > + hrtimer_start(&leap_timer, ktime_set(sec, 0), HRTIMER_MODE_ABS);
    > + } else if (time_status & STA_DEL) {
    > + time_state = TIME_DEL;
    > + sec += 86400 - (sec + 1) % 86400;
    > + hrtimer_start(&leap_timer, ktime_set(sec, 0), HRTIMER_MODE_ABS);
    > + }
    > + break;
    > + case TIME_INS:
    > + case TIME_DEL:
    > + time_state = TIME_OK;
    > + goto start_timer;
    > + break;

    I don't understand, why the goto is required here.

    If you move these two cases in front of case "TIME_OK" and
    omit the break, you can remove the goto and the label "start_timer".
    Don't forget the /* fall through */ comment then.

    If you want to keep this patch a simple code movement,
    maybe add a later patch to improve this on top of it.


    Best Regards

    Ingo Oeser


    \
     
     \ /
      Last update: 2008-03-15 13:43    [W:0.025 / U:2.496 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site