From patchwork Sun Feb 5 19:20:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Willy Tarreau X-Patchwork-Id: 93375 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1514626obz; Sun, 5 Feb 2017 11:29:00 -0800 (PST) X-Received: by 10.84.254.74 with SMTP id a10mr12101616pln.57.1486322940486; Sun, 05 Feb 2017 11:29:00 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j17si26813047pgh.264.2017.02.05.11.29.00; Sun, 05 Feb 2017 11:29:00 -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; 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 S1754762AbdBET2q (ORCPT + 25 others); Sun, 5 Feb 2017 14:28:46 -0500 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:28532 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752697AbdBET2m (ORCPT ); Sun, 5 Feb 2017 14:28:42 -0500 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id v15JMmIJ008557; Sun, 5 Feb 2017 20:22:48 +0100 From: Willy Tarreau To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux@roeck-us.net Cc: Nishanth Menon , Paul Walmsley , Herbert Xu , Willy Tarreau Subject: [PATCH 3.10 187/319] hwrng: omap - Fix assumption that runtime_get_sync will always succeed Date: Sun, 5 Feb 2017 20:20:09 +0100 Message-Id: <1486322541-8206-88-git-send-email-w@1wt.eu> X-Mailer: git-send-email 2.8.0.rc2.1.gbe9624a In-Reply-To: <1486322541-8206-1-git-send-email-w@1wt.eu> References: <1486322541-8206-1-git-send-email-w@1wt.eu> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nishanth Menon commit 61dc0a446e5d08f2de8a24b45f69a1e302bb1b1b upstream. pm_runtime_get_sync does return a error value that must be checked for error conditions, else, due to various reasons, the device maynot be enabled and the system will crash due to lack of clock to the hardware module. Before: 12.562784] [00000000] *pgd=fe193835 12.562792] Internal error: : 1406 [#1] SMP ARM [...] 12.562864] CPU: 1 PID: 241 Comm: modprobe Not tainted 4.7.0-rc4-next-20160624 #2 12.562867] Hardware name: Generic DRA74X (Flattened Device Tree) 12.562872] task: ed51f140 ti: ed44c000 task.ti: ed44c000 12.562886] PC is at omap4_rng_init+0x20/0x84 [omap_rng] 12.562899] LR is at set_current_rng+0xc0/0x154 [rng_core] [...] After the proper checks: [ 94.366705] omap_rng 48090000.rng: _od_fail_runtime_resume: FIXME: missing hwmod/omap_dev info [ 94.375767] omap_rng 48090000.rng: Failed to runtime_get device -19 [ 94.382351] omap_rng 48090000.rng: initialization failed. Fixes: 665d92fa85b5 ("hwrng: OMAP: convert to use runtime PM") Cc: Paul Walmsley Signed-off-by: Nishanth Menon Signed-off-by: Herbert Xu [wt: adjusted context for pre-3.12-rc1 kernels] Signed-off-by: Willy Tarreau --- drivers/char/hw_random/omap-rng.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) -- 2.8.0.rc2.1.gbe9624a diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c index d2903e7..52aebbe 100644 --- a/drivers/char/hw_random/omap-rng.c +++ b/drivers/char/hw_random/omap-rng.c @@ -127,7 +127,12 @@ static int omap_rng_probe(struct platform_device *pdev) dev_set_drvdata(&pdev->dev, priv); pm_runtime_enable(&pdev->dev); - pm_runtime_get_sync(&pdev->dev); + ret = pm_runtime_get_sync(&pdev->dev); + if (ret) { + dev_err(&pdev->dev, "Failed to runtime_get device: %d\n", ret); + pm_runtime_put_noidle(&pdev->dev); + goto err_ioremap; + } ret = hwrng_register(&omap_rng_ops); if (ret) @@ -182,8 +187,15 @@ static int omap_rng_suspend(struct device *dev) static int omap_rng_resume(struct device *dev) { struct omap_rng_private_data *priv = dev_get_drvdata(dev); + int ret; + + ret = pm_runtime_get_sync(dev); + if (ret) { + dev_err(dev, "Failed to runtime_get device: %d\n", ret); + pm_runtime_put_noidle(dev); + return ret; + } - pm_runtime_get_sync(dev); omap_rng_write_reg(priv, RNG_MASK_REG, 0x1); return 0; From patchwork Sun Feb 5 19:20:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Willy Tarreau X-Patchwork-Id: 93374 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1513640obz; Sun, 5 Feb 2017 11:23:58 -0800 (PST) X-Received: by 10.84.214.150 with SMTP id j22mr12129898pli.23.1486322638799; Sun, 05 Feb 2017 11:23:58 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65si31511640pft.125.2017.02.05.11.23.58; Sun, 05 Feb 2017 11:23:58 -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; 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 S1753295AbdBETXu (ORCPT + 25 others); Sun, 5 Feb 2017 14:23:50 -0500 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:27696 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753260AbdBETXr (ORCPT ); Sun, 5 Feb 2017 14:23:47 -0500 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id v15JMsFp008563; Sun, 5 Feb 2017 20:22:54 +0100 From: Willy Tarreau To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux@roeck-us.net Cc: Linus Walleij , Jonathan Cameron , Willy Tarreau Subject: [PATCH 3.10 193/319] iio: accel: kxsd9: Fix raw read return Date: Sun, 5 Feb 2017 20:20:15 +0100 Message-Id: <1486322541-8206-94-git-send-email-w@1wt.eu> X-Mailer: git-send-email 2.8.0.rc2.1.gbe9624a In-Reply-To: <1486322541-8206-1-git-send-email-w@1wt.eu> References: <1486322541-8206-1-git-send-email-w@1wt.eu> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Walleij commit 7ac61a062f3147dc23e3f12b9dfe7c4dd35f9cb8 upstream. Any readings from the raw interface of the KXSD9 driver will return an empty string, because it does not return IIO_VAL_INT but rather some random value from the accelerometer to the caller. Signed-off-by: Linus Walleij Signed-off-by: Jonathan Cameron Signed-off-by: Willy Tarreau --- drivers/iio/accel/kxsd9.c | 1 + 1 file changed, 1 insertion(+) -- 2.8.0.rc2.1.gbe9624a diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c index a22c427..d94c0ca 100644 --- a/drivers/iio/accel/kxsd9.c +++ b/drivers/iio/accel/kxsd9.c @@ -160,6 +160,7 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev, if (ret < 0) goto error_ret; *val = ret; + ret = IIO_VAL_INT; break; case IIO_CHAN_INFO_SCALE: ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); From patchwork Sun Feb 5 19:20:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Willy Tarreau X-Patchwork-Id: 93377 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1439217qgi; Sun, 5 Feb 2017 11:58:41 -0800 (PST) X-Received: by 10.84.140.1 with SMTP id 1mr12196666pls.38.1486324721129; Sun, 05 Feb 2017 11:58:41 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r39si31633677pld.320.2017.02.05.11.58.40; Sun, 05 Feb 2017 11:58:41 -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; 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 S1754126AbdBET62 (ORCPT + 25 others); Sun, 5 Feb 2017 14:58:28 -0500 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:28092 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754050AbdBETZc (ORCPT ); Sun, 5 Feb 2017 14:25:32 -0500 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id v15JMsM2008564; Sun, 5 Feb 2017 20:22:54 +0100 From: Willy Tarreau To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux@roeck-us.net Cc: Linus Walleij , Jonathan Cameron , Willy Tarreau Subject: [PATCH 3.10 194/319] iio: accel: kxsd9: Fix scaling bug Date: Sun, 5 Feb 2017 20:20:16 +0100 Message-Id: <1486322541-8206-95-git-send-email-w@1wt.eu> X-Mailer: git-send-email 2.8.0.rc2.1.gbe9624a In-Reply-To: <1486322541-8206-1-git-send-email-w@1wt.eu> References: <1486322541-8206-1-git-send-email-w@1wt.eu> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Walleij commit 307fe9dd11ae44d4f8881ee449a7cbac36e1f5de upstream. All the scaling of the KXSD9 involves multiplication with a fraction number < 1. However the scaling value returned from IIO_INFO_SCALE was unpredictable as only the micros of the value was assigned, and not the integer part, resulting in scaling like this: $cat in_accel_scale -1057462640.011978 Fix this by assigning zero to the integer part. Tested-by: Jonathan Cameron Signed-off-by: Linus Walleij Signed-off-by: Jonathan Cameron Signed-off-by: Willy Tarreau --- drivers/iio/accel/kxsd9.c | 1 + 1 file changed, 1 insertion(+) -- 2.8.0.rc2.1.gbe9624a diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c index d94c0ca..4f9d178 100644 --- a/drivers/iio/accel/kxsd9.c +++ b/drivers/iio/accel/kxsd9.c @@ -166,6 +166,7 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev, ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); if (ret < 0) goto error_ret; + *val = 0; *val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK]; ret = IIO_VAL_INT_PLUS_MICRO; break;