From patchwork Fri Mar 22 16:17:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160945 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp994019jan; Fri, 22 Mar 2019 09:18:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyeiKfZm8iP20kVzu6mPmxoJy1DHGzxSMpAM92YfNwaDSvik6PuuizKD3keWyehr4sBC+wo X-Received: by 2002:a63:1912:: with SMTP id z18mr9967335pgl.115.1553271503332; Fri, 22 Mar 2019 09:18:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553271503; cv=none; d=google.com; s=arc-20160816; b=wYh+O1TtwSI+zziRCF+c5jEOfxS/8cjk0la0vx9puwc6gLWBQ87xQKmErfsxXzTYUU QF+9ZY7+l38I7C792JbsH2OT8PgNGhVaLDJBtOCRp/PQPGXgMqNVoZNKOLpgjP+a+vLc gVKXWBe4uQSkrunglulE8ALfv3IR/en//V1V3cEQp7mFDg6GoSZcnHu9WxVzVYFgoiVw oS8Vv809kMxBrcOBDhCg5T96OcNQE/+Diph6schVX3U1yJEwxCNYrIcdB/5/rqVZjQBe FI7jBnuAn6L9daQd/Hc0aRgWnCK4MkwaNsf3iYsQ3JAkaC7dWqTOKo3Tnbs+jXCggeg7 0MKg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=aWSEAS+EKEKn17gXxhCNaHJyIzTIZvtlX4CZP1I7mhs=; b=YopyrAShz1rtBKSa4bQuQFY30ZtI4D0QfTqgA17nroa1PRnEw/JAIAtTPUvpnU/xQa 24erEUcewzjMaEkkRntWw92WGAXbWx7cTdI0eJxHgBZ+8cImGNtGTgGVdhyOrzMJQNuH VipnWSInAqoGsMBMmWPkiXhdRYrTvxD9UGRgdbtUeVr1Pu6dYRqO+z/WShMGiz8vvOIH AdKv/+S9CO1mpYNnqys8AspNGpVME4K3vSyAg39CyCyyE5wotr5IckLLTvvNPdzCJehm S/NDw2xza6m47DDD7khgg9gRuvZ0v8Ak/A+8xomjspQKko/siu9w82hVGy+VyrQ3uovD owYQ== ARC-Authentication-Results: i=1; mx.google.com; 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 h21si6992593pgl.346.2019.03.22.09.18.23; Fri, 22 Mar 2019 09:18:23 -0700 (PDT) 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; 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 S1729636AbfCVQSV (ORCPT + 31 others); Fri, 22 Mar 2019 12:18:21 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:50465 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729578AbfCVQST (ORCPT ); Fri, 22 Mar 2019 12:18:19 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1N0o7f-1gkDsW0R1h-00wn6V; Fri, 22 Mar 2019 17:17:49 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Vinayak Holikatti , "James E.J. Bottomley" , "Martin K. Petersen" Cc: kehuanlin , kehuanlin , Subhash Jadavani , Arnd Bergmann , Sasha Levin , Asutosh Das , Greg Kroah-Hartman , Maya Erez , Sujit Reddy Thumma , Stanley Chu , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.14.y 1/8] scsi: ufs: fix wrong command type of UTRD for UFSHCI v2.1 Date: Fri, 22 Mar 2019 17:17:16 +0100 Message-Id: <20190322161727.1153278-2-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322161727.1153278-1-arnd@arndb.de> References: <20190322161727.1153278-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:DQlMCpJq4PR8SX1i9vhvGY3ghVKzEGEX4UNI41mNwMXOlOUcY0e SfpgpjyUeBxjMOhfpHLrelxp/8KlGgS/kgcYAg42QMNrm7dkZOOlXWvN0mAiAejEGIgghXZ 1+Zs5W00Wsyi04W0iRPQAmmHekXt3RL7A/sebYtWKNOm5sbZWDKTssDu/D194jSgKMjw5QA QvHfVD9hsGn0gKTjYNK+Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:ekf+x/GTjO8=:GM4+kKL4fwPtKRIPKs76/l unwfqjjdv2iaabjHDTMLcwTbpXcQq4mFMviJdssiG8OlOT1ErYPeDdp4rSydWm1x4HprtNBKL USkt9wFp0s7oIVSF3eQ1ygPSdGPDxUgc9VAIObcrmkVErUbw2TsNOn1b3pW252Ews6uBC6LyM a2+sa8XJ3LGbAKyqMiFciPlfEBCaE3z9JDHzjcWKumgI3/80xGNoPVjYbeRSXBDJeFt5K/izW gUpi3Py2ZLLS+XoPP+o4hzzzsP1+bAvDY0Av+yA+lpvwYZtQrKniKWTYv4yEe8jFgsq9AbMGW btyPOAqhKekVOpg3jZeMfEJmFZ+zQYPctOeYGDNrFwtZDRZX/mGjZEHPVszUCKPvy+Zhop/zR tizypOFHrOcCr5NCTTHCxEMfZUZ1FPrZ/JzgbpnKQbC6umtGSTa1z6aGX287regbzHewxIsPj 2bVUokuKlZal/cb1cDcqKW7hO/vRd7rl7DvcdMCPz4G4JlSD/EzxR6E4mAQ65n4RzdF2ZmLhN vjpq9rJOliKWfg+ytCX3LZapnZBBjLoJ12p04DO9qzuYVNcqvDkUJAuVo3K5BNhm/u6lzIP6S JvhkT5wCgKmOiG9FBt0gn1tD2CYKnMxfACNxCH6fkiaedSRlAwZrb9UnEzsv0AsOVF6NBxI6P 9degZBJRoTRzscs7AslRa06GJqQWzsrnoh2hbsAXKFYu2sJcr7HqBSzviECIYVu61qI9WlrcU 13AxDMkgpgm14YBqGVg8necg0u0lhs9NOHZ7PA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: kehuanlin Since the command type of UTRD in UFS 2.1 specification is the same with UFS 2.0. And it assumes the future UFS specification will follow the same definition. Signed-off-by: kehuanlin Reviewed-by: Subhash Jadavani Signed-off-by: Martin K. Petersen (cherry picked from commit 83dc7e3dea76b77b6bcc289eb86c5b5c145e8dff) Signed-off-by: Arnd Bergmann --- drivers/scsi/ufs/ufshcd.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) -- 2.20.0 diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 66540491839e..581571de2461 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2195,10 +2195,11 @@ static int ufshcd_comp_devman_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) u32 upiu_flags; int ret = 0; - if (hba->ufs_version == UFSHCI_VERSION_20) - lrbp->command_type = UTP_CMD_TYPE_UFS_STORAGE; - else + if ((hba->ufs_version == UFSHCI_VERSION_10) || + (hba->ufs_version == UFSHCI_VERSION_11)) lrbp->command_type = UTP_CMD_TYPE_DEV_MANAGE; + else + lrbp->command_type = UTP_CMD_TYPE_UFS_STORAGE; ufshcd_prepare_req_desc_hdr(lrbp, &upiu_flags, DMA_NONE); if (hba->dev_cmd.type == DEV_CMD_TYPE_QUERY) @@ -2222,10 +2223,11 @@ static int ufshcd_comp_scsi_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) u32 upiu_flags; int ret = 0; - if (hba->ufs_version == UFSHCI_VERSION_20) - lrbp->command_type = UTP_CMD_TYPE_UFS_STORAGE; - else + if ((hba->ufs_version == UFSHCI_VERSION_10) || + (hba->ufs_version == UFSHCI_VERSION_11)) lrbp->command_type = UTP_CMD_TYPE_SCSI; + else + lrbp->command_type = UTP_CMD_TYPE_UFS_STORAGE; if (likely(lrbp->cmd)) { ufshcd_prepare_req_desc_hdr(lrbp, &upiu_flags, From patchwork Fri Mar 22 16:17:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160942 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp993880jan; Fri, 22 Mar 2019 09:18:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwaNtIQW/6J+HdP4NrUCHKsG98lcLxYPCQJeWHof2KTF9HgmJaAbwKwmIGafWi30SQpkmV X-Received: by 2002:a63:464c:: with SMTP id v12mr9592750pgk.431.1553271495378; Fri, 22 Mar 2019 09:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553271495; cv=none; d=google.com; s=arc-20160816; b=Z1zUYGxeODRXfd+h81BzhjdGPrIh2ozOT6OGu+n8siL3C24ydwJcNFBn7X89K9Vm2k l7KhXuLweVxlUbv/xI2WNCHKP8nnVWeQrsSSO/8JYs193Hp486MgpaUwOvQxBoksxfmW huGF9GCKlWb2SFfOs11SxoABBpLMx8xO28bqL32vXjFujzNR5I7THc0fcmqJ14+9e4Ff JEC2t06bwgQArSVqLz/vWXPFO55G4QQw5Tjy3ZpWmz5jnIgpnIBOnA1heO8FYmPj9ziZ tANzoPVucISlFUJL2kEOXKDX4QnCL6MHRje9o4B3Hqt2dmlvxFcXkx+Otcms0SZmedR1 JN7Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=SK27rDf0D+tVQacfF6w8xnAFeC2VOTLExAzHHvbn9ZQ=; b=IA4kl5RieaQf/Xn8rclDL7E1sF2dtxGqxNRp0uUHP1wja/SPhD4+LL3o/hHNoXd7qj YrFWPSWdUfL08swbCTZ7YsmqSTktBUeUdYl4be4DxDg8xccrEauZgk4X9Xo/prGL3P1m 93dxec4ng6RCGryM+cYYmxcdCTWITJ+vx6UIsZqlH9Q5x/R/gV0rKLgYPopAIyilfh2m Qir/q7mfFapH21M+psMqAPoAaadNfxGLUIBnrVyPMlODx9KNG8eOkegpfQFvi4az/Pi/ a8WdamSns5izgf/mjU1RKGq+L5qZOOWFilkp/27w/y5n9jUtH5J4AJUe53iE1QBBywpa mpqw== ARC-Authentication-Results: i=1; mx.google.com; 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 z1si4230278plb.199.2019.03.22.09.18.15; Fri, 22 Mar 2019 09:18:15 -0700 (PDT) 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; 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 S1729470AbfCVQSN (ORCPT + 31 others); Fri, 22 Mar 2019 12:18:13 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:59561 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727898AbfCVQSM (ORCPT ); Fri, 22 Mar 2019 12:18:12 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1N5mSj-1gwtJa2zff-017GR7; Fri, 22 Mar 2019 17:17:53 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Jingoo Han , Joao Pinto , Lorenzo Pieralisi , Bjorn Helgaas Cc: Niklas Cassel , Gustavo Pimentel , Joao Pinto , Arnd Bergmann , Greg Kroah-Hartman , Kishon Vijay Abraham I , Sasha Levin , Jisheng Zhang , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.14.y 2/8] PCI: designware-ep: dw_pcie_ep_set_msi() should only set MMC bits Date: Fri, 22 Mar 2019 17:17:17 +0100 Message-Id: <20190322161727.1153278-3-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322161727.1153278-1-arnd@arndb.de> References: <20190322161727.1153278-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Uo8SCd+/FXufp8zP23YIUZ9XHIAhfqzREoeT+kXGkT8DrQcIvtO ISLMiq4LYOZCjxilA5CckNAfOAqFDM+LAjWLcxmlmgVxM4p5Bgr6VgHEQIuJGeRFS2s/GYC ilIhAbagAtbWHr8HrO/vV7yevV+US9cos7fN8GQFx4BXmKoWrebgZilbJPg+jAo5alncl90 z1hU1IY884EbOkFU6yBvg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:JgGkVkB65co=:ZK0Oq82pszuJbkxPzXZ9Yj 73QDqJompKb4wnxLc5id8fEuPESPHDKbHZD+sh2o9651pNR5mtS+elVnpUUQH1VfuTvwRE74a jltal0bsxPt8UciDilVITIrcljRKJJk+Gnq9AHk3xZ2YArlfEv/Aop60qz8DIl1ssD/nfbQjS ttClDHA1MxHmYMG60Tld6z3lC3PFxzRBnUuCDWnfguvkJl/fTOahNCwolB6HAMaZRESHHNECE E1RKlc0Hl2miLYvVfK4vOajLAuoiO8yZhurMBKBfXBgWT8FtTW1mT/niodvRkm/QrS5q7o3Cg 2cXEsm/LswE04L+gCAtyFepmsIVsEfloAT4xYv57+8CQxycUmmo4tUHEn+XeUSwvHso44d5o6 lpIb4+OpuEVkcwmeFb9EF91RlNjRhzBl8kfzEOMryFUCwflw7lUA0rCsTt1C6XE/gcTOgPHHM wJm+y262gz8OXYGAQ38EJWrEajVIhzXImAbUXgu4uEHrReRU4w6JV2xl1S0TzFwVv85bUJqXj DsYz0gF2/2VaGoKWkbrGjG7264IzWnugr2FP422/sn4l2++MjDsJ6925vL6PWKYkwqUAe+VD8 unr1v9Mri/9wzc5o35Gh7og3uKEMnU8Rz+Bdjy7RJ6iQYjScHYug1DY+n8uCkdnvIdpiDjF6i lK13EFS/7jhs/GOfb7r8VZK+APxrrPFU9vzUlWYPYX9T4rqLkQrp1VwmJYWVT8YXuzZUhWru8 hI8Gv+CORdm2j3FXOkJPtSfJRGnVY7UoBS3xbg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Niklas Cassel Previously, dw_pcie_ep_set_msi() wrote all bits in the Message Control register, thus overwriting the PCI_MSI_FLAGS_64BIT bit. By clearing the PCI_MSI_FLAGS_64BIT bit, we break MSI on systems where the RC has set a 64 bit MSI address. Fix dw_pcie_ep_set_msi() so that it only sets MMC bits. Tested-by: Gustavo Pimentel Signed-off-by: Niklas Cassel Signed-off-by: Lorenzo Pieralisi Acked-by: Joao Pinto (cherry picked from commit 099a95f3591ade29da52131895a3ba9f92a0e82c) Signed-off-by: Arnd Bergmann --- drivers/pci/dwc/pcie-designware-ep.c | 4 +++- drivers/pci/dwc/pcie-designware.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) -- 2.20.0 diff --git a/drivers/pci/dwc/pcie-designware-ep.c b/drivers/pci/dwc/pcie-designware-ep.c index 7c621877a939..df317d390317 100644 --- a/drivers/pci/dwc/pcie-designware-ep.c +++ b/drivers/pci/dwc/pcie-designware-ep.c @@ -214,7 +214,9 @@ static int dw_pcie_ep_set_msi(struct pci_epc *epc, u8 encode_int) struct dw_pcie_ep *ep = epc_get_drvdata(epc); struct dw_pcie *pci = to_dw_pcie_from_ep(ep); - val = (encode_int << MSI_CAP_MMC_SHIFT); + val = dw_pcie_readw_dbi(pci, MSI_MESSAGE_CONTROL); + val &= ~MSI_CAP_MMC_MASK; + val |= (encode_int << MSI_CAP_MMC_SHIFT) & MSI_CAP_MMC_MASK; dw_pcie_writew_dbi(pci, MSI_MESSAGE_CONTROL, val); return 0; diff --git a/drivers/pci/dwc/pcie-designware.h b/drivers/pci/dwc/pcie-designware.h index 3551dd607b90..5af29d125c7e 100644 --- a/drivers/pci/dwc/pcie-designware.h +++ b/drivers/pci/dwc/pcie-designware.h @@ -99,6 +99,7 @@ #define MSI_MESSAGE_CONTROL 0x52 #define MSI_CAP_MMC_SHIFT 1 +#define MSI_CAP_MMC_MASK (7 << MSI_CAP_MMC_SHIFT) #define MSI_CAP_MME_SHIFT 4 #define MSI_CAP_MSI_EN_MASK 0x1 #define MSI_CAP_MME_MASK (7 << MSI_CAP_MME_SHIFT) From patchwork Fri Mar 22 16:17:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160943 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp993928jan; Fri, 22 Mar 2019 09:18:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3cZ0bF9nA/2sjAq9c3mmcV6HbMP63aQvwy25yfh1LkL+k5sPQRt0Sv/seKRNQh7sFCEhL X-Received: by 2002:a63:5266:: with SMTP id s38mr9668807pgl.333.1553271497966; Fri, 22 Mar 2019 09:18:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553271497; cv=none; d=google.com; s=arc-20160816; b=Q0h+MpJmIu8CWtCQECGEiodpS85ZO8tIn7yPeuIQJw5RlOm8I5CUdjFD4kYZjhtISy eqDUxgghuqqR4oeFxldgSmfT362pAMaVxfkdBdGEiGpIb28QaXuDJSRxCDZ6NGvgZBk5 acri18U0aYKa3pc1fNC/r8lFjyGW9W6/AJdC/Unh9RXf259rHrjMKIcOeFRzGlCP0gGf e6Hy7yHXFoOgkyDrUJUNOmLh4Xyt+c8+HcYZctW12XoKtsCabI5BhXg1tC1XbF1GdXvK k6DumU1Zb0ywuEDsB3JRNuldNmvpVTYKBtQ+KnLe9Ct4Lx/K62hjqFXXCl142PwwRwC6 Ahjg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=3BeuVD6KTjJCLbNVjEMp1OUk7jEXaMmDac9m63JGaIQ=; b=DBhxQT0PThbWBBO7WDDxiAt9LUGBs6DOVNIlR/+bWqkfLp7qD/94dAZU5bekqFZ5N8 QY30xFeWyWJgbp5JyNovwoyOwXMUz6PTYVStZ2kTyiiLXk0jD4YBqRjZRjNhh183/lef zRKVUGbEt7ypCTLhnKUSVh7pSbknzBeDLyoDl5IS7yrSUiyQY+VM2V1QC4iAbP0Ya27d pzajj74BQ8s6xwUD7ipNH27m37e7a3dfxur4Sar9Q6WkzDTo5QTrXJL8nLjbe0rG8NyZ ptqj+Rocy2GqbLD3OddvSgY30TapSC3SkgaPv3jAbx1wvAYYLjFImSpX+2DB+kfFpL7/ IQKg== ARC-Authentication-Results: i=1; mx.google.com; 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 z1si4230278plb.199.2019.03.22.09.18.17; Fri, 22 Mar 2019 09:18:17 -0700 (PDT) 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; 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 S1729209AbfCVQSM (ORCPT + 31 others); Fri, 22 Mar 2019 12:18:12 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:44337 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726649AbfCVQSL (ORCPT ); Fri, 22 Mar 2019 12:18:11 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MOiPx-1hM1Sy32Yp-00QCNR; Fri, 22 Mar 2019 17:17:59 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Kishon Vijay Abraham I , Lorenzo Pieralisi , Bjorn Helgaas Cc: Robin Murphy , Rob Herring , Christoph Hellwig , Cyrille Pitchen , Niklas Cassel , Arnd Bergmann , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.14.y 4/8] PCI: endpoint: Use EPC's device in dma_alloc_coherent()/dma_free_coherent() Date: Fri, 22 Mar 2019 17:17:19 +0100 Message-Id: <20190322161727.1153278-5-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322161727.1153278-1-arnd@arndb.de> References: <20190322161727.1153278-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:o2CLoPPlNd8UOmBaKmOyATpVwB8HHtVtSKM+jhSfSQtfC+aMt0q Qy8eWkE1aQFAplhErWK22aC11lYeUAfBhRJn1G7KaUwzS3+PfKvotAAzb2q/2Vitzgva2Sm b/CLGslToUt3vsGJzvb5EtZB2z2rwSNwXouP3yRu7Ap2t1HNwcb8Xt7nTAfm/9l5zu4WN18 a3MZl5DvVAQpq5cbMtfyg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:MQsZCJCy4cU=:oI3MyfMmFwB3s/9sNcqbtp PDb1eAr102e0g9COK2Xh5YELeGSqD4+p3tyBjSXv1MZlCzLi6iDWv7ir/iuJVbi3uxmfq3vWX mUl24vGjKYbfq3ZDMAamq5OkzGnrNr0zyDV81ci5EOe1gelWA8KTiJpmb2AzFvjf69QSV6Pwy 5xQtmYWA1eN2xvf56ex2SBBjPGvFTCaListYnKqt3A7Vd311U/B0h/eY5diZMCEpNIx2zFfq+ VIaB7eNiJDH3HH4g0KD1BgVgu9fmcyzHBaUIgJ57P1rsgbMGa3HEF9aGpmXD54EoWG3OPD/pO paws2HxHC3U0sNR84cv3+aFKqtJuBwIP7ON007WQ4G+BN4Y2BQaqgmvQONsRyIvUOp+vBYV7U jgpeGnpIfr3H22/US9E4cj9yJ8xf8SlQnsPRjSmh1Q1ZO/VTuUQv0W9M9MFqEZX5P0Kq0Vts9 TeiX/zO+tRqTVoVEcG8/fugZGUkQ+2MSSl7sL/rqtQjZcwqta4SgTmKdYSyo2hs4MObWqsedz H7lNJH6KjdlCWDeyVRoo1BIYlFCMsdhohCojQSbe9VEhcDYL2fsYVCWBYFEyc9ZPi/BTGeFLM Z04XS+CPv7JE377BdIPFmDhD164XnzuVZR7S5asOjzNqxC5GEwlVQoIupaYpsBYC89u8S0UZ2 x4+XxzaE9RQmvNv3frmnRd77CH2jL1pqkoUuHFWz3sZ5kFCYqmdjQY3nA+LZBTphI8xopbH84 o+9wMdO4tdMAtu6+C3UEHUdWSal6KmTveyZfzA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kishon Vijay Abraham I After commit 723288836628 ("of: restrict DMA configuration"), of_dma_configure() doesn't configure the coherent_dma_mask/dma_mask of endpoint function device (since it doesn't have a DT node associated with and hence no dma-ranges property), resulting in dma_alloc_coherent() (used in pci_epf_alloc_space()) to fail. Fix it by making dma_alloc_coherent() use EPC's device for allocating memory address. Link: http://lkml.kernel.org/r/64d63468-d28f-8fcd-a6f3-cf2a6401c8cb@ti.com Signed-off-by: Kishon Vijay Abraham I [lorenzo.pieralisi@arm.com: tweaked commit log] Signed-off-by: Lorenzo Pieralisi Cc: Robin Murphy Cc: Rob Herring Cc: Christoph Hellwig Tested-by: Cyrille Pitchen Tested-by: Niklas Cassel Reviewed-by: Robin Murphy (cherry picked from commit b330104fa76df3eae6e199a23791fed5d35f06b4) Signed-off-by: Arnd Bergmann --- drivers/pci/endpoint/pci-epc-core.c | 10 ---------- drivers/pci/endpoint/pci-epf-core.c | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) -- 2.20.0 diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c index 42c2a1156325..cd7d4788b94d 100644 --- a/drivers/pci/endpoint/pci-epc-core.c +++ b/drivers/pci/endpoint/pci-epc-core.c @@ -18,7 +18,6 @@ */ #include -#include #include #include #include @@ -371,7 +370,6 @@ EXPORT_SYMBOL_GPL(pci_epc_write_header); int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf) { unsigned long flags; - struct device *dev = epc->dev.parent; if (epf->epc) return -EBUSY; @@ -383,12 +381,6 @@ int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf) return -EINVAL; epf->epc = epc; - if (dev->of_node) { - of_dma_configure(&epf->dev, dev->of_node); - } else { - dma_set_coherent_mask(&epf->dev, epc->dev.coherent_dma_mask); - epf->dev.dma_mask = epc->dev.dma_mask; - } spin_lock_irqsave(&epc->lock, flags); list_add_tail(&epf->list, &epc->pci_epf); @@ -503,9 +495,7 @@ __pci_epc_create(struct device *dev, const struct pci_epc_ops *ops, INIT_LIST_HEAD(&epc->pci_epf); device_initialize(&epc->dev); - dma_set_coherent_mask(&epc->dev, dev->coherent_dma_mask); epc->dev.class = pci_epc_class; - epc->dev.dma_mask = dev->dma_mask; epc->dev.parent = dev; epc->ops = ops; diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c index ae1611a62808..95ccc4b8a0a2 100644 --- a/drivers/pci/endpoint/pci-epf-core.c +++ b/drivers/pci/endpoint/pci-epf-core.c @@ -99,7 +99,7 @@ EXPORT_SYMBOL_GPL(pci_epf_bind); */ void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar) { - struct device *dev = &epf->dev; + struct device *dev = epf->epc->dev.parent; if (!addr) return; @@ -122,7 +122,7 @@ EXPORT_SYMBOL_GPL(pci_epf_free_space); void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar) { void *space; - struct device *dev = &epf->dev; + struct device *dev = epf->epc->dev.parent; dma_addr_t phys_addr; if (size < 128) From patchwork Fri Mar 22 16:17:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160944 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp993949jan; Fri, 22 Mar 2019 09:18:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqwm/p2BOR1l9GI9k0WnUtcGwtBlFFWZCkasCRd7dzDQY5HEKqju7VFj1xbJ1Zhn8fcxE6dE X-Received: by 2002:a62:55c7:: with SMTP id j190mr9778521pfb.226.1553271499168; Fri, 22 Mar 2019 09:18:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553271499; cv=none; d=google.com; s=arc-20160816; b=Yd3SyOBrYVSOk2TqfQ6SGg6GiGtwy9YmJvo35DwZOo832fbqQp43TSH8myDZhPDVYI 4wAjKzDStGTXHtmDAbSBWvqngvTpwx610fUBnTT9zLWCFJQo1yBPH0RI0p4X446uPBBV J2GGwLA32WWahp9acGalajrZUQrYgIxcUH9lduGGXZtPNN8SjiDTIaFIko0V5+IFZzK7 fBqsHWQhLe55XOKGrqh97xOd3T8ZUxJ04YYVY8lNzS3gBc1faxgd1hV9KNrct3dFg8GF tM6j70yz/b3cZcYEdMn/odDkWw+iZV7JyMLlw9nlWwcDje1ANnYYgkww6dlEYJfbR3TL tB2A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=DEmRVnD3YOzp5zWba5JmRm1MgJevUJpAo+nvDahANC0=; b=pgid21V8QxHbpXWRQ138qyt4KBddCEDYH9PvE9y56afqrWCQg9TMJjKBQekldAZPgB RC1lwJ2ufDifQIRLFyVb1cdc9oz28Wyvp/guijkxdOItRVrshhbUQzNqSxqfyrxsQkFf IhxhlxlrBiyRWEWBaaOolg1VP/7tQ0xQ5MhHVy64h7501xzYQW1BfTvl3jz07iI/4kcY 4WGUhi8x2GH7wdR8VbI2yPxPc1D6/zk5BwqELnZC9NxCwwjeiWyms1Dt/qSpglWbcKpr LBC2e3sWGeZSwdKEVvPC75qnJYybWOGZJVGRuG9aXNbt0Cadar3MiZLbIKqHApt+e5Sf rEuQ== ARC-Authentication-Results: i=1; mx.google.com; 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 h21si6992593pgl.346.2019.03.22.09.18.18; Fri, 22 Mar 2019 09:18:19 -0700 (PDT) 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; 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 S1729576AbfCVQSR (ORCPT + 31 others); Fri, 22 Mar 2019 12:18:17 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:52975 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728506AbfCVQSM (ORCPT ); Fri, 22 Mar 2019 12:18:12 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MV6Bs-1hXK040iVq-00SBOO; Fri, 22 Mar 2019 17:18:02 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Alessandro Zummo , Alexandre Belloni Cc: Baolin Wang , Arnd Bergmann , Alexandre Belloni , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.14.y 5/8] rtc: Fix overflow when converting time64_t to rtc_time Date: Fri, 22 Mar 2019 17:17:20 +0100 Message-Id: <20190322161727.1153278-6-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322161727.1153278-1-arnd@arndb.de> References: <20190322161727.1153278-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:r0URZeN4gl7747nPXhOIAmjtBlm93At/wCEX35OJL/3fdk1//D1 feA/Fk2kPW6TKH/ldm6agj9lgaUknzZrsXCYPUuJiw4KxzSxdu+2KaKXiktyqmlcukX10Pq +QBEDSo+WLP9BxfDB0b3BldcwiI+rHtMakaIkvtb3NkDEwjC4RfqCQZcAaEy27j+RVfz7o/ pv0OauMAob0C7nkOJlrBQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:F4pSOYgaiOY=:PNleV7UoPK6PrajcUklQi3 Tn4AHogzTixryXzYMkLtR5rpIHwhOPG05W22vny5Stg/9DQbKVlEgWQ/IpCE9ugBanXqk69Lm Wu9/vlbODPiIzxjv5Eer+aLoqDFJTXQpTgbd3dQK3N8VExArKncAGsrKTGiNR5zxyPpf0wjqB 0UHVaAmSvBUfb+sNxn1R8QRx3dl7Q3UVPTRmt+btDU+N5O4iIwJrAti//wZ/PjRiu3NpDKKqs NpfPFxJ7YH3TG2aHJY+/MImdk0cOeVLDbEftrWd9Z9t15FPNIGqq2tQzF9c1+j4d2Q4pP/zRw cGLnFxZtEEp1MUcw4RH+gmfnEgM9Vn0d9ZPWEv/9IzbXjo3qOQmn4znm04cSOklCNVJ+Y1hCr vI8poW694uAEHAPv3jqLlMJ1u4TfwzfskKz5b8rctNwXhOh3+QlbrvKCFq7cLbH6YHMs8qAYP dJq/jVWTzu9I8JjSw3w1Dkhv8ksdFGPs6Oqk7AfI+qfGRN3yM9gX6QRJupGMEV9KVc0FgSwiA uZGIoZUTYnFtQjzKovR4Z8hU6pHEApNrz6AHOVXo5jzti4ffCvodN2OoPkex6Rr3hc9OAgsQk q+F+sVFUqeqdDBDHC5/QdOueHY5eL/00fbqUfFrwkQRrudMVWodeSnUXKEDD0VkbV+lMNtVGZ dF9l33uCCPv26R4lwHgdgtGp3BDoctkOKjw0AU8a4EENsBpwQXDam6s5TCYyeJT3zvzcMmzdR mcoxmo/LRDhjGtPjOuVmzAdp3SlyTJIFZVvD3Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Baolin Wang If we convert one large time values to rtc_time, in the original formula 'days * 86400' can be overflowed in 'unsigned int' type to make the formula get one incorrect remain seconds value. Thus we can use div_s64_rem() function to avoid this situation. Signed-off-by: Baolin Wang Acked-by: Arnd Bergmann Signed-off-by: Alexandre Belloni (cherry picked from commit 36d46cdb43efea74043e29e2a62b13e9aca31452) Signed-off-by: Arnd Bergmann --- drivers/rtc/rtc-lib.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.20.0 diff --git a/drivers/rtc/rtc-lib.c b/drivers/rtc/rtc-lib.c index 1ae7da5cfc60..ad5bb21908e5 100644 --- a/drivers/rtc/rtc-lib.c +++ b/drivers/rtc/rtc-lib.c @@ -52,13 +52,11 @@ EXPORT_SYMBOL(rtc_year_days); */ void rtc_time64_to_tm(time64_t time, struct rtc_time *tm) { - unsigned int month, year; - unsigned long secs; + unsigned int month, year, secs; int days; /* time must be positive */ - days = div_s64(time, 86400); - secs = time - (unsigned int) days * 86400; + days = div_s64_rem(time, 86400, &secs); /* day of the week, 1970-01-01 was a Thursday */ tm->tm_wday = (days + 4) % 7; From patchwork Fri Mar 22 16:17:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160949 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp994413jan; Fri, 22 Mar 2019 09:18:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzEksJQEze6dqn3l5E+HXM7qcDNjbuX+vuTuG5Fau6cRgMVdjw2C9+UlBsBkBPxK45QGyfJ X-Received: by 2002:a63:6193:: with SMTP id v141mr9669127pgb.392.1553271522697; Fri, 22 Mar 2019 09:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553271522; cv=none; d=google.com; s=arc-20160816; b=TZdy3HXud5Jv5jbCN1xqplmZl0q8HpbECZe/WSwWwXLDqQtwrxyE2kUa3BwbP1YM7c yWHd4G8ySQ4GifPbymrRpl0d/yAPCvTz3DBsDA9GM43xxEkBv/ZZ+Cz2slHtdUpGtoAB VxHXN0T/JNtstuV6jxq8GSZLhBH6jWgcWP6HULV8KBlqLuwqowJuq1h9IGwuaGs07Vv3 dAjcoK1G0dN+AszCeAtQhsxKaQvkqo1ngmONE8YlyULhBYCgqxn/wDA5RBhP4r2H9Z3d +jpZo37rS8oJPFU4kUV6zW6gPHRbMgW071aRsi6ajek7N4FIr+TEn9M6utzUYNe8IzDM W4nA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=PPKzMjbjXv312b8cWBdVZu9LEsVF+3skdXIM8MiK81o=; b=nNPbKaZfFKpJ/KYxLi6vVlXWlUZ2a43Yo80H1W7OLszkza/wWq8JPLTE+viGH26iwN RbUFMBYN3QNxOptyF38RtGICKprEcKi0oQxERiWQS/HeuWNTkmLwRgI7fWzT0iNmk6sr eyyCPXXGsWL/GyCfkN2nOxgdwmZAWAFUB5dBu9EBN44/YADqYdeyA/YcQHmwc0t0fqXQ /4BGXv5nvOEsVMH0oK7ySdIyMHBluvnJwEnnYJJ6EtpFyWa0Fe+euOKs2xGqHnIqg8FL U6lgPeme8GEQVb+hw+ecwfvaApxbywhx9HCmxAUcqmuI/ppa4HhtVPT7WyCZpC3iD3Q6 koUQ== ARC-Authentication-Results: i=1; mx.google.com; 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 d195si7287812pga.309.2019.03.22.09.18.42; Fri, 22 Mar 2019 09:18:42 -0700 (PDT) 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; 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 S1729714AbfCVQSl (ORCPT + 31 others); Fri, 22 Mar 2019 12:18:41 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:39111 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728017AbfCVQSk (ORCPT ); Fri, 22 Mar 2019 12:18:40 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mw9Hm-1gosZt2rSu-00s8H8; Fri, 22 Mar 2019 17:18:05 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Ingo Molnar , Peter Zijlstra Cc: Jules Maselbas , Chris Redpath , Dietmar Eggermann , Linus Torvalds , Mike Galbraith , Patrick Bellasi , Stephen Kyle , Thomas Gleixner , linux-kernel@vger.kernel.org, nd@arm.com, Ingo Molnar , Arnd Bergmann , "Rafael J. Wysocki" , Greg Kroah-Hartman Subject: [BACKPORT 4.14.y 6/8] sched/cpufreq/schedutil: Fix error path mutex unlock Date: Fri, 22 Mar 2019 17:17:21 +0100 Message-Id: <20190322161727.1153278-7-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322161727.1153278-1-arnd@arndb.de> References: <20190322161727.1153278-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:MXmycvD1CtaPZk6JuDv4SojVbiweK06JIhz6y2x882YX36mi0DM jbWkydyoobkg+9z0Zc9Gy3DjX9YKXIHqqoPZh5mg508pXHXhGfsnl3ltLgbRic/ddfYZX6T LCEQSKTRZKaiZfLjsDhFWC59O0Xt5EFTZ0cjXan43UPZsQ2whGuvO/Z49yQCqoMeNcP4EfV CveReTpzT4oshyzdGPZmw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:4Lwf+QVPKuE=:4vgzKyqxEq7hRMJ9UyPWm5 UCq/pC1jputQqbYgzbaDOa9ZBx7vDAH2eakVJcA2UdyqqRWV1gjVWtH8eK/HlNWXs/TW1cfjH xdvbN2nnTjTSbsWebK+Vy5BCLdARp5Z9G6nnz2wmt7r6dGTu/OXfHyXj7XxLbzskOAhd+34X3 DdA/oIQKiIVZdZv/Ak0I1xT6p0xmto5j3uxxffY/PA5gsy3elESlSRV0T6fzJsdUIHQQoa8zl +X5O2K5nvfSgVd+49idZug+2ymzi+5G1UVi8Q8bWCiwpuExhxwQph41LaHzMEMv/NZ3+usVHJ 4du+7RbuwxwhZlaGH94I+ZYD+Eyph0kxGGyJeX+wcaIMfcSptbnRjHHnTrtzhCa73wZKswjS4 CvchHpxk5xoldgSY8LRO81x8iS3kg63YliIH9WXDQhAaiPVUHz0oYR3toID5UKLFfm/eAG8EC /oFFux0WZENd+i/rM3xOV2JZ26lHZ51sHr9RZCogRrV+ZI4kYKb56pIYEUQ5pS+sbcBrb/nTV yY3FW4VV+/NWSA/srg/+vCEyRBUyicSmfMn8G1vO6GgNRlNDZYyNuWFXX70stvDG4w6Jib8b0 5S4Wn6AzS8BMsloz5idKtSXTROc9A4KGgUXonqF1w/t3lwMFs0HSUhAgNByUv5Rh8I2up2X2+ 1xQ15PnASE92P7DbJEwNj7bg/bgwFDzcjXhJfeMkYGVf15ks4BeihBhyjheuTeqB0219oETBi rpTb9t1YE8OsRkk41JGR8TPWBB4X1jbnmBs9ew== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jules Maselbas This patch prevents the 'global_tunables_lock' mutex from being unlocked before being locked. This mutex is not locked if the sugov_kthread_create() function fails. Signed-off-by: Jules Maselbas Acked-by: Peter Zijlstra Cc: Chris Redpath Cc: Dietmar Eggermann Cc: Linus Torvalds Cc: Mike Galbraith Cc: Patrick Bellasi Cc: Stephen Kyle Cc: Thomas Gleixner Cc: linux-kernel@vger.kernel.org Cc: nd@arm.com Link: http://lkml.kernel.org/r/20180329144301.38419-1-jules.maselbas@arm.com Signed-off-by: Ingo Molnar (cherry picked from commit 1b5d43cfb69759d8ef8d30469cea31d0c037aed5) Signed-off-by: Arnd Bergmann --- kernel/sched/cpufreq_schedutil.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.20.0 diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 81eb7899c7c8..b314c9eaa71d 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -605,10 +605,9 @@ static int sugov_init(struct cpufreq_policy *policy) stop_kthread: sugov_kthread_stop(sg_policy); - -free_sg_policy: mutex_unlock(&global_tunables_lock); +free_sg_policy: sugov_policy_free(sg_policy); disable_fast_switch: From patchwork Fri Mar 22 16:17:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160947 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp994172jan; Fri, 22 Mar 2019 09:18:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwxvZpR5YvQJMTx6rpQEmUqsjY+5Z9t/2cFFnxDBtEvic37BWbInSGH/0KJ7wL0EVNEHSMM X-Received: by 2002:a17:902:7e4b:: with SMTP id a11mr10334022pln.219.1553271510774; Fri, 22 Mar 2019 09:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553271510; cv=none; d=google.com; s=arc-20160816; b=rlIeZgDDJB3Q+kqWAxwvdUuERYq5TNNYMzJD209yJC6bIOEsz523yqdqANDObXpv8C XqOcMHRl0Exm8WllsEc6JDRSWpuZalduwOUwE1uBYcGR39nhS1lpWYEcxQQ+xipR9ZJW RLNfw5DUmJhydysfowHRY00LBQy3gkjfflSsR6h+Jpxe95wklEWLuisXnuwVE+GCEOqS XwO4U7tt50/fGZq/SU8aY5oTIaww6hYlk1JQsIoC5671j+Kl3O3BR5oFG4u6Dvl6R1Gx UZ1NjidKaY89WzMWpOzKmDCuZW3HF1xXyADCf7QGHtxMPpdec/ExRf698303fip49OAn MNTA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=OVeBF92GegLSrVjq+t17lnOS7C3sIC3BiDQspHPLSy0=; b=tbNI2/sqHfj3G56G7q5GFb2tB2p/UnZaTHy6+kOeBgUBXQSN++IcMkbBt+FejUmzV8 NWc0woaxeXabZ81sid2zw+vAephhTDs2MboJJPGr+tkTZPTus3sP0cBde8pFSj3/VAzS cbmMxhgMDVzMmqInw2B2JbipRbeKKjtLF7yYxZxWp8LjX5TPcsxC5ugWGCr7MSvn+Htr QYGW38M7Os+HGauEsvn829+m5IWDEPZY2k++T02TxPP4zHzpqdI+/cjOIL5aE/c1V7wg FgDojZWe152q/lCi4h4GpsJlQOnc419K72j1bYgiPYfxr6H3P7u7QG8GIdb24OK/L0Lb DylA== ARC-Authentication-Results: i=1; mx.google.com; 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 k25si6794115pfo.254.2019.03.22.09.18.30; Fri, 22 Mar 2019 09:18:30 -0700 (PDT) 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; 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 S1729655AbfCVQS2 (ORCPT + 31 others); Fri, 22 Mar 2019 12:18:28 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:50421 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728506AbfCVQST (ORCPT ); Fri, 22 Mar 2019 12:18:19 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1McGxG-1gZP252F1Y-00celC; Fri, 22 Mar 2019 17:18:09 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Thierry Reding , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz Cc: Enric Balletbo i Serra , Arnd Bergmann , Wolfram Sang , linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.14.y 7/8] pwm-backlight: Enable/disable the PWM before/after LCD enable toggle. Date: Fri, 22 Mar 2019 17:17:22 +0100 Message-Id: <20190322161727.1153278-8-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322161727.1153278-1-arnd@arndb.de> References: <20190322161727.1153278-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:98ZaXMT7Sqw9y1pDFUAjfR/TmDFSO4/c2yDoQqHy9p35Lv3HvzJ zciPwkDzqGxDKzw+WyOpVoyffMWXaocOntl7TtlIJdUdjLDZnGzBhBEQEf6Lcgax7rfjMbP JadONNGfZ5QYDpBv0C1un4TuFE4fNdhbI6D0fOhl9WT7Zv6H5O/2PwWOG2Xxf4JKv4YOpTw wRJEyGTPF0eJPlJ7PkILA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:lnfPOrnU93g=:E+yyWykToN2NNLGa8WibcA uFG5Nt4M9GyDb6fN4XzH3ZLvT65SN/4quOBwwQevFkiLbG5A4WlwB1O50Y2cvj5lbKqbmscZS 9LFfGY+rHuIr5ydKLThpH8eEklNBZyRWZjVY+wAjdtgbmJPbxS8uj3ooh2OZ2thwGvBhTS5Jb XFOoKGJ/8a25He5M9saGFK3iJfMpJsaQphb4obnGKxq6e623h7vO/Z3Gu3A4qpULAFl2YUYu+ bIi8VM0xMiUVgb7oZRnRvjgIOysy7yMp0Aro5wd3f+PGiSbzUXSaDk2EGxXp2sJFcMIVrRoX0 8csmoSFviYm0r2OMsFCZ6KFcru6s+zZ+cG0uDsLGf0nJvdDLduhEgDICbPM9caENgOl9hQYQs 6iREkPu6gznxJNeh2JmzT3rnVx7ZcPwhqRHI9HscXWH1Re14eNZ5ELG60jhcK5vPueVg31y3J rQFkRwl09XG1+ZZ575e7Qe9uf1blU2tiBOpgEOU4Yp2fMlixphAAcPQZtLdFymG3s7MZDZmvf VsLnK5qMT5FLLbPReDVbCuK7jWtWjWh83mawfe7+B1qJWtw9K7z1CGh+Mj8foYTCS8JkX5aTS aYJoat0Cs/L2hzL08kbCu4x3iiJqgaVtjYmuUIahPbciYsmtLnknUd6Uz+WBLDMNOVm+/UOVR UxvOWvLbTKTFP3VLuT4g0jSPcgWBM4wo5vPBv16eWR7ECDybaofPYNok+1uc1+hCX4fFFdFNB 3YyDKBHSJ24vamhc3MXW7OSz3WfnjCBXHky+aQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Enric Balletbo i Serra Before this patch the enable signal was set before the PWM signal and vice-versa on power off. This sequence is wrong, at least, it is on the different panels datasheets that I checked, so I inverted the sequence to follow the specs. For reference the following panels have the mentioned sequence: - N133HSE-EA1 (Innolux) - N116BGE (Innolux) - N156BGE-L21 (Innolux) - B101EAN0 (Auo) - B101AW03 (Auo) - LTN101NT05 (Samsung) - CLAA101WA01A (Chunghwa) Signed-off-by: Enric Balletbo i Serra Acked-by: Daniel Thompson Acked-by: Jingoo Han Acked-by: Thierry Reding Signed-off-by: Lee Jones (cherry picked from commit 5fb5caee92ba35a4a3baa61d45a78eb057e2c031) Signed-off-by: Arnd Bergmann --- drivers/video/backlight/pwm_bl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.20.0 diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 0fa7d2bd0e48..155153ecb894 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -54,10 +54,11 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb, int brightness) if (err < 0) dev_err(pb->dev, "failed to enable power supply\n"); + pwm_enable(pb->pwm); + if (pb->enable_gpio) gpiod_set_value_cansleep(pb->enable_gpio, 1); - pwm_enable(pb->pwm); pb->enabled = true; } @@ -66,12 +67,12 @@ static void pwm_backlight_power_off(struct pwm_bl_data *pb) if (!pb->enabled) return; - pwm_config(pb->pwm, 0, pb->period); - pwm_disable(pb->pwm); - if (pb->enable_gpio) gpiod_set_value_cansleep(pb->enable_gpio, 0); + pwm_config(pb->pwm, 0, pb->period); + pwm_disable(pb->pwm); + regulator_disable(pb->power_supply); pb->enabled = false; } From patchwork Fri Mar 22 16:17:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160946 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp994070jan; Fri, 22 Mar 2019 09:18:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqwefVZXg0+hg8hBdG6iy0SKjwsgdUA7xmzz3suXlQ3XjKgL0L51q89TMvts2lt+8EvFKMHX X-Received: by 2002:a17:902:e701:: with SMTP id co1mr10458921plb.61.1553271506444; Fri, 22 Mar 2019 09:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553271506; cv=none; d=google.com; s=arc-20160816; b=NfrCRgVcmqJPeGgJDxo5SnXoOGIr0IfD9B5FuiOiRYpWC6XC3AyGbybO0zp8cHZxhs 7OY740NvqqxYldfsNmsvfLseow8CqfosEuZQruoqmW0A3WFbg2ewIaV/8FF22js8ovDH Is0/7r97tKaq7l/uvQZBEOKuv8glkhEC/OjwaiYSzQxkEBkolnZfqi728K691h1srvgF 08c2708ssdnD3bh+pdLh1HBL8C3Ix1IGH/PZdvTr+PVDXArjz1cddYh7ySrkzKyJjC/u 927/RQ4zJjH43wPA1qp6C3pQKS1ADuCF0P4qcoz2001JEgoDR/0UuTdU6AvuzaDFdxHl YV/g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=CEBag7n4/GBhYZndOFcYfJc1DpsldGkSGorW5uZtoqY=; b=yg0MeqSYeykBy/PETwDq16GTiesK4Cu+YDuzchPHnosTtHONq/uI9TczCmK2pJZT/5 tYMR9UBzxTnXTQzgfihdkrxDK/AwI+G7px/kmHTXhYaQlytxMrLLo42iYbvCoAeYmjKz WBdKSIiZz1Lq1bFUslatknLqjt2LIAEzXfc0EXp1vO/MbxwKiCAK36jfqGD0VFEQvpi+ AHbvlbIdDLf6rj556KOQM03o+Q1sOCUVJ6rvuzubCQ5RuPd+DywiTMCncFpMF5dA3Ong OUzdLeKlg5RVrhlebw6rqccAQVdek6BlyTALLsELJPwuMQDydm33ukwxz5Z+z8g9AZu9 QycA== ARC-Authentication-Results: i=1; mx.google.com; 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 h21si6992593pgl.346.2019.03.22.09.18.25; Fri, 22 Mar 2019 09:18:26 -0700 (PDT) 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; 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 S1729622AbfCVQSU (ORCPT + 31 others); Fri, 22 Mar 2019 12:18:20 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:55441 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727898AbfCVQSR (ORCPT ); Fri, 22 Mar 2019 12:18:17 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MGz9p-1hC5qR2OBv-00E4Nl; Fri, 22 Mar 2019 17:18:12 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Sebastian Reichel Cc: Baolin Wang , Sebastian Reichel , Arnd Bergmann , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.14.y 8/8] power: supply: charger-manager: Fix incorrect return value Date: Fri, 22 Mar 2019 17:17:23 +0100 Message-Id: <20190322161727.1153278-9-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322161727.1153278-1-arnd@arndb.de> References: <20190322161727.1153278-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:6ScF2cDbBBtmdzkHdRlSrHcxdLZn0+JBp7AxazAA+HUIu4cU7BF O6YY5JWQPNLaP27RU+gIXmAhUSQBpbwKHBtDu3q7eyqppgM9upVOG+je0fogwPvrvkhPrrH yYw3wfTIoAIREC88a6DD8sYR5DvxGLFOzGmMmDXUvBb6OpnCQN3dN68veWv4A7rGcNd9xG5 R/birbHdbDrlg/ZhDHCSQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:BYxt3WBL1qs=:G8aBjDBAzJ9p+b57cHYdFl R70dmBuroo7xpL7qA7YWV9ve5VBE3NOoiRhGcdAg5roJULVzNtkwsCn9AqZc8qpg/stivFZAf HUXTjAkkMWGNFQ9qLa0JFIAUcqjYQenqaEuwvEfQyw3HFbEgAc7PhydSobEdZakCKZ5OX4PAi DoMRYvzDWaHUHc6d0F2tnRWWXSIpThiq6I5ztyLNSRtbAtuSZNBaFGOXDuMgegxReu3tTp4Us aqRFbdsi4DrL9eMPy5hBzOZZzdh5ve/D0+Tc2pJ1UkRufwGFaVyQEDjNxtTJvBlka2GrKZrSF SFOJ5rK5bmCUhQv3BrBYFo0jKJckW6lRbcwA25uYkVwnxVOy1dQ9HIvwJQe4fP0RjpSgmM5ka p/iLHCFYS0TahHNTo9WdY4fidqJaq8hwrIRV3RJ+Fl+KYsD6xXTS1UJcvl0MY4Kd+z6BqxTyN 1b01Po0oDvDG2gIUhtdidWpUlpVBPRkKUMTWeeRr5v80PgeSXWIeITeDD7F9O9QqCs14/fISW j5v5U0Buc6dAKiIYep61lMu5rRbSlQTvjls4LKHc3okTa4J6p7CDqDe1UJaEoMTk0UP35pjnB DZip7WXsVgewXatRUrtnTFElSmLXOylQiewH4CmJwb2BV/B72aAB3zKhLWH0tzlR9231sru4O jCGRq5nnqps08UQcQ6tBQtcYHK+u244RfWTkDiYDzaPt2lEKcoyKSVqOikIL47cc56utdAg0m ePh6i5X1cSPFz+GcaHD9UPaP2Iv1LTYvbdBIaQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Baolin Wang Fix incorrect return value. Signed-off-by: Baolin Wang Signed-off-by: Sebastian Reichel (cherry picked from commit f25a646fbe2051527ad9721853e892d13a99199e) Signed-off-by: Arnd Bergmann --- drivers/power/supply/charger-manager.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.20.0 diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c index 6502fa7c2106..f60dfc213257 100644 --- a/drivers/power/supply/charger-manager.c +++ b/drivers/power/supply/charger-manager.c @@ -1212,7 +1212,6 @@ static int charger_extcon_init(struct charger_manager *cm, if (ret < 0) { pr_info("Cannot register extcon_dev for %s(cable: %s)\n", cable->extcon_name, cable->name); - ret = -EINVAL; } return ret; @@ -1629,7 +1628,7 @@ static int charger_manager_probe(struct platform_device *pdev) if (IS_ERR(desc)) { dev_err(&pdev->dev, "No platform data (desc) found\n"); - return -ENODEV; + return PTR_ERR(desc); } cm = devm_kzalloc(&pdev->dev, sizeof(*cm), GFP_KERNEL);