Received: by 10.223.185.116 with SMTP id b49csp5044488wrg; Wed, 7 Mar 2018 05:35:30 -0800 (PST) X-Google-Smtp-Source: AG47ELvjK5HmYFvPRTWwq7ViYmHk9uQPvDHPlN9NDTqRNEUosVs6tLkN34OS7TE7a4qRkOFI53aM X-Received: by 10.98.17.86 with SMTP id z83mr22675564pfi.207.1520429730603; Wed, 07 Mar 2018 05:35:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520429730; cv=none; d=google.com; s=arc-20160816; b=svMzYR/lxGjjRwVNpI7Y9B+dV0B6e3aWgiPFmr11Tp6SZ9Eu+aO6Ep7pW74Ogr1LdS UyeMLBPi2QXAdz0ybjHQr5i4ndUT1UAE7/hUoMl26ud7Zd1zJHtVn0QurxYKdPWELWFl xAywK3o0VBV1YiOU/ahw/JQM46XWT4RXkspX/fGXlfIhMBWU1++nqxFZj+V73oFsDAVu NOEGYbgna+czmp9DCjQcj2wnoGWA5oFsp+AVCURjbwZszp8G+U4zaiIxZMnaQYpSVKIk oSBOTjDho6m9LCVHpaLMSuaqwoaLdD9lMnIFp7E3h6uOgaF1lSNScmIdE8k4EkZvGRVc qxaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to:dkim-signature :arc-authentication-results; bh=FysqmPdmAkG29KDtgnH5fTj3FNWwCJHdZRadBxIx48I=; b=IK5EMFNy98wQ4EH642UHQDMFB5rMPlVg4VgX9zKsGZkC7uQahBTP5GqyalF8gMb0qx OfgiqYH3hpUsysLpuLDrtx8mDH887vyKoB9eqJoW9sNull7pWKcyNhSV5kaeqFDyWGyS ub2q+x9YZGvOZ/Qemc6n/LKfVb2FMi1xulam1nV1+Ia1C9ldk7hAe+ro1FM3G6npjaE9 pxioEUS7Z74bA08tiro9mE//1Y9ORUVY8WW0VLHv3yHJUiDy11/seevoPfH+haeb46KK 7DlAmNXqUjRnFVcgclMUJSUTiOCzwYRpLM/N0yOuhwkokJlvq2bBrcH80T0cnCLgPRBE mY8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=T9oT6844; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4-v6si12893057plb.68.2018.03.07.05.35.16; Wed, 07 Mar 2018 05:35:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=T9oT6844; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754424AbeCGNeW (ORCPT + 99 others); Wed, 7 Mar 2018 08:34:22 -0500 Received: from mail-ot0-f194.google.com ([74.125.82.194]:35446 "EHLO mail-ot0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751204AbeCGNeV (ORCPT ); Wed, 7 Mar 2018 08:34:21 -0500 Received: by mail-ot0-f194.google.com with SMTP id r30so2049440otr.2 for ; Wed, 07 Mar 2018 05:34:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=FysqmPdmAkG29KDtgnH5fTj3FNWwCJHdZRadBxIx48I=; b=T9oT6844SyHKN3foFu1DrqWNe5BT26+drhKy3Gi3bEIoySDOKOI2T7N8eoDFqBPXy8 1VqMr4Cvn6LzihV4DUGG+qkUPR2h/VoZISSpwthDd+gD5SMmnEVY7KCWw1Z5pXR5N0ii lAboS6DAycGyQKafF66q/dbf0M5IgbfzAFhsKWn4aQqVvzEQSJzxmxlynT7zjgAVMFb1 jvrkdhaA8c+MOC8bfEz5TmXzciKhsJCQ9LTXZ5lLdcZgQe4odPM4v+U34teTEfWOpRKC 8nVIsPBkf4b0rvERewf9TeYD13Thxcd6cavINVchtnbyMWak8bvXELxHefrFwJ7Z6m+K Rjmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:subject:to:cc:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=FysqmPdmAkG29KDtgnH5fTj3FNWwCJHdZRadBxIx48I=; b=t06dLzMhmRsiAiUwei6z1brXOq2HIjACQJR2QxEneCsZcf0RjXA1ThWVBlEqLKrqNr 7CYc1CF6TKDL+g/0UAV/fxS1EmfL5z7hUMOfQTNM5Lf+f7Uj7AxzEs7lHDn5QzDZ6sBO LBC8UOJvIOYLSLtGSiCeUiF2q2TQu/EOucf7pNzNSl59VEfBRj4deegbDn2jmGJAhf9Q z/UNKi0U5iYoREUSVq4eMUjzGprVTHVincFtJZXHcftFrJXOrJqmNTRoWWQ3ouFbbHle G2chDC02G8SQ1/EcEpaQR1bQOw5AjNQCVnoLP2arDXbUFl3hX9y0kOKANINFtg4q5IWX /dHw== X-Gm-Message-State: APf1xPBMu2CHzFdrLpksnWf3g1cX3S//RLUq+ZrwNGaVV1GnLM5vbwIz H+TaQ2Gdnrkhi4mye76wTA== X-Received: by 10.157.8.202 with SMTP id 68mr14458756otf.384.1520429660237; Wed, 07 Mar 2018 05:34:20 -0800 (PST) Received: from serve.minyard.net ([47.184.168.85]) by smtp.gmail.com with ESMTPSA id t200sm2537063oih.44.2018.03.07.05.34.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Mar 2018 05:34:19 -0800 (PST) Received: from [192.168.27.3] (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPSA id 6A616688; Wed, 7 Mar 2018 07:34:18 -0600 (CST) Reply-To: minyard@acm.org Subject: Re: [PATCH] ipmi:ssif: Fix double probe from tryacpi and trydmi To: Jiandi An , arnd@arndb.de, gregkh@linuxfoundation.org Cc: openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <1520401742-29371-1-git-send-email-anjiandi@codeaurora.org> From: Corey Minyard Message-ID: Date: Wed, 7 Mar 2018 07:34:17 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1520401742-29371-1-git-send-email-anjiandi@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 > --- > 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);