From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB787C31E49 for ; Wed, 19 Jun 2019 13:21:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BE6852166E for ; Wed, 19 Jun 2019 13:21:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729984AbfFSNVX (ORCPT ); Wed, 19 Jun 2019 09:21:23 -0400 Received: from mga17.intel.com ([192.55.52.151]:55844 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726330AbfFSNVW (ORCPT ); Wed, 19 Jun 2019 09:21:22 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jun 2019 06:21:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,392,1557212400"; d="scan'208";a="186456946" Received: from mylly.fi.intel.com (HELO [10.237.72.61]) ([10.237.72.61]) by fmsmga002.fm.intel.com with ESMTP; 19 Jun 2019 06:21:19 -0700 Subject: Re: [PATCH] spi/acpi: fix incorrect ACPI parent check To: Ard Biesheuvel Cc: Mika Westerberg , linux-spi@vger.kernel.org, Mark Brown , kbuild test robot , Dan Carpenter , Andy Shevchenko , Masahisa Kojima , "Rafael J. Wysocki" , ACPI Devel Maling List , Lukas Wunner References: <20190619095254.19559-1-ard.biesheuvel@linaro.org> <20190619101604.GR2640@lahna.fi.intel.com> <54ede1d8-0e6b-e7d9-5e61-a7d057abbd2b@linux.intel.com> From: Jarkko Nikula Message-ID: Date: Wed, 19 Jun 2019 16:21:18 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On 6/19/19 2:59 PM, Ard Biesheuvel wrote: > On Wed, 19 Jun 2019 at 13:58, Jarkko Nikula > wrote: >> >> On 6/19/19 1:16 PM, Mika Westerberg wrote: >>> On Wed, Jun 19, 2019 at 11:52:54AM +0200, Ard Biesheuvel wrote: >>>> The ACPI device object parsing code for SPI slaves enumerates the >>>> entire ACPI namespace to look for devices that refer to the master >>>> in question via the 'resource_source' field in the 'SPISerialBus' >>>> resource. If that field does not refer to a valid ACPI device or >>>> if it refers to the wrong SPI master, we should disregard the >>>> device. >>>> >>>> Current, the valid device check is wrong, since it gets the >>>> polarity of 'status' wrong. This could cause issues if the >>>> 'resource_source' field is bogus but parent_handle happens to >>>> refer to the correct master (which is not entirely imaginary >>>> since this code runs in a loop) >>>> >>>> So test for ACPI_FAILURE() instead, to make the code more >>>> self explanatory. >>>> >>>> Fixes: 4c3c59544f33 ("spi/acpi: enumerate all SPI slaves in the namespace") >>>> Reported-by: kbuild test robot >>>> Reported-by: Dan Carpenter >>>> Cc: Mika Westerberg >>> >>> Acked-by: Mika Westerberg >>> >> I hit yesterday a regression caused by 4c3c59544f33. I've a custom ACPI >> tables defining I2C gpio expanders (gpio-pca953x.c as INT3491) and a >> spidev test device (SPT0001). >> >> Both stopped enumerating after 4c3c59544f33. With this fix spidev device >> enumerates but still get confused with I2C GPIO expanders (INT3491): >> > > Could you share the decomplied D/SSDT please? > It's Intel Edison with tables from Mika's sample ACPI tables. The interesting parts here are these two: https://github.com/westeri/meta-acpi/blob/master/recipes-bsp/acpi-tables/samples/edison/spidev.asl https://github.com/westeri/meta-acpi/blob/master/recipes-bsp/acpi-tables/samples/edison/gpioexp.asli The full tables are of course larger but I think those two above are relevant here. I build SSDT from arduino-all.asl below which includes bunch of other files and with above spidev.asl. https://github.com/westeri/meta-acpi/blob/master/recipes-bsp/acpi-tables/samples/edison/arduino-all.asl Let me know if you need full dump. -- Jarkko