Re: f_uac2: why do you save two u8 in one u16?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 14, 2012 at 12:53:56PM +0200, Sebastian Andrzej Siewior wrote:
> looking at f_uac2.c I found this interresting piece of code:
> 
> |struct audio_dev {
> |         /* Currently active {Interface[15:8] | AltSettings[7:0]} */
> |         __u16 ac_alt, as_out_alt, as_in_alt;
> | 
> |};
> |
> | 
> |#define ALT_SET(x, a)   do {(x) &= ~0xff; (x) |= (a); } while (0)
> |#define ALT_GET(x)      ((x) & 0xff)
> |#define INTF_SET(x, i)  do {(x) &= 0xff; (x) |= ((i) << 8); } while (0)
> |#define INTF_GET(x)     ((x >> 8) & 0xff)
> | 
> |    ALT_SET(agdev->as_out_alt, 0);
> |    INTF_SET(agdev->as_out_alt, ret);
> | 
> 
> Could one of you two explain to me why smashing two different things (an
> interface number and an alternative setting number) into one variable
> and using a Macro to seperate them again was a good idea?

Another thing. alsa_uac2_init() calling platform_device_register() and
platform_driver_register()? Why is that helpful can't you just call
snd_uac2_probe() right away?

You have poor (read as non-existing) error recovery in case something
goes wrong during the allocation endpoint/interface/request.

What do I need to test this gadget?
 
Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux