Remove duplicate ->probe() calls to speed up startup by 150ms

Now incorporate is fixed to copy across the properties we need in the
superclass, we don't need to do the subclass ->probe().

Note, we still need to do the subclassed ->probe() when using
FU_UDEV_DEVICE_FLAG_VENDOR_FROM_PARENT or when looking at properties
on the parent device.

This also removes the spurious 'already set GType to FuVliUsbhubDevice,
ignoring FuVliUsbhubDevice' messages when running the daemon.
This commit is contained in:
Richard Hughes 2022-06-09 08:53:01 +01:00
parent 21e3ef4347
commit faa7871b08
32 changed files with 1 additions and 141 deletions

View File

@ -118,10 +118,6 @@ fu_i2c_device_probe(FuDevice *device, GError **error)
g_autoptr(GRegex) regex = NULL;
#endif
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_i2c_device_parent_class)->probe(device, error))
return FALSE;
/* set physical ID */
if (!fu_udev_device_set_physical_id(FU_UDEV_DEVICE(device), "i2c", error))
return FALSE;

View File

@ -233,9 +233,6 @@ fu_analogix_device_find_interface(FuUsbDevice *device, GError **error)
static gboolean
fu_analogix_device_probe(FuDevice *device, GError **error)
{
/* FuUsbDevice->probe */
if (!FU_DEVICE_CLASS(fu_analogix_device_parent_class)->probe(device, error))
return FALSE;
if (!fu_analogix_device_find_interface(FU_USB_DEVICE(device), error)) {
g_prefix_error(error, "failed to find update interface: ");
return FALSE;

View File

@ -468,10 +468,6 @@ fu_ata_device_probe(FuDevice *device, GError **error)
FuAtaDevice *self = FU_ATA_DEVICE(device);
GUdevDevice *udev_device = fu_udev_device_get_dev(FU_UDEV_DEVICE(device));
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_ata_device_parent_class)->probe(device, error))
return FALSE;
/* check is valid */
if (g_strcmp0(g_udev_device_get_devtype(udev_device), "disk") != 0) {
g_set_error(error,

View File

@ -58,10 +58,6 @@ fu_bcm57xx_device_probe(FuDevice *device, GError **error)
g_autofree gchar *fn = NULL;
g_autoptr(GPtrArray) ifaces = NULL;
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_bcm57xx_device_parent_class)->probe(device, error))
return FALSE;
/* only enumerate number 0 */
if (fu_udev_device_get_number(FU_UDEV_DEVICE(device)) != 0) {
g_set_error_literal(error,

View File

@ -878,9 +878,6 @@ fu_bcm57xx_recovery_device_init(FuBcm57xxRecoveryDevice *self)
static gboolean
fu_bcm57xx_recovery_device_probe(FuDevice *device, GError **error)
{
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_bcm57xx_recovery_device_parent_class)->probe(device, error))
return FALSE;
return fu_udev_device_set_physical_id(FU_UDEV_DEVICE(device), "pci", error);
}

View File

@ -333,10 +333,6 @@ fu_colorhug_device_probe(FuDevice *device, GError **error)
{
FuColorhugDevice *self = FU_COLORHUG_DEVICE(device);
/* FuUsbDevice->probe */
if (!FU_DEVICE_CLASS(fu_colorhug_device_parent_class)->probe(device, error))
return FALSE;
/* compact memory layout */
if (fu_device_has_private_flag(device, FU_COLORHUG_DEVICE_FLAG_HALFSIZE))
self->start_addr = CH_EEPROM_ADDR_RUNCODE_ALS;

View File

@ -154,10 +154,6 @@ fu_cros_ec_usb_device_probe(FuDevice *device, GError **error)
{
FuCrosEcUsbDevice *self = FU_CROS_EC_USB_DEVICE(device);
/* FuUsbDevice->probe */
if (!FU_DEVICE_CLASS(fu_cros_ec_usb_device_parent_class)->probe(device, error))
return FALSE;
/* very much like usb_updater2's usb_findit() */
if (!fu_cros_ec_usb_device_find_interface(FU_USB_DEVICE(device), error)) {

View File

@ -397,20 +397,6 @@ fu_dfu_csr_device_download(FuDevice *device,
return fu_dfu_csr_device_download_chunk(self, idx, blob_empty, error);
}
static gboolean
fu_dfu_csr_device_probe(FuDevice *device, GError **error)
{
/* FuUsbDevice->probe */
if (!FU_DEVICE_CLASS(fu_dfu_csr_device_parent_class)->probe(device, error))
return FALSE;
/* hardcoded */
fu_device_add_flag(device, FWUPD_DEVICE_FLAG_UPDATABLE);
/* success */
return TRUE;
}
static gboolean
fu_dfu_csr_device_setup(FuDevice *device, GError **error)
{
@ -443,6 +429,7 @@ fu_dfu_csr_device_init(FuDfuCsrDevice *self)
{
fu_device_add_protocol(FU_DEVICE(self), "com.qualcomm.dfu");
fu_device_add_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_CAN_VERIFY_IMAGE);
fu_device_add_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_UPDATABLE);
fu_device_add_internal_flag(FU_DEVICE(self), FU_DEVICE_INTERNAL_FLAG_REPLUG_MATCH_GUID);
fu_device_set_firmware_gtype(FU_DEVICE(self), FU_TYPE_DFU_FIRMWARE);
fu_device_register_private_flag(FU_DEVICE(self),
@ -459,6 +446,5 @@ fu_dfu_csr_device_class_init(FuDfuCsrDeviceClass *klass)
klass_device->dump_firmware = fu_dfu_csr_device_upload;
klass_device->attach = fu_dfu_csr_device_attach;
klass_device->setup = fu_dfu_csr_device_setup;
klass_device->probe = fu_dfu_csr_device_probe;
klass_device->set_progress = fu_dfu_csr_device_set_progress;
}

View File

@ -1144,10 +1144,6 @@ fu_dfu_device_probe(FuDevice *device, GError **error)
FuDfuDevice *self = FU_DFU_DEVICE(device);
GUsbDevice *usb_device = fu_usb_device_get_dev(FU_USB_DEVICE(device));
/* FuUsbDevice->probe */
if (!FU_DEVICE_CLASS(fu_dfu_device_parent_class)->probe(device, error))
return FALSE;
/* add all the targets */
if (!fu_dfu_device_add_targets(self, error)) {
g_prefix_error(error,

View File

@ -631,10 +631,6 @@ fu_ebitdo_device_attach(FuDevice *device, FuProgress *progress, GError **error)
static gboolean
fu_ebitdo_device_probe(FuDevice *device, GError **error)
{
/* FuUsbDevice->probe */
if (!FU_DEVICE_CLASS(fu_ebitdo_device_parent_class)->probe(device, error))
return FALSE;
/* allowed, but requires manual bootloader step */
fu_device_add_flag(device, FWUPD_DEVICE_FLAG_UPDATABLE);
fu_device_set_remove_delay(device, FU_DEVICE_REMOVE_DELAY_USER_REPLUG);

View File

@ -48,10 +48,6 @@ fu_elantp_hid_device_to_string(FuDevice *device, guint idt, GString *str)
static gboolean
fu_elantp_hid_device_probe(FuDevice *device, GError **error)
{
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_elantp_hid_device_parent_class)->probe(device, error))
return FALSE;
/* check is valid */
if (g_strcmp0(fu_udev_device_get_subsystem(FU_UDEV_DEVICE(device)), "hidraw") != 0) {
g_set_error(error,

View File

@ -49,10 +49,6 @@ fu_elantp_i2c_device_to_string(FuDevice *device, guint idt, GString *str)
static gboolean
fu_elantp_i2c_device_probe(FuDevice *device, GError **error)
{
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_elantp_i2c_device_parent_class)->probe(device, error))
return FALSE;
/* check is valid */
if (g_strcmp0(fu_udev_device_get_subsystem(FU_UDEV_DEVICE(device)), "i2c-dev") != 0) {
g_set_error(error,

View File

@ -144,10 +144,6 @@ fu_emmc_device_probe(FuDevice *device, GError **error)
g_autofree gchar *vendor_id = NULL;
g_autoptr(GRegex) dev_regex = NULL;
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_emmc_device_parent_class)->probe(device, error))
return FALSE;
udev_parent = g_udev_device_get_parent_with_subsystem(udev_device, "mmc", NULL);
if (udev_parent == NULL) {
g_set_error_literal(error, FWUPD_ERROR, FWUPD_ERROR_NOT_SUPPORTED, "no MMC parent");

View File

@ -58,10 +58,6 @@ fu_flashrom_device_probe(FuDevice *device, GError **error)
const gchar *dev_name = NULL;
const gchar *sysfs_path = NULL;
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_flashrom_device_parent_class)->probe(device, error))
return FALSE;
sysfs_path = fu_udev_device_get_sysfs_path(FU_UDEV_DEVICE(device));
if (sysfs_path != NULL) {
g_autofree gchar *physical_id = NULL;

View File

@ -33,10 +33,6 @@ fu_gpio_device_to_string(FuDevice *device, guint idt, GString *str)
static gboolean
fu_gpio_device_probe(FuDevice *device, GError **error)
{
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_gpio_device_parent_class)->probe(device, error))
return FALSE;
/* no device file */
if (fu_udev_device_get_device_file(FU_UDEV_DEVICE(device)) == NULL) {
g_set_error_literal(error,

View File

@ -42,10 +42,6 @@ fu_hailuck_bl_device_attach(FuDevice *device, FuProgress *progress, GError **err
static gboolean
fu_hailuck_bl_device_probe(FuDevice *device, GError **error)
{
/* FuUsbDevice->probe */
if (!FU_DEVICE_CLASS(fu_hailuck_bl_device_parent_class)->probe(device, error))
return FALSE;
/* add instance ID */
fu_device_add_instance_str(device, "MODE", "KBD");
return fu_device_build_instance_id(device, error, "USB", "VID", "PID", "MODE", NULL);

View File

@ -37,10 +37,6 @@ fu_hailuck_kbd_device_probe(FuDevice *device, GError **error)
{
g_autoptr(FuHailuckTpDevice) tp_device = fu_hailuck_tp_device_new(FU_DEVICE(device));
/* FuUsbDevice->probe */
if (!FU_DEVICE_CLASS(fu_hailuck_kbd_device_parent_class)->probe(device, error))
return FALSE;
/* add extra keyboard-specific GUID */
fu_device_add_instance_str(device, "MODE", "KBD");
if (!fu_device_build_instance_id(device, error, "USB", "VID", "PID", "MODE", NULL))

View File

@ -687,16 +687,6 @@ fu_logitech_hidpp_device_probe(FuDevice *device, GError **error)
FuLogitechHidPpDevice *self = FU_HIDPP_DEVICE(device);
FuLogitechHidPpDevicePrivate *priv = GET_PRIVATE(self);
/*
* FuUdevDevice->probe except for paired devices. We don't want
* paired devices to inherit the logical ids of the receiver.
*/
if (priv->device_idx == HIDPP_DEVICE_IDX_UNSET ||
priv->device_idx == HIDPP_DEVICE_IDX_BLE) {
if (!FU_DEVICE_CLASS(fu_logitech_hidpp_device_parent_class)->probe(device, error))
return FALSE;
}
/* set the physical ID */
if (!fu_udev_device_set_physical_id(FU_UDEV_DEVICE(device), "hid", error))
return FALSE;

View File

@ -178,10 +178,6 @@ fu_logitech_hidpp_runtime_probe(FuDevice *device, GError **error)
g_autoptr(GUdevDevice) udev_parent = NULL;
g_autoptr(GUdevDevice) udev_parent_usb_interface = NULL;
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_logitech_hidpp_runtime_parent_class)->probe(device, error))
return FALSE;
/* set the physical ID */
if (!fu_udev_device_set_physical_id(FU_UDEV_DEVICE(device), "usb", error))
return FALSE;

View File

@ -113,10 +113,6 @@ fu_mtd_device_probe(FuDevice *device, GError **error)
guint64 size = 0;
g_autoptr(GError) error_local = NULL;
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_mtd_device_parent_class)->probe(device, error))
return FALSE;
/* set physical ID */
if (!fu_udev_device_set_physical_id(FU_UDEV_DEVICE(device), "mtd", error))
return FALSE;

View File

@ -930,10 +930,6 @@ fu_nordic_hid_cfg_channel_dfu_start(FuNordicHidCfgChannel *self,
static gboolean
fu_nordic_hid_cfg_channel_probe(FuDevice *device, GError **error)
{
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_nordic_hid_cfg_channel_parent_class)->probe(device, error))
return FALSE;
return fu_udev_device_set_physical_id(FU_UDEV_DEVICE(device), "hid", error);
}

View File

@ -48,10 +48,6 @@ fu_scsi_device_probe(FuDevice *device, GError **error)
g_autoptr(FuUdevDevice) ufshci_parent = NULL;
const gchar *subsystem_parents[] = {"pci", "platform", NULL};
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_scsi_device_parent_class)->probe(device, error))
return FALSE;
/* check is valid */
if (g_strcmp0(g_udev_device_get_devtype(udev_device), "disk") != 0) {
g_set_error(error,

View File

@ -110,10 +110,6 @@ fu_steelseries_device_probe(FuDevice *device, GError **error)
g_autoptr(GPtrArray) ifaces = NULL;
g_autoptr(GPtrArray) endpoints = NULL;
/* FuUsbDevice->probe */
if (!FU_DEVICE_CLASS(fu_steelseries_device_parent_class)->probe(device, error))
return FALSE;
ifaces = g_usb_device_get_interfaces(usb_device, error);
if (ifaces == NULL)
return FALSE;

View File

@ -494,9 +494,6 @@ fu_synaptics_rmi_hid_device_set_page(FuSynapticsRmiDevice *self, guint8 page, GE
static gboolean
fu_synaptics_rmi_hid_device_probe(FuDevice *device, GError **error)
{
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_synaptics_rmi_hid_device_parent_class)->probe(device, error))
return FALSE;
return fu_udev_device_set_physical_id(FU_UDEV_DEVICE(device), "hid", error);
}

View File

@ -782,10 +782,6 @@ fu_synaptics_rmi_ps2_device_write_bus_select(FuSynapticsRmiDevice *rmi_device,
static gboolean
fu_synaptics_rmi_ps2_device_probe(FuDevice *device, GError **error)
{
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_synaptics_rmi_ps2_device_parent_class)->probe(device, error))
return FALSE;
/* psmouse is the usual mode, but serio is needed for update */
if (g_strcmp0(fu_udev_device_get_driver(FU_UDEV_DEVICE(device)), "serio_raw") == 0) {
fu_device_add_flag(device, FWUPD_DEVICE_FLAG_IS_BOOTLOADER);

View File

@ -449,10 +449,6 @@ fu_thunderbolt_device_probe(FuDevice *device, GError **error)
{
g_autoptr(FuUdevDevice) udev_parent = NULL;
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_thunderbolt_device_parent_class)->probe(device, error))
return FALSE;
/* if the PCI ID is Intel then it's signed, no idea otherwise */
udev_parent = fu_udev_device_get_parent_with_subsystem(FU_UDEV_DEVICE(device), "pci");
if (udev_parent != NULL) {

View File

@ -79,10 +79,6 @@ fu_thunderbolt_retimer_probe(FuDevice *device, GError **error)
const gchar *devpath = fu_udev_device_get_sysfs_path(FU_UDEV_DEVICE(device));
g_autofree gchar *physical_id = g_path_get_basename(devpath);
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_thunderbolt_retimer_parent_class)->probe(device, error))
return FALSE;
/* device */
if (physical_id != NULL)
fu_device_set_physical_id(device, physical_id);

View File

@ -68,10 +68,6 @@ fu_tpm_v1_device_probe(FuDevice *device, GError **error)
g_auto(GStrv) lines = NULL;
g_autofree gchar *buf_pcrs = NULL;
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_tpm_v1_device_parent_class)->probe(device, error))
return FALSE;
/* get entire contents */
if (!g_file_get_contents(fu_udev_device_get_device_file(FU_UDEV_DEVICE(device)),
&buf_pcrs,

View File

@ -26,9 +26,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(ESYS_CONTEXT, Esys_Finalize_autoptr_cleanup)
static gboolean
fu_tpm_v2_device_probe(FuDevice *device, GError **error)
{
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_tpm_v2_device_parent_class)->probe(device, error))
return FALSE;
return fu_udev_device_set_physical_id(FU_UDEV_DEVICE(device), "tpm", error);
}

View File

@ -317,10 +317,6 @@ fu_uf2_device_probe(FuDevice *device, GError **error)
guint64 vid = 0;
guint64 pid = 0;
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_uf2_device_parent_class)->probe(device, error))
return FALSE;
/* check is valid */
tmp = g_udev_device_get_property(udev_device, "ID_BUS");
if (g_strcmp0(tmp, "usb") != 0) {

View File

@ -628,10 +628,6 @@ fu_vli_usbhub_device_probe(FuDevice *device, GError **error)
{
guint16 usbver = fu_usb_device_get_spec(FU_USB_DEVICE(device));
/* FuUsbDevice->probe */
if (!FU_DEVICE_CLASS(fu_vli_usbhub_device_parent_class)->probe(device, error))
return FALSE;
/* quirks now applied... */
if (usbver > 0x0300 || fu_device_has_private_flag(device, FU_VLI_USBHUB_DEVICE_FLAG_USB3)) {
fu_device_set_summary(device, "USB 3.x hub");

View File

@ -99,10 +99,6 @@ fu_wacom_device_check_mpu(FuWacomDevice *self, GError **error)
static gboolean
fu_wacom_device_probe(FuDevice *device, GError **error)
{
/* FuUdevDevice->probe */
if (!FU_DEVICE_CLASS(fu_wacom_device_parent_class)->probe(device, error))
return FALSE;
/* set the physical ID */
return fu_udev_device_set_physical_id(FU_UDEV_DEVICE(device), "hid", error);
}