NetBSD-Bugs archive

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

Re: kern/45634: hardclock_ticks corner cases in vflushnext() et al



The following reply was made to PR kern/45634; it has been noted by GNATS.

From: Christian Biere <christianbiere%gmx.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/45634: hardclock_ticks corner cases in vflushnext() et al
Date: Thu, 24 Nov 2011 21:33:07 +0100

 This is a multi-part message in MIME format.
 
 --Multipart=_Thu__24_Nov_2011_21_33_07_+0100_r7SGJGTvBRSv2ifH
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: 7bit
 
 The attached patch should fix a related issue in sys/dev/i2c/ibmhawk.c.
 
 
 --Multipart=_Thu__24_Nov_2011_21_33_07_+0100_r7SGJGTvBRSv2ifH
 Content-Type: text/x-diff;
  name="ibmhawk.c.diff"
 Content-Disposition: attachment;
  filename="ibmhawk.c.diff"
 Content-Transfer-Encoding: 7bit
 
 --- ibmhawk.c.orig     2011-11-24 21:08:37.230962151 +0100
 +++ ibmhawk.c  2011-11-24 21:26:09.240962777 +0100
 @@ -48,6 +48,9 @@
  #endif
  #endif
  
 +/* No more than two refreshes per second. */
 +#define IBMHAWK_REFRESH_DELAY (hz / 2U)
 +
  /*
   * Known sensors.
   */
 @@ -117,6 +120,7 @@ ibmhawk_attach(device_t parent, device_t
        sc->sc_dev = self;
        sc->sc_tag = ia->ia_tag;
        sc->sc_addr = ia->ia_addr;
 +      sc->sc_refresh = hardclock_ticks - IBMHAWK_REFRESH_DELAY;
  
        if (!pmf_device_register(self, NULL, NULL))
                aprint_error_dev(self, "couldn't establish power handler\n");
 @@ -357,12 +361,11 @@ ibmhawk_refresh(struct sysmon_envsys *sm
  {
        struct ibmhawk_softc *sc = sme->sme_cookie;
  
 -      /* No more than two refreshes per second. */
 -      if (hardclock_ticks-sc->sc_refresh < hz/2)
 +      if (hardclock_ticks - sc->sc_refresh + 0U < IBMHAWK_REFRESH_DELAY)
                return;
  #if IBMHAWK_DEBUG > 1
 -      aprint_normal_dev(sc->sc_dev, "refresh \"%s\" delta %d\n",
 -          edata->desc, hardclock_ticks-sc->sc_refresh);
 +      aprint_normal_dev(sc->sc_dev, "refresh \"%s\" delta %u\n",
 +          edata->desc, hardclock_ticks - sc->sc_refresh + 0U);
  #endif
        sc->sc_refresh = hardclock_ticks;
        ibmhawk_refreshall(sc, false);
 
 --Multipart=_Thu__24_Nov_2011_21_33_07_+0100_r7SGJGTvBRSv2ifH--
 


Home | Main Index | Thread Index | Old Index