Added a missing return statement in paired_grant().

Removed lots of unused variables.
This commit is contained in:
Kees van Reeuwijk 2010-01-15 21:45:30 +00:00
parent 716df202de
commit 4faed703d9
13 changed files with 23 additions and 59 deletions

View file

@ -17,7 +17,6 @@
#include "at_wini.h" #include "at_wini.h"
#include <minix/sysutil.h> #include <minix/sysutil.h>
#include <minix/keymap.h>
#include <minix/type.h> #include <minix/type.h>
#include <minix/endpoint.h> #include <minix/endpoint.h>
#include <sys/ioc_disk.h> #include <sys/ioc_disk.h>
@ -483,8 +482,6 @@ PRIVATE void init_params_pci(int skip)
/* Any non-compat drives? */ /* Any non-compat drives? */
if (raid || (interface & (ATA_IF_NOTCOMPAT1 | ATA_IF_NOTCOMPAT2))) { if (raid || (interface & (ATA_IF_NOTCOMPAT1 | ATA_IF_NOTCOMPAT2))) {
int s;
if (w_next_drive >= MAX_DRIVES) if (w_next_drive >= MAX_DRIVES)
{ {
/* We can't accept more drives, but have to search for /* We can't accept more drives, but have to search for
@ -510,11 +507,11 @@ PRIVATE void init_params_pci(int skip)
w_instance, devind); w_instance, devind);
continue; continue;
} }
if ((s=sys_irqsetpolicy(irq, 0, &irq_hook)) != OK) { if (sys_irqsetpolicy(irq, 0, &irq_hook) != OK) {
printf("atapci: couldn't set IRQ policy %d\n", irq); printf("atapci: couldn't set IRQ policy %d\n", irq);
continue; continue;
} }
if ((s=sys_irqenable(&irq_hook)) != OK) { if (sys_irqenable(&irq_hook) != OK) {
printf("atapci: couldn't enable IRQ line %d\n", irq); printf("atapci: couldn't enable IRQ line %d\n", irq);
continue; continue;
} }
@ -671,9 +668,7 @@ message *m_ptr;
*===========================================================================*/ *===========================================================================*/
PRIVATE struct device *w_prepare(int device) PRIVATE struct device *w_prepare(int device)
{ {
/* Prepare for I/O on a device. */ /* Prepare for I/O on a device. */
struct wini *prev_wn;
prev_wn = w_wn;
w_device = device; w_device = device;
if (device < NR_MINORS) { /* d0, d0p[0-3], d1, ... */ if (device < NR_MINORS) { /* d0, d0p[0-3], d1, ... */

View file

@ -4,8 +4,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <minix/sysutil.h>
#include <errno.h> #include <errno.h>

View file

@ -430,9 +430,7 @@ PRIVATE int AC97_get_volume(struct volume_level *level) {
&(level->left), &(level->right), 0x1f, 1); &(level->left), &(level->right), 0x1f, 1);
break; break;
case Speaker: case Speaker:
cmd = AC97_PC_BEEP_VOLUME;
return EINVAL; return EINVAL;
break;
case Treble: case Treble:
cmd = AC97_MASTER_TONE; cmd = AC97_MASTER_TONE;
get_volume(&left, &right, cmd); get_volume(&left, &right, cmd);
@ -464,7 +462,6 @@ PRIVATE int AC97_set_volume(struct volume_level *level) {
break; break;
case Dac: case Dac:
return EINVAL; return EINVAL;
break;
case Fm: case Fm:
cmd = AC97_PCM_OUT_VOLUME; cmd = AC97_PCM_OUT_VOLUME;
convert(level->left, level->right, 0x1f, &left, &right, 0x1f, 0); convert(level->left, level->right, 0x1f, &left, &right, 0x1f, 0);
@ -482,17 +479,11 @@ PRIVATE int AC97_set_volume(struct volume_level *level) {
convert(level->left, level->right, 0x1f, &left, &right, 0x1f, 1); convert(level->left, level->right, 0x1f, &left, &right, 0x1f, 1);
break; break;
case Speaker: case Speaker:
cmd = AC97_PC_BEEP_VOLUME;
return EINVAL; return EINVAL;
break;
case Treble: case Treble:
cmd = AC97_MASTER_TONE;
return EINVAL; return EINVAL;
break;
case Bass: case Bass:
cmd = AC97_MASTER_TONE;
return EINVAL; return EINVAL;
break;
default: default:
return EINVAL; return EINVAL;
} }

View file

@ -4,8 +4,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <minix/sysutil.h>
#include <errno.h> #include <errno.h>

View file

@ -1,25 +1,24 @@
#include "../../drivers.h" #include "../../drivers.h"
#include <sys/types.h> #include <sys/types.h>
#include <time.h>
#include "pci_helper.h" #include "pci_helper.h"
int WaitBitd (int paddr, int bitno, int state, long tmout) int WaitBitd (int paddr, int bitno, int state, long tmout)
{ {
unsigned long val, mask; unsigned long mask;
mask = 1UL << bitno; mask = 1UL << bitno;
tmout *= 5000; tmout *= 5000;
if(state) { if(state) {
while(tmout-- > 0) { while(tmout-- > 0) {
if((val = pci_inl(paddr)) & mask) { if(pci_inl(paddr) & mask) {
return 0; return 0;
} }
} }
} else { } else {
while(tmout-- > 0) { while(tmout-- > 0) {
if(!((val = pci_inl(paddr)) & mask)) { if(!(pci_inl(paddr) & mask)) {
return 0; return 0;
} }
} }

View file

@ -576,7 +576,6 @@ PRIVATE void msg_read(message *m_ptr)
PRIVATE void msg_hardware(void) { PRIVATE void msg_hardware(void) {
u32_t i; u32_t i;
int j = 0;
dprint("%s: handling hardware message\n", drv.DriverName); dprint("%s: handling hardware message\n", drv.DriverName);
@ -659,7 +658,6 @@ PRIVATE void msg_sig_stop(void)
PRIVATE void handle_int_write(int sub_dev_nr) PRIVATE void handle_int_write(int sub_dev_nr)
{ {
sub_dev_t *sub_dev_ptr; sub_dev_t *sub_dev_ptr;
int r;
sub_dev_ptr = &sub_dev[sub_dev_nr]; sub_dev_ptr = &sub_dev[sub_dev_nr];
@ -710,7 +708,7 @@ PRIVATE void handle_int_write(int sub_dev_nr)
drv_reenable_int(sub_dev_nr); drv_reenable_int(sub_dev_nr);
#if 0 #if 0
/* reenable irq_hook*/ /* reenable irq_hook*/
if ((r=sys_irqenable(&irq_hook_id)) != OK) { if (sys_irqenable(&irq_hook_id != OK) {
error("%s Couldn't enable IRQ\n", drv.DriverName); error("%s Couldn't enable IRQ\n", drv.DriverName);
} }
#endif #endif
@ -720,7 +718,7 @@ PRIVATE void handle_int_write(int sub_dev_nr)
/* handle interrupt for specified sub device; DmaMode == DEV_READ_S */ /* handle interrupt for specified sub device; DmaMode == DEV_READ_S */
PRIVATE void handle_int_read(int sub_dev_nr) PRIVATE void handle_int_read(int sub_dev_nr)
{ {
sub_dev_t *sub_dev_ptr; int r,i; sub_dev_t *sub_dev_ptr;
sub_dev_ptr = &sub_dev[sub_dev_nr]; sub_dev_ptr = &sub_dev[sub_dev_nr];
@ -765,7 +763,7 @@ PRIVATE void handle_int_read(int sub_dev_nr)
#if 0 #if 0
/* reenable irq_hook*/ /* reenable irq_hook*/
if ((r=sys_irqenable(&irq_hook_id)) != OK) { if (sys_irqenable(&irq_hook_id) != OK) {
error("%s: Couldn't reenable IRQ", drv.DriverName); error("%s: Couldn't reenable IRQ", drv.DriverName);
} }
#endif #endif
@ -773,7 +771,7 @@ PRIVATE void handle_int_read(int sub_dev_nr)
PRIVATE int get_started(sub_dev_t *sub_dev_ptr) { PRIVATE int get_started(sub_dev_t *sub_dev_ptr) {
u32_t i;char c; u32_t i;
/* enable interrupt messages from MINIX */ /* enable interrupt messages from MINIX */
if ((i=sys_irqenable(&irq_hook_id)) != OK) { if ((i=sys_irqenable(&irq_hook_id)) != OK) {

View file

@ -73,7 +73,7 @@ PUBLIC int drv_init(void) {
PUBLIC int drv_init_hw(void) { PUBLIC int drv_init_hw(void) {
int i, s; int i;
int DspVersion[2]; int DspVersion[2];
dprint("drv_init_hw():\n"); dprint("drv_init_hw():\n");
@ -413,7 +413,7 @@ PRIVATE int dsp_get_max_frag_size(u32_t *val, int *len) {
PUBLIC int dsp_command(int value) { PUBLIC int dsp_command(int value) {
int i, status; int i;
for (i = 0; i < SB_TIMEOUT; i++) { for (i = 0; i < SB_TIMEOUT; i++) {
if((sb16_inb(DSP_STATUS) & 0x80) == 0) { if((sb16_inb(DSP_STATUS) & 0x80) == 0) {

View file

@ -523,11 +523,9 @@ struct partition *entry;
/*============================================================================* /*============================================================================*
* w_other * * w_other *
*============================================================================*/ *============================================================================*/
PRIVATE int w_other(dr, m) PRIVATE int w_other(struct driver *dr, message *m)
struct driver *dr;
message *m;
{ {
int r, timeout, prev; int r;
if (m->m_type != DEV_IOCTL_S ) if (m->m_type != DEV_IOCTL_S )
return EINVAL; return EINVAL;

View file

@ -1502,8 +1502,6 @@ size_t offset;
size_t size; size_t size;
void *dst; void *dst;
{ {
int r;
offset = page * DP_PAGESIZE + offset; offset = page * DP_PAGESIZE + offset;
memcpy(dst, dep->de_locmem + offset, size); memcpy(dst, dep->de_locmem + offset, size);
@ -1636,7 +1634,7 @@ vir_bytes offset;
int nic_addr; int nic_addr;
vir_bytes count; vir_bytes count;
{ {
vir_bytes vir_hw, vir_user; vir_bytes vir_hw;
int bytes, i, r; int bytes, i, r;
vir_hw = (vir_bytes)dep->de_locmem + nic_addr; vir_hw = (vir_bytes)dep->de_locmem + nic_addr;
@ -1684,7 +1682,7 @@ vir_bytes offset;
int nic_addr; int nic_addr;
vir_bytes count; vir_bytes count;
{ {
vir_bytes vir_hw, vir_user; vir_bytes vir_hw;
int bytes, i, r; int bytes, i, r;
vir_hw = (vir_bytes)dep->de_locmem + nic_addr; vir_hw = (vir_bytes)dep->de_locmem + nic_addr;
@ -1735,7 +1733,6 @@ vir_bytes offset;
int nic_addr; int nic_addr;
vir_bytes count; vir_bytes count;
{ {
phys_bytes phys_user;
int bytes, i; int bytes, i;
outb_reg0(dep, DP_ISR, ISR_RDC); outb_reg0(dep, DP_ISR, ISR_RDC);
@ -1794,7 +1791,6 @@ vir_bytes offset;
int nic_addr; int nic_addr;
vir_bytes count; vir_bytes count;
{ {
phys_bytes phys_user;
int bytes, i, r; int bytes, i, r;
outb_reg0(dep, DP_ISR, ISR_RDC); outb_reg0(dep, DP_ISR, ISR_RDC);
@ -2084,10 +2080,9 @@ iovec_dat_t *iovp;
vir_bytes offset; vir_bytes offset;
vir_bytes count; vir_bytes count;
{ {
vir_bytes vir_hw, vir_user;
int bytes, i, r; int bytes, i, r;
vir_hw = (vir_bytes)dep->de_locmem + nic_addr; vir_bytes vir_hw = (vir_bytes) (dep->de_locmem + nic_addr);
i= 0; i= 0;
while (count > 0) while (count > 0)
@ -2132,7 +2127,7 @@ iovec_dat_s_t *iovp;
vir_bytes offset; vir_bytes offset;
vir_bytes count; vir_bytes count;
{ {
vir_bytes vir_hw, vir_user; vir_bytes vir_hw;
int bytes, i, r; int bytes, i, r;
vir_hw = (vir_bytes)dep->de_locmem + nic_addr; vir_hw = (vir_bytes)dep->de_locmem + nic_addr;
@ -2181,7 +2176,6 @@ iovec_dat_t *iovp;
vir_bytes offset; vir_bytes offset;
vir_bytes count; vir_bytes count;
{ {
phys_bytes phys_user;
int bytes, i; int bytes, i;
outb_reg0(dep, DP_RBCR0, count & 0xFF); outb_reg0(dep, DP_RBCR0, count & 0xFF);
@ -2228,7 +2222,6 @@ iovec_dat_s_t *iovp;
vir_bytes offset; vir_bytes offset;
vir_bytes count; vir_bytes count;
{ {
phys_bytes phys_user;
int bytes, i, r; int bytes, i, r;
outb_reg0(dep, DP_RBCR0, count & 0xFF); outb_reg0(dep, DP_RBCR0, count & 0xFF);

View file

@ -676,7 +676,6 @@ PRIVATE void sef_local_startup()
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
{ {
/* Initialize the dpeth driver. */ /* Initialize the dpeth driver. */
dpeth_t *dep;
int rc, fkeys, sfkeys, tasknr; int rc, fkeys, sfkeys, tasknr;
(progname=strrchr(env_argv[0],'/')) ? progname++ : (progname=env_argv[0]); (progname=strrchr(env_argv[0],'/')) ? progname++ : (progname=env_argv[0]);

View file

@ -109,7 +109,6 @@ PUBLIC void init_buff(dpeth_t *dep, buff_t **tx_buff)
*/ */
PUBLIC void mem2user(dpeth_t *dep, buff_t *rxbuff) PUBLIC void mem2user(dpeth_t *dep, buff_t *rxbuff)
{ {
phys_bytes phys_user;
int bytes, ix = 0; int bytes, ix = 0;
iovec_dat_s_t *iovp = &dep->de_read_iovec; iovec_dat_s_t *iovp = &dep->de_read_iovec;
int r, pktsize = rxbuff->size; int r, pktsize = rxbuff->size;
@ -142,7 +141,6 @@ PUBLIC void mem2user(dpeth_t *dep, buff_t *rxbuff)
*/ */
PUBLIC void user2mem(dpeth_t *dep, buff_t *txbuff) PUBLIC void user2mem(dpeth_t *dep, buff_t *txbuff)
{ {
phys_bytes phys_user;
int bytes, ix = 0; int bytes, ix = 0;
iovec_dat_s_t *iovp = &dep->de_write_iovec; iovec_dat_s_t *iovp = &dep->de_write_iovec;
int r, pktsize = txbuff->size; int r, pktsize = txbuff->size;

View file

@ -31,7 +31,7 @@ PRIVATE u16_t pcitab_e1000[] =
PRIVATE char *progname; PRIVATE char *progname;
PRIVATE e1000_t e1000_table[E1000_PORT_NR]; PRIVATE e1000_t e1000_table[E1000_PORT_NR];
_PROTOTYPE( PRIVATE int e1000_init, (message *mp) ); _PROTOTYPE( PRIVATE void e1000_init, (message *mp) );
_PROTOTYPE( PRIVATE void e1000_init_pci, (void) ); _PROTOTYPE( PRIVATE void e1000_init_pci, (void) );
_PROTOTYPE( PRIVATE int e1000_probe, (e1000_t *e) ); _PROTOTYPE( PRIVATE int e1000_probe, (e1000_t *e) );
_PROTOTYPE( PRIVATE int e1000_init_hw, (e1000_t *e) ); _PROTOTYPE( PRIVATE int e1000_init_hw, (e1000_t *e) );
@ -177,8 +177,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
/*===========================================================================* /*===========================================================================*
* e1000_init * * e1000_init *
*===========================================================================*/ *===========================================================================*/
PRIVATE int e1000_init(mp) PRIVATE void e1000_init(message *mp)
message *mp;
{ {
static int first_time = 1; static int first_time = 1;
message reply_mess; message reply_mess;
@ -235,14 +234,13 @@ PRIVATE void e1000_init_pci()
/*===========================================================================* /*===========================================================================*
* e1000_probe * * e1000_probe *
*===========================================================================*/ *===========================================================================*/
PRIVATE int e1000_probe(e) PRIVATE int e1000_probe(e1000_t *e)
e1000_t *e;
{ {
int i, r, devind; int i, r, devind;
u16_t vid, did; u16_t vid, did;
u32_t status[2]; u32_t status[2];
u32_t gfpreg, sector_base_addr, sector_end_addr; u32_t gfpreg, sector_base_addr, sector_end_addr;
char *dname, *str; char *dname;
E1000_DEBUG(3, ("%s: probe()\n", e->name)); E1000_DEBUG(3, ("%s: probe()\n", e->name));
@ -868,7 +866,6 @@ message *mp;
PRIVATE void e1000_signal(void) PRIVATE void e1000_signal(void)
{ {
sigset_t sigset; sigset_t sigset;
int sig;
E1000_DEBUG(3, ("e1000: signal()\n")); E1000_DEBUG(3, ("e1000: signal()\n"));

View file

@ -850,7 +850,6 @@ static int paired_grant(char *buf1, char *buf2, int request,
{ {
/* Create memory grants, either to one or to both drivers. /* Create memory grants, either to one or to both drivers.
*/ */
cp_grant_id_t gid;
int count, access; int count, access;
count = 0; count = 0;
@ -869,6 +868,7 @@ static int paired_grant(char *buf1, char *buf2, int request,
vectors[1], &sizes[1]); vectors[1], &sizes[1]);
} }
} }
return count;
} }
/*===========================================================================* /*===========================================================================*