Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: Drop __bitwise and typedefs for snd_device attributes

Using __bitwise and typedefs for the attributes of snd_device struct
isn't so useful, and rather it worsens the readability. Let's drop
them and use the straightforward enum.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

+37 -34
+31 -28
include/sound/core.h
··· 48 48 49 49 #define SNDRV_DEV_TYPE_RANGE_SIZE 0x1000 50 50 51 - typedef int __bitwise snd_device_type_t; 52 - #define SNDRV_DEV_TOPLEVEL ((__force snd_device_type_t) 0) 53 - #define SNDRV_DEV_CONTROL ((__force snd_device_type_t) 1) 54 - #define SNDRV_DEV_LOWLEVEL_PRE ((__force snd_device_type_t) 2) 55 - #define SNDRV_DEV_LOWLEVEL_NORMAL ((__force snd_device_type_t) 0x1000) 56 - #define SNDRV_DEV_PCM ((__force snd_device_type_t) 0x1001) 57 - #define SNDRV_DEV_RAWMIDI ((__force snd_device_type_t) 0x1002) 58 - #define SNDRV_DEV_TIMER ((__force snd_device_type_t) 0x1003) 59 - #define SNDRV_DEV_SEQUENCER ((__force snd_device_type_t) 0x1004) 60 - #define SNDRV_DEV_HWDEP ((__force snd_device_type_t) 0x1005) 61 - #define SNDRV_DEV_INFO ((__force snd_device_type_t) 0x1006) 62 - #define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007) 63 - #define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008) 64 - #define SNDRV_DEV_JACK ((__force snd_device_type_t) 0x1009) 65 - #define SNDRV_DEV_COMPRESS ((__force snd_device_type_t) 0x100A) 66 - #define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000) 51 + enum snd_device_type { 52 + SNDRV_DEV_TOPLEVEL = 0, 53 + SNDRV_DEV_CONTROL = 1, 54 + SNDRV_DEV_LOWLEVEL_PRE = 2, 55 + SNDRV_DEV_LOWLEVEL_NORMAL = 0x1000, 56 + SNDRV_DEV_PCM, 57 + SNDRV_DEV_RAWMIDI, 58 + SNDRV_DEV_TIMER, 59 + SNDRV_DEV_SEQUENCER, 60 + SNDRV_DEV_HWDEP, 61 + SNDRV_DEV_INFO, 62 + SNDRV_DEV_BUS, 63 + SNDRV_DEV_CODEC, 64 + SNDRV_DEV_JACK, 65 + SNDRV_DEV_COMPRESS, 66 + SNDRV_DEV_LOWLEVEL = 0x2000, 67 + }; 67 68 68 - typedef int __bitwise snd_device_state_t; 69 - #define SNDRV_DEV_BUILD ((__force snd_device_state_t) 0) 70 - #define SNDRV_DEV_REGISTERED ((__force snd_device_state_t) 1) 71 - #define SNDRV_DEV_DISCONNECTED ((__force snd_device_state_t) 2) 69 + enum snd_device_state { 70 + SNDRV_DEV_BUILD, 71 + SNDRV_DEV_REGISTERED, 72 + SNDRV_DEV_DISCONNECTED, 73 + }; 72 74 73 - typedef int __bitwise snd_device_cmd_t; 74 - #define SNDRV_DEV_CMD_PRE ((__force snd_device_cmd_t) 0) 75 - #define SNDRV_DEV_CMD_NORMAL ((__force snd_device_cmd_t) 1) 76 - #define SNDRV_DEV_CMD_POST ((__force snd_device_cmd_t) 2) 75 + enum snd_device_cmd { 76 + SNDRV_DEV_CMD_PRE, 77 + SNDRV_DEV_CMD_NORMAL, 78 + SNDRV_DEV_CMD_POST, 79 + }; 77 80 78 81 struct snd_device; 79 82 ··· 89 86 struct snd_device { 90 87 struct list_head list; /* list of registered devices */ 91 88 struct snd_card *card; /* card which holds this device */ 92 - snd_device_state_t state; /* state of the device */ 93 - snd_device_type_t type; /* device type */ 89 + enum snd_device_state state; /* state of the device */ 90 + enum snd_device_type type; /* device type */ 94 91 void *device_data; /* device structure */ 95 92 struct snd_device_ops *ops; /* operations */ 96 93 }; ··· 314 311 315 312 /* device.c */ 316 313 317 - int snd_device_new(struct snd_card *card, snd_device_type_t type, 314 + int snd_device_new(struct snd_card *card, enum snd_device_type type, 318 315 void *device_data, struct snd_device_ops *ops); 319 316 int snd_device_register(struct snd_card *card, void *device_data); 320 317 int snd_device_register_all(struct snd_card *card); 321 318 int snd_device_disconnect(struct snd_card *card, void *device_data); 322 319 int snd_device_disconnect_all(struct snd_card *card); 323 320 int snd_device_free(struct snd_card *card, void *device_data); 324 - int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd); 321 + int snd_device_free_all(struct snd_card *card, enum snd_device_cmd cmd); 325 322 326 323 /* isadma.c */ 327 324
+1 -1
sound/aoa/aoa.h
··· 116 116 struct snd_card *alsa_card; 117 117 }; 118 118 119 - extern int aoa_snd_device_new(snd_device_type_t type, 119 + extern int aoa_snd_device_new(enum snd_device_type type, 120 120 void * device_data, struct snd_device_ops * ops); 121 121 extern struct snd_card *aoa_get_card(void); 122 122 extern int aoa_snd_ctl_add(struct snd_kcontrol* control);
+1 -1
sound/aoa/core/alsa.c
··· 59 59 } 60 60 } 61 61 62 - int aoa_snd_device_new(snd_device_type_t type, 62 + int aoa_snd_device_new(enum snd_device_type type, 63 63 void * device_data, struct snd_device_ops * ops) 64 64 { 65 65 struct snd_card *card = aoa_get_card();
+4 -4
sound/core/device.c
··· 41 41 * 42 42 * Return: Zero if successful, or a negative error code on failure. 43 43 */ 44 - int snd_device_new(struct snd_card *card, snd_device_type_t type, 44 + int snd_device_new(struct snd_card *card, enum snd_device_type type, 45 45 void *device_data, struct snd_device_ops *ops) 46 46 { 47 47 struct snd_device *dev; ··· 223 223 * release all the devices on the card. 224 224 * called from init.c 225 225 */ 226 - int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd) 226 + int snd_device_free_all(struct snd_card *card, enum snd_device_cmd cmd) 227 227 { 228 228 struct snd_device *dev; 229 229 int err; ··· 231 231 232 232 if (snd_BUG_ON(!card)) 233 233 return -ENXIO; 234 - range_low = (__force unsigned int)cmd * SNDRV_DEV_TYPE_RANGE_SIZE; 234 + range_low = (unsigned int)cmd * SNDRV_DEV_TYPE_RANGE_SIZE; 235 235 range_high = range_low + SNDRV_DEV_TYPE_RANGE_SIZE - 1; 236 236 __again: 237 237 list_for_each_entry(dev, &card->devices, list) { 238 - type = (__force unsigned int)dev->type; 238 + type = (unsigned int)dev->type; 239 239 if (type >= range_low && type <= range_high) { 240 240 if ((err = snd_device_free(card, dev->device_data)) < 0) 241 241 return err;