diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2017-01-04 19:41:31 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-01-05 02:39:47 -0500 |
commit | e4f34cf6d59160818dcdcf41f4116cc88093ece3 (patch) | |
tree | 12e7b2cb15199014ebffff2c0d92550a66f189ac | |
parent | 13a6c8328e6056932dc680e447d4c5e8ad9add17 (diff) |
Revert "ALSA: firewire-lib: change structure member with proper type"
This reverts commit 6b7e95d1336b9eb0d4c6db190ce756480496bd13. This commit
is based on a concern about value of the given parameter. It's expected
to be ORed value with some enumeration-constants, thus often it can not be
one of the enumeration-constants. I understood that this is out of
specification and causes implementation-dependent issues.
In C language specification, enumerated type can be interpreted as an
integer type, in which all of enumeration-constants in corresponding
enumerator-list can be stored. Implementations can select one of char,
signed int and unsigned int as its type, and this selection is
implementation-dependent.
In GCC, a signed integer is selected when at least one of
enumeration-constants has negative value, else an unsigned integer is
selected. This behaviour can be switched by -fshort-enums to short type.
Anyway, the type can be decided after scanning all of
enumeration-constants.
Totally, there's no rules to constrain the value of enumerated type to
be one of enumeration-constants. In short, in enumerated type, decision
of actual type for the type is the most important and
enumeration-constants are just used for the decision, thus it's permitted
to have an integer value in a range of enumeration-constants. In our case,
actual type for the type is currently deterministic to be either char or
unsigned int. Under GCC, it's unsigned int.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/firewire/amdtp-stream.c | 2 | ||||
-rw-r--r-- | sound/firewire/amdtp-stream.h | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index 8ce93cdc4b0d..00060c4a9deb 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c | |||
@@ -69,7 +69,7 @@ static void pcm_period_tasklet(unsigned long data); | |||
69 | * @protocol_size: the size to allocate newly for protocol | 69 | * @protocol_size: the size to allocate newly for protocol |
70 | */ | 70 | */ |
71 | int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit, | 71 | int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit, |
72 | enum amdtp_stream_direction dir, int flags, | 72 | enum amdtp_stream_direction dir, enum cip_flags flags, |
73 | unsigned int fmt, | 73 | unsigned int fmt, |
74 | amdtp_stream_process_data_blocks_t process_data_blocks, | 74 | amdtp_stream_process_data_blocks_t process_data_blocks, |
75 | unsigned int protocol_size) | 75 | unsigned int protocol_size) |
diff --git a/sound/firewire/amdtp-stream.h b/sound/firewire/amdtp-stream.h index 7be21429cd12..c1bc7fad056e 100644 --- a/sound/firewire/amdtp-stream.h +++ b/sound/firewire/amdtp-stream.h | |||
@@ -93,7 +93,7 @@ typedef unsigned int (*amdtp_stream_process_data_blocks_t)( | |||
93 | unsigned int *syt); | 93 | unsigned int *syt); |
94 | struct amdtp_stream { | 94 | struct amdtp_stream { |
95 | struct fw_unit *unit; | 95 | struct fw_unit *unit; |
96 | int flags; | 96 | enum cip_flags flags; |
97 | enum amdtp_stream_direction direction; | 97 | enum amdtp_stream_direction direction; |
98 | struct mutex mutex; | 98 | struct mutex mutex; |
99 | 99 | ||
@@ -137,7 +137,7 @@ struct amdtp_stream { | |||
137 | }; | 137 | }; |
138 | 138 | ||
139 | int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit, | 139 | int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit, |
140 | enum amdtp_stream_direction dir, int flags, | 140 | enum amdtp_stream_direction dir, enum cip_flags flags, |
141 | unsigned int fmt, | 141 | unsigned int fmt, |
142 | amdtp_stream_process_data_blocks_t process_data_blocks, | 142 | amdtp_stream_process_data_blocks_t process_data_blocks, |
143 | unsigned int protocol_size); | 143 | unsigned int protocol_size); |