summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/man/man9f/ddi_ffs.9f169
-rw-r--r--usr/src/uts/common/io/ppm/ppm_subr.c13
2 files changed, 70 insertions, 112 deletions
diff --git a/usr/src/man/man9f/ddi_ffs.9f b/usr/src/man/man9f/ddi_ffs.9f
index 1baa029aa6..3c9172edc9 100644
--- a/usr/src/man/man9f/ddi_ffs.9f
+++ b/usr/src/man/man9f/ddi_ffs.9f
@@ -1,110 +1,65 @@
+'\" te
.\" Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
-.\" Copyright 2019 Joyent, Inc.
-.\"
-.\" The contents of this file are subject to the terms of the
-.\" Common Development and Distribution License (the "License").
-.\" You may not use this file except in compliance with the License.
-.\"
-.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-.\" or http://www.opensolaris.org/os/licensing.
-.\" See the License for the specific language governing permissions
-.\" and limitations under the License.
-.\"
-.\" When distributing Covered Code, include this CDDL HEADER in each
-.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-.\" If applicable, add the following below this CDDL HEADER, with the
-.\" fields enclosed by brackets "[]" replaced with your own identifying
-.\" information: Portions Copyright [yyyy] [name of copyright owner]
-.\"
-.Dd December 21, 2019
-.Dt DDI_FFS 9F
-.Os
-.Sh NAME
-.Nm ddi_ffs, ddi_ffsll, ddi_fls, ddi_flsll
-.Nd find first (last) bit set in a long (long) integer
-.Sh SYNOPSIS
-.In sys/conf.h
-.In sys/ddi.h
-.In sys/sunddi.h
-.Ft int
-.Fo "ddi_ffs"
-.Fa "long mask"
-.Fc
-.Ft int
-.Fo "ddi_fls"
-.Fa "long mask"
-.Fc
-.Ft int
-.Fo "ddi_ffsll"
-.Fa "long long mask"
-.Fc
-.Ft int
-.Fo "ddi_flsll"
-.Fa "long long mask"
-.Fc
-.Sh INTERFACE LEVEL
+.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
+.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
+.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
+.TH DDI_FFS 9F "Jan 16, 2021"
+.SH NAME
+ddi_ffs, ddi_fls \- find first (last) bit set in a long integer
+.SH SYNOPSIS
+.nf
+#include <sys/conf.h>
+#include <sys/ddi.h>
+#include <sys/sunddi.h>
+
+
+
+\fBint\fR \fBddi_ffs\fR(\fBlong\fR \fImask\fR);
+.fi
+
+.LP
+.nf
+\fBint\fR \fBddi_fls\fR(\fBlong\fR \fImask\fR);
+.fi
+
+.SH INTERFACE LEVEL
Solaris DDI specific (Solaris DDI).
-.Sh PARAMETERS
-.Bl -tag -width Va
-.It Fa mask
-A 32-bit or 64-bit argument value to search through.
-.El
-.Sh DESCRIPTION
-The functions
-.Fn ddi_ffs
-and
-.Fn ddi_ffsll
-take their argument and return the shift count that the first (least
-significant) bit set in the argument corresponds to.
-The functions
-.Fn ddi_fls
-and
-.Fn ddi_flsll
-do the same, only they returns the shift count for the last (most
-significant) bit set in the argument.
-.Fn ddi_ffs
-and
-.Fn ddi_fls
-operate on 32-bit values, while
-.Fn ddi_ffsll
-and
-.Fn ddi_flsll
-operate on 64-bit values.
-.Sh CONTEXT
-These functions can be called from user, interrupt, or kernel context.
-.Sh RETURN VALUES
-.Bl -tag -width Va
-.It 0
+.SH PARAMETERS
+.ne 2
+.na
+\fB\fImask\fR\fR
+.ad
+.RS 8n
+A 64-bit argument value to search through.
+.RE
+
+.SH DESCRIPTION
+The function \fBddi_ffs()\fR takes its argument and returns the shift count
+that the first (least significant) bit set in the argument corresponds to. The
+function \fBddi_fls()\fR does the same, only it returns the shift count for the
+last (most significant) bit set in the argument.
+.SH RETURN VALUES
+.ne 2
+.na
+\fB\fB0\fR\fR
+.ad
+.RS 5n
No bits are set in mask.
-.It N
-Bit
-.Em N
-is the least significant
-.Po
-.Fn ddi_ffs ,
-.Fn ddi_ffsll
-.Pc
-or most significant
-.Po
-.Fn ddi_fls ,
-.Fn ddi_flsll
-.Pc
-bit set in
-.Fa mask .
-Bits are numbered from
-.Em 1
-to
-.Em 32
-or
-.Em 64 ,
-with bit
-.Em 1
-being the least significant bit position and bit
-.Em 32
-or
-.Em 64
-the most significant position, depending on the variant of the
-functions used.
-.El
-.Sh SEE ALSO
-.%T Writing Device Drivers
+.RE
+
+.sp
+.ne 2
+.na
+\fB\fIN\fR\fR
+.ad
+.RS 5n
+Bit \fIN\fR is the least significant (\fBddi_ffs\fR) or most significant
+(\fBddi_fls\fR) bit set in mask. Bits are numbered from \fB1\fR to \fB64\fR,
+with bit \fB1\fR being the least significant bit position and bit \fB64\fR the
+most significant position.
+.RE
+
+.SH CONTEXT
+This function can be called from user, interrupt, or kernel context.
+.SH SEE ALSO
+\fIWriting Device Drivers\fR
diff --git a/usr/src/uts/common/io/ppm/ppm_subr.c b/usr/src/uts/common/io/ppm/ppm_subr.c
index d0e3c5788c..af19c622ce 100644
--- a/usr/src/uts/common/io/ppm/ppm_subr.c
+++ b/usr/src/uts/common/io/ppm/ppm_subr.c
@@ -831,7 +831,7 @@ ppm_init_cb(dev_info_t *dip)
int
ppm_init_lyr(ppm_dc_t *dc, dev_info_t *dip)
{
- char *str = "ppm_init_lyr";
+ char *str = "ppm_init_lyr";
int err = 0;
ldi_ident_t li;
@@ -994,8 +994,10 @@ ppm_stoi(char *ss, uint_t *val)
int hex_ = 0, base = D_BASE;
int digit;
- if ((cp = strchr(ss, '=')) == NULL)
- return (*val = (uint_t)-1);
+ if ((cp = strchr(ss, '=')) == NULL) {
+ *val = UINT_MAX;
+ return (-1);
+ }
cp++;
if ((*cp == '0') && (*++cp == 'x')) {
@@ -1064,10 +1066,11 @@ ppm_convert(char *symbol, uint_t *val)
char *s;
struct ppm_confdefs *pcfp;
+ *val = UINT_MAX;
if ((s = strchr(symbol, '=')) == NULL) {
cmn_err(CE_WARN, "ppm_convert: token \"%s\" syntax error in "
"ppm.conf file", symbol);
- return (*val = (uint_t)-1);
+ return (-1);
}
s++;
@@ -1078,7 +1081,7 @@ ppm_convert(char *symbol, uint_t *val)
cmn_err(CE_WARN, "ppm_convert: Unrecognizable token \"%s\" "
"in ppm.conf file", symbol);
- return (*val = (uint_t)-1);
+ return (-1);
}