mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Corey Minyard <minyard@acm.org>
To: Jiandi An <anjiandi@codeaurora.org>,
	arnd@arndb.de, gregkh@linuxfoundation.org
Cc: openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ipmi:ssif: Fix double probe from tryacpi and trydmi
Date: Wed, 7 Mar 2018 07:34:17 -0600	[thread overview]
Message-ID: <fa7367db-4199-3dd6-0e51-e991a5fd97fb@acm.org> (raw)
In-Reply-To: <1520401742-29371-1-git-send-email-anjiandi@codeaurora.org>

On 03/06/2018 11:49 PM, Jiandi An wrote:
> IPMI SSIF driver's parameter tryacpi and trydmi both
> are set to true.  The addition of IPMI DMI driver to
> create platform device for each IPMI device causes
> SSIF probe to be done twice on the same SMB I2C address
> for BMC.  Fix is to not call trydmi if tryacpi is able
> to find I2C address for BMC from SPMI ACPI table and
> probe successfully.

Why are you trying to do this?  Is something bad happening?

SPMI is not the preferred mechanism for detecting a device,
the preferred mechanism should be the acpi match table or
OF, followed by DMI, followed by SPMI.  In fact, it might be
best to just remove SPMI.

-corey

> Signed-off-by: Jiandi An <anjiandi@codeaurora.org>
> ---
>   drivers/char/ipmi/ipmi_ssif.c | 35 ++++++++++++++++++++++++-----------
>   1 file changed, 24 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
> index 9d3b0fa..5c57363 100644
> --- a/drivers/char/ipmi/ipmi_ssif.c
> +++ b/drivers/char/ipmi/ipmi_ssif.c
> @@ -1981,29 +1981,41 @@ static int try_init_spmi(struct SPMITable *spmi)
>   	return new_ssif_client(myaddr, NULL, 0, 0, SI_SPMI, NULL);
>   }
>   
> -static void spmi_find_bmc(void)
> +static int spmi_find_bmc(void)
>   {
>   	acpi_status      status;
>   	struct SPMITable *spmi;
>   	int              i;
> +	int              rc = 0;
>   
>   	if (acpi_disabled)
> -		return;
> +		return -EPERM;
>   
>   	if (acpi_failure)
> -		return;
> +		return -ENODEV;
>   
>   	for (i = 0; ; i++) {
>   		status = acpi_get_table(ACPI_SIG_SPMI, i+1,
>   					(struct acpi_table_header **)&spmi);
> -		if (status != AE_OK)
> -			return;
> +		if (status != AE_OK) {
> +			if (i == 0)
> +				return -ENODEV;
> +			else
> +				return 0;
> +		}
>   
> -		try_init_spmi(spmi);
> +		rc = try_init_spmi(spmi);
> +		if (rc)
> +			return rc;
>   	}
> +
> +	return 0;
>   }
>   #else
> -static void spmi_find_bmc(void) { }
> +static int spmi_find_bmc(void)
> +{
> +	return -ENODEV;
> +}
>   #endif
>   
>   #ifdef CONFIG_DMI
> @@ -2104,12 +2116,13 @@ static int init_ipmi_ssif(void)
>   			       addr[i]);
>   	}
>   
> -	if (ssif_tryacpi)
> +	if (ssif_tryacpi) {
>   		ssif_i2c_driver.driver.acpi_match_table	=
>   			ACPI_PTR(ssif_acpi_match);
> -
> -	if (ssif_tryacpi)
> -		spmi_find_bmc();
> +		rv = spmi_find_bmc();
> +		if (!rv)
> +			ssif_trydmi = false;
> +	}
>   
>   	if (ssif_trydmi) {
>   		rv = platform_driver_register(&ipmi_driver);

  reply	other threads:[~2018-03-07 13:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07  5:49 Jiandi An
2018-03-07 13:34 ` Corey Minyard [this message]
2018-03-07 23:59   ` Jiandi An
2018-03-08 14:10     ` Corey Minyard
2018-03-08 18:18       ` Jiandi An
2018-03-08 20:40         ` Corey Minyard

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=fa7367db-4199-3dd6-0e51-e991a5fd97fb@acm.org \
    --to=minyard@acm.org \
    --cc=anjiandi@codeaurora.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    /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

Powered by JetHome