Print this page
5256 document some nonsensical code in the px driver

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/sun4/io/px/px_debug.c
          +++ new/usr/src/uts/sun4/io/px/px_debug.c
↓ open down ↓ 247 lines elided ↑ open up ↑
 248  248  #endif  /* DEBUG */
 249  249  
 250  250  void
 251  251  px_dbg_attach(dev_info_t *dip, ddi_softint_handle_t *dbg_hdl)
 252  252  {
 253  253  #ifdef  DEBUG
 254  254          if (px_dbg_reference++ == 0) {
 255  255                  int size = px_dbg_msg_size;
 256  256  
 257  257                  /* Check if px_dbg_msg_size is ^2 */
      258 +                /*
      259 +                 * WARNING: The bellow statement makes no sense.  If size is
      260 +                 * not a power of 2, it will set size to zero.
      261 +                 */
 258  262                  size = !ISP2(size) ? ((size | ~size) + 1) : size;
 259  263                  px_dbg_msg_size = size;
 260  264                  px_dbg_qmask = size - 1;
 261  265                  px_dbg_msgq = kmem_zalloc(sizeof (px_dbg_msg_t) * size,
 262  266                      KM_SLEEP);
 263  267  
 264  268                  mutex_init(&px_dbg_mutex, NULL, MUTEX_DRIVER, NULL);
 265  269          }
 266  270  
 267  271          if (ddi_intr_add_softint(dip, dbg_hdl,
↓ open down ↓ 24 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX