kernel-device: simplify handling of platform/pci/pnp/sdio parent
This patch simplifies the handling of platform/pci/pnp/sdio device in find_physical_gudevdevice(). When the code finds the first parent device under the subsystem 'platform', 'pci', 'pnp', or 'sdio', it stops traversing up the device tree, so there is no need to keep track of whether a platform / pci / pnp / sdio device has previously been visited via those is_platform/is_pci/is_pnp/is_sdio Boolean variables.
This commit is contained in:
@@ -177,8 +177,7 @@ find_physical_gudevdevice (GUdevDevice *child)
|
|||||||
GUdevDevice *physdev = NULL;
|
GUdevDevice *physdev = NULL;
|
||||||
const char *subsys, *type, *name;
|
const char *subsys, *type, *name;
|
||||||
guint32 i = 0;
|
guint32 i = 0;
|
||||||
gboolean is_usb = FALSE, is_pci = FALSE, is_pcmcia = FALSE, is_platform = FALSE;
|
gboolean is_usb = FALSE, is_pcmcia = FALSE;
|
||||||
gboolean is_pnp = FALSE, is_sdio = FALSE;
|
|
||||||
|
|
||||||
g_return_val_if_fail (child != NULL, NULL);
|
g_return_val_if_fail (child != NULL, NULL);
|
||||||
|
|
||||||
@@ -220,21 +219,11 @@ find_physical_gudevdevice (GUdevDevice *child)
|
|||||||
if (physdev)
|
if (physdev)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (is_platform || !strcmp (subsys, "platform")) {
|
} else if (!strcmp (subsys, "platform") ||
|
||||||
/* Take the first platform parent as the physical device */
|
!strcmp (subsys, "pci") ||
|
||||||
is_platform = TRUE;
|
!strcmp (subsys, "pnp") ||
|
||||||
physdev = iter;
|
!strcmp (subsys, "sdio")) {
|
||||||
break;
|
/* Take the first parent as the physical device */
|
||||||
} else if (is_pci || !strcmp (subsys, "pci")) {
|
|
||||||
is_pci = TRUE;
|
|
||||||
physdev = iter;
|
|
||||||
break;
|
|
||||||
} else if (is_pnp || !strcmp (subsys, "pnp")) {
|
|
||||||
is_pnp = TRUE;
|
|
||||||
physdev = iter;
|
|
||||||
break;
|
|
||||||
} else if (is_sdio || !strcmp (subsys, "sdio")) {
|
|
||||||
is_sdio = TRUE;
|
|
||||||
physdev = iter;
|
physdev = iter;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user