Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src localcount_init() can't fail because percpu_alloc() can't fail.
details: https://anonhg.NetBSD.org/src/rev/45d7da299c8a
branches: trunk
changeset: 354030:45d7da299c8a
user: chs <chs%NetBSD.org@localhost>
date: Fri Jun 02 00:32:12 2017 +0000
description:
localcount_init() can't fail because percpu_alloc() can't fail.
remove the check and change the return type to void.
diffstat:
share/man/man9/localcount.9 | 6 +++---
sys/kern/subr_localcount.c | 10 +++-------
sys/sys/localcount.h | 4 ++--
3 files changed, 8 insertions(+), 12 deletions(-)
diffs (81 lines):
diff -r a9ed20c834f0 -r 45d7da299c8a share/man/man9/localcount.9
--- a/share/man/man9/localcount.9 Fri Jun 02 00:16:27 2017 +0000
+++ b/share/man/man9/localcount.9 Fri Jun 02 00:32:12 2017 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: localcount.9,v 1.5 2017/05/19 11:12:50 pgoyette Exp $
+.\" $NetBSD: localcount.9,v 1.6 2017/06/02 00:32:12 chs Exp $
.\"
.\" Copyright (c) 2016 The NetBSD Foundation
.\" All rights reserved.
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd May 19, 2017
+.Dd June 1, 2017
.Dt LOCALCOUNT 9
.Os
.Sh NAME
@@ -40,7 +40,7 @@
.Nd reference-count primitives
.Sh SYNOPSIS
.In sys/localcount.h
-.Ft int
+.Ft void
.Fn localcount_init "struct localcount *lc"
.Ft void
.Fn localcount_fini "struct localcount *lc"
diff -r a9ed20c834f0 -r 45d7da299c8a sys/kern/subr_localcount.c
--- a/sys/kern/subr_localcount.c Fri Jun 02 00:16:27 2017 +0000
+++ b/sys/kern/subr_localcount.c Fri Jun 02 00:32:12 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_localcount.c,v 1.3 2017/05/19 02:20:24 pgoyette Exp $ */
+/* $NetBSD: subr_localcount.c,v 1.4 2017/06/02 00:32:12 chs Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_localcount.c,v 1.3 2017/05/19 02:20:24 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_localcount.c,v 1.4 2017/06/02 00:32:12 chs Exp $");
#include <sys/param.h>
#include <sys/localcount.h>
@@ -66,16 +66,12 @@
*/
static void localcount_xc(void *, void *);
-int
+void
localcount_init(struct localcount *lc)
{
lc->lc_totalp = NULL;
lc->lc_percpu = percpu_alloc(sizeof(int64_t));
- if (lc->lc_percpu == NULL)
- return ENOMEM;
-
- return 0;
}
/*
diff -r a9ed20c834f0 -r 45d7da299c8a sys/sys/localcount.h
--- a/sys/sys/localcount.h Fri Jun 02 00:16:27 2017 +0000
+++ b/sys/sys/localcount.h Fri Jun 02 00:32:12 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: localcount.h,v 1.3 2017/05/19 11:45:40 pgoyette Exp $ */
+/* $NetBSD: localcount.h,v 1.4 2017/06/02 00:32:12 chs Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
struct percpu *lc_percpu; /* int64_t */
};
-int localcount_init(struct localcount *);
+void localcount_init(struct localcount *);
void localcount_drain(struct localcount *, struct kcondvar *,
struct kmutex *);
void localcount_fini(struct localcount *);
Home |
Main Index |
Thread Index |
Old Index