diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-04-27 18:29:40 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-04-27 18:29:40 +0000 |
commit | 74263d684b6bd9df3138d7d3ed8e0106a87c1648 (patch) | |
tree | deee5ddc67b97dd1326731fa6df894fa5022cd28 /sys/arch/hppa/dev | |
parent | 996c599edb827abd37f911f42afb154c28f1cc5d (diff) |
Don't use cast expressions as lvalues; gcc4 complains about them. And gcc3
generates smaller code without them.
ok miod@
Diffstat (limited to 'sys/arch/hppa/dev')
-rw-r--r-- | sys/arch/hppa/dev/mongoose.c | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/sys/arch/hppa/dev/mongoose.c b/sys/arch/hppa/dev/mongoose.c index 05a67ec2a9c..be66db5a73d 100644 --- a/sys/arch/hppa/dev/mongoose.c +++ b/sys/arch/hppa/dev/mongoose.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mongoose.c,v 1.19 2010/01/01 20:28:42 kettenis Exp $ */ +/* $OpenBSD: mongoose.c,v 1.20 2010/04/27 18:29:39 kettenis Exp $ */ /* * Copyright (c) 1998-2003 Michael Shalayeff @@ -304,63 +304,69 @@ mg_isa_sm_4(void *v, bus_space_handle_t h, bus_size_t o, u_int32_t vv, bus_size_ void mg_isa_rr_2(void *v, bus_space_handle_t h, bus_size_t o, u_int16_t *a, bus_size_t c) { - register u_int16_t r; - h += o; + volatile u_int16_t *p = (u_int16_t *)(h + o); + u_int32_t r; + while (c--) { - r = *((volatile u_int16_t *)h)++; - *(a++) = letoh16(r); + r = *p++; + *a++ = letoh16(r); } } void mg_isa_rr_4(void *v, bus_space_handle_t h, bus_size_t o, u_int32_t *a, bus_size_t c) { - register u_int32_t r; - h += o; + volatile u_int32_t *p = (u_int32_t *)(h + o); + u_int32_t r; + while (c--) { - r = *((volatile u_int32_t *)h)++; - *(a++) = letoh32(r); + r = *p++; + *a++ = letoh32(r); } } void mg_isa_wr_2(void *v, bus_space_handle_t h, bus_size_t o, const u_int16_t *a, bus_size_t c) { - register u_int16_t r; - h += o; + volatile u_int16_t *p = (u_int16_t *)(h + o); + u_int32_t r; + while (c--) { - r = *(a++); - *((volatile u_int16_t *)h)++ = htole16(r); + r = *a++; + *p++ = htole16(r); } } void mg_isa_wr_4(void *v, bus_space_handle_t h, bus_size_t o, const u_int32_t *a, bus_size_t c) { - register u_int32_t r; - h += o; + volatile u_int32_t *p = (u_int32_t *)(h + o); + u_int32_t r; + while (c--) { - r = *(a++); - *((volatile u_int32_t *)h)++ = htole32(r); + r = *a++; + *p++ = htole32(r); } } void mg_isa_sr_2(void *v, bus_space_handle_t h, bus_size_t o, u_int16_t vv, bus_size_t c) { + volatile u_int16_t *p = (u_int16_t *)(h + o); + vv = htole16(vv); - h += o; while (c--) - *((volatile u_int16_t *)h)++ = vv; + *p++ = vv; } void mg_isa_sr_4(void *v, bus_space_handle_t h, bus_size_t o, u_int32_t vv, bus_size_t c) { + volatile u_int32_t *p = (u_int32_t *)(h + o); + vv = htole32(vv); - h += o; while (c--) - *((volatile u_int32_t *)h)++ = vv; + *p++ = vv; } int |