From 5fa34988faa11b12cc9dcad6c0667b6efceb6bc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Tue, 9 Jan 2024 15:24:49 +0100 Subject: [PATCH] spa: alsa,v4l2: use proper enum for action An enum provides better debugging experience and makes the source code easier to grasp. --- spa/plugins/alsa/alsa-udev.c | 10 ++++++---- spa/plugins/v4l2/v4l2-udev.c | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/spa/plugins/alsa/alsa-udev.c b/spa/plugins/alsa/alsa-udev.c index 39b98e908..8de472907 100644 --- a/spa/plugins/alsa/alsa-udev.c +++ b/spa/plugins/alsa/alsa-udev.c @@ -31,9 +31,11 @@ #define MAX_CARDS 64 -#define ACTION_ADD 0 -#define ACTION_REMOVE 1 -#define ACTION_DISABLE 2 +enum action { + ACTION_ADD, + ACTION_REMOVE, + ACTION_DISABLE, +}; /* Used for unavailable devices in the card structure. */ #define ID_DEVICE_NOT_SUPPORTED 0 @@ -715,7 +717,7 @@ static bool check_access(struct impl *this, struct card *card) 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; struct card *card; diff --git a/spa/plugins/v4l2/v4l2-udev.c b/spa/plugins/v4l2/v4l2-udev.c index 733f3da2a..c2a350cd9 100644 --- a/spa/plugins/v4l2/v4l2-udev.c +++ b/spa/plugins/v4l2/v4l2-udev.c @@ -28,9 +28,11 @@ #define MAX_DEVICES 64 -#define ACTION_ADD 0 -#define ACTION_REMOVE 1 -#define ACTION_DISABLE 2 +enum action { + ACTION_ADD, + ACTION_REMOVE, + ACTION_DISABLE, +}; struct device { uint32_t id; @@ -357,7 +359,7 @@ static bool check_access(struct impl *this, struct device *device) 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; struct device *device;