Minor style(9) changes:

return (VALUE);
This commit is contained in:
imp 2001-05-14 06:15:24 +00:00
parent fdcf9e8aeb
commit 2b7173faed
4 changed files with 78 additions and 74 deletions

View File

@ -189,7 +189,7 @@ pccard_init_slot(device_t dev, struct slot_ctrl *ctrl)
callout_handle_init(&slt->insert_ch);
callout_handle_init(&slt->poff_ch);
return(slt);
return (slt);
}
/*
@ -321,10 +321,10 @@ crdopen(dev_t dev, int oflags, int devtype, struct proc *p)
struct slot *slt = PCCARD_DEV2SOFTC(dev);
if (slt == NULL)
return(ENXIO);
return (ENXIO);
if (slt->rwmem == 0)
slt->rwmem = MDF_ATTR;
return(0);
return (0);
}
/*
@ -334,7 +334,7 @@ crdopen(dev_t dev, int oflags, int devtype, struct proc *p)
static int
crdclose(dev_t dev, int fflag, int devtype, struct proc *p)
{
return(0);
return (0);
}
/*
@ -351,14 +351,14 @@ crdread(dev_t dev, struct uio *uio, int ioflag)
int error = 0, win, count;
if (slt == 0 || slt->state != filled)
return(ENXIO);
return (ENXIO);
if (pccard_mem == 0)
return(ENOMEM);
return (ENOMEM);
for (win = 0; win < slt->ctrl->maxmem; win++)
if ((slt->mem[win].flags & MDF_ACTIVE) == 0)
break;
if (win >= slt->ctrl->maxmem)
return(EBUSY);
return (EBUSY);
mp = &slt->mem[win];
oldmap = *mp;
mp->flags = slt->rwmem|MDF_ACTIVE;
@ -379,7 +379,7 @@ crdread(dev_t dev, struct uio *uio, int ioflag)
*mp = oldmap;
slt->ctrl->mapmem(slt, win);
return(error);
return (error);
}
/*
@ -397,14 +397,14 @@ crdwrite(dev_t dev, struct uio *uio, int ioflag)
int error = 0, win, count;
if (slt == 0 || slt->state != filled)
return(ENXIO);
return (ENXIO);
if (pccard_mem == 0)
return(ENOMEM);
return (ENOMEM);
for (win = 0; win < slt->ctrl->maxmem; win++)
if ((slt->mem[win].flags & MDF_ACTIVE) == 0)
break;
if (win >= slt->ctrl->maxmem)
return(EBUSY);
return (EBUSY);
mp = &slt->mem[win];
oldmap = *mp;
mp->flags = slt->rwmem|MDF_ACTIVE;
@ -425,7 +425,7 @@ crdwrite(dev_t dev, struct uio *uio, int ioflag)
*mp = oldmap;
slt->ctrl->mapmem(slt, win);
return(error);
return (error);
}
static int
@ -481,12 +481,12 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p)
struct slot *slt = PCCARD_DEV2SOFTC(dev);
if (slt == 0 && cmd != PIOCRWMEM)
return(ENXIO);
return (ENXIO);
switch(cmd) {
default:
if (slt->ctrl->ioctl)
return(slt->ctrl->ioctl(slt, cmd, data));
return(ENOTTY);
return (slt->ctrl->ioctl(slt, cmd, data));
return (ENOTTY);
/*
* Get slot state.
*/
@ -506,7 +506,7 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p)
case PIOCGMEM:
s = ((struct mem_desc *)data)->window;
if (s < 0 || s >= slt->ctrl->maxmem)
return(EINVAL);
return (EINVAL);
mp = &slt->mem[s];
((struct mem_desc *)data)->flags = mp->flags;
((struct mem_desc *)data)->start = mp->start;
@ -520,21 +520,21 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p)
*/
case PIOCSMEM:
if (suser(p))
return(EPERM);
return (EPERM);
if (slt->state != filled)
return(ENXIO);
return (ENXIO);
s = ((struct mem_desc *)data)->window;
if (s < 0 || s >= slt->ctrl->maxmem)
return(EINVAL);
return (EINVAL);
slt->mem[s] = *((struct mem_desc *)data);
return(slt->ctrl->mapmem(slt, s));
return (slt->ctrl->mapmem(slt, s));
/*
* Get I/O port context.
*/
case PIOCGIO:
s = ((struct io_desc *)data)->window;
if (s < 0 || s >= slt->ctrl->maxio)
return(EINVAL);
return (EINVAL);
ip = &slt->io[s];
((struct io_desc *)data)->flags = ip->flags;
((struct io_desc *)data)->start = ip->start;
@ -545,15 +545,15 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p)
*/
case PIOCSIO:
if (suser(p))
return(EPERM);
return (EPERM);
if (slt->state != filled)
return(ENXIO);
return (ENXIO);
s = ((struct io_desc *)data)->window;
if (s < 0 || s >= slt->ctrl->maxio)
return(EINVAL);
return (EINVAL);
slt->io[s] = *((struct io_desc *)data);
/* XXX Don't actually map */
return 0;
return (0);
break;
/*
* Set memory window flags for read/write interface.
@ -571,13 +571,13 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p)
break;
}
if (suser(p))
return(EPERM);
return (EPERM);
/*
* Validate the memory by checking it against the I/O
* memory range. It must also start on an aligned block size.
*/
if (*(unsigned long *)data & (PCCARD_MEMSIZE-1))
return(EINVAL);
return (EINVAL);
pccarddev = PCCARD_DEV2SOFTC(dev)->dev;
pccard_mem_rid = 0;
addr = *(unsigned long *)data;
@ -588,7 +588,7 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p)
&pccard_mem_rid, addr, addr, PCCARD_MEMSIZE,
RF_ACTIVE | rman_make_alignment_flags(PCCARD_MEMSIZE));
if (pccard_mem_res == NULL)
return(EINVAL);
return (EINVAL);
pccard_mem = rman_get_start(pccard_mem_res);
pccard_kmem = rman_get_virtual(pccard_mem_res);
break;
@ -597,19 +597,19 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p)
*/
case PIOCSPOW:
slt->pwr = *(struct power *)data;
return(slt->ctrl->power(slt));
return (slt->ctrl->power(slt));
/*
* Allocate a driver to this slot.
*/
case PIOCSDRV:
if (suser(p))
return(EPERM);
return (EPERM);
err = allocate_driver(slt, (struct dev_desc *)data);
if (!err)
pccard_success_beep();
else
pccard_failure_beep();
return err;
return (err);
/*
* Virtual removal/insertion
*/
@ -617,25 +617,25 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p)
pwval = *(int *)data;
if (!pwval) {
if (slt->state != filled)
return EINVAL;
return (EINVAL);
pccard_event(slt, card_removed);
slt->state = inactive;
} else {
if (slt->state != empty && slt->state != inactive)
return EINVAL;
return (EINVAL);
pccard_event(slt, card_inserted);
}
break;
case PIOCSBEEP:
if (pccard_beep_select(*(int *)data)) {
return EINVAL;
return (EINVAL);
}
break;
case PIOCSRESOURCE:
return (crdioctl_sresource(dev, data));
break;
}
return(0);
return (0);
}
/*

View File

@ -24,7 +24,6 @@ struct tone {
int duration;
};
static struct tone silent_beep[] = {
{0, 0}
};
@ -93,38 +92,43 @@ pccard_beep_start(void *arg)
}
}
void pccard_success_beep(void)
void
pccard_success_beep(void)
{
pccard_beep_start(melody_table[melody_type][0]);
}
void pccard_failure_beep(void)
void
pccard_failure_beep(void)
{
pccard_beep_start(melody_table[melody_type][1]);
}
void pccard_insert_beep(void)
void
pccard_insert_beep(void)
{
pccard_beep_start(melody_table[melody_type][2]);
}
void pccard_remove_beep(void)
void
pccard_remove_beep(void)
{
pccard_beep_start(melody_table[melody_type][3]);
}
int pccard_beep_select(int type)
int
pccard_beep_select(int type)
{
int errcode = 0;
if (type == 0) {
allow_beep = BEEP_OFF;
melody_type = 0;
} else if (type < 0 || MAX_TONE_MODE - 1 < type)
} else if (type < 0 || MAX_TONE_MODE - 1 < type) {
errcode = 1;
else {
} else {
allow_beep = BEEP_ON;
melody_type = type;
}
return errcode;
return (errcode);
}

View File

@ -183,21 +183,21 @@ pccard_set_resource(device_t dev, device_t child, int type, int rid,
if (type != SYS_RES_IOPORT && type != SYS_RES_MEMORY
&& type != SYS_RES_IRQ && type != SYS_RES_DRQ)
return EINVAL;
return (EINVAL);
if (rid < 0)
return EINVAL;
return (EINVAL);
if (type == SYS_RES_IOPORT && rid >= PCCARD_NPORT)
return EINVAL;
return (EINVAL);
if (type == SYS_RES_MEMORY && rid >= PCCARD_NMEM)
return EINVAL;
return (EINVAL);
if (type == SYS_RES_IRQ && rid >= PCCARD_NIRQ)
return EINVAL;
return (EINVAL);
if (type == SYS_RES_DRQ && rid >= PCCARD_NDRQ)
return EINVAL;
return (EINVAL);
resource_list_add(rl, type, rid, start, start + count - 1, count);
return 0;
return (0);
}
static int
@ -210,14 +210,14 @@ pccard_get_resource(device_t dev, device_t child, int type, int rid,
rle = resource_list_find(rl, type, rid);
if (!rle)
return ENOENT;
return (ENOENT);
if (startp)
*startp = rle->start;
if (countp)
*countp = rle->count;
return 0;
return (0);
}
static void
@ -252,26 +252,26 @@ pccard_alloc_resource(device_t bus, device_t child, int type, int *rid,
rle = resource_list_find(rl, type, *rid);
if (!rle) {
if (*rid < 0)
return 0;
return (NULL);
switch (type) {
case SYS_RES_IRQ:
if (*rid >= PCCARD_NIRQ)
return 0;
return (NULL);
break;
case SYS_RES_DRQ:
if (*rid >= PCCARD_NDRQ)
return 0;
return (NULL);
break;
case SYS_RES_MEMORY:
if (*rid >= PCCARD_NMEM)
return 0;
return (NULL);
break;
case SYS_RES_IOPORT:
if (*rid >= PCCARD_NPORT)
return 0;
return (NULL);
break;
default:
return 0;
return (NULL);
}
resource_list_add(rl, type, *rid, start, end, count);
}
@ -287,7 +287,7 @@ pccard_release_resource(device_t bus, device_t child, int type, int rid,
{
struct pccard_devinfo *devi = PCCARD_DEVINFO(child);
struct resource_list *rl = &devi->resources;
return resource_list_release(rl, bus, child, type, rid, r);
return (resource_list_release(rl, bus, child, type, rid, r));
}
static int
@ -298,41 +298,41 @@ pccard_read_ivar(device_t bus, device_t child, int which, u_char *result)
switch (which) {
case PCCARD_IVAR_ETHADDR:
bcopy(devi->misc, result, ETHER_ADDR_LEN);
return 0;
return (0);
}
return ENOENT;
return (ENOENT);
}
static int
pccard_set_res_flags(device_t bus, device_t child, int restype, int rid,
u_long value)
{
return CARD_SET_RES_FLAGS(device_get_parent(bus), child, restype,
rid, value);
return (CARD_SET_RES_FLAGS(device_get_parent(bus), child, restype,
rid, value));
}
static int
pccard_get_res_flags(device_t bus, device_t child, int restype, int rid,
u_long *value)
{
return CARD_GET_RES_FLAGS(device_get_parent(bus), child, restype,
rid, value);
return (CARD_GET_RES_FLAGS(device_get_parent(bus), child, restype,
rid, value));
}
static int
pccard_set_memory_offset(device_t bus, device_t child, int rid,
u_int32_t offset, u_int32_t *deltap)
{
return CARD_SET_MEMORY_OFFSET(device_get_parent(bus), child, rid,
offset, deltap);
return (CARD_SET_MEMORY_OFFSET(device_get_parent(bus), child, rid,
offset, deltap));
}
static int
pccard_get_memory_offset(device_t bus, device_t child, int rid,
u_int32_t *offset)
{
return CARD_GET_MEMORY_OFFSET(device_get_parent(bus), child, rid,
offset);
return (CARD_GET_MEMORY_OFFSET(device_get_parent(bus), child, rid,
offset));
}
static int
@ -360,7 +360,7 @@ const struct pccard_product *
pccard_product_lookup(device_t dev, const struct pccard_product *tab,
size_t ent_size, pccard_product_match_fn matchfn)
{
return NULL;
return (NULL);
}
static device_method_t pccard_methods[] = {

View File

@ -311,7 +311,7 @@ pcic_pci_probe(device_t dev)
return (ENXIO);
device_set_desc(dev, desc);
return 0; /* exact match */
return (0); /* exact match */
}
static void
@ -410,13 +410,13 @@ pcic_pci_attach(device_t dev)
printf("%02x: %16D\n", i, p + 0x800 + i, " ");
}
return 0;
return (0);
}
static int
pcic_pci_detach(device_t dev)
{
return 0;
return (0);
}
static device_method_t pcic_pci_methods[] = {