From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, clemens@ladisch.de
Subject: Re: [PATCH v2 07/10] ALSA: oxfw: code refactoring for jumbo-payload quirk in OXFW970
Date: Tue, 18 May 2021 10:45:01 +0900 [thread overview]
Message-ID: <20210518014501.GA37317@workstation> (raw)
In-Reply-To: <s5hsg2l67ys.wl-tiwai@suse.de>
On Mon, May 17, 2021 at 11:11:07AM +0200, Takashi Iwai wrote:
> On Sat, 15 May 2021 09:11:09 +0200,
> Takashi Sakamoto wrote:
> > --- a/sound/firewire/oxfw/oxfw.h
> > +++ b/sound/firewire/oxfw/oxfw.h
> > @@ -32,6 +32,12 @@
> > #include "../amdtp-am824.h"
> > #include "../cmp.h"
> >
> > +enum snd_oxfw_quirk {
> > + // Postpone transferring packets during handling asynchronous transaction. As a result,
> > + // next isochronous packet includes more events than one packet can include.
> > + SND_OXFW_QUIRK_JUMBO_PAYLOAD = 0x01,
> > +};
> > +
> > /* This is an arbitrary number for convinience. */
> > #define SND_OXFW_STREAM_FORMAT_ENTRIES 10
> > struct snd_oxfw {
> > @@ -43,6 +49,7 @@ struct snd_oxfw {
> > bool registered;
> > struct delayed_work dwork;
> >
> > + enum snd_oxfw_quirk quirks;
>
> Declaring the field as this enum type for bit flags isn't really
> right, IMO. Usually an enum *type* is used for storing only the
> enumerated values as-is, but the actual code (in a later patch) stores
> the combination of the defined values as bits.
> That is, if a field is defined with an enum type, readers and
> compilers may believe that only the defined values are stored there,
> while the code doesn't follow that, which is a confusing situation.
>
> I see that a similar pattern is used already in the firewire code, but
> I don't think this justifies to introduce it to yet another place.
The concern is in the category of human practice, and heuristics, in my
opinion.
I check C language specification and it says that enumeration-constant
has type int, and enumerated type shall be compatible with char, a signed
integer type, or an unsigned integer type and the choice of type is
implementation-defined. The assignment of ORed enumeration-constant (int)
to enumerated type (int with 32 bit storage in most System V ABIs) is not
forbidden past and future though the specification mentions about its
warnings in the annex.
Nevertheless, the practical point should be respected as well. I'll
prepare take 3 patchset including fix for some issued points.
Thanks
Takashi Sakamoto
next prev parent reply other threads:[~2021-05-18 1:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-15 7:11 [PATCH v2 00/10] ALSA: oxfw: code refactoring for quirks specific to ASICs Takashi Sakamoto
2021-05-15 7:11 ` [PATCH v2 01/10] Revert "ALSA: bebob/oxfw: fix Kconfig entry for Mackie d.2 Pro" Takashi Sakamoto
2021-05-15 7:11 ` [PATCH v2 02/10] ALSA: oxfw: code refactoring for existent device entry with specifier_id and version Takashi Sakamoto
2021-05-15 7:11 ` [PATCH v2 03/10] ALSA: oxfw: code refactoring to detect mackie models Takashi Sakamoto
2021-05-15 7:11 ` [PATCH v2 04/10] ALSA: oxfw: add explicit device entry for Loud Technologies Tapco Link.FireWire 4x6 Takashi Sakamoto
2021-05-15 7:11 ` [PATCH v2 05/10] ALSA: oxfw: add explicit device entry for Loud Technologies Mackie Onyx Sattelite Takashi Sakamoto
2021-05-15 7:11 ` [PATCH v2 06/10] ALSA: oxfw: add comment for the type of ASICs Takashi Sakamoto
2021-05-15 7:11 ` [PATCH v2 07/10] ALSA: oxfw: code refactoring for jumbo-payload quirk in OXFW970 Takashi Sakamoto
2021-05-17 9:11 ` Takashi Iwai
2021-05-18 1:45 ` Takashi Sakamoto [this message]
2021-05-15 7:11 ` [PATCH v2 08/10] ALSA: firewire-lib: code refactoring for jumbo payload quirk Takashi Sakamoto
2021-05-15 7:11 ` [PATCH v2 09/10] ALSA: oxfw; code refactoring for wrong_dbs quirk Takashi Sakamoto
2021-05-17 9:11 ` Takashi Iwai
2021-05-15 7:11 ` [PATCH v2 10/10] ALSA: oxfw: add quirk flag for blocking transmission method Takashi Sakamoto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210518014501.GA37317@workstation \
--to=o-takashi@sakamocchi.jp \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox