Diff for /src/sys/dev/misc/psm/psm.c between versions 1.10 and 1.11

version 1.10, 2004/05/13 23:49:17 version 1.11, 2004/05/19 22:52:44
Line 130 Line 130
 /* some macros */  /* some macros */
 #define PSM_UNIT(dev)           (minor(dev) >> 1)  #define PSM_UNIT(dev)           (minor(dev) >> 1)
 #define PSM_NBLOCKIO(dev)       (minor(dev) & 1)  #define PSM_NBLOCKIO(dev)       (minor(dev) & 1)
#define PSM_MKMINOR(unit,block) (((unit) << 1) | ((block) ? 0:1))#define PSM_MKMINOR(unit,block) ((((unit) & 0xff) << 1) | ((block) ? 0:1))
   
 #ifndef max  #ifndef max
 #define max(x,y)                ((x) > (y) ? (x) : (y))  #define max(x,y)                ((x) > (y) ? (x) : (y))
Line 173  struct psm_softc {  /* Driver status inf Line 173  struct psm_softc {  /* Driver status inf
     struct timeval inputtimeout;      struct timeval inputtimeout;
     int           watchdog;     /* watchdog timer flag */      int           watchdog;     /* watchdog timer flag */
     struct callout_handle callout;      /* watchdog timer call out */      struct callout_handle callout;      /* watchdog timer call out */
     dev_t         dev;  
     dev_t         bdev;  
 };  };
 devclass_t psm_devclass;  devclass_t psm_devclass;
 #define PSM_SOFTC(unit) ((struct psm_softc*)devclass_get_softc(psm_devclass, unit))  #define PSM_SOFTC(unit) ((struct psm_softc*)devclass_get_softc(psm_devclass, unit))
Line 1250  psmattach(device_t dev) Line 1248  psmattach(device_t dev)
     }      }
   
     /* Done */      /* Done */
    sc->dev = make_dev(&psm_cdevsw, PSM_MKMINOR(unit, FALSE), 0, 0, 0666,    cdevsw_add(&psm_cdevsw, PSM_MKMINOR(-1, 0), PSM_MKMINOR(unit, 0));
                       "psm%d", unit);    make_dev(&psm_cdevsw, PSM_MKMINOR(unit, FALSE), 0, 0, 0666, "psm%d", unit);
    sc->bdev = make_dev(&psm_cdevsw, PSM_MKMINOR(unit, TRUE), 0, 0, 0666,    make_dev(&psm_cdevsw, PSM_MKMINOR(unit, TRUE), 0, 0, 0666, "bpsm%d", unit);
                        "bpsm%d", unit); 
   
     if (!verbose) {      if (!verbose) {
         printf("psm%d: model %s, device ID %d\n",           printf("psm%d: model %s, device ID %d\n", 
Line 1279  psmdetach(device_t dev) Line 1276  psmdetach(device_t dev)
 {  {
     struct psm_softc *sc;      struct psm_softc *sc;
     int rid;      int rid;
       int unit;
   
     sc = device_get_softc(dev);      sc = device_get_softc(dev);
     if (sc->state & PSM_OPEN)      if (sc->state & PSM_OPEN)
         return EBUSY;          return EBUSY;
   
       unit = device_get_unit(dev);
   
     rid = 0;      rid = 0;
     BUS_TEARDOWN_INTR(device_get_parent(dev), dev, sc->intr, sc->ih);      BUS_TEARDOWN_INTR(device_get_parent(dev), dev, sc->intr, sc->ih);
     bus_release_resource(dev, SYS_RES_IRQ, rid, sc->intr);      bus_release_resource(dev, SYS_RES_IRQ, rid, sc->intr);
    cdevsw_remove(&psm_cdevsw, PSM_MKMINOR(-1, 0), PSM_MKMINOR(unit, 0));
    destroy_dev(sc->dev); 
    destroy_dev(sc->bdev); 
   
     return 0;      return 0;
 }  }

Removed from v.1.10  
changed lines
  Added in v.1.11