From patchwork Fri Jun 9 09:59:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 103447 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp127891qgd; Fri, 9 Jun 2017 03:00:00 -0700 (PDT) X-Received: by 10.98.58.217 with SMTP id v86mr17770733pfj.115.1497002400445; Fri, 09 Jun 2017 03:00:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497002400; cv=none; d=google.com; s=arc-20160816; b=r/gtn9Kdp9IIoP1rpuHTpiuKhV66qNtDzzNnrHu/mtNWsAn1SLXtJIN3deMgkgrMQD P81xLZGgt90kHUfgjIlj01uLqeOsAoIOJ4sVZw2ef2ivyFim49d5odgt3mALmVe3m33L pMI4s7BIk1EvR7t8VV2aWM2Dr7Mu8mA2oGEsvCXt3CCzf0lBPqm9VCAEQPlt8rnTfN/M 4mwbYB6ZqHe6cNZjChA2ouo9i8ZJecjRIql65aldwdQLyTjUBN+nzEenbj7CoHxMstON bzv6PPUPqYYYjV0HguOXwfAOvEcEyls/r5FRyIZcF4X5o2BsvnfqIiRV97NMWu3pyvLy /NbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=v3Mfz9aUu+V9a6fs+DewXPhDFURlOGfJX9iZZ3STCvw=; b=F7uBIwDP/ZgmXBb61rYxvK5V3Vb+GnCgkL3z00VDeQ4XXoC+LloWTgClczzEcv3iiI APabnt25xwtAujW3J8CNrSE1utBiiynoLPoxfznfLfdrJK7GjqilFJG4A80sUtOOCFc8 bG4tTt33ZRid/y5BgpSCmn5hG50queCG+b864KvNyTAI7JpPTzK6D68TdDS2Ae4L2NXh tAgrUCfnJCrSuJFYJwRK9pSnndFmZe935vzNu0Szm8AoTx3LNAu4Bch5Y2SJ6TUl5t5E pwL6mXVIoB0yV8JKfG3aETXqxdz989i8UmupV38sWU7a+/HitRp0vINojaBebcXQKKQj HphQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; 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 p12si6673369pgs.309.2017.06.09.03.00.00; Fri, 09 Jun 2017 03:00:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; 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 S1751651AbdFIJ7s (ORCPT + 25 others); Fri, 9 Jun 2017 05:59:48 -0400 Received: from mail-wr0-f173.google.com ([209.85.128.173]:33130 "EHLO mail-wr0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751519AbdFIJ7l (ORCPT ); Fri, 9 Jun 2017 05:59:41 -0400 Received: by mail-wr0-f173.google.com with SMTP id v104so28250732wrb.0 for ; Fri, 09 Jun 2017 02:59:40 -0700 (PDT) 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; bh=v3Mfz9aUu+V9a6fs+DewXPhDFURlOGfJX9iZZ3STCvw=; b=Sekvv9RHmFrCuQtrTqIONjJzr+JM8VRkMCzHxdAbQ1Iu8jxSXcgv8dRO8f+HGChUFQ VMl1lpi0gOd54NYc+cnLWbLSJOLRGo5zkAC4Y9YmknmXTG14WqkjUmm76MWEB96uwIFh cDWHiwtqnpM2QW7UaOSHPs6OkSlJ4W7ULctNs= 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; bh=v3Mfz9aUu+V9a6fs+DewXPhDFURlOGfJX9iZZ3STCvw=; b=FSo1iXZ143Yx9e45uN8R5QTz5S+A2qgo1PDPN4PB/N7gNZFZU+RdpXNUNK8y7/SIwq p6fC+3tQ2c/Ozt5hGpX7enlINhyfuA7v0W5eGJdnrni/RZpYPChqNIiHqtaMuYmw3v8W /aeCA+JnjQ+oalQzBt5Xhj661q5PYQs69UqfXjKE3yqE2ZSV4SHS+mKoUTI/d1mbvo7F ouEYLGWIc0QMo8MoJlkK59IZkHz/VhFNJ/UjXZZzzqfWhc3CzsllL+nlElBgXt2bAI/T 7imK3D7q39Aeyu0VUr/QMmsM+Gd/MFmPLCl7L8kD7If4jDB/kfbCY6UuryF9E/sUn2jv OoHw== X-Gm-Message-State: AODbwcDQEmgiduSJYucCLsXLsk5rX4IeGIyrMMvDme+9cuag9mJ/yMCo hxwcrDpiySV6UGk1 X-Received: by 10.223.131.166 with SMTP id 35mr3670351wre.161.1497002379976; Fri, 09 Jun 2017 02:59:39 -0700 (PDT) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id g46sm1031207wrg.69.2017.06.09.02.59.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Jun 2017 02:59:39 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: srinivas.kandagatla@linaro.org, linux-kernel@vger.kernel.org, Oza Pawandeep , Scott Branden Subject: [PATCH 1/5] nvmem: correct Broadcom OTP controller driver writes Date: Fri, 9 Jun 2017 10:59:06 +0100 Message-Id: <20170609095910.4090-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170609095910.4090-1-srinivas.kandagatla@linaro.org> References: <20170609095910.4090-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oza Pawandeep - use data write offset to write otp data instead of read offset - use OTP program command 0x8 to write otp with ECC rather than just command 0xA without ECC Fixes: 9d59c6e8ae27 ("nvmem: Add the Broadcom OTP controller driver") Signed-off-by: Oza Pawandeep Signed-off-by: Scott Branden Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/bcm-ocotp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/drivers/nvmem/bcm-ocotp.c b/drivers/nvmem/bcm-ocotp.c index 646cadbf1f93..3c56e3b2bd65 100644 --- a/drivers/nvmem/bcm-ocotp.c +++ b/drivers/nvmem/bcm-ocotp.c @@ -34,7 +34,7 @@ #define OTPC_CMD_READ 0x0 #define OTPC_CMD_OTP_PROG_ENABLE 0x2 #define OTPC_CMD_OTP_PROG_DISABLE 0x3 -#define OTPC_CMD_PROGRAM 0xA +#define OTPC_CMD_PROGRAM 0x8 /* OTPC Status Bits */ #define OTPC_STAT_CMD_DONE BIT(1) @@ -209,7 +209,7 @@ static int bcm_otpc_write(void *context, unsigned int offset, void *val, set_command(priv->base, OTPC_CMD_PROGRAM); set_cpu_address(priv->base, address++); for (i = 0; i < priv->map->otpc_row_size; i++) { - writel(*buf, priv->base + priv->map->data_r_offset[i]); + writel(*buf, priv->base + priv->map->data_w_offset[i]); buf++; bytes_written += sizeof(*buf); } From patchwork Fri Jun 9 09:59:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 103448 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp127962qgd; Fri, 9 Jun 2017 03:00:11 -0700 (PDT) X-Received: by 10.84.238.139 with SMTP id v11mr40366600plk.182.1497002411628; Fri, 09 Jun 2017 03:00:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497002411; cv=none; d=google.com; s=arc-20160816; b=vfkH/OJOfdhNXqczdK4c4rg9tynJK4gAtAWUySZppu0iStmmVfzjB6xPkTNJ2vj3H0 1qmjxqIh9aP4FOlqCKsy2dyGf2ybIAopdcFn583lrHO9nNdTGYiaxqeWE4kMirzo9JNo yarUag+3MIqtlgaB4ZLG/y6w6yEu0//Y9/UcxNvm/5DXfI/SEzvGq+1U5IXHZRVDoiVN m76/EwEaQRiHcLB+48RtKJWZGRz4CPuMm8ErhDqTRwS31u+s/cwG5sTvgcCy2HrZccC/ ZxSmXKv6eS58DQ4d7vGohVXI7eS3M/RCRwmwBsQ/E1wRaqxrEVfCzr8X9b9MJChTcrJ/ BtcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=fifqN0Iohhhvk6Gh+Sz4R5n353bbvLkO+ID2QgxUP0Y=; b=Pr13s5g+/2J72A21pGLuJxLlT1TkaJVk5mx371KB6llzL2DX0VXXGO6bTyxIbWASPw 9x57oUx3BYW0OjTiuihsrB/rwERly7iL6O2VSpzg9mTfbT3b8SIOGw1HzfS2Sy+WfRRa z1wBS78tSgTnlXRNWYsoPbcbE6Sx0nYZgdVeGJKrYvFt86QZHQILBhSj+JvyYdcrbNp9 jzqIUJ5CbfKbITUKPxjzd8aIrT0sA+cGwv2Xm0zcKzUhKU2m5D9ww0ivLD9YN9AZVqht f/oYpEhme4IyYYCIa/woP67wwyhtn7v1oKI4O91pzmaXVcBVkzsP1zjswtNVBSkZQEfq Bngg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; 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 p12si6673369pgs.309.2017.06.09.03.00.11; Fri, 09 Jun 2017 03:00:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; 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 S1751606AbdFIJ7p (ORCPT + 25 others); Fri, 9 Jun 2017 05:59:45 -0400 Received: from mail-wr0-f174.google.com ([209.85.128.174]:35723 "EHLO mail-wr0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751558AbdFIJ7m (ORCPT ); Fri, 9 Jun 2017 05:59:42 -0400 Received: by mail-wr0-f174.google.com with SMTP id q97so28298123wrb.2 for ; Fri, 09 Jun 2017 02:59:41 -0700 (PDT) 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; bh=fifqN0Iohhhvk6Gh+Sz4R5n353bbvLkO+ID2QgxUP0Y=; b=CWiWx0XtwKg93UEKiKf+1Cogpu3vgUwvC9gwAPXVQVFaX654X2LYuzZGEtr7NPMJPq tQlIHBLe8L94BdIZz48Qiqe6YZ2+aW/wLEEcqGiZSXtHfeVfSmzPm5XKKVnX2m4NGpSL /mJUUwLr3BIy5745PtaTtGer3ej245OK3YT4U= 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; bh=fifqN0Iohhhvk6Gh+Sz4R5n353bbvLkO+ID2QgxUP0Y=; b=I9YyclFUDqfyx+1p5hng9NkUBadxUTnmGymjAhgsdFYaIX0cIOMSPhYVurnIzufx3U 4dZmJHX9lCp/djdIA02IEP6ojBjq9Zx/2FD2hpEgJGtdiV4s0VWVXvs4M0w2tKhVxvw4 RvxOPFA2msXzWSpC7GXrEXb13/+/AWJ+BKAvcqhw/iRP68pQvUr7WjJ4qyqtZ0mgtX9B yGi29vvIG9/TKcMHr+gk0Cr3QZyCau2+Hpr2A0+03VYvkPw4Q8igPFq+PlhQZJ7VwhP5 MCl9u7pfPyIYm1Ba1/P46TWj10GeuTzFYiif4YiYdthb/t94TBb0Svd/zdI6Jv41ltmF +mqA== X-Gm-Message-State: AODbwcA5pKBBYgbyWlw93tw88pyCYnbbRgbGfw2cjG5likSpNASohwry w7f0x8p1rfn0yhTz X-Received: by 10.223.171.83 with SMTP id r19mr28284588wrc.7.1497002381123; Fri, 09 Jun 2017 02:59:41 -0700 (PDT) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id g46sm1031207wrg.69.2017.06.09.02.59.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Jun 2017 02:59:40 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: srinivas.kandagatla@linaro.org, linux-kernel@vger.kernel.org, Johan Hovold , "stable # 4 . 3" , Andrew Lunn , Mika Westerberg Subject: [PATCH 2/5] nvmem: core: fix leaks on registration errors Date: Fri, 9 Jun 2017 10:59:07 +0100 Message-Id: <20170609095910.4090-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170609095910.4090-1-srinivas.kandagatla@linaro.org> References: <20170609095910.4090-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johan Hovold Make sure to deregister and release the nvmem device and underlying memory on registration errors. Note that the private data must be freed using put_device() once the struct device has been initialised. Also note that there's a related reference leak in the deregistration function as reported by Mika Westerberg which is being fixed separately. Fixes: b6c217ab9be6 ("nvmem: Add backwards compatibility support for older EEPROM drivers.") Fixes: eace75cfdcf7 ("nvmem: Add a simple NVMEM framework for nvmem providers") Cc: stable # 4.3 Cc: Andrew Lunn Cc: Srinivas Kandagatla Cc: Mika Westerberg Signed-off-by: Johan Hovold Acked-by: Andrey Smirnov Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) -- 2.11.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 8c830a80a648..6cf916d9db6d 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -489,21 +489,24 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) rval = device_add(&nvmem->dev); if (rval) - goto out; + goto err_put_device; if (config->compat) { rval = nvmem_setup_compat(nvmem, config); if (rval) - goto out; + goto err_device_del; } if (config->cells) nvmem_add_cells(nvmem, config); return nvmem; -out: - ida_simple_remove(&nvmem_ida, nvmem->id); - kfree(nvmem); + +err_device_del: + device_del(&nvmem->dev); +err_put_device: + put_device(&nvmem->dev); + return ERR_PTR(rval); } EXPORT_SYMBOL_GPL(nvmem_register); From patchwork Fri Jun 9 09:59:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 103446 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp127888qgd; Fri, 9 Jun 2017 03:00:00 -0700 (PDT) X-Received: by 10.98.201.212 with SMTP id l81mr41398156pfk.225.1497002400043; Fri, 09 Jun 2017 03:00:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497002400; cv=none; d=google.com; s=arc-20160816; b=H5STng5Bx1F90wrx1zl6sQfoD18MmImL+D2yxjwbhuxvnjLQPpia4GzCqwcaM+mdAO EkdZQNuktGrlM8wFsllCs5GobFWkV/YSGN7wTaF2j5sWsGS9jvuf/TQ0KA/1X++0T8G0 boqsETM4DK4T5NYpyt8/V7xudpxPEM6xgoXfNRTNj++97oCd79AoC+7FASfxMvpw00HG EMfLUEiDRKe3sPolCPsz3TXZBiZq37m+wwRqgtKB/jhaqoJpL5h6YOAmXvDi4QhpX7IQ 8Op4FjnCf+GKr4vI3E3cCYxWehuGFsRKhxsyejumMICOTcmBU46zL4UgFzF98vQopyH3 gXGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=YOadIl0B0RfGRRhcpV6DOG4B/yIEBLtnlk2wZf6HVU8=; b=seeD0jHlMjZtlShRhBfCxUuxywqp6FKcO8mWXF5J1RDBos+eqS//vV3mSvtoP8VsC5 Uf1EW41FiGleitgPVr/webLxRLnuIX9DIGkPRk/jXUDkydrskIe7+MnFpLf5XGV7dbdx VTwa6LCQEPBh/vxOXawWeMTjrG1D26eOwOodRUXozWFt1ZUz6lpLmMmr1a/CwssigdQv lTwJObk0cbkPbQGGGNhxttA9VkI0WhKf1TPfDYcnErbiB3F6E/hmVyperLt/PK0Onsg2 F4itHRldTC8lsjMINrq+k1cykWpe0CpWkOeRBJ7eD7P1PA0CQTKvYjgY+SSZpxBmFnVQ uzIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; 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 p12si6673369pgs.309.2017.06.09.02.59.59; Fri, 09 Jun 2017 03:00:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; 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 S1751628AbdFIJ7r (ORCPT + 25 others); Fri, 9 Jun 2017 05:59:47 -0400 Received: from mail-wr0-f179.google.com ([209.85.128.179]:33144 "EHLO mail-wr0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751572AbdFIJ7n (ORCPT ); Fri, 9 Jun 2017 05:59:43 -0400 Received: by mail-wr0-f179.google.com with SMTP id v104so28251127wrb.0 for ; Fri, 09 Jun 2017 02:59:42 -0700 (PDT) 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; bh=YOadIl0B0RfGRRhcpV6DOG4B/yIEBLtnlk2wZf6HVU8=; b=AckF5RF84eYa3x7MUjoQBG435Tth7eK60w1j9NR6Cx/FeiXzAUYaePXWAPqBUmuAGm neLlTBvP35bmSebraWS1py9n03ZDRnvjVIV6+4Sjvm2jr3N2e0qTyt24DW+llAnXWnBY BJLAKVJ3emwxqpYG65pGYZX+lkBVW9OsLpQUk= 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; bh=YOadIl0B0RfGRRhcpV6DOG4B/yIEBLtnlk2wZf6HVU8=; b=PcIINjeejvMx2SRmJ8QuDG9ntPIZxUKJCeDVoZTXcNOVDD1bAQXfTL9upF1pRaKjQj 1Lzrtw9ZR0qmv96qLNNPCBlNhe5XFklSV+BgtQlrCs9jMVb686xOYiRCeddw1HafQhpE zmaHb4C6aG2xezho1Kh5hGQUtiaWI5Vm2sKBeEeWKKHb3iwAZNIH8d8TMyPzY7970jq7 2jAUeyFK6/uEXrRu5i3ASVWONZpeUNBpcuviX54j50qhJxqcecf3ZVBiImpFbHpqUBkv sezstoq+Lzdnm/AO0qekOAo92DGu7hOr7JoeJUcrB/9qDmCjU2WR+vnew+8Z12x2NbMk f+jQ== X-Gm-Message-State: AODbwcBmXjRznJM0iG3oHifwa8MiY8F22eNykWTvbZ0KRLYAewkllgna RzbuFn/znJYDh6zt X-Received: by 10.223.160.178 with SMTP id m47mr6335108wrm.194.1497002382238; Fri, 09 Jun 2017 02:59:42 -0700 (PDT) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id g46sm1031207wrg.69.2017.06.09.02.59.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Jun 2017 02:59:41 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: srinivas.kandagatla@linaro.org, linux-kernel@vger.kernel.org, Andrey Smirnov , cphealy@gmail.com, Maxime Ripard Subject: [PATCH 3/5] nvmem: core: Call put_device() in nvmem_unregister() Date: Fri, 9 Jun 2017 10:59:08 +0100 Message-Id: <20170609095910.4090-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170609095910.4090-1-srinivas.kandagatla@linaro.org> References: <20170609095910.4090-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrey Smirnov Call put_device() in nvmem_unregister() to make sure nvmem_release gets called freeing up allocated resources. Cc: cphealy@gmail.com Cc: Srinivas Kandagatla Cc: Maxime Ripard Signed-off-by: Andrey Smirnov Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 1 + 1 file changed, 1 insertion(+) -- 2.11.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 6cf916d9db6d..0cbac71195b5 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -532,6 +532,7 @@ int nvmem_unregister(struct nvmem_device *nvmem) nvmem_device_remove_all_cells(nvmem); device_del(&nvmem->dev); + put_device(&nvmem->dev); return 0; } From patchwork Fri Jun 9 09:59:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 103450 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp128417qgd; Fri, 9 Jun 2017 03:01:07 -0700 (PDT) X-Received: by 10.84.218.78 with SMTP id f14mr39597166plm.214.1497002467577; Fri, 09 Jun 2017 03:01:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497002467; cv=none; d=google.com; s=arc-20160816; b=rNVpsDdTuO40aPH8bDVerKeODV44VxaGn7mFfggkKJ2bzHdp5r0/AM8apoR1pRvpqY OUOyDGFMXL6hOj9znJ2jHwyU5vywRz8zhzDta4a1nqEZemhKD18NAE5u3cDC4425hHQB AJJtxH8yot8InVnxMPJkMJt0fSqYY9jEJo8PDdfP4eLtwjpJh1xc35Bww5/x+ig1bNU1 AND5SZk4Ukbpn2cl3M+XMFrnfNFiXMYWz5k5VEL+gWrlmWPUX72obCGo5kL++mdKz+5T kvdd/iVplIZbwBeka3cCJKHL9cVu31vm80Atj64WEfWFv9gYBe3cJ1wz92Cg5lh4yznL nY4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=4ZgAoXdiEHfJxkMowZm763/qYb3veIRjJzruAcT81YI=; b=ODY7aTemPvrO3T3eBcbvGr1Rj9lk3yduaBBMdr5ITfaU0Yj8XfxWKXxkHYvz0koEMl 8ZaUt1POj15DNH5f31kUMh2u1clnGVQ193HEOBupjvMTlFkHzIBJvSKgI7ExTJlC4H0x vh7YxpBSJ+xQW83NojVj9T7UuyQrhze2mjnMMFeLZP1N5GZa4yuDaLefSHC07V96VbvM 8961irniWcAN49NSET6dVjr3yWQhIIUdD9EYODsxKbKkv4A5VfE7GOzB39p1PbrZ3xQp g/cmbRxEPJCbElMr0M08Zcrzpn59XdqtpnZerG6T2qvDyjk3jC54LsdS/aXN9qmTIhSa rjUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; 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 y8si563638pli.453.2017.06.09.03.01.07; Fri, 09 Jun 2017 03:01:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; 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 S1751785AbdFIKAp (ORCPT + 25 others); Fri, 9 Jun 2017 06:00:45 -0400 Received: from mail-wr0-f182.google.com ([209.85.128.182]:34390 "EHLO mail-wr0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751573AbdFIJ7o (ORCPT ); Fri, 9 Jun 2017 05:59:44 -0400 Received: by mail-wr0-f182.google.com with SMTP id g76so28194283wrd.1 for ; Fri, 09 Jun 2017 02:59:43 -0700 (PDT) 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; bh=4ZgAoXdiEHfJxkMowZm763/qYb3veIRjJzruAcT81YI=; b=PynZTKPW+Jjf+AYJ96AVScybXUq+UW5mYvqcIlDrUtKUMnafBQf+E39vdcHxfB4rAV H/ArCYZZ57R+dxwUBk0cwm1Mb7FRjkvWF3GQxhTPnS3GDGoN74YKBHLUY/3GnZxFcMWp qt57yuRwrty3cwLwhFqdXa70ZW1I5T3RMToh0= 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; bh=4ZgAoXdiEHfJxkMowZm763/qYb3veIRjJzruAcT81YI=; b=mqE8iB2Ssp7kQ3rqzDDgtZc1EPaN5/PryIhPrTFldN2hgRpFl2/EuxC1cCzRCuskFf 3lsMA84+/Vdqz/O9Wy0+MA/ehB/IOn5LWoNLLodWpgB2SGGemGtQinSIgXtXStLMLvkH wl10C5xKpCl3oleiYOSJbcJ9PVefns6Vk0Trtr4wVwTYUJlwHbsI62TRLXqT3Yrax0p0 RrNsjh+UP2ZcK57uUzj9NDpdISrHW4x3CRWdpTBsucIZb8nFlIMofOXHEifI9pECkIZy w8QJEDievVAsJZssAK80MlRjpsSOpE2U8uQr0qlopJ5yaGSJ37BfUBlKtODsaSZT2vzL /21w== X-Gm-Message-State: AODbwcBIbxcxGw6l3fbbfizG3lSUAzqOUEa6JP3q9hhaOYJGq8rQJjHx XEMCtzAwL++jiBf7 X-Received: by 10.223.145.75 with SMTP id j69mr27472642wrj.23.1497002383066; Fri, 09 Jun 2017 02:59:43 -0700 (PDT) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id g46sm1031207wrg.69.2017.06.09.02.59.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Jun 2017 02:59:42 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: srinivas.kandagatla@linaro.org, linux-kernel@vger.kernel.org, Heiner Kallweit Subject: [PATCH 4/5] nvmem: core: add locking to nvmem_find_cell Date: Fri, 9 Jun 2017 10:59:09 +0100 Message-Id: <20170609095910.4090-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170609095910.4090-1-srinivas.kandagatla@linaro.org> References: <20170609095910.4090-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Heiner Kallweit Adding entries to nvmem_cells and deleting entries from it is protected by nvmem_cells_mutex. Therefore this mutex should also protect iterating over the list. Signed-off-by: Heiner Kallweit Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 0cbac71195b5..4c49285168fb 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -287,9 +287,15 @@ static struct nvmem_cell *nvmem_find_cell(const char *cell_id) { struct nvmem_cell *p; + mutex_lock(&nvmem_cells_mutex); + list_for_each_entry(p, &nvmem_cells, node) - if (p && !strcmp(p->name, cell_id)) + if (p && !strcmp(p->name, cell_id)) { + mutex_unlock(&nvmem_cells_mutex); return p; + } + + mutex_unlock(&nvmem_cells_mutex); return NULL; } From patchwork Fri Jun 9 09:59:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 103449 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp128035qgd; Fri, 9 Jun 2017 03:00:21 -0700 (PDT) X-Received: by 10.84.245.2 with SMTP id i2mr35966279pll.284.1497002421728; Fri, 09 Jun 2017 03:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497002421; cv=none; d=google.com; s=arc-20160816; b=uJUQ/KzUHRQjFBkEM0cS0jeq7KeokUDImlvznk2Sw0bcd6jAiB2e7phpD9whuk/22L /f0jRgTTNVuYDLbmcNzv/Nw7QPWO0E+GL16/+iHvEPqu229FdvP/1dpGFc0r3WXCO/I3 ksIsOp6ArbIKsFNDLr5pKL8w0AnTvnXcwEcHkgy27FdMoDwjxaWNUxoz1aYjpammH7wZ CBVPo0naGje11J6/eazqLS7ja4Kl0odvM4zoqKD4u7DBrhjxUGiQ8LrRi25yE597WiqZ BRlzTnY7WhKFKFoPCh0+VlTwRYVOLmJ3aVTpeyQF/1w8untia7nZqW3vd+f3T/30ODkt nBlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=c+/3/vnryXz+gm9O3Nmbno263QYB+u/ydclzKMo9pGo=; b=XidmiCZnuTqNlElb2V+C2Ib1E/d/j8EBM90rtvrsHqH4VOZix1QcIeU1OYdPVoItyO HaewemT0M2yMGEAJG9I9qnRWtsvnInpu+In3tQHqSXplYPAg6+PcOzApfi9EVPGIXaco vgS9zodKZLa3LaCPg9kUtA5wgPwiAy7nWUyAMLsFxr5ES8lVtug8ZmMv/p9fU9zsD7W/ lK3RE1Dau1udJtJ5QepaCKpZe0dzr+2k6giIzH3R1tqnf6TodH08ztqhMBhc3dxST2ut 1c//ak0dVRjrHLBryv6MEnfJi48HBRPrApxFSRYk56AXV8R/ZzWzB9sF1VfHB/PrIcNb Be/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; 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 d82si605134pfl.148.2017.06.09.03.00.21; Fri, 09 Jun 2017 03:00:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; 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 S1751698AbdFIKAK (ORCPT + 25 others); Fri, 9 Jun 2017 06:00:10 -0400 Received: from mail-wr0-f181.google.com ([209.85.128.181]:33157 "EHLO mail-wr0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751598AbdFIJ7q (ORCPT ); Fri, 9 Jun 2017 05:59:46 -0400 Received: by mail-wr0-f181.google.com with SMTP id v104so28251529wrb.0 for ; Fri, 09 Jun 2017 02:59:45 -0700 (PDT) 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; bh=c+/3/vnryXz+gm9O3Nmbno263QYB+u/ydclzKMo9pGo=; b=h+o5rK3dFCnerfv6FV+DeXNKh0JW8Qt6ILOKqK/RQqYGurnqDbfEyF6GED5+heqHNL VrbAmQXQl0x1Ddqee8iRre7ykz+o0e1h0u+01e0XV32dF3l2LIJHu7CbbSz4/6lBMX1r MS9O2N5lNvo7RiVLttPdcLjBGbS/5uiMpDSs0= 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; bh=c+/3/vnryXz+gm9O3Nmbno263QYB+u/ydclzKMo9pGo=; b=gol65d349va8rikCSqzMxm2x10d5j5FGbq0Db9TDhrssXPYM9O/tIE/BiLphroLtk9 QHjvua/qEgEssb2UFIfR27tOAJqPtD9CqURkr1xu/jV+CkduOzad0fqLWbgPWugcyy1F bgYBKpFzkh2FESwFVegyRSkJl4CTejeUQxlvOqpevAPl1T3GQQskl+cLGIp1P/4HSgo3 0fQ63fFJQuRC5RgzWUKDfdrQhdZIRazvIQPBJDK9QQZHketTQZ9PUktU+OzwdyHlH08l q73WZMTrc5VWond4WFA8gLBdEGOk0oaZ3TJtgPZbQ61iTkkUK2T3+xcO94evw4+VO+nc +uag== X-Gm-Message-State: AODbwcBY8yODj5YpLTs9Z3bSZQVM3zFXeWXHIIeHR443LUzEcsu1x1MY sE0VhkLdqqi9u/+M X-Received: by 10.223.154.15 with SMTP id z15mr31238144wrb.136.1497002384645; Fri, 09 Jun 2017 02:59:44 -0700 (PDT) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id g46sm1031207wrg.69.2017.06.09.02.59.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Jun 2017 02:59:43 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: srinivas.kandagatla@linaro.org, linux-kernel@vger.kernel.org, Finley Xiao Subject: [PATCH 5/5] nvmem: rockchip-efuse: add support for rk322x-efuse Date: Fri, 9 Jun 2017 10:59:10 +0100 Message-Id: <20170609095910.4090-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170609095910.4090-1-srinivas.kandagatla@linaro.org> References: <20170609095910.4090-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Finley Xiao This adds the necessary data for handling eFuse on the rk322x. Signed-off-by: Finley Xiao Acked-by: Rob Herring Signed-off-by: Srinivas Kandagatla --- Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt | 1 + drivers/nvmem/rockchip-efuse.c | 4 ++++ 2 files changed, 5 insertions(+) -- 2.11.0 diff --git a/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt b/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt index 94aeeeabadd5..194926f77194 100644 --- a/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt +++ b/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt @@ -4,6 +4,7 @@ Required properties: - compatible: Should be one of the following. - "rockchip,rk3066a-efuse" - for RK3066a SoCs. - "rockchip,rk3188-efuse" - for RK3188 SoCs. + - "rockchip,rk322x-efuse" - for RK322x SoCs. - "rockchip,rk3288-efuse" - for RK3288 SoCs. - "rockchip,rk3399-efuse" - for RK3399 SoCs. - reg: Should contain the registers location and exact eFuse size diff --git a/drivers/nvmem/rockchip-efuse.c b/drivers/nvmem/rockchip-efuse.c index 423907bdd259..a0d4ede9b8fc 100644 --- a/drivers/nvmem/rockchip-efuse.c +++ b/drivers/nvmem/rockchip-efuse.c @@ -170,6 +170,10 @@ static const struct of_device_id rockchip_efuse_match[] = { .data = (void *)&rockchip_rk3288_efuse_read, }, { + .compatible = "rockchip,rk322x-efuse", + .data = (void *)&rockchip_rk3288_efuse_read, + }, + { .compatible = "rockchip,rk3288-efuse", .data = (void *)&rockchip_rk3288_efuse_read, },