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?

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to