All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Morse <james.morse@arm.com>
To: Gavin Shan <gshan@redhat.com>
Cc: mark.rutland@arm.com, catalin.marinas@arm.com, will@kernel.org,
	shan.gavin@gmail.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 04/14] drivers/firmware/sdei: Rework sdei_init()
Date: Tue, 21 Jul 2020 21:42:34 +0100	[thread overview]
Message-ID: <d69c3727-c032-521b-c32e-59abe491fc63@arm.com> (raw)
In-Reply-To: <20200706054732.99387-5-gshan@redhat.com>

Hi Gavin,

On 06/07/2020 06:47, Gavin Shan wrote:
> This reworks sdei_init()
> 
>    * The function follows the steps in sequence: check ACPI existence,
>      register platform device, register platform driver.
>    * The corresponding error numbers are returned in failing paths.
>    * The platform device is deleted if the driver can't be registered.

What is your motivation for the change?

The commit message should describe the problem you are solving, and why you are doing it
this way.


> diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
> index 35a319e7e1e6..7e7b26b1f91b 100644
> --- a/drivers/firmware/arm_sdei.c
> +++ b/drivers/firmware/arm_sdei.c
> @@ -1058,7 +1058,7 @@ static bool __init sdei_present_acpi(void)
>  	acpi_status status;
>  	struct acpi_table_header *sdei_table_header;
>  
> -	if (acpi_disabled)
> +	if (!IS_ENABLED(CONFIG_ACPI) || acpi_disabled)
>  		return false;
>  

This was already covered. From include/linux/acpi.h:
| #else	/* !CONFIG_ACPI */
|
| #define acpi_disabled 1


>  	status = acpi_get_table(ACPI_SIG_SDEI, 0, &sdei_table_header);
> @@ -1077,19 +1077,27 @@ static bool __init sdei_present_acpi(void)
>  
>  static int __init sdei_init(void)
>  {
> -	int ret = platform_driver_register(&sdei_driver);
> +	struct platform_device *pdev;
> +	int ret;
>  
> -	if (!ret && sdei_present_acpi()) {
> -		struct platform_device *pdev;
> +	if (!sdei_present_acpi())
> +		return -EPERM;
>  
> -		pdev = platform_device_register_simple(sdei_driver.driver.name,
> -						       0, NULL, 0);
> -		if (IS_ERR(pdev))
> -			pr_info("Failed to register ACPI:SDEI platform device %ld\n",
> -				PTR_ERR(pdev));

> +	pdev = platform_device_register_simple(sdei_driver.driver.name,
> +					       0, NULL, 0);
> +	if (IS_ERR(pdev)) {
> +		pr_info("Failed to register ACPI:SDEI platform device %ld\n",
> +			PTR_ERR(pdev));
> +		return -ENOMEM;
>  	}

This will break DT platforms. Not everything in the world is ACPI.


> -	return ret;
> +	ret = platform_driver_register(&sdei_driver);
> +	if (ret) {
> +		platform_device_del(pdev);

The platform device is not unregistered on APCI platforms because it does not get
unregistered on DT platforms either. When using DT its created by the OF core code when it
probes the '/firmware' node of the DT.


> +		return ret;
> +	}
> +
> +	return 0;
>  }

Without a motivation in the commit message, I can't work out if there is something here,
or its just churn.



Thanks,

James

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-07-21 20:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06  5:47 [PATCH 00/14] Refactor SDEI client driver Gavin Shan
2020-07-06  5:47 ` [PATCH 01/14] drivers/firmware/sdei: Remove sdei_is_err() Gavin Shan
2020-07-21 20:39   ` James Morse
2020-07-22  2:04     ` Gavin Shan
2020-07-06  5:47 ` [PATCH 02/14] drivers/firmware/sdei: Common block for failing path in sdei_event_create() Gavin Shan
2020-07-21 20:40   ` James Morse
2020-07-22  2:12     ` Gavin Shan
2020-07-06  5:47 ` [PATCH 03/14] drivers/firmware/sdei: Dereference SDEI event parameter directly Gavin Shan
2020-07-21 20:41   ` James Morse
2020-07-22  2:38     ` Gavin Shan
2020-07-06  5:47 ` [PATCH 04/14] drivers/firmware/sdei: Rework sdei_init() Gavin Shan
2020-07-21 20:42   ` James Morse [this message]
2020-07-22  3:34     ` Gavin Shan
2020-07-06  5:47 ` [PATCH 05/14] drivers/firmware/sdei: Remove sdei_get_conduit() Gavin Shan
2020-07-21 20:42   ` James Morse
2020-07-22  3:50     ` Gavin Shan
2020-07-06  5:47 ` [PATCH 06/14] drivers/firmware/sdei: Drop redundant error message in sdei_probe() Gavin Shan
2020-07-06  5:47 ` [PATCH 07/14] drivers/firmware/sdei: Drop unnecessary while loop Gavin Shan
2020-07-06  5:47 ` [PATCH 08/14] drivers/firmware/sdei: Cleanup on cross call functions Gavin Shan
2020-07-06  5:47 ` [PATCH 09/14] drivers/firmware/sdei: Introduce sdei_do_local_call() Gavin Shan
2020-07-06  5:47 ` [PATCH 10/14] drivers/firmware/sdei: Remove _sdei_event_register() Gavin Shan
2020-07-06  5:47 ` [PATCH 11/14] drivers/firmware/sdei: Remove _sdei_event_unregister() Gavin Shan
2020-07-06  5:47 ` [PATCH 12/14] drivers/firmware/sdei: Identify event by struct sdei_event Gavin Shan
2020-07-06  5:47 ` [PATCH 13/14] drivers/firmware/sdei: Retrieve event signaled property on creation Gavin Shan
2020-07-06  5:47 ` [PATCH 14/14] drivers/firmware/sdei: Add sdei_event_get_info() Gavin Shan
2020-07-21  9:44 ` [PATCH 00/14] Refactor SDEI client driver Gavin Shan

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=d69c3727-c032-521b-c32e-59abe491fc63@arm.com \
    --to=james.morse@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=gshan@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=shan.gavin@gmail.com \
    --cc=will@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.