From patchwork Mon Jan 28 15:54:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 156759 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3581877jaa; Mon, 28 Jan 2019 07:55:16 -0800 (PST) X-Google-Smtp-Source: ALg8bN7mXBghDXmMt28+k1VflGWw5LX4DLRSqOilbKWQJkN46IkoCONucCFEZcqLCOsHZdn2eQl4 X-Received: by 2002:a17:902:704b:: with SMTP id h11mr22437528plt.157.1548690915944; Mon, 28 Jan 2019 07:55:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548690915; cv=none; d=google.com; s=arc-20160816; b=ooFcrDsdvM3Zkgj+IoirFW7G16HhXU+eEC5idRZzaSfnJg1C1d1KLTyci8LjNFhX36 rQJCFCJ58CW5gfq+d5T1YBFxOfwjcoelY/RlQVdROkAq0gpiM8tHaSnTzRYLbsAzXd1X BrXHebnGzMtiE8ZxzONLaXnp4UZIa4AdYjQe7ZZKjFV8hTN3KI/u9pzLqsMspfDKvoFM aDq1uBRMOn+GDXP6x6jW2SYYv3u9s8fsdBr14bQJHX0NuBc2eVLy90mASNCGCn+PZTeD Y+277e+iw4N551NFx8w1RGNrAF6J4vkGktg168m5X9jNigMvaLYrwSUXMk0C4I/uAw9C BimA== 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 :dkim-signature; bh=4uJKpLWM6aPmr+zhJuvVuuv2Ucq9pVDA4S2r+Yn6Xzk=; b=zGXpMZVNDL8J/cCJZQOrMDRIZflbLh8AuJLznwAP8RyJq1DCV3jDIQLhDnU9jwnPGu HEzv6oObVUkxKUprxdo5mc0/R/aYow4BdOPlvuyHZcSe5/Ub1Bf7RASNHzSLypJVPUpZ eH9bv9ppzZKRNa82hnDEjrKPZ3DZhMYVeEGs6IChlJqs0cKesjd1gh6pewnbTX1g6o2A dBwsd2u+lEkRAV9FwnzDjspVVKUx7/32XJEhMehIudpAuw+Gvmlk/gsf5otJEoxqDWgR Y8wsJhEJ7G2tvDcQSUJvhN3qZiEiLBkLgBPgVfq8QKBeuq5S9YIGGDuQBnK+rE4uaUL5 cy5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jVOUnK34; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si19733220pfn.26.2019.01.28.07.55.15; Mon, 28 Jan 2019 07:55:15 -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=pass header.i=@linaro.org header.s=google header.b=jVOUnK34; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727986AbfA1PzN (ORCPT + 31 others); Mon, 28 Jan 2019 10:55:13 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42642 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729835AbfA1PzL (ORCPT ); Mon, 28 Jan 2019 10:55:11 -0500 Received: by mail-wr1-f68.google.com with SMTP id q18so18605864wrx.9 for ; Mon, 28 Jan 2019 07:55:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4uJKpLWM6aPmr+zhJuvVuuv2Ucq9pVDA4S2r+Yn6Xzk=; b=jVOUnK34SgCGU4+niCiHTbiLCK6fH4+xrDwa49Pd9qknCFh2xEyLTDDip2x6TUUVKO CH/13tx2t7q53C4haDiFitiVzy33h50K4LYkgrEmya/NkZxwg6HqKyIu4zeH9QMK8im7 voxeWxUNRisqGBz66XcUeZ2VhtgiAX+FSkoQc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4uJKpLWM6aPmr+zhJuvVuuv2Ucq9pVDA4S2r+Yn6Xzk=; b=rTMM2cDrgZ9KT3vXuJJkAZqdcozzOUIqWhDky5JWZH63vgyzSz2f/6HsNRzS/vuWal wv62C6pjDxBoGi/5MfWhh9xhHIZ5pREKsOhV77fyt4bIjxiKlNgh+axSvCakhNjCf9Ln 50Vr69cdBIiUFbxVqMcQFH+YBu/M+g6kJVxVmInz1Njz4fwChIIYH228eRYAwaiS1NG1 2XEGNn0hLEE4dIy054uKNqwvYirmdjqoXq0xqx40zc0SYog+pMX9poWyhuXYxf8nObs1 i2Z/+0VovBjW4o/IECevH1gUE5LsprPUctQ8u3ghsAYo5WYqWWb+xgkfm2OYYsMG3aeI z93g== X-Gm-Message-State: AJcUukfW8EfCVKnTU78PATRyCfGP73THuKhsSHs1/kO7K7q7h6gavFip TZdf5JkBmzTSiqxTyDZHn6lpxpQAadw= X-Received: by 2002:adf:bb8d:: with SMTP id q13mr22085966wrg.183.1548690909803; Mon, 28 Jan 2019 07:55:09 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id p6sm145140485wrx.50.2019.01.28.07.55.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 07:55:08 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 01/13] nvmem: sc27xx: Convert nvmem offset to block index Date: Mon, 28 Jan 2019 15:54:54 +0000 Message-Id: <20190128155506.25566-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> References: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Freeman Liu The Spreadtrum SC27XX efuse data are organized by blocks and each block contains 2 bytes data. Moreover the nvmem core always pass the offset in byte to the controller, so we should change the offset in byte to the correct block index and block offset to read the data. Signed-off-by: Freeman Liu Signed-off-by: Baolin Wang Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/sc27xx-efuse.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/drivers/nvmem/sc27xx-efuse.c b/drivers/nvmem/sc27xx-efuse.c index 33185d8d82cf..c6ee21018d80 100644 --- a/drivers/nvmem/sc27xx-efuse.c +++ b/drivers/nvmem/sc27xx-efuse.c @@ -106,10 +106,12 @@ static int sc27xx_efuse_poll_status(struct sc27xx_efuse *efuse, u32 bits) static int sc27xx_efuse_read(void *context, u32 offset, void *val, size_t bytes) { struct sc27xx_efuse *efuse = context; - u32 buf; + u32 buf, blk_index = offset / SC27XX_EFUSE_BLOCK_WIDTH; + u32 blk_offset = (offset % SC27XX_EFUSE_BLOCK_WIDTH) * BITS_PER_BYTE; int ret; - if (offset > SC27XX_EFUSE_BLOCK_MAX || bytes > SC27XX_EFUSE_BLOCK_WIDTH) + if (blk_index > SC27XX_EFUSE_BLOCK_MAX || + bytes > SC27XX_EFUSE_BLOCK_WIDTH) return -EINVAL; ret = sc27xx_efuse_lock(efuse); @@ -133,7 +135,7 @@ static int sc27xx_efuse_read(void *context, u32 offset, void *val, size_t bytes) /* Set the block address to be read. */ ret = regmap_write(efuse->regmap, efuse->base + SC27XX_EFUSE_BLOCK_INDEX, - offset & SC27XX_EFUSE_BLOCK_MASK); + blk_index & SC27XX_EFUSE_BLOCK_MASK); if (ret) goto disable_efuse; @@ -171,8 +173,10 @@ static int sc27xx_efuse_read(void *context, u32 offset, void *val, size_t bytes) unlock_efuse: sc27xx_efuse_unlock(efuse); - if (!ret) + if (!ret) { + buf >>= blk_offset; memcpy(val, &buf, bytes); + } return ret; } From patchwork Mon Jan 28 15:54:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 156806 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3692291jaa; Mon, 28 Jan 2019 09:36:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN6fKFAvix/AlitcS1l2E+ViT0qIQwm0IJG8XK5y880Ddj6+UQg2Upc35ceSL7rs6I42Zq+K X-Received: by 2002:a63:5d20:: with SMTP id r32mr20834016pgb.329.1548696995104; Mon, 28 Jan 2019 09:36:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696995; cv=none; d=google.com; s=arc-20160816; b=V+2Jghf6vwqqnMbKxUnYHZlHJh+Hc8idOb75FOpgipb06dPn6g73Dn+bkhW8bomVGK 0THQYadPOWqsdUhQ7zdiYz8008JA4dfd/TJwq+6Iq06GaIHFoRR4VdYv4+yNVrHXO4o/ +/hd+sbZmUvTIGA5Jjcal6+MUJ6tfGMetxyp72VyUPwBQJXrt01L6hYncMyIvOl7vs7E YS0p56Gc5IqtHeHOxqf8X/prCNN4pEHmt/f7Rvz15V5qF6A7fx4pFmXozWxAg7vkEXRf y6cxMeafmG/rwIVTOZFN9EkSu6S/7OWxq19Pc+5sT8MuDTOoalLJvi2Wjk65l1F2uDeD sHzQ== 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 :dkim-signature; bh=SNJ/arubp0NvuRnUSqt6ubxHY3NTyD03p3QIxO+K8Rc=; b=O2eFyALJLAdM6oXUGDAmPCexXHT3R0NlpBEZCcnmeyWJY0uePCtcrVxCzgod6pWuQ8 FJHtjtNPvpzET0YekbPVVYg+o1hICMc5s/mSzAvHwdFmH2kgN0GdxedRrBcomaCB3xqP 5B75k9a2/O3njyxjTt1okITCAZ+SUCb/7reO8W1ZRM/8kgiS2N87z3S6v0iOng5uqLHj wfzZeYnuR0b9FfnjTcVdv912rcYMCHbIoZXjMXcvp3MED8Dp1qTM+77paXGsWxlOyJJP QaXuZLC5B9MrPy3kLO1NCoQqAuQphhyysnYtmQmRD449In9TYucYMmJe2ktaBZ9Lc+VL Qo1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QLkrznzk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b91si14921626plb.11.2019.01.28.09.36.34; Mon, 28 Jan 2019 09:36:35 -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=pass header.i=@linaro.org header.s=google header.b=QLkrznzk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729972AbfA1Rgc (ORCPT + 31 others); Mon, 28 Jan 2019 12:36:32 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36783 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729845AbfA1PzN (ORCPT ); Mon, 28 Jan 2019 10:55:13 -0500 Received: by mail-wm1-f67.google.com with SMTP id p6so14437137wmc.1 for ; Mon, 28 Jan 2019 07:55:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SNJ/arubp0NvuRnUSqt6ubxHY3NTyD03p3QIxO+K8Rc=; b=QLkrznzkM6Wn+F/suJwPVmSazcvjYunEB6SOf3rxu7iFW3rXherfp6L+TY6aPMARAK 6jw8TsGs+NpKnpimc/Dkdru2dRUtNRsyzvVM6Nwqa0Z3BnJIGRLKUIddHOk9D1o/hxWP /pZFXohhOvlFrqffRy2QiPGi8RPxsEFLdt7/4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SNJ/arubp0NvuRnUSqt6ubxHY3NTyD03p3QIxO+K8Rc=; b=NjnerhiQENDmLdyEZOf+6As22UlTUS+1BVvNNINsMj/8jNK30MzqM5w6l6G3HCOq4S aytdyNlI0SXfX+/ezyAi2jZYYWsnw2HLSyFu6T5i2T7X2Hx10tyr8ASlEHx+t7dnIrNX 1akIoe6/TgvwasrjM5JNOjDsyWyJ90HJHa+3NxLy1kPeUjT8mFp/GJV8sM1/WxTPZMnM qsGRNLq33p1gzRO/in3gfl1WAeQkNpaCK7ZzV4HtTTwRY5CnDKCZcRjV6ANn2fRPn1Hg ayFoej/zoGb4BzmsVODv0exP+79p8W0ZRk3ixYHL7962twhCJDUfbZuR5+x/pIak9hC4 H+WA== X-Gm-Message-State: AJcUukfgW0r5Pk3XqJ0kPDIe4jXMUF9QH6a0qgSHVFngmXrYAZV9XWx3 7iDRX20SmaIG9diPaZEBhGxLMs4TqO0= X-Received: by 2002:a1c:8484:: with SMTP id g126mr18421456wmd.117.1548690910820; Mon, 28 Jan 2019 07:55:10 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id p6sm145140485wrx.50.2019.01.28.07.55.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 07:55:10 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 02/13] nvmem: bcm-ocotp: Add ACPI support to BCM OCOTP Date: Mon, 28 Jan 2019 15:54:55 +0000 Message-Id: <20190128155506.25566-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> References: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Srinath Mannam Add ACPI support to bcm ocotp driver This patch is based on Linux-4.20-rc7. Signed-off-by: Srinath Mannam Acked-by: Scott Branden Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/bcm-ocotp.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) -- 2.20.1 diff --git a/drivers/nvmem/bcm-ocotp.c b/drivers/nvmem/bcm-ocotp.c index 4159b3f41d79..a8097511582a 100644 --- a/drivers/nvmem/bcm-ocotp.c +++ b/drivers/nvmem/bcm-ocotp.c @@ -11,13 +11,14 @@ * GNU General Public License for more details. */ +#include #include #include #include #include #include #include -#include +#include #include /* @@ -78,9 +79,9 @@ static struct otpc_map otp_map_v2 = { }; struct otpc_priv { - struct device *dev; - void __iomem *base; - struct otpc_map *map; + struct device *dev; + void __iomem *base; + const struct otpc_map *map; struct nvmem_config *config; }; @@ -237,16 +238,22 @@ static struct nvmem_config bcm_otpc_nvmem_config = { }; static const struct of_device_id bcm_otpc_dt_ids[] = { - { .compatible = "brcm,ocotp" }, - { .compatible = "brcm,ocotp-v2" }, + { .compatible = "brcm,ocotp", .data = &otp_map }, + { .compatible = "brcm,ocotp-v2", .data = &otp_map_v2 }, { }, }; MODULE_DEVICE_TABLE(of, bcm_otpc_dt_ids); +static const struct acpi_device_id bcm_otpc_acpi_ids[] = { + { .id = "BRCM0700", .driver_data = (kernel_ulong_t)&otp_map }, + { .id = "BRCM0701", .driver_data = (kernel_ulong_t)&otp_map_v2 }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(acpi, bcm_otpc_acpi_ids); + static int bcm_otpc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *dn = dev->of_node; struct resource *res; struct otpc_priv *priv; struct nvmem_device *nvmem; @@ -257,14 +264,9 @@ static int bcm_otpc_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; - if (of_device_is_compatible(dev->of_node, "brcm,ocotp")) - priv->map = &otp_map; - else if (of_device_is_compatible(dev->of_node, "brcm,ocotp-v2")) - priv->map = &otp_map_v2; - else { - dev_err(dev, "%s otpc config map not defined\n", __func__); - return -EINVAL; - } + priv->map = device_get_match_data(dev); + if (!priv->map) + return -ENODEV; /* Get OTP base address register. */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -281,7 +283,7 @@ static int bcm_otpc_probe(struct platform_device *pdev) reset_start_bit(priv->base); /* Read size of memory in words. */ - err = of_property_read_u32(dn, "brcm,ocotp-size", &num_words); + err = device_property_read_u32(dev, "brcm,ocotp-size", &num_words); if (err) { dev_err(dev, "size parameter not specified\n"); return -EINVAL; @@ -294,7 +296,7 @@ static int bcm_otpc_probe(struct platform_device *pdev) bcm_otpc_nvmem_config.dev = dev; bcm_otpc_nvmem_config.priv = priv; - if (of_device_is_compatible(dev->of_node, "brcm,ocotp-v2")) { + if (priv->map == &otp_map_v2) { bcm_otpc_nvmem_config.word_size = 8; bcm_otpc_nvmem_config.stride = 8; } @@ -315,6 +317,7 @@ static struct platform_driver bcm_otpc_driver = { .driver = { .name = "brcm-otpc", .of_match_table = bcm_otpc_dt_ids, + .acpi_match_table = ACPI_PTR(bcm_otpc_acpi_ids), }, }; module_platform_driver(bcm_otpc_driver); From patchwork Mon Jan 28 15:54:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 156805 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3692141jaa; Mon, 28 Jan 2019 09:36:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN5uycPfTHe7yS6DwMr+zut4SCi8b43njtDfnugGhR+i08VkKcrS/iCr2YnLCQwOwout6TcH X-Received: by 2002:a17:902:8d95:: with SMTP id v21mr22624860plo.162.1548696986637; Mon, 28 Jan 2019 09:36:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696986; cv=none; d=google.com; s=arc-20160816; b=pUZLMCi1vPLXHAcijwpnlC4XCLak835aaxlXnxkF5gJVDmoa0K4XhXu2ffAcaNNlxD O7xMtD5In5GwinoRjLaw9wS+DSMO04qt2pzMoYYZYgJXyDUFXGEmrw1zyifioHrNudLP y8mH4UL+8S3TSHqo8KKsCIc1WNlA6d30OPuceeQKsVZDoUmiCcil9ZooHdrIQrv8bsLV 0ruBewdqG/6sIfJcFVRimeur1eorMgHIz+QQWm8iISIPhkjJYe8wDjl57WYgLTBSNfMr OfsoUate54HMLUSgEG9mDp78skl5uigea2C1ix9At4rL1NvZ2W3Iw6JJVjTZEURA3lvY bgKQ== 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 :dkim-signature; bh=lBFH16G24nu4YB67dt1sl6z4UKIl9qGdXLFE8KrZbCM=; b=SuG3XVvJrKujyNzjZLDeeRwdBuJ1/KTOqgptohu8x+OP+s+dgSpukSadicAqxlIOJE 4pT4DWBBs4B2wNkU4Da9Df36QDyxBP0XagFyucPz7vMbZ8VrU0NJAEi3vd00Nf6X8OY8 tHMtPhhQBgrpZm87dPavxNOBEs2QXafMbwuE8N6zEcM5QCuhJZZoyp7h7xfYqZ8NAuh3 nR7CkMuLBVJKfA6t4SPYK+yG1g6d/rqFIp4tPudM3w+3C+0lK0rClBbv0QdkYn4hkvfm HhwcVs1I76lyEWM3ZsnKtVzGZAtRdidw1afwRO86atJiyHc7+5UiCm9O84x4cgB6SjbY Fksw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eL0OqY1M; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w6si1053539plp.429.2019.01.28.09.36.26; Mon, 28 Jan 2019 09:36:26 -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=pass header.i=@linaro.org header.s=google header.b=eL0OqY1M; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729941AbfA1RgT (ORCPT + 31 others); Mon, 28 Jan 2019 12:36:19 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:55981 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729850AbfA1PzN (ORCPT ); Mon, 28 Jan 2019 10:55:13 -0500 Received: by mail-wm1-f68.google.com with SMTP id y139so14414720wmc.5 for ; Mon, 28 Jan 2019 07:55:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lBFH16G24nu4YB67dt1sl6z4UKIl9qGdXLFE8KrZbCM=; b=eL0OqY1M94ki7CFOX8th19DbRBmvm2E2XuEXfkfkgqyY1YgzbJi8svnjCwgdYQ/Pu8 gFzlSYaETp+oMyx6MdbfszC5y64vXad3XcBhNB1yJStJcA52XTTnC7SNynO9edUuLmX5 S+exfaN2++GQbztJZz8B0kHpCWMPFdBJqCTgI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lBFH16G24nu4YB67dt1sl6z4UKIl9qGdXLFE8KrZbCM=; b=OrSSKxLPI4whGz6jvBq8iIaIsxEXk/YL8RGCNmbQc3GMSC9nqGtbd4SAipVPMVuz+7 4+BK1JJQNxjDjaDTpWaaa1o4p69D7x12PNip46ipNsqDegPxnokTwUrAbSJwCKNJgOmg V2fR3B3XqwqJ54NFd1RnI8IKZjSkjDsBgQ+ZNOMslg0hTi+b3/4QW2I/RiAmO4S5GVaF OmwyKOAi2CzaANHLy59ePXJdInREOL39738TJUuKFro6AWuSFKPb0kEOeqqXu2nIxcnZ SdH1LieNT3mIMcYMFN/XsCfZN19MBG1v7lxQef/jRFakTJSQYpCPtH12U3td6BEw7Dee TjUw== X-Gm-Message-State: AJcUukfyAAbBFFi5OKGPPVicJSFfT3IeOe7dBKkM12aVd4OEBagMUDV9 8l+36hoVsAp+bLqWMi7ejdS+sQ== X-Received: by 2002:a1c:6e06:: with SMTP id j6mr18350492wmc.3.1548690911956; Mon, 28 Jan 2019 07:55:11 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id p6sm145140485wrx.50.2019.01.28.07.55.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 07:55:11 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 03/13] dt-bindings: nvmem: imx-ocotp: add compatible string for i.MX7ULP Date: Mon, 28 Jan 2019 15:54:56 +0000 Message-Id: <20190128155506.25566-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> References: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anson Huang Add new compatible string for i.MX7ULP SOC. Signed-off-by: Anson Huang Reviewed-by: Rob Herring Signed-off-by: Srinivas Kandagatla --- Documentation/devicetree/bindings/nvmem/imx-ocotp.txt | 1 + 1 file changed, 1 insertion(+) -- 2.20.1 diff --git a/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt b/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt index 792bc5fafeb9..ff389cf1606e 100644 --- a/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt +++ b/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt @@ -11,6 +11,7 @@ Required properties: "fsl,imx6ul-ocotp" (i.MX6UL), "fsl,imx7d-ocotp" (i.MX7D/S), "fsl,imx6sll-ocotp" (i.MX6SLL), + "fsl,imx7ulp-ocotp" (i.MX7ULP), followed by "syscon". - #address-cells : Should be 1 - #size-cells : Should be 1 From patchwork Mon Jan 28 15:54:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 156760 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3581943jaa; Mon, 28 Jan 2019 07:55:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN5BvBJURx6dymMZHX9MPWX4/EXUqpLVUpgarvy5RBRkTjiUp8k3O9gBhM37UbcCJLzMt0Mx X-Received: by 2002:a17:902:5588:: with SMTP id g8mr22389978pli.22.1548690920345; Mon, 28 Jan 2019 07:55:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548690920; cv=none; d=google.com; s=arc-20160816; b=PQDPz9cuZS48tUw6L0S8AmHmktikLZhJrvh7B9z8iKzEgTFRfd2zx7Fn7Z9k94cRRw oz99yVuvXPRkVXGwKo75oSE+09gTuFbBxPTpjY2spv/aj6gcsqkWaQb/aeZvwlKs/UK/ wUJndFv7AQsQtCnMRoDsNNd8WxmOzaZmmGSyJzfACtMsvuO6If3c5Qu/mJ5jRvRvNIkA BVo0IeM88HN+qxy4Tdnp9vp5+SaKEM22ioWo9rYN6LnQYr8F7swcXaNYS+fxcLfH3A1N l7m93uHnqUdM/hizJg4VHZokcRQmbjjy0Oe+VqK26JQfZn3iDSC8adWvG8cOkiKqIEIr 9Vew== 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 :dkim-signature; bh=Bl3ew2I2xjmi0d8XaQksODeb+uT8jXBsV8IAc/xEUJ0=; b=hi7LV++zj16lIsV8PkJNNaUWyVn2Idawyrx2IBb+Cx6uodNL54SKsbnaKzZUpRX5JS XkR15xfibr8TWltP0uf0t06PiSdJT8pnN7rOAL+SGyJPwJguAKG46MoGfjWcPlSHCkoN a4dSy6kqkIlijqBpxRw9i7+gCObLFLDjceVHPvKexjXJT9hgIpPatcwLVbjH+PG3ky6n mFTZRMu9I02rG0LonE5zpDe2wFE9tT4u97xOnzxAg4ByJEGvm5iebD+PgF5YLXb7s29f ODU0LU3Qn7tZgHP4bxNqbdOJ1NxaGSPXHFtzsbXJv3dpspaH7vzRapuqDBek9R3QFT8e bfdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FCtO9BlK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p64si32796597pfa.94.2019.01.28.07.55.20; Mon, 28 Jan 2019 07:55:20 -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=pass header.i=@linaro.org header.s=google header.b=FCtO9BlK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729835AbfA1PzR (ORCPT + 31 others); Mon, 28 Jan 2019 10:55:17 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:46946 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729857AbfA1PzO (ORCPT ); Mon, 28 Jan 2019 10:55:14 -0500 Received: by mail-wr1-f65.google.com with SMTP id l9so18556165wrt.13 for ; Mon, 28 Jan 2019 07:55:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Bl3ew2I2xjmi0d8XaQksODeb+uT8jXBsV8IAc/xEUJ0=; b=FCtO9BlKB8ovRLPilHdtn2N80dQ7P7bXMmdfadJANXdBLWLP+Jy2YjKfJyqSkJLOkv JpCGX4trHlJBKY2lO2Vjdnrkxy1W3ZBrNi+2d3yDO87B3K5DBs5M7gUq2NKkA9nGdj8r nhMaBFtYZsrMh0yxfw1MslpNC4gQqUlEwE8Vc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Bl3ew2I2xjmi0d8XaQksODeb+uT8jXBsV8IAc/xEUJ0=; b=jXxs3dlw5GFFGJenwpziUH/SIOViGMCX26v3a7PfVN6eXvaBKuxbZ9VIx5WEypnCSH hqMB6uenM5+9zbcJi4AjRt2j0geEWE/ReDP894AvQCujE58cgpcjr7CMp8mUupYturs+ pPbabdiDwgHqr/3LBlS4TJKvYQ733KAzks5/jiCzv7Y8Hqolf0x/1pYtnE6OVQMI1YHF 4PTv2sOlU1j+ADRTNVHR+rPTXvutaVDHScS9uP6r9GliEppG5ieS2P4co6Wtpn9NWu0m JcolwDTDn/lqLFC7nUDr97lEVCvZx7oCNxoniucFZQDoeLTDhKaxwMO8qLFiuKhCcybV wiUw== X-Gm-Message-State: AJcUukdLHc/E+CosGMlPXWZKmXkmcyvDbhZ37Xg8xQTf3ci0LIlL7fM4 OMfp3wotn0rIxNfa+QGSa2h3+kbYGkg= X-Received: by 2002:adf:de91:: with SMTP id w17mr23924006wrl.320.1548690913072; Mon, 28 Jan 2019 07:55:13 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id p6sm145140485wrx.50.2019.01.28.07.55.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 07:55:12 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 04/13] nvmem: imx-ocotp: add i.MX7ULP support Date: Mon, 28 Jan 2019 15:54:57 +0000 Message-Id: <20190128155506.25566-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> References: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anson Huang i.MX7ULP is a new SoC of i.MX family which has 8 kbit eFuse OTP, enable ocotp driver support for this SoC. Signed-off-by: Anson Huang Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/imx-ocotp.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.20.1 diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c index afb429a417fe..90a398252770 100644 --- a/drivers/nvmem/imx-ocotp.c +++ b/drivers/nvmem/imx-ocotp.c @@ -433,6 +433,11 @@ static const struct ocotp_params imx7d_params = { .set_timing = imx_ocotp_set_imx7_timing, }; +static const struct ocotp_params imx7ulp_params = { + .nregs = 256, + .bank_address_words = 0, +}; + static const struct of_device_id imx_ocotp_dt_ids[] = { { .compatible = "fsl,imx6q-ocotp", .data = &imx6q_params }, { .compatible = "fsl,imx6sl-ocotp", .data = &imx6sl_params }, @@ -440,6 +445,7 @@ static const struct of_device_id imx_ocotp_dt_ids[] = { { .compatible = "fsl,imx6ul-ocotp", .data = &imx6ul_params }, { .compatible = "fsl,imx7d-ocotp", .data = &imx7d_params }, { .compatible = "fsl,imx6sll-ocotp", .data = &imx6sll_params }, + { .compatible = "fsl,imx7ulp-ocotp", .data = &imx7ulp_params }, { }, }; MODULE_DEVICE_TABLE(of, imx_ocotp_dt_ids); From patchwork Mon Jan 28 15:54:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 156804 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3691923jaa; Mon, 28 Jan 2019 09:36:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN5Yhvas2t2AVcBS4KbsVbmaFRgcWA+LR09+sCoGZuqyfIsS0CIceq2BHVAUMfAp9qHUDpeq X-Received: by 2002:a62:8a51:: with SMTP id y78mr22502170pfd.35.1548696974315; Mon, 28 Jan 2019 09:36:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696974; cv=none; d=google.com; s=arc-20160816; b=eiHRunw8tjccL3w40CpQ9Ay/WtO4RKizg7GC1lFVLnfx0lExrGel//MI9Nd17qhem4 s/EJKdmyGlaZcDTIVPwQo/IHruWynqvhcTMB0SyrgSHKacJBm/wUbQ9CS5p7O53pUR6R mqi8+Em/zydXA3mrPXJvxx3mr4O22Uie2gfpgWhZRaOt3Vg0g8A6Nzdnd6Y5fUYBznK0 CS3wTmpZffFP6QeLB7rU0T8Td0NHrOeH4Gbiy79R+4i+FMR5zKGfQIncddpz9hWfEC92 NablmIBhr32dS/BSOhKCjPRWZRUlCSsULbFLo+r+0hZx8nOCq1dkaqLlWnq/YAhBnLcP xwbg== 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 :dkim-signature; bh=quTvH/8HwdVKlU+wlhb7sd6WX/yxeEDN3CSJOW9W6jU=; b=CN0RmCHLE2hME51eyb0JGnf7R9OTiAQ0Tyl9gh0GnHheCrdu0OMBXDd3eGGqHCDe9q OSE9GdHKbyuatj4AsZdPxUPQf8nIEjm3y1LL5mU253Ry3NlNm7ZmR6kjKoPmf9lbTM9d iUm7OwtaDYlg0PmQAfuw0ojN0ZKcMAYxsor3trDSStsyrqKW+g54UKu2iKwh2OxaV37+ QvPSS0Cpi58H6Zht1Sq4ncbgO3XL3Os9lDZsGQ44zqU76w4XVA04uc6zDeT1eUTHvxna chpTljcaAgsUvGS1psoI71YUANq3HREo9eQ1h3hzdP7d1wk0/BqjbmPH3Q5ILQRjpCk5 oOCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TIBNIqQ+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s8si32178040pgm.508.2019.01.28.09.36.13; Mon, 28 Jan 2019 09:36:14 -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=pass header.i=@linaro.org header.s=google header.b=TIBNIqQ+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730412AbfA1RgM (ORCPT + 31 others); Mon, 28 Jan 2019 12:36:12 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:54628 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729299AbfA1PzQ (ORCPT ); Mon, 28 Jan 2019 10:55:16 -0500 Received: by mail-wm1-f68.google.com with SMTP id a62so14538555wmh.4 for ; Mon, 28 Jan 2019 07:55:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=quTvH/8HwdVKlU+wlhb7sd6WX/yxeEDN3CSJOW9W6jU=; b=TIBNIqQ+69+2A1i7ampbm8QrDAl3gLCvK9p0kFPr3ofwWum9/xG6XA5qgolMEdaJhk SCkFwqV7tCpbqEBVcAY+OaqXXGHDEn2K/FgibRIx8WR2FKirLpY77lTAxBAMuijVFlXf dkQZRZ9VP7G6HnBAA+Ayxw7bbOLy/xUtBG6sM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=quTvH/8HwdVKlU+wlhb7sd6WX/yxeEDN3CSJOW9W6jU=; b=syH4Kb/CkjwkLODAhoP65KP8ItZ0z60jETXB8BhgUsknG3hS1cJe50m7/gi3Ws0MrS sHtFhNp93luZd9EZ+NGBxc4SJwRkuu/NOXAOWqbMQscBMPDRZ7v2HcfBrK8rM+vOHCtW uzsUoVgUymo8mwWu0i49cVJSsZQ/a/y59gAcSwKTt5KsaSriM1DZ+kFDPmmj0Amu3tTD NHCU+z8lb9yAEtInlPEo16HPeAxEn3R/77cUwijXqgHx88ZbcrWUWZT9vue+0oXqrSnZ rDMD1WvN91UKNgk0lUqF8k8pium73ITHrHM3jhorhhel3zWa2PnJlLbBoCNGQ8JZK/T1 Utdg== X-Gm-Message-State: AJcUukfFHmNHkTA+Vc3Is3ALrbyzVOxtOC/hrEtZlZqdEzFxa+c+Wb0V f2OQNk/bZsvl5T2tvjh0RAY7OA== X-Received: by 2002:a1c:2088:: with SMTP id g130mr17284229wmg.122.1548690914001; Mon, 28 Jan 2019 07:55:14 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id p6sm145140485wrx.50.2019.01.28.07.55.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 07:55:13 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 05/13] dt-bindings: imx-ocotp: Add i.MX6ULL/ULZ support Date: Mon, 28 Jan 2019 15:54:58 +0000 Message-Id: <20190128155506.25566-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> References: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefan Wahren Since the i.MX6ULL/ULZ only supports 8 OTP banks we need to introduce a new compatible. Signed-off-by: Stefan Wahren Reviewed-by: Rob Herring Signed-off-by: Srinivas Kandagatla --- Documentation/devicetree/bindings/nvmem/imx-ocotp.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt b/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt index ff389cf1606e..7a999a135e56 100644 --- a/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt +++ b/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt @@ -1,7 +1,7 @@ Freescale i.MX6 On-Chip OTP Controller (OCOTP) device tree bindings This binding represents the on-chip eFuse OTP controller found on -i.MX6Q/D, i.MX6DL/S, i.MX6SL, i.MX6SX, i.MX6UL and i.MX6SLL SoCs. +i.MX6Q/D, i.MX6DL/S, i.MX6SL, i.MX6SX, i.MX6UL, i.MX6ULL/ULZ and i.MX6SLL SoCs. Required properties: - compatible: should be one of @@ -9,6 +9,7 @@ Required properties: "fsl,imx6sl-ocotp" (i.MX6SL), or "fsl,imx6sx-ocotp" (i.MX6SX), "fsl,imx6ul-ocotp" (i.MX6UL), + "fsl,imx6ull-ocotp" (i.MX6ULL/ULZ), "fsl,imx7d-ocotp" (i.MX7D/S), "fsl,imx6sll-ocotp" (i.MX6SLL), "fsl,imx7ulp-ocotp" (i.MX7ULP), From patchwork Mon Jan 28 15:54:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 156803 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3691861jaa; Mon, 28 Jan 2019 09:36:10 -0800 (PST) X-Google-Smtp-Source: ALg8bN4gd7j7q+NhZtDyzw9LzW4FuGtMDFLIrNri/ISIaWLhkLk7Tfkw3khjc4/lca/bumDkVqsY X-Received: by 2002:a17:902:e012:: with SMTP id ca18mr22583217plb.218.1548696970468; Mon, 28 Jan 2019 09:36:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696970; cv=none; d=google.com; s=arc-20160816; b=eK6q4+l3qavf9KNLtehUFkJVP1mKlAlBBPC42M0DlUGoLS1JitnlIttwfQSFjCeoan rEWzs0SQx8z+AU3pNp9ilhrfQglvNYPRMaJJ/3PWpBLmvf0bPM+9pdn/qe7wOySPLxcD flTE6rc3gv8LFgHwz68jZX4qZlef0V2F9ULtpfD9p7QK+Pj341BqR9bHA0ogYDFYfNzn QuNn8tjZefaAESYI8dIciYbYDoFar8jn8/Glumc7qbGJhRevtItOLlkeL9q+imWqpxav +S6skuyOy6tdOw/rlgKDoTVr0GoIF6J6xL3+AAhV5pFvambjicjIm2aupgMxjPqQaZwT EHKA== 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 :dkim-signature; bh=C0iN6aJENz6qbt1UdAuej131qJDG5aeHCCLqTs0M+VU=; b=zJgnZviQmZbbD8tqDe8I2sxHQLlLbyswQu4d1MtcNcIB632U/rZD6MssxNdwhSYNDu gzyyzr8ZVAFXgEy/y4qEoOOkwAPylM5DjgAbeg6Isv3MZxSRTJB+18M8xePZ08mJ6vvK wMSysoT63cSzZxmgcrqBSyRjG1x4T1k2AUo2atFIFGiw3r24KwPcwIMaQ46xzleAahxs bElyNMV1JUx1fufUGymL5ZaqdiKiZVIJagPvKuRd7AeG1A/veU34bc9vUPF+m+bC7Uio 4BZo3n5uum03R2N28PICDKaFiIXviLWouLmV37WNoKPG+9C/XMk7Kca27IlsfdIOn8m6 p4LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DfLHLmcW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10si30787562pgt.155.2019.01.28.09.36.10; Mon, 28 Jan 2019 09:36:10 -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=pass header.i=@linaro.org header.s=google header.b=DfLHLmcW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729968AbfA1RgI (ORCPT + 31 others); Mon, 28 Jan 2019 12:36:08 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:44327 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729415AbfA1PzQ (ORCPT ); Mon, 28 Jan 2019 10:55:16 -0500 Received: by mail-wr1-f68.google.com with SMTP id z5so18585724wrt.11 for ; Mon, 28 Jan 2019 07:55:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C0iN6aJENz6qbt1UdAuej131qJDG5aeHCCLqTs0M+VU=; b=DfLHLmcWjA3sRWcv5DSf2ZLHJXG2JlyqLLpKmNoompy1g2ioINKlVn0RcyaFDdGu77 +HdchoyHbse17p4N4KONcQpeKmbkizSmJoNRow25u3KbviqcOEJiX6qwdRtqmpULXjGs gm6kuEWfQVJ7b+ECumxyTz9Di/OcUuZudrfwM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=C0iN6aJENz6qbt1UdAuej131qJDG5aeHCCLqTs0M+VU=; b=hg54Xfah6TF/a+zG2i6E1VCE5BzqLbIXrVI++wve2L6973ywP/YEI1vHbygh/IWKjV 6q6gjDX0MU+1dcKEYIJLNEJschXmv92VYVWPyrUz5jD0r7Ov1T3imRLgAUPNehZYSs3/ ruHQWuBWr8bpxc33HubVdN12TgxHOQRlXrLMdOECwAOdPto/qNqJb1dtE3dGjjC4993u WVe7RkAXkOSchM41lYditeXgITxopX7VyQgA5i6AzMjh31Bsa9QzQXWaDM3dj0cRSsft n2QJ0lfdDGHgddUUwz099myKk6Cca/z+Q/NfNIgEEBTGf0vlrLWvZ7yrtNWydhxuKDRO aVgg== X-Gm-Message-State: AJcUukdzCCkPibWo9nQ5hiTwrVESS0KtUPIS2gHIXJnFdr41IcjMZeLR dcAHBk22xkuFQumdXwJeBzy+cA== X-Received: by 2002:adf:ba8e:: with SMTP id p14mr21825152wrg.230.1548690915143; Mon, 28 Jan 2019 07:55:15 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id p6sm145140485wrx.50.2019.01.28.07.55.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 07:55:14 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 06/13] nvmem: imx-ocotp: Implement i.MX6ULL/ULZ support Date: Mon, 28 Jan 2019 15:54:59 +0000 Message-Id: <20190128155506.25566-7-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> References: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefan Wahren In comparision to the i.MX6UL the lower cost variants i.MX6ULL/ULZ only supports 8 OTP banks a 8 words. Signed-off-by: Stefan Wahren Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/imx-ocotp.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.20.1 diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c index 90a398252770..08a9b1ef8ae4 100644 --- a/drivers/nvmem/imx-ocotp.c +++ b/drivers/nvmem/imx-ocotp.c @@ -427,6 +427,12 @@ static const struct ocotp_params imx6ul_params = { .set_timing = imx_ocotp_set_imx6_timing, }; +static const struct ocotp_params imx6ull_params = { + .nregs = 64, + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, +}; + static const struct ocotp_params imx7d_params = { .nregs = 64, .bank_address_words = 4, @@ -443,6 +449,7 @@ static const struct of_device_id imx_ocotp_dt_ids[] = { { .compatible = "fsl,imx6sl-ocotp", .data = &imx6sl_params }, { .compatible = "fsl,imx6sx-ocotp", .data = &imx6sx_params }, { .compatible = "fsl,imx6ul-ocotp", .data = &imx6ul_params }, + { .compatible = "fsl,imx6ull-ocotp", .data = &imx6ull_params }, { .compatible = "fsl,imx7d-ocotp", .data = &imx7d_params }, { .compatible = "fsl,imx6sll-ocotp", .data = &imx6sll_params }, { .compatible = "fsl,imx7ulp-ocotp", .data = &imx7ulp_params }, From patchwork Mon Jan 28 15:55:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 156761 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3582018jaa; Mon, 28 Jan 2019 07:55:24 -0800 (PST) X-Google-Smtp-Source: ALg8bN5csGV75CapsU4y3AG3bPn2u3Uq/x3iITdj9o7XtaftLK6WrYtqJa+JfXv3CWWxNg8UtnMu X-Received: by 2002:a63:9e19:: with SMTP id s25mr20275720pgd.203.1548690924610; Mon, 28 Jan 2019 07:55:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548690924; cv=none; d=google.com; s=arc-20160816; b=znk3mFtG12EVQN0jzRfwzxRDyhwNIT9dle6TM6Z/38ugA8yuflGjJiKulo/OCTEhiE /JWBXZ2EoHlWTnRisYXjnF5rxHTg+45Igxg+yZiRL0B+Vd+JDyd/AlDZXRCDcJ2nckrn zotCTvJ7XJKei1qiREmYozEZo/M7wrQieltoq1MoXy6YM2haL8WO3ZarrMuP2Vqoeq9V h0KY+oipN1NS4O0MeJBJcU3OdK5XgaTzqcc+cKedmWCIE8iCTB0RM1m3n/7/1Nhp9rg/ QvD4HoayTv+nNPsi8sprfIUiNlJq/C5L4RTBBvsiuUxQtVpIuJ4Ncqzw2kmxFKINSc4m DqXQ== 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 :dkim-signature; bh=EzzauLuRu7S4DI8YrZtbq8X+zovdFXkJQc9myBytVls=; b=sx5v4hU6xZf1G4kC24/v+YPzkE2Ok5Ln9FaFrBlF83XlgTZtUJ/p/Ucbdv2it2Y40E /9oiZqg+HbzPP2cy6oDEgS8it8f+qdfSJG+QyHp0Enzvq0nVTWc2Pw4rRBdWCHhGbrdF x3//BseNxK9LoYCV+T2Q8HnEBFKyaFG6PIQzn5LhzWCZmcfYbDuqv2mlHwKZ4Ts7Wz04 1M7Qm7bZeNfku3Kc+mhRmdNP8U2e9pGz8dkMTK2uWBl1Ecxo2HPTLFKKQuB/hVlPnpF8 WyQQVJYuiKvWK5aMGRKJCHdAftU2choAJCixIxn4KDjml1pIOAoCQFJWIOVHKBWz+NR7 2khQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f0jFbjCA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o27si32886687pgl.53.2019.01.28.07.55.24; Mon, 28 Jan 2019 07:55:24 -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=pass header.i=@linaro.org header.s=google header.b=f0jFbjCA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729879AbfA1PzW (ORCPT + 31 others); Mon, 28 Jan 2019 10:55:22 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:39805 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729434AbfA1PzR (ORCPT ); Mon, 28 Jan 2019 10:55:17 -0500 Received: by mail-wr1-f67.google.com with SMTP id t27so18614858wra.6 for ; Mon, 28 Jan 2019 07:55:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EzzauLuRu7S4DI8YrZtbq8X+zovdFXkJQc9myBytVls=; b=f0jFbjCA+wizq41/gotVHqLqwPq00jSl0pprOR48HBDrBkyrWDohdYSA8yFonqdbZc 5k3Wtpvi7daPEezkDYb242jq4esQiXyoxXKD/sFT5xCGs0ZAiS/l6Wb37bDMsuBlI7Ui CIb1CIqmh5QYqFrkPXW1RqHtdz7V2Ccenz1Us= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EzzauLuRu7S4DI8YrZtbq8X+zovdFXkJQc9myBytVls=; b=rwO0ggMlcHxRiSZlzkfUHWbFHfwFEYTfd7eGlTIZNIu2QG8jwa4yDzqV+GJuCTMAE3 bBheEaTDj/YvtL+WQFIzIFE9krnuqRUB7AqOcvdvFqpoEkcklXoo134TaOpW2CEaCjN6 FsGtOiAp7Hqko65msLxdjygxkdm/z8i8lgWukIzFZ1Q6tHMoHGxaqwx0BQHgjMYw2JTX rOZ+2OmVeko2dFGpp/GEWD3aRgG0xKTGQxaO2Lkb6O5x9TK7t0E+Ls5rXUHljYBY+WeE 1Sh/PARCn+NiySMRE0isqWrXRaTXTlg5LqMZbYWenQgeU0mQLHWcD8cpsNuM1Qm3wmvR fdQw== X-Gm-Message-State: AJcUukfkHH5fFutD9HOxvdULQC87ZwoNIlO87MO0+/HS4CkRRZ4gIdPE NO4EgYdXJRb9MnQRTAuN+zylUA== X-Received: by 2002:adf:ff09:: with SMTP id k9mr21346704wrr.97.1548690916153; Mon, 28 Jan 2019 07:55:16 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id p6sm145140485wrx.50.2019.01.28.07.55.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 07:55:15 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 07/13] nvmem: core: Set the provider read-only when no write callback is given Date: Mon, 28 Jan 2019 15:55:00 +0000 Message-Id: <20190128155506.25566-8-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> References: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alban Bedel If no write callback is given the device should be marked as read-only. While at it also move from a bit or to a logical or as that is a logical expression. Signed-off-by: Alban Bedel Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index f7301bb4ef3b..cf2e1091fe89 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -646,8 +646,8 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) config->name ? config->id : nvmem->id); } - nvmem->read_only = device_property_present(config->dev, "read-only") | - config->read_only; + nvmem->read_only = device_property_present(config->dev, "read-only") || + config->read_only || !nvmem->reg_write; if (config->root_only) nvmem->dev.groups = nvmem->read_only ? From patchwork Mon Jan 28 15:55:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 156802 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3691772jaa; Mon, 28 Jan 2019 09:36:03 -0800 (PST) X-Google-Smtp-Source: ALg8bN5mIznjo1G9nNWYdroWRbOB0sYT+7ottOWBGMCMh5DesIpTS36/IIyH0E9d9dzV3xf5xDhQ X-Received: by 2002:a63:6bc1:: with SMTP id g184mr21022622pgc.25.1548696963435; Mon, 28 Jan 2019 09:36:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696963; cv=none; d=google.com; s=arc-20160816; b=RjqvBRyDyFEsPTITY/rX/D6KEqr25OKlx5nWGUR1eHiZ4iZL6DiwDR9NeRAgcyZh05 oFG9JNqOjjQOfLlzhwrIYIgYOD82Q/xf5JNEn3KKItH/FQtdE6QqndTUX7KI9XQYG79u nZZGoqTj0ZsJJ6yhxoW+WCtJ5oX2D98ua1ifOq+KQEVS8NtCQ9Cz1He8sK/qpI5uVCRg TdIrikUcJy+NbJCUHDRDSNZhxSU15lsP7Bb/L8YuHKYFDtR/SvVwGyGQiP5AQOZGfkQm VsKfjkN1LPxYiassJQMgDldmNbr8RSBw3sm+ekcSPaSj31zOAmUB/0zr8u0VImaYrJR/ OOQg== 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 :dkim-signature; bh=SM1B9I6t8HFBSAnmnKVD5EISrf58W+phlPhNn1H5SHI=; b=bMsqkha3ZCkZgM37JqoY4dSRMEy4TCJshlfx9kme9ewkD2Kttc0AI0P9pk6FLiYZn4 DZf1rnTBh15Fc3T9NJrPHh3qDXo/AVjI9Cc8e9YKtlPiumdY0wXeElEq55/ya19gNjiP sNIRxydV7iPy5xVr1IadTz+tv5xk+W5JIdWLrNtQa32c/+dJj7cJJ7ERHPnA1p3k60YU w2ZCPyTxpOPT84P79ftKw7mUcbBS64X908/Zn3FE57iHAAOh7AheUNgXDHV77DKtyznf 9hBkEHkGYG9nf9fvWySCjGvhSpw0OGxpQsVQdMjtQbvcqlXH4FO+qFpBXB3du6mkyFum SnAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BW6BxRUl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10si30787562pgt.155.2019.01.28.09.36.02; Mon, 28 Jan 2019 09:36:03 -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=pass header.i=@linaro.org header.s=google header.b=BW6BxRUl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729989AbfA1RgA (ORCPT + 31 others); Mon, 28 Jan 2019 12:36:00 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:34916 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729857AbfA1PzS (ORCPT ); Mon, 28 Jan 2019 10:55:18 -0500 Received: by mail-wr1-f68.google.com with SMTP id 96so18659566wrb.2 for ; Mon, 28 Jan 2019 07:55:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SM1B9I6t8HFBSAnmnKVD5EISrf58W+phlPhNn1H5SHI=; b=BW6BxRUlOzvur7L2/Cfdyc8uYKO3JNnbliumNpAzwqMo59groRSPfT8lEzXEksR5KI e9+CqZ17J42SXVm8RRelyiG8IO1DVkLJbBSRMpfb/97XY/r/eFOrgEcI38tU0u2K6MWr PvMs8b+m4G+g+5KNKZJZB15zWWtZw2s4RKDK4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SM1B9I6t8HFBSAnmnKVD5EISrf58W+phlPhNn1H5SHI=; b=gLW9XKeg5efjHdINYEBhDZ6Km/ASEy1vmhtndDDjOLpRZVU2z+dU2gLFxw03tynPa/ PABiHlgPCvk3OfO8QnGUqIsBRCVLqU5S3ikz3XfNUO6rtdcqB8EyZVP3T0pPLyqbUa5j W3B0Bv2lWAHZq1yGqwrZM93KZtsTkKt2RBWZ0DsVEPRw2aWiSOHSa0Mlk+doo+PN/2GK ggT5SJOMdRS8+i24ETPeCRQJX+w4/GcJMTk0Qcsgr4ksmpOczvxple6M7CzmVku+4z+B NtknLgmt11zzfrjgcckUiVz09aakyzTK+YrOupItFUXqufHCKpjcDy4DsiRYBEqzyyK0 A1TQ== X-Gm-Message-State: AJcUukf22xd6mdN+6jfcig5Fx1g+7kOf38Xckeohsieg3Hqto75rYXM2 9yBJKoMGEOrwSeWusbJeUMwiuHK9+yM= X-Received: by 2002:a5d:4a45:: with SMTP id v5mr21265063wrs.7.1548690917342; Mon, 28 Jan 2019 07:55:17 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id p6sm145140485wrx.50.2019.01.28.07.55.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 07:55:16 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 08/13] nvmem: core: Fix of_nvmem_cell_get() for optional cells Date: Mon, 28 Jan 2019 15:55:01 +0000 Message-Id: <20190128155506.25566-9-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> References: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alban Bedel of_nvmem_cell_get() should return -ENOENT when a cell isn't defined, otherwise callers can't distinguish between a missing cell and other errors. Signed-off-by: Alban Bedel Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index cf2e1091fe89..f8c43da6f2ca 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -1031,7 +1031,7 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, const char *id) cell_np = of_parse_phandle(np, "nvmem-cells", index); if (!cell_np) - return ERR_PTR(-EINVAL); + return ERR_PTR(-ENOENT); nvmem_np = of_get_next_parent(cell_np); if (!nvmem_np) From patchwork Mon Jan 28 15:55:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 156801 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3691608jaa; Mon, 28 Jan 2019 09:35:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN4ixGlQU8g6uBGUwMFNm88T1Nh97s9PnfE0SivBbHYJ3moDpnt3faZCqqR03D4dVxuRsI+c X-Received: by 2002:a62:cec6:: with SMTP id y189mr23611762pfg.100.1548696952746; Mon, 28 Jan 2019 09:35:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696952; cv=none; d=google.com; s=arc-20160816; b=byGGp4w+08+aRJSv0sBn0ePjSmmhYFyqx0C1HdBj1Tyd6x3jT8a7YiRXdpFGOcSh6b dUVk8hwU+TZZkl/Vi7Oif3ZybSdzBjmxSIbarR0++Hwna1g3QzjEYgiysUwVGnHV/kaK FHynzBnM/srCi18iGUnDBONI8WFJo7DUdAKiTG6rozVs9h7Kn5K2t17TCTcDsICdI3B/ t5GPvzSA9akIoMcJkxwjdQV4n94gLw1u1HNGZxELDrkreBgmgpTrfMwHc8RtpQu43cvI JCFdLRIUv+mH+pwLcZFJ2FAGu2IeuKTFKMjPaGkRPEceQZ2iahqb2rzpLAT2C6kr1WmN Y3sg== 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 :dkim-signature; bh=Y61FLzvMGwuY8EhkE3hjek/pc/s87AiM7Lg6ZKyxvx4=; b=Ks5zOYa/wqfa5bFluuzoWZO84G/IK6ujlM1FAmwM2pwLd60psjJfDH1npNgMUkF4F3 i2R0+MTtIDJkFlJOhxXMkN2p3AHJ9uLeuosWh7B3ETvhUyDI6fdd6eThGFaefGnLiNfO mYgv7jtOseIGjsoiqv45wDCY1cKp1fH/qPp5abyek4FEzVwR7YJzX0M8FbV8VhkMsmQs zaKeqSB+eyKEcGEYgeFZYyD9+ZMjZVTvL3/2saxAxg+F0ZVnkyUT07vnO+Vl/JMmheWg v+odcFlIxdeaC42jj6kjZgZ8Wk7FkYkfIEk2f4xzyqt79Z5PPiJpITXxzP9+hLlLg5v6 vfhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PAJPA0PE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h188si33266524pfg.44.2019.01.28.09.35.52; Mon, 28 Jan 2019 09:35:52 -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=pass header.i=@linaro.org header.s=google header.b=PAJPA0PE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730708AbfA1Rfn (ORCPT + 31 others); Mon, 28 Jan 2019 12:35:43 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:45650 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729872AbfA1PzU (ORCPT ); Mon, 28 Jan 2019 10:55:20 -0500 Received: by mail-wr1-f66.google.com with SMTP id t6so18578830wrr.12 for ; Mon, 28 Jan 2019 07:55:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y61FLzvMGwuY8EhkE3hjek/pc/s87AiM7Lg6ZKyxvx4=; b=PAJPA0PEon0lTUGPXRPrGfxDPtCfSY3yMfUz5KR6fsjS6OccHlcjx2Up2RA7cX+3Iv 4SwIz4Xvs7Dig4ulvTR/hKXAiebOu4POKXv8sbcp/FEbrT9OXCyWCDYTxyHqIjrpNRXE lNjDPjhgsSkP+A40JmE7Bqdh5O1w5pPHujeog= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y61FLzvMGwuY8EhkE3hjek/pc/s87AiM7Lg6ZKyxvx4=; b=A/tqGzAV6ORuZ8AR4iDut1muRhkkY58NelQbOA3Xez797hZD3axA1nFh3xPB0KsRjJ bRqnb6r5mg4nAoEPDmQZRXkEewAVojECYJmoVZh4ZtzHrEWtJ5gJxUSdwTkMxeam3R9i bdoPFK5es3gKvEhujvD8z7UZ6PjbEchmjHZvITtvKq9Tv+BELDbDogzB9M0uhn+v8uT6 DpCLQgfd19QYFyF4GRKnW0/y7DXpvN2cXcP5pZnyp+rEuMGEiBEpDSXybkQ9WGAgw6gT RVk4CBsdkPzs4ComHYmsLVbNx1XBowaYFR2Je4ddOxKrTO9SEcsORphJiDb8RsBZ8ijE K0aQ== X-Gm-Message-State: AJcUukd4Ek0etLspRIW1scCotN9ne2pvvzYtP+YU51rWura9d6xanoHJ jFwnXwYSoR1/pzgfuE56jVPERp2qT3c= X-Received: by 2002:a5d:5208:: with SMTP id j8mr23115456wrv.188.1548690918427; Mon, 28 Jan 2019 07:55:18 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id p6sm145140485wrx.50.2019.01.28.07.55.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 07:55:17 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 09/13] nvmem: core: Fix cell lookup when no cell is found Date: Mon, 28 Jan 2019 15:55:02 +0000 Message-Id: <20190128155506.25566-10-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> References: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alban Bedel If the cell list is not empty and nvmem_find_cell_by_node/name() is called for a cell that is not present in the list they will return an invalid pointer instead of NULL. This happen because list_for_each_entry() stop once it reach the list head again, but as the list head is not contained in a struct nvmem_cell the iteration variable then contains an invalid value. This is easily solved by using a variable to iterate over the list and one to return the cell found. Signed-off-by: Alban Bedel Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index f8c43da6f2ca..a2ad44104aa2 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -525,12 +525,14 @@ static int nvmem_add_cells_from_table(struct nvmem_device *nvmem) static struct nvmem_cell * nvmem_find_cell_by_name(struct nvmem_device *nvmem, const char *cell_id) { - struct nvmem_cell *cell = NULL; + struct nvmem_cell *iter, *cell = NULL; mutex_lock(&nvmem_mutex); - list_for_each_entry(cell, &nvmem->cells, node) { - if (strcmp(cell_id, cell->name) == 0) + list_for_each_entry(iter, &nvmem->cells, node) { + if (strcmp(cell_id, iter->name) == 0) { + cell = iter; break; + } } mutex_unlock(&nvmem_mutex); @@ -994,12 +996,14 @@ nvmem_cell_get_from_lookup(struct device *dev, const char *con_id) static struct nvmem_cell * nvmem_find_cell_by_node(struct nvmem_device *nvmem, struct device_node *np) { - struct nvmem_cell *cell = NULL; + struct nvmem_cell *iter, *cell = NULL; mutex_lock(&nvmem_mutex); - list_for_each_entry(cell, &nvmem->cells, node) { - if (np == cell->np) + list_for_each_entry(iter, &nvmem->cells, node) { + if (np == iter->np) { + cell = iter; break; + } } mutex_unlock(&nvmem_mutex); From patchwork Mon Jan 28 15:55:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 156800 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3691412jaa; Mon, 28 Jan 2019 09:35:38 -0800 (PST) X-Google-Smtp-Source: ALg8bN6qrmI1NmRpUqYnDvgopV7aIXki25HCsVzsRrvZltc9+tx+eBJ6+S0utMYzhMHv/NLn43Sq X-Received: by 2002:a63:a91a:: with SMTP id u26mr20281614pge.349.1548696938670; Mon, 28 Jan 2019 09:35:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696938; cv=none; d=google.com; s=arc-20160816; b=prHFUGwyfxOvm+7Tpk132f1en3fOoumQXjdPXdhHc8ze14P23Dg5yKTI0z0W4X6L8V iSckE0+rFqZZ7Xs1EDlANUhsKj7H5PtwLHBW++cjqp61prH0OwIx8bu28kC1jlGyN3o9 LtEdh5yAMKGBtoGROP8pIYXZaBNXTQM6TLtLLZxqfoJ3+6c2WnNKeo85W3yYWnD5kXWM 3+uVeIPB+VIJqrz5mOj2gGPOmanWwb/U15ZSawUfFjqoqZQ5wf93BGu2CsPm3d5DNTni nwqRDi7oGC+E5GNval8GjQF1F82/pck1iGzVjW+QgU3fhGYXgiMYbu+bRYX/7jwgLaCA ncIQ== 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 :dkim-signature; bh=g0/pWPJ9dN7bFakh4TwkUfEapIBrvkN+RgDjhJ97VaY=; b=GjMenE3q1Isk3d3O317jrie4aeobRyV+jEcGzy1NjMV6turTxlDAKNJ15hn3/6knX/ eTmL2YodsHTmBsXnsaE0euT2thBEkj0unnKJlmwvrPE7aWrfS+L5nz22QXNffRMlSJoP Xxy+tGI4mcOOKXm64mWSqwqMNd/qaH/vNQSFiItZqaMW9NTFlITclwCRwNIg0Y9FFcVj j8vPYOigrIX16cSy6wr8ZH5jXZMgJpS0TDaEX1oudOeGL9TrccPL37d/wnDLrBD8KsZJ CdxV0KwFUyNvNw2faUGoub0TRE9HfwVQMSpCmIph1ZjyFFUHiuH82RrUbzGozBRRezuo L5mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XX45LbDL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c12si22682824pgh.257.2019.01.28.09.35.38; Mon, 28 Jan 2019 09:35:38 -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=pass header.i=@linaro.org header.s=google header.b=XX45LbDL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730376AbfA1Rfg (ORCPT + 31 others); Mon, 28 Jan 2019 12:35:36 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40961 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728572AbfA1PzV (ORCPT ); Mon, 28 Jan 2019 10:55:21 -0500 Received: by mail-wr1-f67.google.com with SMTP id x10so18589832wrs.8 for ; Mon, 28 Jan 2019 07:55:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g0/pWPJ9dN7bFakh4TwkUfEapIBrvkN+RgDjhJ97VaY=; b=XX45LbDLTNBdDRPJ8E3DbnJM9ifQQ5fhMisTGa7brzYR2ZY6kjoahFlFgXDb8eu/ZB 54Y26gr9wTWC4yGD0D/r9gbXz/TqZ2vtpXB+hMe+KUeAXKNdHCeCTtFP1w7yqad5VMDQ 54aJVzPR0imzId/4a1WRzUIJyEhmdKTogSVS8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g0/pWPJ9dN7bFakh4TwkUfEapIBrvkN+RgDjhJ97VaY=; b=cNDHo117eD8lLKSrDkDkk+5bSN16v+b8k5ibZ5azDKLpk1T49nYfZiKG+aK8fOg/jQ IlRXOErTcL69PhVw6HWwqzuq9+CGhE8keKrPwNAXECUh3TQlKDmJT2PnpTGqfL0Wmswd p4GXmSSgjTO5S4FyWWwIFrX6y+xQ9ZnQG1O6hqBJxDt9wFkBEjLDpbY8LxmUxN1P2RYu WNGsmgGZxsZJRAyGE0Q2PSFkshFH06qOOTOfJyD38JZ9ddnuwalLogDf66NNUUfI/slN ENCAmgqs1OvGNenZtketAt2Wd1BPhjXRSd12p1lbCIbrznHAbyJmIOKv2ka4C3Le/MdB KoJA== X-Gm-Message-State: AHQUAuZGTd8Cjk57ZZfQBmpeujkEC+ZJoewNbTf8Myb0250+ddYZZvUV CXihm/q4Cxk1R0oOYSrecN47+utvpUo= X-Received: by 2002:adf:ef88:: with SMTP id d8mr1130981wro.163.1548690919658; Mon, 28 Jan 2019 07:55:19 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id p6sm145140485wrx.50.2019.01.28.07.55.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 07:55:18 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 10/13] nvmem: core: Properly handle connection ID in of_nvmem_device_get() Date: Mon, 28 Jan 2019 15:55:03 +0000 Message-Id: <20190128155506.25566-11-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> References: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alban Bedel of_nvmem_device_get() would crash if NULL was passed as a connection ID. Rework this to use the usual sementic of assuming the first connection when no connection ID is given. Furthermore of_nvmem_device_get() would return -EINVAL when it failed to resolve the connection, making it impossible to properly implement an optional connection. Return -ENOENT instead to let the caller know that the connection doesn't exists. Signed-off-by: Alban Bedel Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.20.1 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index a2ad44104aa2..a749a5cb0a4e 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -839,13 +839,14 @@ struct nvmem_device *of_nvmem_device_get(struct device_node *np, const char *id) { struct device_node *nvmem_np; - int index; + int index = 0; - index = of_property_match_string(np, "nvmem-names", id); + if (id) + index = of_property_match_string(np, "nvmem-names", id); nvmem_np = of_parse_phandle(np, "nvmem", index); if (!nvmem_np) - return ERR_PTR(-EINVAL); + return ERR_PTR(-ENOENT); return __nvmem_device_get(nvmem_np, NULL); } From patchwork Mon Jan 28 15:55:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 156762 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3582062jaa; Mon, 28 Jan 2019 07:55:27 -0800 (PST) X-Google-Smtp-Source: ALg8bN52NJ9UIL0QCutqM+CMpzBOC4fmBsGNc5AKpR1l28DPCD4O9rbDrEy4+bCGSAXqyMlaa4Yh X-Received: by 2002:a17:902:4601:: with SMTP id o1mr22275805pld.243.1548690927286; Mon, 28 Jan 2019 07:55:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548690927; cv=none; d=google.com; s=arc-20160816; b=RZ0hHOYWyWcI7DDCecxjfa+cvlpmIyG5bAjRAsM5SI4/C5UNdTqb+pvM1m9sXP+4hL UkVJV1bAruqY+GUW9dN33QgWnQUkDRqReLNiMFasg87P3BCJguKAVPz50dbvS9PD27gT nNqy67K6tvRLPrraEqmapP1rMOOLdgF5khjYXKrmRoQKI3R5Ub0hBzhd2vxuvYVWrnNv pnnZzxiYDPXad32E1v6fLp6B93XmBST3PICLAg+UlbnMkc+A0MVYzRj9t+IwNYFgoL7E SDEOLG9NiqNdwk0D78Yz0G/7Zo7m61TQOmyRlChnSWMsxtT8MYUuwWQ+cY8JtmRbEF26 U4Wg== 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 :dkim-signature; bh=e0Ha4ellaoNOp/hRaJJ64zG2xd/bafkpJFLNPc8fabM=; b=K4oTB0Wh8hsKgnuhYGK3GUQmlXjO0gMNOjGfKiJpEK43fWlFhsJrviGcFldoUYhmsI DBiR5j5lkTCCTRSlmWhM42Y01WGYJ4KAYrLUTvOQkCscv5kDqCh39/U6XqwJgJ1E7SUm ++BGB6o26RXmS0k3ZqC4fN0voAl7nspjUthrjEFhYp2nI9nx00ZGI3XDMA7g6B0+dozx pPzwb+2IdXer8GSLNP6UvJAmWfpgDB6srauWU/G3DA4VXNalWd9XP1mLSMXbQdxz3kIP nkwnWwUMOxtgWf/vmlz7rORmOGxFn9ZvXs899bezaIP4qb/K/e9HC18zvTrDPTAGLQsn X+ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fjDvN5g9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j186si172374pfb.174.2019.01.28.07.55.27; Mon, 28 Jan 2019 07:55:27 -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=pass header.i=@linaro.org header.s=google header.b=fjDvN5g9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729439AbfA1PzZ (ORCPT + 31 others); Mon, 28 Jan 2019 10:55:25 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:40335 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728859AbfA1PzW (ORCPT ); Mon, 28 Jan 2019 10:55:22 -0500 Received: by mail-wr1-f68.google.com with SMTP id p4so18623901wrt.7 for ; Mon, 28 Jan 2019 07:55:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=e0Ha4ellaoNOp/hRaJJ64zG2xd/bafkpJFLNPc8fabM=; b=fjDvN5g9fjipqa2VAqDp3/6TPI+kGIIQBdBnots0pBJug2WXIXVM5VihE4JUIxDF5U mMBzLvPto83PARanyrApdIIFfNbAQxauJGfUn0j514Vpl8AF9ZlWsVHNh7l+WZc3zuVc xPxdsHguQYtEQcYx6fVlSrdUsPV2mrhtoX+Cc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e0Ha4ellaoNOp/hRaJJ64zG2xd/bafkpJFLNPc8fabM=; b=Cd8Jba+WCWh+gkC4tWfq6WZQ01NTth/dSajy4zaSrqLW3PjNcMMdO1ZVQ/lik8vIyD xyI8DzfqQUPsNrVguWOa7moE1LmgOorFSb2EpJruU3vlRzwf5QdymvtXRBNsITwuKFnb UY5hs1v2XR7wtm3qB+7+ejKy9e3ZpXJa1w3vG8Drj159DFnHBscILqrA3tkHxCNs9UTK SvZpLcCW958PUawKnELXU17zIQ3eWRKXMV5eJ/X0mWKiH4GSjFf+6eEm32cO6SNmc4Kx PlPDqj2Phzg3Wp6KSy0/2x5CCKOihHWawiYDaYEqSIgot/8vxTGlXEB5qRFEIfQpKaAA /YXw== X-Gm-Message-State: AJcUukfxJD0+ExvrGwziZq8AjRnO+v1cvLJD75mY9S7pQQNOeY5tsTvE 2HTLZgcMyZOQ/35d7n/rkzXDpyVhHAU= X-Received: by 2002:a5d:4f10:: with SMTP id c16mr22937298wru.177.1548690920879; Mon, 28 Jan 2019 07:55:20 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id p6sm145140485wrx.50.2019.01.28.07.55.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 07:55:19 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 11/13] nvmem: core: Always reference the device returned by nvmem_device_get() Date: Mon, 28 Jan 2019 15:55:04 +0000 Message-Id: <20190128155506.25566-12-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> References: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alban Bedel In nvmem_device_get(), when the device lookup fails with DT it currently fallback on nvmem_find() which is wrong for two reasons. First nvmem_find() return NULL when nothing is found instead of an ERR_PTR. But nvmem_find() also just lookup the device, it doesn't reference the module and increment the reference count like it is done in the DT path. To fix this we replace the call to nvmem_find() with a call to __nvmem_device_get() which does all the referencing and return a proper ERR_PTR in case of error. Signed-off-by: Alban Bedel Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index a749a5cb0a4e..1752768dd2d2 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -874,7 +874,7 @@ struct nvmem_device *nvmem_device_get(struct device *dev, const char *dev_name) } - return nvmem_find(dev_name); + return __nvmem_device_get(NULL, dev_name); } EXPORT_SYMBOL_GPL(nvmem_device_get); From patchwork Mon Jan 28 15:55:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 156799 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3691143jaa; Mon, 28 Jan 2019 09:35:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN6N2chRpcvImU3RVAYV74Cy2aZPgOImo7LcSloIn+2/9RS+Z/P89GGOG+fpVKMKR2glmWn4 X-Received: by 2002:a62:d148:: with SMTP id t8mr23277809pfl.52.1548696921399; Mon, 28 Jan 2019 09:35:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696921; cv=none; d=google.com; s=arc-20160816; b=MHe/sP9aNxp7w4tCUdqaUegVDyPJsVuOXFZ/f92FlFUEDwOAP82nmk8LiMwavrK8vW RdXAiNlqo4hw3qBefcdWNNeQRWGw7rsk0EsUrVKlkT5jsO0taLbCY7QD0yX9/7NcJ1RB LsRJPGuzClkrMYKRWTGqF/RNUW890sxqV1+f6lvm2hg1BoGgtOifz+EHl3nkEMaZ3QJx FNGYKLqdlhAeqBrsBLW84zBB3HScagXtlgkxTZbI2sCu4I6DxikUA4qbbvgSiE7Zfqrw jfqmpcCqZhDZkANamQolttCaJEXt1e7fKUkLPwXISh30VEe+5M6i8No9cc6agd3GGQ2i jKPw== 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 :dkim-signature; bh=lZsyg31nN3cTqKBQ+cnJv/eVAHpsVh0TDVW8eJ9YX1U=; b=PeQ7y42K9dQCYfGk5bJzb9sl8Xrist1NcSRH/7NIdKOTLoj4QbJidOxh02VIjKKMd0 s3t3WGYfTbNghjo7QF1hk0ytodpnz9e+24ijBRMaQmH8kPujuRKz/ODjj07zWH7l2e3b xF1qT1u61AI/5hIO6wMVT6VGNdiFNkZSjp8RnQurB9Sq0gVe12oxGxpz5VuNA0P/o9m8 b3XFkfWjDg8UumE0itkgQtVHqvOz5FSPmAh+YlUtDQMA8JvKWU03IjGIfh5OVpY6lVkc jz75FdG/3lPU195J5Gh3CqQyFYrS1XVDe88Vzj/qVyij4ytelY5itufbr80BXcwZKxn0 9cGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H08UXXHZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si32743364plq.138.2019.01.28.09.35.21; Mon, 28 Jan 2019 09:35:21 -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=pass header.i=@linaro.org header.s=google header.b=H08UXXHZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729900AbfA1Pz3 (ORCPT + 31 others); Mon, 28 Jan 2019 10:55:29 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:40965 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729881AbfA1PzY (ORCPT ); Mon, 28 Jan 2019 10:55:24 -0500 Received: by mail-wr1-f68.google.com with SMTP id x10so18589966wrs.8 for ; Mon, 28 Jan 2019 07:55:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lZsyg31nN3cTqKBQ+cnJv/eVAHpsVh0TDVW8eJ9YX1U=; b=H08UXXHZSo6EQbLRUZaDJa+u695P9tPKYYCyWyb1Sk5F35f1SNHRnD/TEMkd0ze3iB Q+/TtKyEyXXnUrRUF49uuQXdrphkZSAFqlv+xBzTC41xskHXGABFZ5woc2c03yrkoJkE PLgHsylS620TRUE1dUS7QjSyaMrNx2p9fltJE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lZsyg31nN3cTqKBQ+cnJv/eVAHpsVh0TDVW8eJ9YX1U=; b=PJ8YDATbTCDFrVQYrS1xGbY0PIZgx4gFVQozWsmeC2l7YFQBeTzwThi+injTdB9iBR xsOjZ6kNprqxjfQODCpFmEeoaqtq5OqQ08NsPHh+TV9IIe1oqvxMfyUmLnBqvnlrhglA Mc3rTcwkxeahNOJ+3ZqIhvMzaA+W1Zgfrv5stDMozfA2mGgYU04uliIoHq3u2cd30BHU 236VWtzj9PulLViEAOEdYcUP/Xp1aQ5HPjHkC2OJsBqW1WOSoJYsO6pYAnB2vxkb+rjo 9O+qJS/lTTlBddit3/vQ/2N6aQkL9384stzBpVtfqxAdcNj09xVnVX34A68AtFY+MnaF Lx/A== X-Gm-Message-State: AJcUukexn1WXeX1QBLKjHeV2Px5SK1iJonlZZVUj3Ibu2cqfFOuFNlpI 08THLzjZaAx4aTdicSacBsq/jT1WILE= X-Received: by 2002:a5d:40c1:: with SMTP id b1mr23293116wrq.133.1548690921964; Mon, 28 Jan 2019 07:55:21 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id p6sm145140485wrx.50.2019.01.28.07.55.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 07:55:21 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 12/13] nvmem: core: Fix device reference leak Date: Mon, 28 Jan 2019 15:55:05 +0000 Message-Id: <20190128155506.25566-13-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> References: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alban Bedel __nvmem_device_get() make use of bus_find_device() to get the relevant device and this function increase the reference count of the device found, however this is not accounted for anywhere. Fix __nvmem_device_get() and __nvmem_device_put() to properly release this reference count. Signed-off-by: Alban Bedel Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.20.1 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 1752768dd2d2..5400017ef616 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -811,6 +811,7 @@ static struct nvmem_device *__nvmem_device_get(struct device_node *np, "could not increase module refcount for cell %s\n", nvmem_dev_name(nvmem)); + put_device(&nvmem->dev); return ERR_PTR(-EINVAL); } @@ -821,6 +822,7 @@ static struct nvmem_device *__nvmem_device_get(struct device_node *np, static void __nvmem_device_put(struct nvmem_device *nvmem) { + put_device(&nvmem->dev); module_put(nvmem->owner); kref_put(&nvmem->refcnt, nvmem_device_release); } From patchwork Mon Jan 28 15:55:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 156798 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3690976jaa; Mon, 28 Jan 2019 09:35:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN5+Vci9qMh4LfDS8YRBVTbOY9U+26fHHhVam5bkKz1/tRdGWTOz/znxDD/MFjLA7WVDdDAS X-Received: by 2002:a17:902:24a2:: with SMTP id w31mr22210233pla.216.1548696912161; Mon, 28 Jan 2019 09:35:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696912; cv=none; d=google.com; s=arc-20160816; b=VxV4yZNNHlkA2P8o8S5OdP/+s78/SEwFJd4O1OIQrJ8ktyu7tFGqa9x/Z+xoWqnpgk uAuq1dYqEKQajc6UEexQ+OfPdqAfihyUI/GwDfTjXq9nRMonLRxK78aqx4kgxWyoO9Up dpJMZ85ZF+bkeOxm5bv/ggDzqY3XIwahM/MAc7AZNI+lUDGRzLKpQusN8AUZ/8IigmRn q5/3WhLAkPy8aZ3OYHIG1U2QnSyw3qLyUR5DKgp6tPzyyrA1uja+eJzzqq/hV5q8azrE QbiGYg6nIZiJ2PxsQdkNIkUGfZfHAYrtcMBD8crVrL6LYtse9NU87/E6FA4tFk/zzbXo Jgtg== 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 :dkim-signature; bh=slmqeLOsa8d5rsqPApJzFEU02ClYEPT68CCNN/PckQ4=; b=fDWGOXCSrb+51KaCwF6MmBFm+tDhO/WDGy/4yKKKABgSYx/j6M6z9nuc1k71AvnU/3 i0dtKKVGdT0E16bng6cKSzdRLi7ntbAkKzuVZK9j08ssSoO+EBIFjbvjBNmwyJcaxLdK swogJxCTuSGyPfwcb7VypEcyuQkHGwlhLXDEEEXrRdPOjoKG8cGUEU4p32odjGeBd1c5 13X3BvU+jtncmSA/q37wrRUTY3X4N0SAen7iAu829ceIYkSieWLBCp/RSURzila1XweE XU+Ex/70KFLUnkxG1G5C8NbgDhYGJUHvMKc5gG02XG0lHK65jeHJX2cbGKDE0HCEvTiy gjdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VF77ai8z; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 35si19157045plf.177.2019.01.28.09.35.11; Mon, 28 Jan 2019 09:35:12 -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=pass header.i=@linaro.org header.s=google header.b=VF77ai8z; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729910AbfA1Pzb (ORCPT + 31 others); Mon, 28 Jan 2019 10:55:31 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36371 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729434AbfA1PzZ (ORCPT ); Mon, 28 Jan 2019 10:55:25 -0500 Received: by mail-wr1-f65.google.com with SMTP id u4so18632232wrp.3 for ; Mon, 28 Jan 2019 07:55:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=slmqeLOsa8d5rsqPApJzFEU02ClYEPT68CCNN/PckQ4=; b=VF77ai8zHtPKwML6aprf3N7NLb5YqyWZv6bQ/tnh93JpldM6Zrmc67BYxkg5nWwt6O t+IDXf39LvwmLE5l26SuQ48Gcf+C2NHUNboRbelNGTjQPdNPLsICqCsmqZC2wBFOjjy7 Vla2rE2ojk0JDI6juZ7osloJP2gnADIrWd/Ik= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=slmqeLOsa8d5rsqPApJzFEU02ClYEPT68CCNN/PckQ4=; b=l6k1t7gnCbM+jEqNyeR+514C8/maC3edo0NXjD2zn4lQHYeP2fWp13Cq8D+gu1k3oe FEKRldpq3IE3njZASEqlhtp0GHbrIJUV9Jf3H0p145KY6H6VsoUNwiznH5bC7nVjGgsz TVCJxTtVE3qDiz78RwKuhtZ0k1Q9CwyIrHxVXuiX9DCtX2RryRmnt6Ee291oPF9o4ul1 fCxOL3bcFzjn1E/WW3PPUg88Pd9pV48BZDgt6qEkwHsKXTWscP8795Ihz2ZB1g+vzz49 nF/odAqqMXjFdbmoIc7/SuVAIlDitkzYz6VhmXNPi3qY03i1j8UG17ARKOEdx6+u0TfX xH8w== X-Gm-Message-State: AJcUukcRYwTxjWpS+B9uYBYM04IcJkUpU7uw9F2xIaNEPJ+7lUF60pqB cBcnNHFu9KvmTPFgaiwpRuIJeQ== X-Received: by 2002:a5d:678b:: with SMTP id v11mr23905340wru.245.1548690923025; Mon, 28 Jan 2019 07:55:23 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id p6sm145140485wrx.50.2019.01.28.07.55.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Jan 2019 07:55:22 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 13/13] nvmem: core: Avoid useless iterations in nvmem_cell_get_from_lookup() Date: Mon, 28 Jan 2019 15:55:06 +0000 Message-Id: <20190128155506.25566-14-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> References: <20190128155506.25566-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alban Bedel Once the correct cell has been found there is no need to continue iterating, just stop there. While at it replace the goto used to leave the loop with simple break statements. Signed-off-by: Alban Bedel Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.20.1 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 5400017ef616..9dd07eae1f3e 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -977,7 +977,7 @@ nvmem_cell_get_from_lookup(struct device *dev, const char *con_id) if (IS_ERR(nvmem)) { /* Provider may not be registered yet. */ cell = ERR_CAST(nvmem); - goto out; + break; } cell = nvmem_find_cell_by_name(nvmem, @@ -985,12 +985,11 @@ nvmem_cell_get_from_lookup(struct device *dev, const char *con_id) if (!cell) { __nvmem_device_put(nvmem); cell = ERR_PTR(-ENOENT); - goto out; } + break; } } -out: mutex_unlock(&nvmem_lookup_mutex); return cell; }