Hi Jonas,

On 03/25/2017 11:57 AM, Jonas Bonn wrote:
The udev-monitor already guarantees that only devices with these
subsystems will be returned so we don't need to check again.
---
 plugins/udev.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/plugins/udev.c b/plugins/udev.c
index 3c90e40..196c528 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -410,7 +410,7 @@ static gboolean udev_event(GIOChannel *channel, 
GIOCondition cond,
                                                        gpointer user_data)
 {
        struct udev_device *device;
-       const char *subsystem, *action;
+       const char *action;

        if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
                ofono_warn("Error with udev monitor channel");
@@ -422,30 +422,16 @@ static gboolean udev_event(GIOChannel *channel, 
GIOCondition cond,
        if (device == NULL)
                return TRUE;

-       subsystem = udev_device_get_subsystem(device);
-       if (subsystem == NULL)
-               goto done;
-
        action = udev_device_get_action(device);
        if (action == NULL)
                goto done;

-       DBG("subsystem %s %s", subsystem, action);
-
        if (g_str_equal(action, "add") == TRUE) {
-               if (g_strcmp0(subsystem, "tty") == 0 ||
-                               g_strcmp0(subsystem, "net") == 0 ||
-                                       g_strcmp0(subsystem, "hsi") == 0)
                        add_modem(device);
        } else if (g_str_equal(action, "remove") == TRUE) {
-               if (g_strcmp0(subsystem, "tty") == 0 ||
-                               g_strcmp0(subsystem, "net") == 0 ||
-                                       g_strcmp0(subsystem, "hsi") == 0)
                        remove_modem(device);
        }

This resulted in some weirdness in indentation / style, so I amended this patch to remove the now unneeded {} from the if/else if


-       DBG("subsystem %s finished", subsystem);
-
 done:
        udev_device_unref(device);



Applied, thanks.

Regards,
-Denis
_______________________________________________
ofono mailing list
[email protected]
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to