Remove a use of lockmgr/LOCK_INITIALIZER.

This commit is contained in:
ad 2007-03-11 22:16:32 +00:00
parent 2dc89bb0bd
commit 5941740892
3 changed files with 15 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: icp.c,v 1.23 2007/03/04 06:01:56 christos Exp $ */
/* $NetBSD: icp.c,v 1.24 2007/03/11 22:16:32 ad Exp $ */
/*-
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@ -83,7 +83,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: icp.c,v 1.23 2007/03/04 06:01:56 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: icp.c,v 1.24 2007/03/11 22:16:32 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -416,7 +416,8 @@ icp_init(struct icp_softc *icp, const char *intrstr)
/*
* Count the controller, and we're done!
*/
icp_count++;
if (icp_count++ == 0)
mutex_init(&icp_ioctl_mutex, MUTEX_DEFAULT, IPL_NONE);
return (0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: icp_ioctl.c,v 1.15 2007/03/04 06:01:56 christos Exp $ */
/* $NetBSD: icp_ioctl.c,v 1.16 2007/03/11 22:16:32 ad Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: icp_ioctl.c,v 1.15 2007/03/04 06:01:56 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: icp_ioctl.c,v 1.16 2007/03/11 22:16:32 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -106,8 +106,7 @@ const struct cdevsw icp_cdevsw = {
extern struct cfdriver icp_cd;
static struct lock icp_ioctl_mutex =
LOCK_INITIALIZER(PRIBIO|PCATCH, "icplk", 0, 0);
kmutex_t icp_ioctl_mutex;
static int
icpopen(dev_t dev, int flag, int mode, struct lwp *l)
@ -123,10 +122,9 @@ static int
icpioctl(dev_t dev, u_long cmd, void *data, int flag,
struct lwp *l)
{
int error;
int error = 0;
if ((error = lockmgr(&icp_ioctl_mutex, LK_EXCLUSIVE, NULL)) != 0)
return (error);
mutex_enter(&icp_ioctl_mutex);
switch (cmd) {
case GDT_IOCTL_GENERAL:
@ -295,7 +293,7 @@ icpioctl(dev_t dev, u_long cmd, void *data, int flag,
error = ENOTTY;
}
(void) lockmgr(&icp_ioctl_mutex, LK_RELEASE, NULL);
mutex_exit(&icp_ioctl_mutex);
return (error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: icpvar.h,v 1.8 2007/03/04 06:01:56 christos Exp $ */
/* $NetBSD: icpvar.h,v 1.9 2007/03/11 22:16:32 ad Exp $ */
/*-
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@ -39,6 +39,8 @@
#ifndef _IC_ICPVAR_H_
#define _IC_ICPVAR_H_
#include <sys/mutex.h>
#include <dev/ic/icp_ioctl.h>
/*
@ -264,4 +266,6 @@ int icp_read_event(struct icp_softc *, int, gdt_evt_str *);
void icp_readapp_event(struct icp_softc *, u_int8_t, gdt_evt_str *);
void icp_clear_events(struct icp_softc *);
extern kmutex_t icp_ioctl_mutex;
#endif /* !_IC_ICPVAR_H_ */