spa: alsa,v4l2: use proper enum for action

An enum provides better debugging experience
and makes the source code easier to grasp.

(cherry picked from commit 5fa34988fa)
This commit is contained in:
Barnabás Pőcze 2024-01-09 15:24:49 +01:00 committed by Robert Mader
parent dd03036667
commit 6aea34ff72
2 changed files with 12 additions and 8 deletions

View file

@ -31,9 +31,11 @@
#define MAX_CARDS 64 #define MAX_CARDS 64
#define ACTION_ADD 0 enum action {
#define ACTION_REMOVE 1 ACTION_ADD,
#define ACTION_DISABLE 2 ACTION_REMOVE,
ACTION_DISABLE,
};
/* Used for unavailable devices in the card structure. */ /* Used for unavailable devices in the card structure. */
#define ID_DEVICE_NOT_SUPPORTED 0 #define ID_DEVICE_NOT_SUPPORTED 0
@ -718,7 +720,7 @@ static bool check_access(struct impl *this, struct card *card)
return card->accessible; return card->accessible;
} }
static void process_card(struct impl *this, uint32_t action, struct udev_device *udev_device) static void process_card(struct impl *this, enum action action, struct udev_device *udev_device)
{ {
unsigned int card_nr; unsigned int card_nr;
struct card *card; struct card *card;

View file

@ -28,9 +28,11 @@
#define MAX_DEVICES 64 #define MAX_DEVICES 64
#define ACTION_ADD 0 enum action {
#define ACTION_REMOVE 1 ACTION_ADD,
#define ACTION_DISABLE 2 ACTION_REMOVE,
ACTION_DISABLE,
};
struct device { struct device {
uint32_t id; uint32_t id;
@ -357,7 +359,7 @@ static bool check_access(struct impl *this, struct device *device)
return device->accessible; return device->accessible;
} }
static void process_device(struct impl *this, uint32_t action, struct udev_device *dev) static void process_device(struct impl *this, enum action action, struct udev_device *dev)
{ {
uint32_t id; uint32_t id;
struct device *device; struct device *device;