Remove extraneous parentheses. Fix spelling/grammar. No functional

change intended.
This commit is contained in:
dyoung 2009-04-30 20:39:08 +00:00
parent c968789de1
commit 662437b2c3

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_drvctl.c,v 1.27 2009/04/30 05:15:36 nonaka Exp $ */
/* $NetBSD: kern_drvctl.c,v 1.28 2009/04/30 20:39:08 dyoung Exp $ */
/*
* Copyright (c) 2004
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_drvctl.c,v 1.27 2009/04/30 05:15:36 nonaka Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_drvctl.c,v 1.28 2009/04/30 20:39:08 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -159,7 +159,7 @@ drvctlopen(dev_t dev, int flags, int mode, struct lwp *l)
ret = fd_allocfile(&fp, &fd);
if (ret)
return (ret);
return ret;
/* XXX setup context */
mutex_enter(&drvctl_lock);
@ -239,12 +239,12 @@ detachdevbyname(const char *devname)
* If the parent cannot be notified, it might keep
* pointers to the detached device.
* There might be a private notification mechanism,
* but better play save here.
* but better play it safe here.
*/
if (d->dv_parent && !d->dv_parent->dv_cfattach->ca_childdetached)
return (ENOTSUP);
return ENOTSUP;
#endif
return (config_detach(d, 0));
return config_detach(d, 0);
}
static int
@ -273,12 +273,12 @@ rescanbus(const char *busname, const char *ifattr,
*/
if (!d->dv_cfattach->ca_rescan ||
!d->dv_cfdriver->cd_attrs)
return (ENODEV);
return ENODEV;
/* allow to omit attribute if there is exactly one */
if (!ifattr) {
if (d->dv_cfdriver->cd_attrs[1])
return (EINVAL);
return EINVAL;
ifattr = d->dv_cfdriver->cd_attrs[0]->ci_name;
} else {
/* check for valid attribute passed */
@ -286,7 +286,7 @@ rescanbus(const char *busname, const char *ifattr,
if (!strcmp((*ap)->ci_name, ifattr))
break;
if (!*ap)
return (EINVAL);
return EINVAL;
}
rc = (*d->dv_cfattach->ca_rescan)(d, ifattr, locs);
@ -298,14 +298,14 @@ static int
drvctl_read(struct file *fp, off_t *offp, struct uio *uio, kauth_cred_t cred,
int flags)
{
return (ENODEV);
return ENODEV;
}
static int
drvctl_write(struct file *fp, off_t *offp, struct uio *uio, kauth_cred_t cred,
int flags)
{
return (ENODEV);
return ENODEV;
}
static int
@ -344,13 +344,13 @@ drvctl_ioctl(struct file *fp, u_long cmd, void *data)
if (d->numlocators) {
if (d->numlocators > MAXLOCATORS)
return (EINVAL);
return EINVAL;
locs_sz = d->numlocators * sizeof(int);
locs = kmem_alloc(locs_sz, KM_SLEEP);
res = copyin(d->locators, locs, locs_sz);
if (res) {
kmem_free(locs, locs_sz);
return (res);
return res;
}
} else
locs = NULL;
@ -368,9 +368,9 @@ drvctl_ioctl(struct file *fp, u_long cmd, void *data)
fp->f_flag);
break;
default:
return (EPASSTHROUGH);
return EPASSTHROUGH;
}
return (res);
return res;
}
static int
@ -416,7 +416,7 @@ drvctl_close(struct file *fp)
}
mutex_exit(&drvctl_lock);
return (0);
return 0;
}
void
@ -440,11 +440,11 @@ drvctl_command_get_properties(struct lwp *l,
args_dict = prop_dictionary_get(command_dict, "drvctl-arguments");
if (args_dict == NULL)
return (EINVAL);
return EINVAL;
devname_string = prop_dictionary_get(args_dict, "device-name");
if (devname_string == NULL)
return (EINVAL);
return EINVAL;
for (dev = deviter_first(&di, 0); dev != NULL;
dev = deviter_next(&di)) {
@ -459,9 +459,9 @@ drvctl_command_get_properties(struct lwp *l,
deviter_release(&di);
if (dev == NULL)
return (ESRCH);
return ESRCH;
return (0);
return 0;
}
struct drvctl_command_desc {
@ -492,12 +492,12 @@ drvctl_command(struct lwp *l, struct plistref *pref, u_long ioctl_cmd,
error = prop_dictionary_copyin_ioctl(pref, ioctl_cmd, &command_dict);
if (error)
return (error);
return error;
results_dict = prop_dictionary_create();
if (results_dict == NULL) {
prop_object_release(command_dict);
return (ENOMEM);
return ENOMEM;
}
command_string = prop_dictionary_get(command_dict, "drvctl-command");
@ -530,7 +530,7 @@ drvctl_command(struct lwp *l, struct plistref *pref, u_long ioctl_cmd,
out:
prop_object_release(command_dict);
prop_object_release(results_dict);
return (error);
return error;
}
static int
@ -541,19 +541,19 @@ drvctl_getevent(struct lwp *l, struct plistref *pref, u_long ioctl_cmd,
int ret;
if ((fflag & (FREAD|FWRITE)) != (FREAD|FWRITE))
return (EPERM);
return EPERM;
mutex_enter(&drvctl_lock);
while ((dce = TAILQ_FIRST(&drvctl_eventq)) == NULL) {
if (fflag & O_NONBLOCK) {
mutex_exit(&drvctl_lock);
return (EWOULDBLOCK);
return EWOULDBLOCK;
}
ret = cv_wait_sig(&drvctl_cond, &drvctl_lock);
if (ret) {
mutex_exit(&drvctl_lock);
return (ret);
return ret;
}
}
TAILQ_REMOVE(&drvctl_eventq, dce, dce_link);
@ -566,5 +566,5 @@ drvctl_getevent(struct lwp *l, struct plistref *pref, u_long ioctl_cmd,
prop_object_release(dce->dce_event);
kmem_free(dce, sizeof(*dce));
return (ret);
return ret;
}