diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-06-29 12:24:58 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2004-06-29 12:24:58 +0000 |
commit | 3cc926cd9087ee3d0e6dbcabe69ebfbba72029a7 (patch) | |
tree | 03fccbb6dea4aee6b65259636defda7eb624c76f | |
parent | 1207847f16685fd29f229d5bbfd02afe2b63ebd5 (diff) |
do not use u_long for 32bit data; found by Jacob Meuser
-rw-r--r-- | sys/dev/pci/bktr/bktr_audio.c | 8 | ||||
-rw-r--r-- | sys/dev/pci/bktr/bktr_core.c | 82 | ||||
-rw-r--r-- | sys/dev/pci/bktr/bktr_core.h | 4 | ||||
-rw-r--r-- | sys/dev/pci/bktr/bktr_os.c | 14 | ||||
-rw-r--r-- | sys/dev/pci/bktr/bktr_reg.h | 26 |
5 files changed, 67 insertions, 67 deletions
diff --git a/sys/dev/pci/bktr/bktr_audio.c b/sys/dev/pci/bktr/bktr_audio.c index bc0d9444cd4..5f11ec3a62d 100644 --- a/sys/dev/pci/bktr/bktr_audio.c +++ b/sys/dev/pci/bktr/bktr_audio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bktr_audio.c,v 1.5 2004/03/19 09:14:15 mickey Exp $ */ +/* $OpenBSD: bktr_audio.c,v 1.6 2004/06/29 12:24:57 mickey Exp $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_audio.c,v 1.8 2000/10/31 13:09:56 roger Exp $ */ /* * This is part of the Driver for Video Capture Cards (Frame grabbers) @@ -122,7 +122,7 @@ void init_audio_devices( bktr_ptr_t bktr ) { int set_audio( bktr_ptr_t bktr, int cmd ) { - u_long temp; + u_int temp; volatile u_char idx; #if defined( AUDIOMUX_DISCOVER ) @@ -387,7 +387,7 @@ set_bctv_audio( bktr_ptr_t bktr ) void bctv_gpio_write( bktr_ptr_t bktr, int port, int val ) { - u_long data, outbits; + u_int data, outbits; port &= BCTV_GPIO_PORT_MASK; switch (port) { @@ -417,7 +417,7 @@ bctv_gpio_write( bktr_ptr_t bktr, int port, int val ) int bctv_gpio_read( bktr_ptr_t bktr, int port ) { - u_long data, outbits, ret; + u_int data, outbits, ret; port &= BCTV_GPIO_PORT_MASK; switch (port) { diff --git a/sys/dev/pci/bktr/bktr_core.c b/sys/dev/pci/bktr/bktr_core.c index fe237802e9f..f96fdc57235 100644 --- a/sys/dev/pci/bktr/bktr_core.c +++ b/sys/dev/pci/bktr/bktr_core.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bktr_core.c,v 1.12 2004/05/24 21:59:28 mickey Exp $ */ +/* $OpenBSD: bktr_core.c,v 1.13 2004/06/29 12:24:57 mickey Exp $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_core.c,v 1.114 2000/10/31 13:09:56 roger Exp $ */ /* @@ -343,7 +343,7 @@ static const struct meteor_pixfmt_internal { /* FIXME: Also add YUV_422 and YUV_PACKED as well */ static const struct { - u_long meteor_format; + u_int meteor_format; struct meteor_pixfmt public; } meteor_pixfmt_table[] = { { METEOR_GEO_YUV_12, @@ -388,7 +388,7 @@ static const struct { /* debug utility for holding previous INT_STAT contents */ #define STATUS_SUM -static u_long status_sum = 0; +static u_int status_sum = 0; /* * defines to make certain bit-fiddles understandable @@ -410,7 +410,7 @@ static u_long status_sum = 0; -static int oformat_meteor_to_bt( u_long format ); +static int oformat_meteor_to_bt( u_int format ); static u_int pixfmt_swap_flags( int pixfmt ); @@ -470,7 +470,7 @@ static int i2c_read_byte( bktr_ptr_t bktr, unsigned char *data, int last ); * the common attach code, used by all OS versions. */ void -common_bktr_attach( bktr_ptr_t bktr, int unit, u_long pci_id, u_int rev ) +common_bktr_attach( bktr_ptr_t bktr, int unit, u_int pci_id, u_int rev ) { vaddr_t buf = 0; @@ -1433,12 +1433,12 @@ video_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct pro break; case METEORGFMT: /* get input format */ - *(u_long *)arg = bktr->flags & METEOR_FORM_MASK; + *(u_int *)arg = bktr->flags & METEOR_FORM_MASK; break; case BT848GFMT: /* get input format */ - *(u_long *)arg = INB(bktr, BKTR_IFORM) & BT848_IFORM_FORMAT; + *(u_int *)arg = INB(bktr, BKTR_IFORM) & BT848_IFORM_FORMAT; break; case METEORSCOUNT: /* (re)set error counts */ @@ -1890,11 +1890,11 @@ tuner_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct pro int offset; int count; u_char *buf; - u_long par; - u_char write; - int i2c_addr; - int i2c_port; - u_long data; + u_int par; + u_char write; + int i2c_addr; + int i2c_port; + u_int data; switch ( cmd ) { @@ -2251,7 +2251,7 @@ tuner_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct pro /* Luigi's I2CWR ioctl */ case BT848_I2CWR: - par = *(u_long *)arg; + par = *(u_int *)arg; write = (par >> 24) & 0xff ; i2c_addr = (par >> 16) & 0xff ; i2c_port = (par >> 8) & 0xff ; @@ -2262,7 +2262,7 @@ tuner_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct pro } else { data = i2cRead( bktr, i2c_addr); } - *(u_long *)arg = (par & 0xffffff00) | ( data & 0xff ); + *(u_int *)arg = (par & 0xffffff00) | ( data & 0xff ); break; @@ -2407,7 +2407,7 @@ bktr_common_ioctl( bktr_ptr_t bktr, ioctl_cmd_t cmd, caddr_t arg ) break; case METEORGINPUT: /* get input device */ - *(u_long *)arg = bktr->flags & METEOR_DEV_MASK; + *(u_int *)arg = bktr->flags & METEOR_DEV_MASK; break; case METEORSACTPIXFMT: @@ -2626,7 +2626,7 @@ split(bktr_reg_t *bktr, u_int **dma_prog, int width, u_int operation, int pixel_width, u_int *target_buffer, int cols) { - u_long flag, flag2; + u_int flag, flag2; const struct meteor_pixfmt *pf = &pixfmt_table[ bktr->pixfmt ].public; u_int skip, start_skip; @@ -2837,7 +2837,7 @@ rgb_vbi_prog(bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace ) for(i = 0; i < vbilines; i++) { *dma_prog++ = htole32(OP_WRITE | OP_SOL | OP_EOL | vbisamples); #ifdef __FreeBSD__ - *dma_prog++ = (u_long) vtophys((caddr_t)bktr->vbidata + + *dma_prog++ = (u_int) vtophys((caddr_t)bktr->vbidata + ((i+MAX_VBI_LINES) * VBI_LINE_SIZE)); #else *dma_prog++ = htole32(bktr->dm_vbidata->dm_segs->ds_addr + @@ -2933,12 +2933,12 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace ) /* Construct Write */ if (bktr->video.addr) { - target_buffer = (u_long) bktr->video.addr; + target_buffer = (u_int) bktr->video.addr; pitch = bktr->video.width; } else { #ifdef __FreeBSD__ - target_buffer = (u_long) vtophys(bktr->bigbuf); + target_buffer = (u_int) vtophys(bktr->bigbuf); #else target_buffer = bktr->dm_mem->dm_segs->ds_addr; #endif @@ -2983,7 +2983,7 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace ) *dma_prog++ = htole32(OP_JUMP); #ifdef __FreeBSD__ - *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); + *dma_prog++ = (u_int) vtophys(bktr->dma_prog); #else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); #endif @@ -2996,7 +2996,7 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace ) *dma_prog++ = htole32(OP_JUMP); #ifdef __FreeBSD__ - *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); + *dma_prog++ = (u_int) vtophys(bktr->dma_prog); #else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); #endif @@ -3008,7 +3008,7 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace ) *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); #ifdef __FreeBSD__ - *dma_prog = (u_long ) vtophys(bktr->odd_dma_prog); + *dma_prog = (u_int) vtophys(bktr->odd_dma_prog); #else *dma_prog++ = htole32(bktr->dm_oprog->dm_segs->ds_addr); #endif @@ -3052,7 +3052,7 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace ) *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); #ifdef __FreeBSD__ - *dma_prog++ = (u_long ) vtophys(bktr->dma_prog) ; + *dma_prog++ = (u_ong ) vtophys(bktr->dma_prog) ; #else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); #endif @@ -3070,8 +3070,8 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag, int i; volatile unsigned int inst; volatile unsigned int inst3; - volatile u_long target_buffer, buffer; - volatile u_long *dma_prog; + volatile u_int target_buffer, buffer; + volatile u_int *dma_prog; const struct meteor_pixfmt_internal *pf_int = &pixfmt_table[ bktr->pixfmt ]; int b; @@ -3086,7 +3086,7 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag, bktr->capcontrol = 1 << 6 | 1 << 4 | 1 << 2 | 3; bktr->capcontrol = 3 << 2 | 3; - dma_prog = (u_long *) bktr->dma_prog; + dma_prog = (u_int *) bktr->dma_prog; /* Construct Write */ @@ -3096,10 +3096,10 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag, inst3 = OP_WRITE | OP_EOL | (cols); if (bktr->video.addr) - target_buffer = (u_long) bktr->video.addr; + target_buffer = bktr->video.addr; else #ifdef __FreeBSD__ - target_buffer = (u_long) vtophys(bktr->bigbuf); + target_buffer = vtophys(bktr->bigbuf); #else target_buffer = bktr->dm_mem->dm_segs->ds_addr; #endif @@ -3129,7 +3129,7 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag, *dma_prog++ = htole32(OP_JUMP); #ifdef __FreeBSD__ - *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); + *dma_prog++ = (u_int) vtophys(bktr->dma_prog); #else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); #endif @@ -3141,7 +3141,7 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag, *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); #ifdef __FreeBSD__ - *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); + *dma_prog++ = (u_int) vtophys(bktr->dma_prog); #else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); #endif @@ -3153,7 +3153,7 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag, *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); #ifdef __FreeBSD__ - *dma_prog = (u_long ) vtophys(bktr->odd_dma_prog); + *dma_prog = (u_int) vtophys(bktr->odd_dma_prog); #else *dma_prog++ = htole32(bktr->dm_oprog->dm_segs->ds_addr); #endif @@ -3162,9 +3162,9 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag, if (interlace == 2) { - target_buffer = (u_long) buffer + cols*2; + target_buffer = buffer + cols*2; - dma_prog = (u_long * ) bktr->odd_dma_prog; + dma_prog = (u_int * ) bktr->odd_dma_prog; /* sync vre */ *dma_prog++ = htole32(OP_SYNC | BKTR_RESYNC | BKTR_FM1); @@ -3184,14 +3184,14 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag, *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); #ifdef __FreeBSD__ - *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); + *dma_prog++ = (u_int) vtophys(bktr->dma_prog); #else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); #endif *dma_prog++ = htole32(OP_JUMP); #ifdef __FreeBSD__ - *dma_prog++ = (u_long ) vtophys(bktr->dma_prog); + *dma_prog++ = (u_int) vtophys(bktr->dma_prog); #else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); #endif @@ -3362,10 +3362,10 @@ yuv12_prog( bktr_ptr_t bktr, char i_flag, inst = OP_WRITE123 | OP_SOL | OP_EOL | (cols); inst1 = OP_WRITES123 | OP_SOL | OP_EOL | (cols); if (bktr->video.addr) - target_buffer = (u_long) bktr->video.addr; + target_buffer = (u_int) bktr->video.addr; else #ifdef __FreeBSD__ - target_buffer = (u_long) vtophys(bktr->bigbuf); + target_buffer = (u_int) vtophys(bktr->bigbuf); #else target_buffer = bktr->dm_mem->dm_segs->ds_addr; #endif @@ -3433,7 +3433,7 @@ yuv12_prog( bktr_ptr_t bktr, char i_flag, dma_prog = (u_int *)bktr->odd_dma_prog; - target_buffer = (u_long) buffer + cols; + target_buffer = (u_int) buffer + cols; t1 = buffer + cols/2; *dma_prog++ = htole32(OP_SYNC | BKTR_RESYNC | BKTR_FM3); *dma_prog++ = htole32(0); /* NULL WORD */ @@ -3834,7 +3834,7 @@ static u_int pixfmt_swap_flags( int pixfmt ) * our pixfmt_table indices. */ -static int oformat_meteor_to_bt( u_long format ) +static int oformat_meteor_to_bt( u_int format ) { int i; const struct meteor_pixfmt *pf1, *pf2; @@ -4036,8 +4036,8 @@ static void remote_read(bktr_ptr_t bktr, struct bktr_remote *remote) { int i2cWrite( bktr_ptr_t bktr, int addr, int byte1, int byte2 ) { - u_long x; - u_long data; + u_int x; + u_int data; /* clear status bits */ OUTL(bktr, BKTR_INT_STAT, BT848_INT_RACK | BT848_INT_I2CDONE); diff --git a/sys/dev/pci/bktr/bktr_core.h b/sys/dev/pci/bktr/bktr_core.h index e8362e6078e..8ec83611c8d 100644 --- a/sys/dev/pci/bktr/bktr_core.h +++ b/sys/dev/pci/bktr/bktr_core.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bktr_core.h,v 1.2 2003/01/05 01:24:53 mickey Exp $ */ +/* $OpenBSD: bktr_core.h,v 1.3 2004/06/29 12:24:57 mickey Exp $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_core.h,v 1.4 2000/06/26 09:41:32 roger Exp $ */ /* @@ -74,7 +74,7 @@ const char *bktr_name(bktr_ptr_t bktr); /* Prototypes for attatch and interrupt functions */ void common_bktr_attach( bktr_ptr_t bktr, int unit, - u_long pci_id, u_int rev ); + u_int pci_id, u_int rev ); int common_bktr_intr( void *arg ); diff --git a/sys/dev/pci/bktr/bktr_os.c b/sys/dev/pci/bktr/bktr_os.c index 4c7bd3a9e58..4670b2cccd7 100644 --- a/sys/dev/pci/bktr/bktr_os.c +++ b/sys/dev/pci/bktr/bktr_os.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bktr_os.c,v 1.18 2004/05/24 21:56:41 mickey Exp $ */ +/* $OpenBSD: bktr_os.c,v 1.19 2004/06/29 12:24:57 mickey Exp $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_os.c,v 1.20 2000/10/20 08:16:53 roger Exp $ */ /* @@ -296,14 +296,14 @@ bktr_probe( device_t dev ) static int bktr_attach( device_t dev ) { - u_long latency; - u_long fun; - u_long val; + u_int latency; + u_int fun; + u_int val; unsigned int rev; unsigned int unit; int error = 0; #ifdef BROOKTREE_IRQ - u_long old_irq, new_irq; + u_int old_irq, new_irq; #endif struct bktr_softc *bktr = device_get_softc(dev); @@ -913,8 +913,8 @@ static void bktr_attach(struct device *parent, struct device *self, void *aux) { bktr_ptr_t bktr; - u_long latency; - u_long fun; + u_int latency; + u_int fun; unsigned int rev; struct pci_attach_args *pa = aux; pci_intr_handle_t ih; diff --git a/sys/dev/pci/bktr/bktr_reg.h b/sys/dev/pci/bktr/bktr_reg.h index 9aeb2b8093f..9ac715629ed 100644 --- a/sys/dev/pci/bktr/bktr_reg.h +++ b/sys/dev/pci/bktr/bktr_reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bktr_reg.h,v 1.6 2003/01/05 01:24:53 mickey Exp $ */ +/* $OpenBSD: bktr_reg.h,v 1.7 2004/06/29 12:24:57 mickey Exp $ */ /* * $FreeBSD: src/sys/dev/bktr/bktr_reg.h,v 1.42 2000/10/31 13:09:56 roger Exp $ * @@ -606,7 +606,7 @@ struct bktr_softc { int vbiinsert; /* Position for next write into circular buffer */ int vbistart; /* Position of last read from circular buffer */ int vbisize; /* Number of bytes in the circular buffer */ - u_long vbi_sequence_number; /* sequence number for VBI */ + u_int vbi_sequence_number; /* sequence number for VBI */ int vbi_read_blocked; /* user process blocked on read() from /dev/vbi */ struct selinfo vbi_select; /* Data used by select() on /dev/vbi */ @@ -619,7 +619,7 @@ struct bktr_softc { #define METEOR_SIG_FRAME_MODE 0x00000000 char dma_prog_loaded; struct meteor_mem *mem; /* used to control sync. multi-frame output */ - u_long synch_wait; /* wait for free buffer before continuing */ + u_int synch_wait; /* wait for free buffer before continuing */ short current; /* frame number in buffer (1-frames) */ short rows; /* number of rows in a frame */ short cols; /* number of columns in a frame */ @@ -630,15 +630,15 @@ struct bktr_softc { char capture_area_enabled; /* When TRUE use user's capture area. */ int pixfmt; /* active pixel format (idx into fmt tbl) */ int pixfmt_compat; /* Y/N - in meteor pix fmt compat mode */ - u_long format; /* frame format rgb, yuv, etc.. */ + u_int format; /* frame format rgb, yuv, etc.. */ short frames; /* number of frames allocated */ int frame_size; /* number of bytes in a frame */ - u_long fifo_errors; /* number of fifo capture errors since open */ - u_long dma_errors; /* number of DMA capture errors since open */ - u_long frames_captured;/* number of frames captured since open */ - u_long even_fields_captured; /* number of even fields captured */ - u_long odd_fields_captured; /* number of odd fields captured */ - u_long range_enable; /* enable range checking ?? */ + u_int fifo_errors; /* number of fifo capture errors since open */ + u_int dma_errors; /* number of DMA capture errors since open */ + u_int frames_captured;/* number of frames captured since open */ + u_int even_fields_captured; /* number of even fields captured */ + u_int odd_fields_captured; /* number of odd fields captured */ + u_int range_enable; /* enable range checking ?? */ u_short capcontrol; /* reg 0xdc capture control */ u_short bktr_cap_ctl; volatile u_int flags; @@ -695,8 +695,8 @@ struct bktr_softc { u_char audio_mux_select; /* current mode of the audio */ u_char audio_mute_state; /* mute state of the audio */ u_char format_params; - u_long current_sol; - u_long current_col; + u_int current_sol; + u_int current_col; int clip_start; int line_length; int last_y; @@ -709,7 +709,7 @@ struct bktr_softc { int reverse_mute; /* Swap the GPIO values for Mute and TV Audio */ int bt848_tuner; int bt848_card; - u_long id; + u_int id; #define BT848_USE_XTALS 0 #define BT848_USE_PLL 1 int xtal_pll_mode; /* Use XTAL or PLL mode for PAL/SECAM */ |