ALSA: hdspm - AES32: Enable TCO/Sync-In in snd_hdspm_put_sync_ref()
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 12 lines · Linux Kernel
Gitweb: http://git.kernel.org/linus/;a=commit;h=2d60fc7f7d3d79e5646646bb34811961f19d111a Commit: 2d60fc7f7d3d79e5646646bb34811961f19d111a Parent: dbae4a0c8d8794df1a6bd7e644ed94b915f46f7e Author: Adrian Knoth <[email protected]> AuthorDate: Fri Jul 5 11:28:15 2013 +0200 Committer: Takashi Iwai <[email protected]> CommitDate: Fri Jul 5 14:52:42 2013 +0200ALSA: hdspm - AES32: Enable TCO/Sync-In in
snd_hdspm_put_sync_ref()static int
hdspm_autosync_ref(struct hdspm *hdspm){
...
Review
Quoted 5 lines
(quoted diff) +4
-0+ unsigned int syncref = (status >> HDSPM_AES32_syncref_bit) & 0xF; + if ((syncref >= HDSPM_AES32_AUTOSYNC_FROM_WORD) && + (syncref <= HDSPM_AES32_AUTOSYNC_FROM_SYNC_IN)) { return syncref; + }
Because syncref is unsigned, the first part of that if always evaluates true. (it will always be >0)
Dave
At Thu, 5 Sep 2013 10:50:13 -0400,
Quoted 15 lines · Dave Jones
Quoted 12 lines · Linux Kernel
Gitweb: http://git.kernel.org/linus/;a=commit;h=2d60fc7f7d3d79e5646646bb34811961f19d111a Commit: 2d60fc7f7d3d79e5646646bb34811961f19d111a Parent: dbae4a0c8d8794df1a6bd7e644ed94b915f46f7e Author: Adrian Knoth <[email protected]> AuthorDate: Fri Jul 5 11:28:15 2013 +0200 Committer: Takashi Iwai <[email protected]> CommitDate: Fri Jul 5 14:52:42 2013 +0200ALSA: hdspm - AES32: Enable TCO/Sync-In in
snd_hdspm_put_sync_ref()static int
hdspm_autosync_ref(struct hdspm *hdspm){...
Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +4
-0+ unsigned int syncref = (status >> HDSPM_AES32_syncref_bit) & 0xF; + if ((syncref >= HDSPM_AES32_AUTOSYNC_FROM_WORD) && + (syncref <= HDSPM_AES32_AUTOSYNC_FROM_SYNC_IN)) { return syncref; + }Because syncref is unsigned, the first part of that if always evaluates true. (it will always be >0)
True. But from the coding POV, it's not so bad to show both "from" and "to" for clearly indicating a range, IMO. (And the compiler should be cleverer than the programmer and will optimize it out in anyway :)
thanks,
Takashi
Quoted 23 lines · Takashi Iwai
At Thu, 5 Sep 2013 10:50:13 -0400,
Quoted 21 lines · Dave Jones
Quoted 12 lines · Linux Kernel
Gitweb: http://git.kernel.org/linus/;a=commit;h=2d60fc7f7d3d79e5646646bb34811961f19d111a Commit: 2d60fc7f7d3d79e5646646bb34811961f19d111a Parent: dbae4a0c8d8794df1a6bd7e644ed94b915f46f7e Author: Adrian Knoth <[email protected]> AuthorDate: Fri Jul 5 11:28:15 2013 +0200 Committer: Takashi Iwai <[email protected]> CommitDate: Fri Jul 5 14:52:42 2013 +0200ALSA: hdspm - AES32: Enable TCO/Sync-In in
snd_hdspm_put_sync_ref()static int
hdspm_autosync_ref(struct hdspm *hdspm){...
Quoted 5 lines
(quoted diff) +4
-0+ unsigned int syncref = (status >> HDSPM_AES32_syncref_bit) & 0xF; + if ((syncref >= HDSPM_AES32_AUTOSYNC_FROM_WORD) && + (syncref <= HDSPM_AES32_AUTOSYNC_FROM_SYNC_IN)) { return syncref; + }
Quoted 7 lines
Quoted 2 lines
Because syncref is unsigned, the first part of that if always evaluates true. (it will always be >0)
True. But from the coding POV, it's not so bad to show both "from" and "to" for clearly indicating a range, IMO. (And the compiler should be cleverer than the programmer and will optimize it out in anyway :)
Good point.
hmm, I thought we had a within_range function (maybe it was driver specific)
Dave