From: Hans de Goede <hdegoede@redhat.com>
To: Weifeng Liu <weifeng.liu.z@gmail.com>,
platform-driver-x86@vger.kernel.org,
linux-serial@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@intel.com>,
Maximilian Luz <luzmaximilian@gmail.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH v3 2/2] platform/surface: aggregator: Log critical errors during SAM probing
Date: Mon, 13 May 2024 13:55:06 +0200 [thread overview]
Message-ID: <1ca0f892-72be-44d2-9a57-2bf27de305a0@redhat.com> (raw)
In-Reply-To: <20240505130800.2546640-3-weifeng.liu.z@gmail.com>
Hi,
On 5/5/24 3:07 PM, Weifeng Liu wrote:
> Emits messages upon errors during probing of SAM. Hopefully this could
> provide useful context to user for the purpose of diagnosis when
> something miserable happen.
>
> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Weifeng Liu <weifeng.liu.z@gmail.com>
Thank you for your patch, I've applied this patch to my review-hans
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.
Regards,
Hans
> ---
> drivers/platform/surface/aggregator/core.c | 42 ++++++++++++++--------
> 1 file changed, 27 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/platform/surface/aggregator/core.c b/drivers/platform/surface/aggregator/core.c
> index 7b1871eb7a6f..046fa63446bf 100644
> --- a/drivers/platform/surface/aggregator/core.c
> +++ b/drivers/platform/surface/aggregator/core.c
> @@ -618,15 +618,17 @@ static const struct acpi_gpio_mapping ssam_acpi_gpios[] = {
>
> static int ssam_serial_hub_probe(struct serdev_device *serdev)
> {
> - struct acpi_device *ssh = ACPI_COMPANION(&serdev->dev);
> + struct device *dev = &serdev->dev;
> + struct acpi_device *ssh = ACPI_COMPANION(dev);
> struct ssam_controller *ctrl;
> acpi_status astatus;
> int status;
>
> - if (gpiod_count(&serdev->dev, NULL) < 0)
> - return -ENODEV;
> + status = gpiod_count(dev, NULL);
> + if (status < 0)
> + return dev_err_probe(dev, status, "no GPIO found\n");
>
> - status = devm_acpi_dev_add_driver_gpios(&serdev->dev, ssam_acpi_gpios);
> + status = devm_acpi_dev_add_driver_gpios(dev, ssam_acpi_gpios);
> if (status)
> return status;
>
> @@ -637,8 +639,11 @@ 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(dev, status,
> + "failed to initialize ssam controller\n");
> goto err_ctrl_init;
> + }
>
> ssam_controller_lock(ctrl);
>
> @@ -657,14 +662,13 @@ static int ssam_serial_hub_probe(struct serdev_device *serdev)
> if (status == -ENXIO)
> status = -EPROBE_DEFER;
> if (status) {
> - dev_err_probe(&serdev->dev, status,
> - "failed to open serdev device\n");
> + dev_err_probe(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;
> + status = dev_err_probe(dev, -ENXIO, "failed to setup serdev\n");
> goto err_devinit;
> }
>
> @@ -680,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_probe(dev, status, "failed to get firmware version\n");
> goto err_initrq;
> + }
>
> status = ssam_ctrl_notif_d0_entry(ctrl);
> - if (status)
> + if (status) {
> + dev_err_probe(dev, status, "D0-entry notification failed\n");
> goto err_initrq;
> + }
>
> status = ssam_ctrl_notif_display_on(ctrl);
> - if (status)
> + if (status) {
> + dev_err_probe(dev, status, "display-on notification failed\n");
> goto err_initrq;
> + }
>
> - status = sysfs_create_group(&serdev->dev.kobj, &ssam_sam_group);
> + status = sysfs_create_group(&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(dev, status, "failed to setup IRQ\n");
> goto err_irq;
> + }
>
> /* Finally, set main controller reference. */
> status = ssam_try_set_controller(ctrl);
> @@ -715,7 +727,7 @@ static int ssam_serial_hub_probe(struct serdev_device *serdev)
> * resumed. In short, this causes some spurious unwanted wake-ups.
> * For now let's thus default power/wakeup to false.
> */
> - device_set_wakeup_capable(&serdev->dev, true);
> + device_set_wakeup_capable(dev, true);
> acpi_dev_clear_dependencies(ssh);
>
> return 0;
> @@ -723,7 +735,7 @@ static int ssam_serial_hub_probe(struct serdev_device *serdev)
> err_mainref:
> ssam_irq_free(ctrl);
> err_irq:
> - sysfs_remove_group(&serdev->dev.kobj, &ssam_sam_group);
> + sysfs_remove_group(&dev->kobj, &ssam_sam_group);
> err_initrq:
> ssam_controller_lock(ctrl);
> ssam_controller_shutdown(ctrl);
next prev parent reply other threads:[~2024-05-13 11:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-05 13:07 [PATCH v3 0/2] Defer probing of SAM if serdev device is not ready Weifeng Liu
2024-05-05 13:07 ` [PATCH v3 1/2] platform/surface: aggregator: Defer probing when serdev " Weifeng Liu
2024-05-06 9:06 ` Andy Shevchenko
2024-05-05 13:07 ` [PATCH v3 2/2] platform/surface: aggregator: Log critical errors during SAM probing Weifeng Liu
2024-05-13 11:55 ` Hans de Goede [this message]
2024-05-06 14:41 ` [PATCH v3 0/2] Defer probing of SAM if serdev device is not ready Hans de Goede
2024-05-06 14:52 ` Andy Shevchenko
2024-05-07 13:44 ` Weifeng Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1ca0f892-72be-44d2-9a57-2bf27de305a0@redhat.com \
--to=hdegoede@redhat.com \
--cc=andriy.shevchenko@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-serial@vger.kernel.org \
--cc=luzmaximilian@gmail.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=weifeng.liu.z@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).