Print this page
10886 smatch debug macro cleanup in usr/src/uts


   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  *


  25  * The "bscbus" driver provides access to the LOMlite2 virtual registers,
  26  * so that its clients (children) need not be concerned with the details
  27  * of the access mechanism, which in this case is implemented via a
  28  * packet-based protocol over a Xbus (similar to ebus) parallel link to the
  29  * H8 host interface registers.
  30  *
  31  * On the other hand, this driver doesn't generally know what the virtual
  32  * registers signify - only the clients need this information.
  33  */
  34 
  35 
  36 #include <sys/note.h>
  37 #include <sys/types.h>
  38 #include <sys/conf.h>
  39 #include <sys/debug.h>
  40 #include <sys/errno.h>
  41 #include <sys/file.h>
  42 
  43 #if defined(__sparc)
  44 #include <sys/intr.h>


 387         char buf[256];
 388         char *p;
 389         va_list va;
 390 
 391         if (csp->ssp->debug & (1 << (code-'@'))) {
 392                 p = buf;
 393                 (void) snprintf(p, sizeof (buf) - (p - buf),
 394                     "%s/%s: ", MYNAME, caller);
 395                 p += strlen(p);
 396 
 397                 va_start(va, fmt);
 398                 (void) vsnprintf(p, sizeof (buf) - (p - buf), fmt, va);
 399                 va_end(va);
 400 
 401                 buf[sizeof (buf) - 1] = '\0';
 402                 (void) strlog(csp->ssp->majornum, csp->ssp->instance,
 403                     code, SL_TRACE, buf);
 404         }
 405 }
 406 #else /* DEBUG */
 407 #define bscbus_trace
 408 #endif /* DEBUG */
 409 
 410 static struct bscbus_state *
 411 bscbus_getstate(dev_info_t *dip, int instance, const char *caller)
 412 {
 413         struct bscbus_state *ssp = NULL;
 414         dev_info_t *sdip = NULL;
 415         major_t dmaj = NOMAJOR;
 416 
 417         if (dip != NULL) {
 418                 /*
 419                  * Use the instance number from the <dip>; also,
 420                  * check that it really corresponds to this driver
 421                  */
 422                 instance = ddi_get_instance(dip);
 423                 dmaj = ddi_driver_major(dip);
 424                 if (bscbus_major == NOMAJOR && dmaj != NOMAJOR)
 425                         bscbus_major = dmaj;
 426                 else if (dmaj != bscbus_major) {
 427                         cmn_err(CE_WARN,




   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  *
  25  * Copyright 2019 Joyent, Inc.
  26  *
  27  * The "bscbus" driver provides access to the LOMlite2 virtual registers,
  28  * so that its clients (children) need not be concerned with the details
  29  * of the access mechanism, which in this case is implemented via a
  30  * packet-based protocol over a Xbus (similar to ebus) parallel link to the
  31  * H8 host interface registers.
  32  *
  33  * On the other hand, this driver doesn't generally know what the virtual
  34  * registers signify - only the clients need this information.
  35  */
  36 
  37 
  38 #include <sys/note.h>
  39 #include <sys/types.h>
  40 #include <sys/conf.h>
  41 #include <sys/debug.h>
  42 #include <sys/errno.h>
  43 #include <sys/file.h>
  44 
  45 #if defined(__sparc)
  46 #include <sys/intr.h>


 389         char buf[256];
 390         char *p;
 391         va_list va;
 392 
 393         if (csp->ssp->debug & (1 << (code-'@'))) {
 394                 p = buf;
 395                 (void) snprintf(p, sizeof (buf) - (p - buf),
 396                     "%s/%s: ", MYNAME, caller);
 397                 p += strlen(p);
 398 
 399                 va_start(va, fmt);
 400                 (void) vsnprintf(p, sizeof (buf) - (p - buf), fmt, va);
 401                 va_end(va);
 402 
 403                 buf[sizeof (buf) - 1] = '\0';
 404                 (void) strlog(csp->ssp->majornum, csp->ssp->instance,
 405                     code, SL_TRACE, buf);
 406         }
 407 }
 408 #else /* DEBUG */
 409 #define bscbus_trace(...) (void)(0)
 410 #endif /* DEBUG */
 411 
 412 static struct bscbus_state *
 413 bscbus_getstate(dev_info_t *dip, int instance, const char *caller)
 414 {
 415         struct bscbus_state *ssp = NULL;
 416         dev_info_t *sdip = NULL;
 417         major_t dmaj = NOMAJOR;
 418 
 419         if (dip != NULL) {
 420                 /*
 421                  * Use the instance number from the <dip>; also,
 422                  * check that it really corresponds to this driver
 423                  */
 424                 instance = ddi_get_instance(dip);
 425                 dmaj = ddi_driver_major(dip);
 426                 if (bscbus_major == NOMAJOR && dmaj != NOMAJOR)
 427                         bscbus_major = dmaj;
 428                 else if (dmaj != bscbus_major) {
 429                         cmn_err(CE_WARN,