From patchwork Wed Jul 24 19:20:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 169644 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp10670444ilk; Wed, 24 Jul 2019 12:56:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7rzvr7hulFYOF9dAAV6I0J04CFyQpBCw72paoDNs+UElpvTrsViGSGrLmj2Zxq6dxFVTa X-Received: by 2002:a17:902:2889:: with SMTP id f9mr82974829plb.230.1563998216302; Wed, 24 Jul 2019 12:56:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563998216; cv=none; d=google.com; s=arc-20160816; b=qhLYRqLJ3tw8oA9BdhhKiKAz96uOxs5cEe7yiTe62qbwJo7Q2cENqboYajDeLkAdnh AejrCBl5r9VcBo2Q1oQu3c0yZIMDsdEeVnXwsAyCPFYtgpqfzRZh3meqZdwq8Z9inhoo HSf7fAniKzOwtXuWd+JKz6ev0n0ud5eTFdPBMSkFpeCG0+Snmoe47ODBdGDBjbvRJZQb ODY/m44q3IIpIQTQXdTCpobeBSp7AwwVk0YDUphNJrdnB022zpwyQOeTcGzePrxYfRax mZki9L2eJcpyq2wprgByHumcP4gsWnLhM6hFuWQ6geaJu/cHBRRvlUsCkkkYYIoiKFJL wWMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fe+p10YfnyqcFUyaZQKDg/pc4hRRGQ7ZskTdE32j60w=; b=Wq0CDza4/GBd9eedLnQsuCj5lXWLPZCFJY1MyU6V74poFMsUpEbgIsEKvMdJKXH7Oy RKyc0sj5qkL8v9cBAjwkiOm6xf+MIp8e7qAH9Jhi79pF5ulJ04jCgQBwmeDFzb2dSV1w QnhSPW8e1SZPFDeEcWGsLB1s1fjrJvGIOSEXcresK3WW4ap+3qTyOidTi37WqwIyRKyt JNzI0iU5yXViEsO+dXLnuE0YNcxu1VwYxcxBxiI/MCD6WRC27VUAKfB/A5U9LfvhPLwg UmrQdd1Fb6Zbo9ILHUfibXWtuDXRYKl9Qm+e/PCHbA3I1bIc+xzlwOZntkCTbCPrc9e7 ddcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=evZ4iP3S; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 s126si9376058pgs.431.2019.07.24.12.56.56; Wed, 24 Jul 2019 12:56:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=evZ4iP3S; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404706AbfGXT4y (ORCPT + 14 others); Wed, 24 Jul 2019 15:56:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:41720 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404466AbfGXT4y (ORCPT ); Wed, 24 Jul 2019 15:56:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B9B8421873; Wed, 24 Jul 2019 19:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563998213; bh=2HnvleEuQXWEcpKX9BILP/+xkRxnVYQLF0R4G6X7+yo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=evZ4iP3StSPWUZe4K+vPQgpU0LdSOVEfo4GtI3T5XVvEnSsS4uptWfj4rMEUSrtC1 FAketQ58xTWv1K440HFRDVSWo30cqjSrpkOOt6vfAuMfk8VPQbdnj8ySpWcyDN/hpw PYP9C0CXuutrcANpB7UG5LBXRntS9nPctElhB+Ro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown Subject: [PATCH 5.1 285/371] ASoC: core: Adapt for debugfs API change Date: Wed, 24 Jul 2019 21:20:37 +0200 Message-Id: <20190724191745.736560057@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191724.382593077@linuxfoundation.org> References: <20190724191724.382593077@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mark Brown commit c2c928c93173f220955030e8440517b87ec7df92 upstream. Back in ff9fb72bc07705c (debugfs: return error values, not NULL) the debugfs APIs were changed to return error pointers rather than NULL pointers on error, breaking the error checking in ASoC. Update the code to use IS_ERR() and log the codes that are returned as part of the error messages. Fixes: ff9fb72bc07705c (debugfs: return error values, not NULL) Signed-off-by: Mark Brown Cc: stable@vger.kernel.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/soc-core.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -158,9 +158,10 @@ static void soc_init_component_debugfs(s component->card->debugfs_card_root); } - if (!component->debugfs_root) { + if (IS_ERR(component->debugfs_root)) { dev_warn(component->dev, - "ASoC: Failed to create component debugfs directory\n"); + "ASoC: Failed to create component debugfs directory: %ld\n", + PTR_ERR(component->debugfs_root)); return; } @@ -212,18 +213,21 @@ static void soc_init_card_debugfs(struct card->debugfs_card_root = debugfs_create_dir(card->name, snd_soc_debugfs_root); - if (!card->debugfs_card_root) { + if (IS_ERR(card->debugfs_card_root)) { dev_warn(card->dev, - "ASoC: Failed to create card debugfs directory\n"); + "ASoC: Failed to create card debugfs directory: %ld\n", + PTR_ERR(card->debugfs_card_root)); + card->debugfs_card_root = NULL; return; } card->debugfs_pop_time = debugfs_create_u32("dapm_pop_time", 0644, card->debugfs_card_root, &card->pop_time); - if (!card->debugfs_pop_time) + if (IS_ERR(card->debugfs_pop_time)) dev_warn(card->dev, - "ASoC: Failed to create pop time debugfs file\n"); + "ASoC: Failed to create pop time debugfs file: %ld\n", + PTR_ERR(card->debugfs_pop_time)); } static void soc_cleanup_card_debugfs(struct snd_soc_card *card) From patchwork Wed Jul 24 19:21:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 169645 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp10671439ilk; Wed, 24 Jul 2019 12:58:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxRl1368JQ9sODjIOH8HOWAyWm1wpqIWO8tv1nzBsKwUSkiZMEkYw1c0tk0h2gqoJ5bFN0q X-Received: by 2002:a62:770e:: with SMTP id s14mr12523397pfc.150.1563998286743; Wed, 24 Jul 2019 12:58:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563998286; cv=none; d=google.com; s=arc-20160816; b=ykLzzFfreUALKxJdTvWdCnWWNEUt4LWzQMPpKXsAgpvH1cMSY6mXLkrvKjk/Z75pVx 45DpFQw33VZb6yVmAt23PID/YucNwLDVah2mzud+50mwS0JBh0reLxwSSwlF4ur9Vy4Z tViJOK+l/rwwoONX4sx3Woy4sdKLXe6+M9+Vb8Uvzpn0uQ44lyNTUF/TdndUj6IYggFH ZhlXc2hO2vyqyKyTKcT8/vZjcvfdfYVEcm3d7GCnVynE9H6yAn+XhNfOM5DWsU6InVhW xr0Pt7Hog97zG2e7DGn6wUj4E0Y2ee0ZHx2SX5RWNT69iLcExGqVgLhY+afhs71AtUGy XPmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ESAKAvawxLtk9bPNinfpZcV/Y5wj3BaBQDxrhMH/v50=; b=v5ezbZLAafpwD6YeJdT39DOhl1v8ScBaqwzIvbwu18cmAs5la7nxmKLXwxr2Y5biTJ 8yem+QBkVOkkw2tv2OuqQ+5HuLsDdHEfVDQt6/7C3KwYYKRTHJZ7Y6K8KD0T/tHHCGL0 GfpTYyDPQc577ogQZH6Nav6g4vnqcjhOQujeYYX5GTlUyqysVI1RLXu2yk+DCM1Eyokv ueRBMgcUOq5EDJeDy/kMjjpgLmBPY53YrfnH2Tn5q9Q6I/QcQJok+D3degNkBg9qopds wh3zrqEyhbNgxz09NpVYK1iD/lOZGjQzg+C25f2b9xH8gcc6N50AHdXkIbsL4rJWBDu9 r8sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S5McEkIj; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 23si14845540pfi.265.2019.07.24.12.58.06; Wed, 24 Jul 2019 12:58:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S5McEkIj; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404355AbfGXT6F (ORCPT + 14 others); Wed, 24 Jul 2019 15:58:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:44236 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404270AbfGXT6F (ORCPT ); Wed, 24 Jul 2019 15:58:05 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 886CD22ADA; Wed, 24 Jul 2019 19:58:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563998284; bh=2fpanJA6x17r0T9hIjVg0+38Fecf+inTo/bKazZyWW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S5McEkIji7ozyHcb7KljWibhOw+gJRDpk94w7aW2CF5fi6ddGYD+iNAwYo3r6kSMu 8qSoR0KIQs8omgZq2Q28UA0SfI7KpWHvQW9B6IBM9rdk7BuIXJ1eLKqwNv+X+mZnr2 0ZW5eiqfvmKUTYq0jTJ16/90tKH/NbPS3y5cfwFM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Joonas_Kylm=C3=A4l=C3=A4?= , Masahiro Yamada Subject: [PATCH 5.1 312/371] kconfig: fix missing choice values in auto.conf Date: Wed, 24 Jul 2019 21:21:04 +0200 Message-Id: <20190724191747.564888035@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191724.382593077@linuxfoundation.org> References: <20190724191724.382593077@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Masahiro Yamada commit 8e2442a5f86e1f77b86401fce274a7f622740bc4 upstream. Since commit 00c864f8903d ("kconfig: allow all config targets to write auto.conf if missing"), Kconfig creates include/config/auto.conf in the defconfig stage when it is missing. Joonas Kylmälä reported incorrect auto.conf generation under some circumstances. To reproduce it, apply the following diff: | --- a/arch/arm/configs/imx_v6_v7_defconfig | +++ b/arch/arm/configs/imx_v6_v7_defconfig | @@ -345,14 +345,7 @@ CONFIG_USB_CONFIGFS_F_MIDI=y | CONFIG_USB_CONFIGFS_F_HID=y | CONFIG_USB_CONFIGFS_F_UVC=y | CONFIG_USB_CONFIGFS_F_PRINTER=y | -CONFIG_USB_ZERO=m | -CONFIG_USB_AUDIO=m | -CONFIG_USB_ETH=m | -CONFIG_USB_G_NCM=m | -CONFIG_USB_GADGETFS=m | -CONFIG_USB_FUNCTIONFS=m | -CONFIG_USB_MASS_STORAGE=m | -CONFIG_USB_G_SERIAL=m | +CONFIG_USB_FUNCTIONFS=y | CONFIG_MMC=y | CONFIG_MMC_SDHCI=y | CONFIG_MMC_SDHCI_PLTFM=y And then, run: $ make ARCH=arm mrproper imx_v6_v7_defconfig You will see CONFIG_USB_FUNCTIONFS=y is correctly contained in the .config, but not in the auto.conf. Please note drivers/usb/gadget/legacy/Kconfig is included from a choice block in drivers/usb/gadget/Kconfig. So USB_FUNCTIONFS is a choice value. This is probably a similar situation described in commit beaaddb62540 ("kconfig: tests: test defconfig when two choices interact"). When sym_calc_choice() is called, the choice symbol forgets the SYMBOL_DEF_USER unless all of its choice values are explicitly set by the user. The choice symbol is given just one chance to recall it because set_all_choice_values() is called if SYMBOL_NEED_SET_CHOICE_VALUES is set. When sym_calc_choice() is called again, the choice symbol forgets it forever, since SYMBOL_NEED_SET_CHOICE_VALUES is a one-time aid. Hence, we cannot call sym_clear_all_valid() again and again. It is crazy to repeat set and unset of internal flags. However, we cannot simply get rid of "sym->flags &= flags | ~SYMBOL_DEF_USER;" Doing so would re-introduce the problem solved by commit 5d09598d488f ("kconfig: fix new choices being skipped upon config update"). To work around the issue, conf_write_autoconf() stopped calling sym_clear_all_valid(). conf_write() must be changed accordingly. Currently, it clears SYMBOL_WRITE after the symbol is written into the .config file. This is needed to prevent it from writing the same symbol multiple times in case the symbol is declared in two or more locations. I added the new flag SYMBOL_WRITTEN, to track the symbols that have been written. Anyway, this is a cheesy workaround in order to suppress the issue as far as defconfig is concerned. Handling of choices is totally broken. sym_clear_all_valid() is called every time a user touches a symbol from the GUI interface. To reproduce it, just add a new symbol drivers/usb/gadget/legacy/Kconfig, then touch around unrelated symbols from menuconfig. USB_FUNCTIONFS will disappear from the .config file. I added the Fixes tag since it is more fatal than before. But, this has been broken since long long time before, and still it is. We should take a closer look to fix this correctly somehow. Fixes: 00c864f8903d ("kconfig: allow all config targets to write auto.conf if missing") Cc: linux-stable # 4.19+ Reported-by: Joonas Kylmälä Signed-off-by: Masahiro Yamada Tested-by: Joonas Kylmälä Signed-off-by: Greg Kroah-Hartman --- scripts/kconfig/confdata.c | 7 +++---- scripts/kconfig/expr.h | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -871,11 +871,12 @@ int conf_write(const char *name) "#\n" "# %s\n" "#\n", str); - } else if (!(sym->flags & SYMBOL_CHOICE)) { + } else if (!(sym->flags & SYMBOL_CHOICE) && + !(sym->flags & SYMBOL_WRITTEN)) { sym_calc_value(sym); if (!(sym->flags & SYMBOL_WRITE)) goto next; - sym->flags &= ~SYMBOL_WRITE; + sym->flags |= SYMBOL_WRITTEN; conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); } @@ -1026,8 +1027,6 @@ int conf_write_autoconf(int overwrite) if (!overwrite && is_present(autoconf_name)) return 0; - sym_clear_all_valid(); - conf_write_dep("include/config/auto.conf.cmd"); if (conf_touch_deps()) --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -141,6 +141,7 @@ struct symbol { #define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */ #define SYMBOL_WRITE 0x0200 /* write symbol to file (KCONFIG_CONFIG) */ #define SYMBOL_CHANGED 0x0400 /* ? */ +#define SYMBOL_WRITTEN 0x0800 /* track info to avoid double-write to .config */ #define SYMBOL_NO_WRITE 0x1000 /* Symbol for internal use only; it will not be written */ #define SYMBOL_CHECKED 0x2000 /* used during dependency checking */ #define SYMBOL_WARNED 0x8000 /* warning has been issued */ From patchwork Wed Jul 24 19:21:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 169648 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp10685232ilk; Wed, 24 Jul 2019 13:10:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0ggtg+nZOppYcgZqAqUStPjrBRRlVX8CyatGzRJqL2AzgTs74NpmYrAjVL6LNIad3eeul X-Received: by 2002:a17:902:9041:: with SMTP id w1mr89147847plz.132.1563999028027; Wed, 24 Jul 2019 13:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563999028; cv=none; d=google.com; s=arc-20160816; b=WVQS6PxWqbHiqaCiMtzKH39M06eqQm9UCa3ZKGKjz6k3JtS6YaH4iOETJ4bI+v/4JC nSjV1IigSsj9q+F3IEi7oR0OHYUWEc0kFAYfOOPFvzlhcfeONk+PPsTBC4+C862Uh6K3 77B9YeTURtrSbV7Ron0hpGZxro9oih/y988tmJek7AhHeLIjnAqoM6S7w16787mWWv9+ iCAOiGN/q8pQhWQRIKwAqOwjma4imiDHuoSYL/eQAPUX33PWN8dJhWEi2CDTdrQysI/y DR7x58ibtIMfqOGQzRtxDEsioDp2WBIHi0IFcO0UQGu3USPxLpDIw88u1Y7k9O7cuZf7 ySjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ki+0q5T6jfoMGjMnsQGlnJ7pr0iqH5Nxbna9Rfk6Y7o=; b=rS7bwc37nX0qyB0bRzJxSAaF6DWPIwLEUx1AbiEETjtCeTW8+m7Upwb9NliDEXhR8C bGJm3Peo2mc3wi//7UD+SA0XHLEJo14XWjSkXsGB6KD9H49V0UX0s37X+lucYngrY8fd X6RuCCjjdoNmW4V/N2t+QT+/sP7wEoeuw0pV7mgC88oc7PxYOVJwY33C6fwAC9txtgJj s8uSmAGnqq4F9V/snd6bWvrojVEBNEQktqEVGyQYpdrwTzT2Bgra5syfi5YHQy1h2ZaK N+EU9DVpQ3QKa9smLvN36fswkAuODFZyi5JEmvzAj7e7pAiZ7Ts7Ef6CW/wCEpzAxabs ETzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="oLTX/wyZ"; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 m15si17976121pgt.495.2019.07.24.13.10.27; Wed, 24 Jul 2019 13:10:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="oLTX/wyZ"; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388835AbfGXUK0 (ORCPT + 14 others); Wed, 24 Jul 2019 16:10:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:46190 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405070AbfGXT7G (ORCPT ); Wed, 24 Jul 2019 15:59:06 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 31F7720665; Wed, 24 Jul 2019 19:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563998345; bh=hdPiwWOIh86sapnLw0u7XiSoH7Kj3zi5jtTPZLDP9H0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oLTX/wyZUnX+SOh7kulxi2vGuIK8ceBgLNsYU9zc851QF9X0ydaVfoYUdU0QSg6nj uUBcmE/bIQ6CqJibAaygbwqmU6z08FHqdRVlhni1snDh+hz8R4fr3zcw1iXu/TvQWH q9lMAa9BZdkmVzBfJNXK/NkOiOQXpVxYJRHAuve8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Lorenzo Pieralisi , Stanimir Varbanov Subject: [PATCH 5.1 332/371] PCI: qcom: Ensure that PERST is asserted for at least 100 ms Date: Wed, 24 Jul 2019 21:21:24 +0200 Message-Id: <20190724191748.756382478@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191724.382593077@linuxfoundation.org> References: <20190724191724.382593077@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Niklas Cassel commit 64adde31c8e996a6db6f7a1a4131180e363aa9f2 upstream. Currently, there is only a 1 ms sleep after asserting PERST. Reading the datasheets for different endpoints, some require PERST to be asserted for 10 ms in order for the endpoint to perform a reset, others require it to be asserted for 50 ms. Several SoCs using this driver uses PCIe Mini Card, where we don't know what endpoint will be plugged in. The PCI Express Card Electromechanical Specification r2.0, section 2.2, "PERST# Signal" specifies: "On power up, the deassertion of PERST# is delayed 100 ms (TPVPERL) from the power rails achieving specified operating limits." Add a sleep of 100 ms before deasserting PERST, in order to ensure that we are compliant with the spec. Fixes: 82a823833f4e ("PCI: qcom: Add Qualcomm PCIe controller driver") Signed-off-by: Niklas Cassel Signed-off-by: Lorenzo Pieralisi Acked-by: Stanimir Varbanov Cc: stable@vger.kernel.org # 4.5+ Signed-off-by: Greg Kroah-Hartman --- drivers/pci/controller/dwc/pcie-qcom.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -178,6 +178,8 @@ static void qcom_ep_reset_assert(struct static void qcom_ep_reset_deassert(struct qcom_pcie *pcie) { + /* Ensure that PERST has been asserted for at least 100 ms */ + msleep(100); gpiod_set_value_cansleep(pcie->reset, 0); usleep_range(PERST_DELAY_US, PERST_DELAY_US + 500); }