[pulseaudio-discuss] [PATCH v2 01/21] Remove pa_device_port_new_data.create_node

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Thu Dec 5 06:19:01 PST 2013


Every port should have a node, so we don't need the create_node flag.
---
 src/modules/alsa/alsa-mixer.c                   |  1 -
 src/modules/alsa/alsa-ucm.c                     |  1 -
 src/modules/bluetooth/module-bluetooth-device.c |  2 --
 src/pulsecore/device-port.c                     | 24 ++++++++----------------
 src/pulsecore/device-port.h                     |  2 --
 5 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index c1fa72c..8f85677 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -4497,7 +4497,6 @@ static pa_device_port* device_port_alsa_init(pa_hashmap *ports, /* card ports */
         pa_device_port_new_data_set_name(&port_data, name);
         pa_device_port_new_data_set_description(&port_data, description);
         pa_device_port_new_data_set_direction(&port_data, path->direction == PA_ALSA_DIRECTION_OUTPUT ? PA_DIRECTION_OUTPUT : PA_DIRECTION_INPUT);
-        pa_device_port_new_data_set_create_node(&port_data, true);
         pa_node_new_data_set_fallback_name_prefix(&port_data.node_data, "alsa");
 
         p = pa_device_port_new(core, &port_data, sizeof(pa_alsa_port_data));
diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
index 6c1310e..b1f1518 100644
--- a/src/modules/alsa/alsa-ucm.c
+++ b/src/modules/alsa/alsa-ucm.c
@@ -729,7 +729,6 @@ static void ucm_add_port_combination(
         pa_device_port_new_data_set_name(&port_data, name);
         pa_device_port_new_data_set_description(&port_data, desc);
         pa_device_port_new_data_set_direction(&port_data, is_sink ? PA_DIRECTION_OUTPUT : PA_DIRECTION_INPUT);
-        pa_device_port_new_data_set_create_node(&port_data, true);
         pa_node_new_data_set_fallback_name_prefix(&port_data.node_data, "alsa");
 
         port = pa_device_port_new(core, &port_data, 0);
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index fb76744..34745fd 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -2140,7 +2140,6 @@ static int create_card_ports(struct userdata *u, pa_hashmap *ports) {
     pa_device_port_new_data_set_description(&port_data, output_description);
     pa_device_port_new_data_set_direction(&port_data, PA_DIRECTION_OUTPUT);
     pa_device_port_new_data_set_available(&port_data, get_port_availability(u, PA_DIRECTION_OUTPUT));
-    pa_device_port_new_data_set_create_node(&port_data, true);
     pa_node_new_data_set_fallback_name_prefix(&port_data.node_data, "bluetooth");
 
     output_port = pa_device_port_new(u->core, &port_data, 0);
@@ -2156,7 +2155,6 @@ static int create_card_ports(struct userdata *u, pa_hashmap *ports) {
     pa_device_port_new_data_set_description(&port_data, input_description);
     pa_device_port_new_data_set_direction(&port_data, PA_DIRECTION_INPUT);
     pa_device_port_new_data_set_available(&port_data, get_port_availability(u, PA_DIRECTION_INPUT));
-    pa_device_port_new_data_set_create_node(&port_data, true);
     pa_node_new_data_set_fallback_name_prefix(&port_data.node_data, "bluetooth");
 
     input_port = pa_device_port_new(u->core, &port_data, 0);
diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c
index 8435c1f..9801e35 100644
--- a/src/pulsecore/device-port.c
+++ b/src/pulsecore/device-port.c
@@ -64,12 +64,6 @@ void pa_device_port_new_data_set_direction(pa_device_port_new_data *data, pa_dir
     pa_node_new_data_set_direction(&data->node_data, direction);
 }
 
-void pa_device_port_new_data_set_create_node(pa_device_port_new_data *data, bool create) {
-    pa_assert(data);
-
-    data->create_node = create;
-}
-
 void pa_device_port_new_data_done(pa_device_port_new_data *data) {
     pa_assert(data);
 
@@ -144,19 +138,17 @@ pa_device_port *pa_device_port_new(pa_core *c, pa_device_port_new_data *data, si
     p->latency_offset = 0;
     p->proplist = pa_proplist_new();
 
-    if (data->create_node) {
-        if (!data->node_data.description)
-            pa_node_new_data_set_description(&data->node_data, p->description);
+    if (!data->node_data.description)
+        pa_node_new_data_set_description(&data->node_data, p->description);
 
-        if (!(p->node = pa_node_new(p->core, &data->node_data))) {
-            pa_log("Failed to create a node for port %s.", p->name);
-            goto fail;
-        }
-
-        p->node->owner = p;
-        pa_node_put(p->node);
+    if (!(p->node = pa_node_new(p->core, &data->node_data))) {
+        pa_log("Failed to create a node for port %s.", p->name);
+        goto fail;
     }
 
+    p->node->owner = p;
+    pa_node_put(p->node);
+
     return p;
 
 fail:
diff --git a/src/pulsecore/device-port.h b/src/pulsecore/device-port.h
index a66949e..6b2a677 100644
--- a/src/pulsecore/device-port.h
+++ b/src/pulsecore/device-port.h
@@ -70,7 +70,6 @@ typedef struct pa_device_port_new_data {
     pa_available_t available;
     pa_direction_t direction;
 
-    bool create_node;
     pa_node_new_data node_data;
 } pa_device_port_new_data;
 
@@ -79,7 +78,6 @@ void pa_device_port_new_data_set_name(pa_device_port_new_data *data, const char
 void pa_device_port_new_data_set_description(pa_device_port_new_data *data, const char *description);
 void pa_device_port_new_data_set_available(pa_device_port_new_data *data, pa_available_t available);
 void pa_device_port_new_data_set_direction(pa_device_port_new_data *data, pa_direction_t direction);
-void pa_device_port_new_data_set_create_node(pa_device_port_new_data *data, bool create);
 void pa_device_port_new_data_done(pa_device_port_new_data *data);
 
 pa_device_port *pa_device_port_new(pa_core *c, pa_device_port_new_data *data, size_t extra);
-- 
1.8.3.1



More information about the pulseaudio-discuss mailing list