Date: Thu, 14 Dec 2017 03:03:08 +0000 (UTC) From: "Landon J. Fuller" <landonf@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326837 - in head/sys/dev/bhnd: . tools Message-ID: <201712140303.vBE3383B024708@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: landonf Date: Thu Dec 14 03:03:08 2017 New Revision: 326837 URL: https://svnweb.freebsd.org/changeset/base/326837 Log: bhnd(4): Add missing enclosing parentheses to the bhnd bus space macros to avoid precedence bugs. Approved by: adrian (mentor, implicit) Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/bhnd/bhnd.h head/sys/dev/bhnd/tools/bus_macro.sh Modified: head/sys/dev/bhnd/bhnd.h ============================================================================== --- head/sys/dev/bhnd/bhnd.h Thu Dec 14 01:58:05 2017 (r326836) +++ head/sys/dev/bhnd/bhnd.h Thu Dec 14 03:03:08 2017 (r326837) @@ -1502,262 +1502,262 @@ bhnd_get_region_addr(device_t dev, bhnd_port_type port * Generated with bhnd/tools/bus_macro.sh */ #define bhnd_bus_barrier(r, o, l, f) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_barrier((r)->res, (o), (l), (f)) : \ BHND_BUS_BARRIER( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (l), (f)) + rman_get_device((r)->res), (r), (o), (l), (f))) #define bhnd_bus_read_1(r, o) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_1((r)->res, (o)) : \ BHND_BUS_READ_1( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o)) + rman_get_device((r)->res), (r), (o))) #define bhnd_bus_read_multi_1(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_multi_1((r)->res, (o), (d), (c)) : \ BHND_BUS_READ_MULTI_1( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_read_region_1(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_region_1((r)->res, (o), (d), (c)) : \ BHND_BUS_READ_REGION_1( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_write_1(r, o, v) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_1((r)->res, (o), (v)) : \ BHND_BUS_WRITE_1( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (v)) + rman_get_device((r)->res), (r), (o), (v))) #define bhnd_bus_write_multi_1(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_multi_1((r)->res, (o), (d), (c)) : \ BHND_BUS_WRITE_MULTI_1( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_write_region_1(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_region_1((r)->res, (o), (d), (c)) : \ BHND_BUS_WRITE_REGION_1( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_read_stream_1(r, o) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_stream_1((r)->res, (o)) : \ BHND_BUS_READ_STREAM_1( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o)) + rman_get_device((r)->res), (r), (o))) #define bhnd_bus_read_multi_stream_1(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_multi_stream_1((r)->res, (o), (d), (c)) : \ BHND_BUS_READ_MULTI_STREAM_1( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_read_region_stream_1(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_region_stream_1((r)->res, (o), (d), (c)) : \ BHND_BUS_READ_REGION_STREAM_1( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_write_stream_1(r, o, v) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_stream_1((r)->res, (o), (v)) : \ BHND_BUS_WRITE_STREAM_1( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (v)) + rman_get_device((r)->res), (r), (o), (v))) #define bhnd_bus_write_multi_stream_1(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_multi_stream_1((r)->res, (o), (d), (c)) : \ BHND_BUS_WRITE_MULTI_STREAM_1( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_write_region_stream_1(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_region_stream_1((r)->res, (o), (d), (c)) : \ BHND_BUS_WRITE_REGION_STREAM_1( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_set_multi_1(r, o, v, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_set_multi_1((r)->res, (o), (v), (c)) : \ BHND_BUS_SET_MULTI_1( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (v), (c)) + rman_get_device((r)->res), (r), (o), (v), (c))) #define bhnd_bus_set_region_1(r, o, v, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_set_region_1((r)->res, (o), (v), (c)) : \ BHND_BUS_SET_REGION_1( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (v), (c)) + rman_get_device((r)->res), (r), (o), (v), (c))) #define bhnd_bus_read_2(r, o) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_2((r)->res, (o)) : \ BHND_BUS_READ_2( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o)) + rman_get_device((r)->res), (r), (o))) #define bhnd_bus_read_multi_2(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_multi_2((r)->res, (o), (d), (c)) : \ BHND_BUS_READ_MULTI_2( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_read_region_2(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_region_2((r)->res, (o), (d), (c)) : \ BHND_BUS_READ_REGION_2( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_write_2(r, o, v) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_2((r)->res, (o), (v)) : \ BHND_BUS_WRITE_2( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (v)) + rman_get_device((r)->res), (r), (o), (v))) #define bhnd_bus_write_multi_2(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_multi_2((r)->res, (o), (d), (c)) : \ BHND_BUS_WRITE_MULTI_2( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_write_region_2(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_region_2((r)->res, (o), (d), (c)) : \ BHND_BUS_WRITE_REGION_2( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_read_stream_2(r, o) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_stream_2((r)->res, (o)) : \ BHND_BUS_READ_STREAM_2( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o)) + rman_get_device((r)->res), (r), (o))) #define bhnd_bus_read_multi_stream_2(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_multi_stream_2((r)->res, (o), (d), (c)) : \ BHND_BUS_READ_MULTI_STREAM_2( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_read_region_stream_2(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_region_stream_2((r)->res, (o), (d), (c)) : \ BHND_BUS_READ_REGION_STREAM_2( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_write_stream_2(r, o, v) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_stream_2((r)->res, (o), (v)) : \ BHND_BUS_WRITE_STREAM_2( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (v)) + rman_get_device((r)->res), (r), (o), (v))) #define bhnd_bus_write_multi_stream_2(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_multi_stream_2((r)->res, (o), (d), (c)) : \ BHND_BUS_WRITE_MULTI_STREAM_2( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_write_region_stream_2(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_region_stream_2((r)->res, (o), (d), (c)) : \ BHND_BUS_WRITE_REGION_STREAM_2( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_set_multi_2(r, o, v, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_set_multi_2((r)->res, (o), (v), (c)) : \ BHND_BUS_SET_MULTI_2( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (v), (c)) + rman_get_device((r)->res), (r), (o), (v), (c))) #define bhnd_bus_set_region_2(r, o, v, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_set_region_2((r)->res, (o), (v), (c)) : \ BHND_BUS_SET_REGION_2( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (v), (c)) + rman_get_device((r)->res), (r), (o), (v), (c))) #define bhnd_bus_read_4(r, o) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_4((r)->res, (o)) : \ BHND_BUS_READ_4( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o)) + rman_get_device((r)->res), (r), (o))) #define bhnd_bus_read_multi_4(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_multi_4((r)->res, (o), (d), (c)) : \ BHND_BUS_READ_MULTI_4( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_read_region_4(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_region_4((r)->res, (o), (d), (c)) : \ BHND_BUS_READ_REGION_4( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_write_4(r, o, v) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_4((r)->res, (o), (v)) : \ BHND_BUS_WRITE_4( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (v)) + rman_get_device((r)->res), (r), (o), (v))) #define bhnd_bus_write_multi_4(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_multi_4((r)->res, (o), (d), (c)) : \ BHND_BUS_WRITE_MULTI_4( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_write_region_4(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_region_4((r)->res, (o), (d), (c)) : \ BHND_BUS_WRITE_REGION_4( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_read_stream_4(r, o) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_stream_4((r)->res, (o)) : \ BHND_BUS_READ_STREAM_4( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o)) + rman_get_device((r)->res), (r), (o))) #define bhnd_bus_read_multi_stream_4(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_multi_stream_4((r)->res, (o), (d), (c)) : \ BHND_BUS_READ_MULTI_STREAM_4( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_read_region_stream_4(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_read_region_stream_4((r)->res, (o), (d), (c)) : \ BHND_BUS_READ_REGION_STREAM_4( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_write_stream_4(r, o, v) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_stream_4((r)->res, (o), (v)) : \ BHND_BUS_WRITE_STREAM_4( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (v)) + rman_get_device((r)->res), (r), (o), (v))) #define bhnd_bus_write_multi_stream_4(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_multi_stream_4((r)->res, (o), (d), (c)) : \ BHND_BUS_WRITE_MULTI_STREAM_4( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_write_region_stream_4(r, o, d, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_write_region_stream_4((r)->res, (o), (d), (c)) : \ BHND_BUS_WRITE_REGION_STREAM_4( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (d), (c)) + rman_get_device((r)->res), (r), (o), (d), (c))) #define bhnd_bus_set_multi_4(r, o, v, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_set_multi_4((r)->res, (o), (v), (c)) : \ BHND_BUS_SET_MULTI_4( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (v), (c)) + rman_get_device((r)->res), (r), (o), (v), (c))) #define bhnd_bus_set_region_4(r, o, v, c) \ - ((r)->direct) ? \ + (((r)->direct) ? \ bus_set_region_4((r)->res, (o), (v), (c)) : \ BHND_BUS_SET_REGION_4( \ device_get_parent(rman_get_device((r)->res)), \ - rman_get_device((r)->res), (r), (o), (v), (c)) + rman_get_device((r)->res), (r), (o), (v), (c))) #endif /* _BHND_BHND_H_ */ Modified: head/sys/dev/bhnd/tools/bus_macro.sh ============================================================================== --- head/sys/dev/bhnd/tools/bus_macro.sh Thu Dec 14 01:58:05 2017 (r326836) +++ head/sys/dev/bhnd/tools/bus_macro.sh Thu Dec 14 03:03:08 2017 (r326837) @@ -43,7 +43,7 @@ macro () { echo -n ", ${i}" done echo ") \\" - echo " ((r)->direct) ? \\" + echo " (((r)->direct) ? \\" echo -n " bus_${n}((r)->res" for i do @@ -57,7 +57,7 @@ macro () { do echo -n ", (${i})" done - echo ")" + echo "))" }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712140303.vBE3383B024708>