Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 32 additions & 7 deletions drivers/platform/surface/aggregator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,10 @@ static int ssam_serial_hub_probe(struct serdev_device *serdev)
acpi_status astatus;
int status;

if (gpiod_count(&serdev->dev, NULL) < 0)
if (gpiod_count(&serdev->dev, NULL) < 0) {
dev_err(&serdev->dev, "no GPIO found\n");
return -ENODEV;
}

status = devm_acpi_dev_add_driver_gpios(&serdev->dev, ssam_acpi_gpios);
if (status)
Expand All @@ -637,21 +639,36 @@ static int ssam_serial_hub_probe(struct serdev_device *serdev)

/* Initialize controller. */
status = ssam_controller_init(ctrl, serdev);
if (status)
if (status) {
dev_err_probe(&serdev->dev, status,
"failed to initialize ssam controller\n");
goto err_ctrl_init;
}

ssam_controller_lock(ctrl);

/* Set up serdev device. */
serdev_device_set_drvdata(serdev, ctrl);
serdev_device_set_client_ops(serdev, &ssam_serdev_ops);

/* The following step can fail when it's called too early before the
* underlying uart device is ready (in this case -ENXIO is returned).
* Instead of simply giving up and losing everything, we can defer
* the probing by returning -EPROBE_DEFER so that the kernel would be
* able to retry later. */
status = serdev_device_open(serdev);
if (status)
if (status == -ENXIO)
status = -EPROBE_DEFER;
if (status) {
dev_err_probe(&serdev->dev, status,
"failed to open serdev device\n");
goto err_devopen;
}

astatus = ssam_serdev_setup_via_acpi(ssh->handle, serdev);
if (ACPI_FAILURE(astatus)) {
status = -ENXIO;
dev_err(&serdev->dev, "failed to setup serdev\n");
goto err_devinit;
}

Expand All @@ -667,25 +684,33 @@ static int ssam_serial_hub_probe(struct serdev_device *serdev)
* states.
*/
status = ssam_log_firmware_version(ctrl);
if (status)
if (status) {
dev_err(&serdev->dev, "failed to get firmware version\n");
goto err_initrq;
}

status = ssam_ctrl_notif_d0_entry(ctrl);
if (status)
if (status) {
dev_err(&serdev->dev, "failed to notify EC of entry of D0\n");
goto err_initrq;
}

status = ssam_ctrl_notif_display_on(ctrl);
if (status)
if (status) {
dev_err(&serdev->dev, "failed to notify EC of display on\n");
goto err_initrq;
}

status = sysfs_create_group(&serdev->dev.kobj, &ssam_sam_group);
if (status)
goto err_initrq;

/* Set up IRQ. */
status = ssam_irq_setup(ctrl);
if (status)
if (status) {
dev_err_probe(&serdev->dev, status, "failed to setup IRQ\n");
goto err_irq;
}

/* Finally, set main controller reference. */
status = ssam_try_set_controller(ctrl);
Expand Down