* Re: ALSA: hdspm - AES32: Enable TCO/Sync-In in snd_hdspm_put_sync_ref() [not found] <20130905013837.9F84A660DA9@gitolite.kernel.org> @ 2013-09-05 14:50 ` Dave Jones 2013-09-05 15:01 ` Takashi Iwai 0 siblings, 1 reply; 3+ messages in thread From: Dave Jones @ 2013-09-05 14:50 UTC (permalink / raw) To: Linux Kernel Mailing List; +Cc: adi On Thu, Sep 05, 2013 at 01:38:37AM +0000, Linux Kernel wrote: > Gitweb: http://git.kernel.org/linus/;a=commit;h=2d60fc7f7d3d79e5646646bb34811961f19d111a > Commit: 2d60fc7f7d3d79e5646646bb34811961f19d111a > Parent: dbae4a0c8d8794df1a6bd7e644ed94b915f46f7e > Author: Adrian Knoth <adi@drcomp.erfurt.thur.de> > AuthorDate: Fri Jul 5 11:28:15 2013 +0200 > Committer: Takashi Iwai <tiwai@suse.de> > CommitDate: Fri Jul 5 14:52:42 2013 +0200 > > ALSA: hdspm - AES32: Enable TCO/Sync-In in snd_hdspm_put_sync_ref() > static int hdspm_autosync_ref(struct hdspm *hdspm) > { ... > + 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ALSA: hdspm - AES32: Enable TCO/Sync-In in snd_hdspm_put_sync_ref() 2013-09-05 14:50 ` ALSA: hdspm - AES32: Enable TCO/Sync-In in snd_hdspm_put_sync_ref() Dave Jones @ 2013-09-05 15:01 ` Takashi Iwai 2013-09-05 15:21 ` Dave Jones 0 siblings, 1 reply; 3+ messages in thread From: Takashi Iwai @ 2013-09-05 15:01 UTC (permalink / raw) To: Dave Jones; +Cc: Linux Kernel Mailing List, adi At Thu, 5 Sep 2013 10:50:13 -0400, Dave Jones wrote: > > On Thu, Sep 05, 2013 at 01:38:37AM +0000, Linux Kernel wrote: > > Gitweb: http://git.kernel.org/linus/;a=commit;h=2d60fc7f7d3d79e5646646bb34811961f19d111a > > Commit: 2d60fc7f7d3d79e5646646bb34811961f19d111a > > Parent: dbae4a0c8d8794df1a6bd7e644ed94b915f46f7e > > Author: Adrian Knoth <adi@drcomp.erfurt.thur.de> > > AuthorDate: Fri Jul 5 11:28:15 2013 +0200 > > Committer: Takashi Iwai <tiwai@suse.de> > > CommitDate: Fri Jul 5 14:52:42 2013 +0200 > > > > ALSA: hdspm - AES32: Enable TCO/Sync-In in snd_hdspm_put_sync_ref() > > > static int hdspm_autosync_ref(struct hdspm *hdspm) > > { > ... > > + 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: ALSA: hdspm - AES32: Enable TCO/Sync-In in snd_hdspm_put_sync_ref() 2013-09-05 15:01 ` Takashi Iwai @ 2013-09-05 15:21 ` Dave Jones 0 siblings, 0 replies; 3+ messages in thread From: Dave Jones @ 2013-09-05 15:21 UTC (permalink / raw) To: Takashi Iwai; +Cc: Linux Kernel Mailing List, adi On Thu, Sep 05, 2013 at 05:01:20PM +0200, Takashi Iwai wrote: > At Thu, 5 Sep 2013 10:50:13 -0400, > Dave Jones wrote: > > > > On Thu, Sep 05, 2013 at 01:38:37AM +0000, Linux Kernel wrote: > > > Gitweb: http://git.kernel.org/linus/;a=commit;h=2d60fc7f7d3d79e5646646bb34811961f19d111a > > > Commit: 2d60fc7f7d3d79e5646646bb34811961f19d111a > > > Parent: dbae4a0c8d8794df1a6bd7e644ed94b915f46f7e > > > Author: Adrian Knoth <adi@drcomp.erfurt.thur.de> > > > AuthorDate: Fri Jul 5 11:28:15 2013 +0200 > > > Committer: Takashi Iwai <tiwai@suse.de> > > > CommitDate: Fri Jul 5 14:52:42 2013 +0200 > > > > > > ALSA: hdspm - AES32: Enable TCO/Sync-In in snd_hdspm_put_sync_ref() > > > > > static int hdspm_autosync_ref(struct hdspm *hdspm) > > > { > > ... > > > + 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 :) Good point. hmm, I thought we had a within_range function (maybe it was driver specific) Dave ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-09-05 15:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20130905013837.9F84A660DA9@gitolite.kernel.org>
2013-09-05 14:50 ` ALSA: hdspm - AES32: Enable TCO/Sync-In in snd_hdspm_put_sync_ref() Dave Jones
2013-09-05 15:01 ` Takashi Iwai
2013-09-05 15:21 ` Dave Jones
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.