From patchwork Fri Sep 21 13:40:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147255 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837086ljw; Fri, 21 Sep 2018 06:40:40 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZMEHlHKxbaGbOnriwDLcYuzNHB8RpWqlZiD59FEk9L8SMw4w1Lq82k+EmHYPy896hCEA9n X-Received: by 2002:a63:e206:: with SMTP id q6-v6mr40358570pgh.223.1537537240189; Fri, 21 Sep 2018 06:40:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537240; cv=none; d=google.com; s=arc-20160816; b=mntjI69Ch2qC0jz9Gz/tdnfozylEWjEqen6UMwGY5717mIDZdGaj4S3qwaNYHvnToB aSJUc51kE7EHjoNzvAU5bJyxtCTmEQSEoU2ERGuX90PAEpAWeemFA3KsT5F7iKfJ1qDi lYvXzzl3cmaJBZJ/T4XDryLu0bsNmT6pTmO9xkFqP/F7DLQsbZZG1lSRqcC7FgrRewVX NQ4h2lF97X8PFfuM5cJ1aWwhQi68KCHlEhOGU+KGyfnWhvLZ2T/2VCRvmbF4nvg+Yq/e bzKBDaIRP4oD1/r8WlT4wjqqOVOIOHO7AoWH8ORjyAWRlS1yVyXVBsLSA4F/HhmtHzcD a/6w== 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; bh=TyrJA8rFdaHKp9ncwV+/fPKK1X9mZxeny1nGtBgA+NA=; b=c9dcdp/M2rC6KcUbiPVBnklazXz53agUbIWw95XEH2gfXPYYBQUK6qzhM9USMlFTxz Zj9lJccq0qMGKuS53qixyx0tnsvz0wK+K440I5BUzyQtOD54J3BYDQ2dJvMmMsKke4+w qFb9174DJUnLos2bH51crNrz3v2NFK90voWKlHwR72YgX/S53Ice+KXKOteHi7BL4Nvs oAAsWB6HNjFC9nm7ZJfqJPDlI+A/b/zXoR5rad5QT1gDEXaF0BRFfryaYyuv796pzlvg fOxfxTkf79u/xbvAdwNEGf3wAXIVV7Olge+RLoH1083/zdUe+a/0yOzWVDJsE2iD2qW+ tOig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="A7/wmq7R"; 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 x7-v6si26623315pgh.595.2018.09.21.06.40.39; Fri, 21 Sep 2018 06:40:40 -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 header.s=google header.b="A7/wmq7R"; 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 S2390023AbeIUT3c (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:32 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:56010 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389870AbeIUT3b (ORCPT ); Fri, 21 Sep 2018 15:29:31 -0400 Received: by mail-it1-f196.google.com with SMTP id d10-v6so2002163itj.5 for ; Fri, 21 Sep 2018 06:40:36 -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=TyrJA8rFdaHKp9ncwV+/fPKK1X9mZxeny1nGtBgA+NA=; b=A7/wmq7Rjf/cp8IjDYLIsnASdZYSHpda3l2ZfxhWhr5otQAXBS/FTC51txu0vzdpZ3 WPR3R/+DVSkqBvJjSeVQxZtvMyoaHDB9Yu1xnuwMOziiQae37pqHYKhJ0W32HKrjwmMh mIwtAAcFDjVn9Zxy7tU/T3fQnh3Um6SOrAyUY= 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=TyrJA8rFdaHKp9ncwV+/fPKK1X9mZxeny1nGtBgA+NA=; b=NhmxoRrgbFHGOK/yzphH6uRX3OG+hVeXAiHiLHXRTsEPz9uwtwHjW5Yk0yEA0KuFmU 55OxUsrMYwlMAPlnWJsFA2w6ryC+qvVmEcmQae66zqyz4aAFqw+0WXFSzbY+V2MwmNTn /MEZcG9E+pAwm01qZ3QJVqdNxmkysSrv+yFzPq6nCcarswl3XPkoxLcQ7MMpQk6o4ff0 F7/cnGBuIZCtnfugvurBCawKS5PqFc4g7JZiUKSimr3U59c0QjqcEgguvQPrCCkIWPjV BDm+BLHD0nQibMf5T9RGpd1pMWgdzYgbiEoW/S1DlXxuE4o6yW1jEnR6c4iKHrhc7SEF 0TxQ== X-Gm-Message-State: APzg51C6s6XkEjhFzQiCGIE4k+e0g99HANUGcdNNMhJk/EoOFTuPzAoE WUK7jNr8oVQTygJuVbKcpkTtVQ== X-Received: by 2002:a24:f60a:: with SMTP id u10-v6mr6038065ith.116.1537537236436; Fri, 21 Sep 2018 06:40:36 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:35 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 01/26] eeprom: eeprom_93xx46: use resource management Date: Fri, 21 Sep 2018 06:40:01 -0700 Message-Id: <20180921134026.4596-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Use resource managed variants of nvmem_register() and kzalloc(). Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/misc/eeprom/eeprom_93xx46.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) -- 2.19.0 diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c index 38766968bfa2..c6dd9ad9bf7b 100644 --- a/drivers/misc/eeprom/eeprom_93xx46.c +++ b/drivers/misc/eeprom/eeprom_93xx46.c @@ -439,7 +439,7 @@ static int eeprom_93xx46_probe(struct spi_device *spi) return -ENODEV; } - edev = kzalloc(sizeof(*edev), GFP_KERNEL); + edev = devm_kzalloc(&spi->dev, sizeof(*edev), GFP_KERNEL); if (!edev) return -ENOMEM; @@ -449,8 +449,7 @@ static int eeprom_93xx46_probe(struct spi_device *spi) edev->addrlen = 6; else { dev_err(&spi->dev, "unspecified address type\n"); - err = -EINVAL; - goto fail; + return -EINVAL; } mutex_init(&edev->lock); @@ -473,11 +472,9 @@ static int eeprom_93xx46_probe(struct spi_device *spi) edev->nvmem_config.word_size = 1; edev->nvmem_config.size = edev->size; - edev->nvmem = nvmem_register(&edev->nvmem_config); - if (IS_ERR(edev->nvmem)) { - err = PTR_ERR(edev->nvmem); - goto fail; - } + edev->nvmem = devm_nvmem_register(&spi->dev, &edev->nvmem_config); + if (IS_ERR(edev->nvmem)) + return PTR_ERR(edev->nvmem); dev_info(&spi->dev, "%d-bit eeprom %s\n", (pd->flags & EE_ADDR8) ? 8 : 16, @@ -490,21 +487,15 @@ static int eeprom_93xx46_probe(struct spi_device *spi) spi_set_drvdata(spi, edev); return 0; -fail: - kfree(edev); - return err; } static int eeprom_93xx46_remove(struct spi_device *spi) { struct eeprom_93xx46_dev *edev = spi_get_drvdata(spi); - nvmem_unregister(edev->nvmem); - if (!(edev->pdata->flags & EE_READONLY)) device_remove_file(&spi->dev, &dev_attr_erase); - kfree(edev); return 0; } From patchwork Fri Sep 21 13:40:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147256 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837119ljw; Fri, 21 Sep 2018 06:40:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY3nz6p2oPi7u7vXrd0IQPHOiBkFaWPmZMfhC5rLJsbF7scD9xxmQyX+colg8X86u1cFfLB X-Received: by 2002:a65:448c:: with SMTP id l12-v6mr42454806pgq.277.1537537241983; Fri, 21 Sep 2018 06:40:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537241; cv=none; d=google.com; s=arc-20160816; b=csaxo39OWvgsn8XtzW3N7CAfmvMWyUYpOouSka5N7d29DkxAtRS20m5iv45RFdGVrP fdG5AXhQYy874e+uRj23ZhXOLGfB9JMI8OJ0Ll6zQlra3uMNsGnAJhLbEfUlUccV/TJu V72XxG9XDZDsb0i5+MAaVWMDSJn2+/efj6PI5uaMv6lRuE9MdJYI1ate9BeeeVOidgWh QdIOV8TjXYbu9Gmtul11aKeQrI6L8/RHo/Y+gajy83D1JWj/5+lbuMemV/zlzV30j0nB jFcDbUQZkYfSfxBjthacDtZ3wajMMbPdTC/lT6D1ZTpWI+XYt35ItNDyiBhwMnW7hIGm 54fQ== 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; bh=E/0R3w/YyRjmUKnlnZ1pdly25jlIiIzlpEdSveGkcWc=; b=xma+tjz0ghO8aZvy7wMd0NWCsuUkNos1PP/lNHceTcw0QU+d+FI9/An+PG7rQzctJN zCjGyn4NLLwp82OH9ZKYpAvPfOKH8q/8mjE1HTFfSmYpy0MhjL5nAUx7fQdjoUeRRdqh s4zNkRlU7TiOq2GTmbtTysDMtJ73TpkPP1lXa5X+TMTYSD/R0zWJkAzT+9J7Sdo9YcID 3YlSyLFBziN5TsslYcYgNvMbrSqIiab6Hpb9r710KcwjYTxD/J48ADtcTHssiC2888zR Q8eW4dHOXkuJqk/IJLsPYR95RaSTJgIr7TwL3ILwVeTBVsos0CxsaH4DPDPKNRicOKAB BY2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jWVHpRv6; 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 g11-v6si24545665pgo.525.2018.09.21.06.40.41; Fri, 21 Sep 2018 06:40:41 -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 header.s=google header.b=jWVHpRv6; 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 S2390076AbeIUT3d (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:33 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:56014 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389870AbeIUT3c (ORCPT ); Fri, 21 Sep 2018 15:29:32 -0400 Received: by mail-it1-f196.google.com with SMTP id d10-v6so2002242itj.5 for ; Fri, 21 Sep 2018 06:40:38 -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=E/0R3w/YyRjmUKnlnZ1pdly25jlIiIzlpEdSveGkcWc=; b=jWVHpRv6Yy73yvA733s8Xzwq+sF8OhMrKgQPS4Y9uu26Eugt5Z/smUNl9DxrwLGciw W2NzT2e7RIDNLS46KJNxi8hDdFSjJaW2pCGcGdWFAzaA44nd30Y9Bqhnjb8h1mnRh2zq JJrH+cjcZJwb5ltShAYnhO70fN7AKsSvAK1Jk= 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=E/0R3w/YyRjmUKnlnZ1pdly25jlIiIzlpEdSveGkcWc=; b=tsFlUsYH7I0nEjc9Jg4LgggdtJfh1LedHpFOatk44JYzKXaJ/R+63ONSFtLFTS8oZb YOWpEpiPJ5HclUKc0OUNx6sy2LddykNw4+o3NKvspviUX/Xv6j+n+6+o4Nptz2IvM9/g i7eJhmOV5qBPzPt45SviDxvuHe9Q4QQXhVtTIJ2v5mDbg28w6XOWlg0oKcpaL+CDt3Xq xz/LEbkPJ9KcMYtnL+QaJie3IgBSnz649Xibuc3rtVNHKaIFXMZWkFd91UfQNbxVsT9s 8HhMfAan4DvppLM1+Nad9exlGWaYSSqsReM+j76y9qQrqgrTTLYNZ6ZZxrFaP+F7b3HB EdBQ== X-Gm-Message-State: APzg51Abs/aBW61GINd5KOnj+4hKCN38kUlRIX0nNXxwVH4Zijmxq6Qd NeoPw7q64yAciiGALjHft01hww== X-Received: by 2002:a02:9c5c:: with SMTP id h28-v6mr2842169jal.3.1537537237599; Fri, 21 Sep 2018 06:40:37 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:37 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 02/26] eeprom: at25: use devm_nvmem_register() Date: Fri, 21 Sep 2018 06:40:02 -0700 Message-Id: <20180921134026.4596-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Use the resource managed variant of nvmem_register(). Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/misc/eeprom/at25.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.19.0 diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c index 840afb398f9e..d874df72853f 100644 --- a/drivers/misc/eeprom/at25.c +++ b/drivers/misc/eeprom/at25.c @@ -366,7 +366,7 @@ static int at25_probe(struct spi_device *spi) at25->nvmem_config.word_size = 1; at25->nvmem_config.size = chip.byte_len; - at25->nvmem = nvmem_register(&at25->nvmem_config); + at25->nvmem = devm_nvmem_register(&spi->dev, &at25->nvmem_config); if (IS_ERR(at25->nvmem)) return PTR_ERR(at25->nvmem); @@ -384,7 +384,6 @@ static int at25_remove(struct spi_device *spi) struct at25_data *at25; at25 = spi_get_drvdata(spi); - nvmem_unregister(at25->nvmem); return 0; } From patchwork Fri Sep 21 13:40:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147257 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837167ljw; Fri, 21 Sep 2018 06:40:44 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbn/w3i3kPkw512p+xeK1J4yyTh3OIh7MRI3NZEv9lZ/Vqx9KGJ0zpuqg7+7z7kD32fSwU5 X-Received: by 2002:a63:5904:: with SMTP id n4-v6mr41611390pgb.134.1537537243879; Fri, 21 Sep 2018 06:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537243; cv=none; d=google.com; s=arc-20160816; b=VnFM+IyWSdb8OR6DD1uC8hzTjQipFW/L/dGdBxZj23kC1QRsavQcwXQGflOOwAhUzU uWh3B/Nj0jy5BmMonGaUHND6gIDd3ZYZbN1k/sB0HkB1gxgvYxHHIx41qFaGN/mFXdAU bLgDuyr4lPvz8dKJ7uyrYdmOyQtdHLkcaO6tZMfqUf0ZxWOOjSuOTvTHX/iXs8yrkJFq kNmyxDbbMAChT1Z0TGpkxuk1dgeN9EGGlQrXnBkCS+d/wLTv4NP6KY8QhqFq5vL5IDfz lTZFF77MqLiFcP3Q66fkYGEex0wzQIJa7x96MRDlu8jzwEZyHQMQzlwSqlj48eQzqs9a Y9QA== 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; bh=UGnBvrzQNBCErkim5skLyhtAPY6JidTg2ZjK6bwL0Pg=; b=ualdOOCCExld8zdE9/churqDbnMMm0UZBU2967IQRFu4S1sBjkgY+McgStMSgvxzhb ojhNKYhT2TYraS958ZqBoqIO+D3g3pG8mSb9BroLuG/EbvpfkOrFXCyQj7uOaj8W5ybj N3PaTtJLHYIXse2d1UKMi0B7We2HLc4T8MXr5d+NgLzW6K7VnEOyzh2JttpWE22baG/+ a8GXx1t63BpEa07kF3UA3Jgz0X5X5jAbxGU1kSl3tnRyYCg+kEpl9Z8kN7CguXFUmqRB ggZEMpbE21JXMRBgmJudzTte+XyZXTvfHhfy9kcOvRGjuZy0e6l2GQysL1lFzxz3LPRC 0QlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XHQRhZpW; 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 g11-v6si24545665pgo.525.2018.09.21.06.40.43; Fri, 21 Sep 2018 06:40:43 -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 header.s=google header.b=XHQRhZpW; 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 S2390144AbeIUT3g (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:36 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:52077 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389870AbeIUT3e (ORCPT ); Fri, 21 Sep 2018 15:29:34 -0400 Received: by mail-it1-f195.google.com with SMTP id e14-v6so1997381itf.1 for ; Fri, 21 Sep 2018 06:40:39 -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=UGnBvrzQNBCErkim5skLyhtAPY6JidTg2ZjK6bwL0Pg=; b=XHQRhZpWHWvjJ1HHghjY9gPp4UA339mxuh/WlDr9PI3jFbtg48oXCQXdRO5TdtOrTM B+Bs62KNEssz+/VjvbIb43bqGIncMBgkitbigVCSnbSoRSNST2MO8CVTQs3eVnEr2F5X e4a9x4l5s5ZT4hhdSnOPNGD7Er0MZd82q9nQU= 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=UGnBvrzQNBCErkim5skLyhtAPY6JidTg2ZjK6bwL0Pg=; b=jFjmj62rEXNqTQvbRz8qyurfbLHgAlpc5fN2hHFt/GUPpHMiNiQRULenEEUJy14Tvq BpCs2p/Om7I4RMBrXg4iaD3Uh/E0s2/YqOBN2OL+ZUcHivIMRHv12qIrkvdEsIdOguSQ Rt3kVb6UH2ryMVemhLmR8Iq2dpZkjGZLZ2V+s2bAC+yXszoqyR5nDmFdNfereXOCB5ay 5HLoWjY/EtOy3ru5sthd/Ns2fJ/RxP5Fcbj7/buHrkDT8tepZDsNLddAgUtqkjkVYfyh cdnqd6Co4P3DFwo956mlsTY6R0kvcp/K/D1p+5FJEN+S7H7b8hPP+oeurjQ/PrRVoGA2 6mLA== X-Gm-Message-State: APzg51AqRiFJ6k9QWyeJOHyI6cGPWjuH60mcg6lhPBC6BHkmgydvePvH irze1xlaU2kHr8kM5DHqGVS+Ag== X-Received: by 2002:a24:37d6:: with SMTP id r205-v6mr5569309itr.66.1537537238629; Fri, 21 Sep 2018 06:40:38 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:38 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 03/26] nvmem: provide nvmem_dev_name() Date: Fri, 21 Sep 2018 06:40:03 -0700 Message-Id: <20180921134026.4596-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Kernel users don't have any means of checking the names of nvmem devices. Add a routine that returns the name of the nvmem provider. This will be useful for future nvmem notifier subscribers - otherwise they can't check what device is being added/removed. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 13 +++++++++++++ include/linux/nvmem-consumer.h | 8 ++++++++ 2 files changed, 21 insertions(+) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 6f064002f439..11afa3b6d551 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -1343,6 +1343,19 @@ int nvmem_device_write(struct nvmem_device *nvmem, } EXPORT_SYMBOL_GPL(nvmem_device_write); +/** + * nvmem_dev_name() - Get the name of a given nvmem device. + * + * @nvmem: nvmem device. + * + * Return: name of the nvmem device. + */ +const char *nvmem_dev_name(struct nvmem_device *nvmem) +{ + return dev_name(&nvmem->dev); +} +EXPORT_SYMBOL_GPL(nvmem_dev_name); + static int __init nvmem_init(void) { return bus_register(&nvmem_bus_type); diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index 4e85447f7860..0389fe00b177 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -55,6 +55,8 @@ ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem, int nvmem_device_cell_write(struct nvmem_device *nvmem, struct nvmem_cell_info *info, void *buf); +const char *nvmem_dev_name(struct nvmem_device *nvmem); + #else static inline struct nvmem_cell *nvmem_cell_get(struct device *dev, @@ -143,6 +145,12 @@ static inline int nvmem_device_write(struct nvmem_device *nvmem, { return -ENOSYS; } + +static inline const char *nvmem_dev_name(struct nvmem_device *nvmem) +{ + return NULL; +} + #endif /* CONFIG_NVMEM */ #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) From patchwork Fri Sep 21 13:40:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147280 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp839614ljw; Fri, 21 Sep 2018 06:43:13 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZrKgmvmqJnImGTDcK6ypFvilxM0iYp0ih7Chjxvf8LEh52yT8xw+qO/kWI77TYGFeupCma X-Received: by 2002:a62:c805:: with SMTP id z5-v6mr47153958pff.44.1537537393564; Fri, 21 Sep 2018 06:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537393; cv=none; d=google.com; s=arc-20160816; b=jR29WyDVzJRzEhQv3Z3jXK5pcPZaP06Lp09BtVvgapcyWtaLgHQHNdd87uhCzvtTBF IJvmoyqmcvc0xktowDK6YwOBu9kV6m1Q7qsx9ovZdSkK8Nk6cBzN0nkxwx7nZy/JHNX4 A2l9BxY96H6BtLDoguBLbcWLtF6NzrM50s9ZRo3UxnZsyRym0lXcKMeKDOvuiVUlw7nz jkHS545CptRIvcHztxK6+lfTcVyCqcxGN4t9zD1CT/UxLmv5CYnpvjy6o48FXfzUhYP6 RUWExkG8WYV2+HVTCyWFhP8w0avOC8JliHlKoU+725XBglyJmSr0A+/ik1973XpLOQ2E XHzQ== 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; bh=rzBeb2hyTL8rR7/sPqEb+muFfVwV6usujwCr55pWv2I=; b=Hwolxj71RwtnytqCdRIURLa/KzNiRCbojzXcyvzkJLzMpiH4cHpStf2ecqsB3aur2m ae1HWQPL9CTRo0yj028EiejxJVOuPlTeLwmDw/nzSYNQ0KjhpLmNb8Jq5yQSpsWSN3fJ sEuhsp7cjOGSsqyYt161ccxD61rTOJ2njQ1VLbR2r6C2qzbRUjVA4tFBIF8uJllrQ/Cu ZDnrKz9x64NJyNXxZLpEpE9X0IFd6rb4+dPo4z2ElpsrKDwiv4wfBLhfJkFe3lOFQIWk +4AHIHX1nfejeJue2cUNZR5pTjlG2cE/jz5vjzUEAj0sf7yZbtxB8jr9iWE6f56XufPb qNkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i+5nHf4V; 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 n137-v6si29127193pfd.177.2018.09.21.06.43.13; Fri, 21 Sep 2018 06:43:13 -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 header.s=google header.b=i+5nHf4V; 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 S2390121AbeIUT3g (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:36 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:39552 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390081AbeIUT3e (ORCPT ); Fri, 21 Sep 2018 15:29:34 -0400 Received: by mail-it1-f193.google.com with SMTP id h1-v6so1929525itj.4 for ; Fri, 21 Sep 2018 06:40: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=rzBeb2hyTL8rR7/sPqEb+muFfVwV6usujwCr55pWv2I=; b=i+5nHf4VQD0TBf/6+QzKfGTYdjIshV+4ER+vOBEyrUOK6wkK5aZIbZajPJlFDV/s5k D7FNjqzqZSB1Fwskh/zo4FWVLtj+Uh23mbNA1MV1TlTloHP9wF0FBGL232jXMzbuTCLA XEKemQ6Ly1P05/yg9M+2NcrVzy65UfTWygh/8= 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=rzBeb2hyTL8rR7/sPqEb+muFfVwV6usujwCr55pWv2I=; b=MbCQ1NlHFiGJqvE7KK8dLOKV6hyGDS97uFe46SbMKrwBBQghV+fr8pL5qNwX1u80t4 i784ZzXs62J8Aju1rQp/MT3axchXzBSq4x/fT2NiS3M1iGsxGROERLQHFNE14j4faMrF e5NPOuzGGQNyQsh5QQ6if1n/o2N5Z0WQqUAWVyUYwBWoNxGiqKfTeZWxUBZ0WeOzshCf gCnYFbbZQcjNsZYLCOdVpotL4Pef/+z7QyNBzw1RwpkJjh4KnQrpI/AMAwonaz/7Lxz0 FL9kGNuGaeK95iN34scPUc6BNfdM5Fq5vQBzVR4sn45r5Mz3JStoRtwZ3THyZfqVFE1a xzYA== X-Gm-Message-State: APzg51Dq5bL43VrwT2sV4hdqsR2njgo+eDqS8Da6xW1DvRRHpWHDcA4X hY8QAV87qi35uFc2IE6H4aAk0gvJvM8= X-Received: by 2002:a24:1ad1:: with SMTP id 200-v6mr5991746iti.4.1537537239709; Fri, 21 Sep 2018 06:40:39 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:39 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 04/26] nvmem: remove the name field from struct nvmem_device Date: Fri, 21 Sep 2018 06:40:04 -0700 Message-Id: <20180921134026.4596-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski This field is never set and is only used in a single error message. Remove the field and use nvmem_dev_name() instead. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 11afa3b6d551..72313a1d215f 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -26,7 +26,6 @@ #include struct nvmem_device { - const char *name; struct module *owner; struct device dev; int stride; @@ -652,7 +651,7 @@ static struct nvmem_device *__nvmem_device_get(struct device_node *np, if (!try_module_get(nvmem->owner)) { dev_err(&nvmem->dev, "could not increase module refcount for cell %s\n", - nvmem->name); + nvmem_dev_name(nvmem)); mutex_lock(&nvmem_mutex); nvmem->users--; From patchwork Fri Sep 21 13:40:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147279 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp839063ljw; Fri, 21 Sep 2018 06:42:38 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdah3LadZgKdwpr+7ISER6L1jOpMrRt5gdLJhZ77LsFRz4cX2P7iXV0rEjR8e2U+Fy20AKxp X-Received: by 2002:a62:8ad1:: with SMTP id o78-v6mr46242186pfk.17.1537537358776; Fri, 21 Sep 2018 06:42:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537358; cv=none; d=google.com; s=arc-20160816; b=JNjiv26BDiPRH3kVrDD7hMz2LE2U6xKok/6Q3vqrxDP1MskGepSilsETpDeQQJFgIt /aBbM6LM6Ae2YIucNrmAO6zlc7YPPciZa4b7xUs9ejyBhBGXgga3pyuLVM6J0gV75HxG KcPx71j4fzbsarLSccNIJdAxOMzW3k2e1+RqO2uKh/sPILXd6LtuknSvdG34KY06IcQO 6MYo6E2oAljztClOheJFOQl4vL65Vn9YwNwrKAD64G1iLn1Ozi5ZZ43pz3HEbCRs5GRg lnFF0RCwYevoLvTfg33zFnl0ddj7PLirwcBTlw2XnyDR8t5toQBgZXsSzBxvzzhhEwey jQMA== 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; bh=amN7ddXkResdHNrYb0iY3daOfe5OJqdHWfYz3x09ACo=; b=kQ5TcYMmQFBtlWQmDfXtBfcvLtAzbzV1Nnj39N4t+zRNkzZxZyMTKmeFnC2RnFvzw6 Q8oq9c/H6kx5joOhgYAyhXdW9ZoIWXgc6mHAjIMs6xQs8OmzDleoYYqtncI8pitIUsgt 60vJoRMk0ciKR5tcv7w5of6BdZsJ4wAMq6jPHZsL+FtUCu317fO39e2vd32htqbemEIB x+LgA+L76Qow9iQNMp9yT/QNqfOUbOBw607p0fasznD1BxfS7D4rnVpyRKI+EGwYANCT DTm9rKV1D9/LeThrv4fx5WkmgJszAi/5H/PgvQRPa7LBtDrsMrKg6JMmYZCIVJab5ZGm s46w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Mp/d4UTg"; 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 u90-v6si30252948pfk.82.2018.09.21.06.42.38; Fri, 21 Sep 2018 06:42:38 -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 header.s=google header.b="Mp/d4UTg"; 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 S2390484AbeIUTbc (ORCPT + 32 others); Fri, 21 Sep 2018 15:31:32 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:39964 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390084AbeIUT3g (ORCPT ); Fri, 21 Sep 2018 15:29:36 -0400 Received: by mail-io1-f66.google.com with SMTP id l14-v6so12206447iob.7 for ; Fri, 21 Sep 2018 06:40: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=amN7ddXkResdHNrYb0iY3daOfe5OJqdHWfYz3x09ACo=; b=Mp/d4UTgcJSm6suijva9O0ARRHCzFsHG0E61wEWgrJA8roIsxCLYllX4I/4eC7QUUD nDwU7Ox46ctqyxgx+PlrGqmYNevt1YBC8AcwUn7hqrLIsCM6F+8+YgpNqEfeaDgOZVs0 aBU4kk935QXfLVEg3OQ2nYdgu0PVXN6YmfcOc= 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=amN7ddXkResdHNrYb0iY3daOfe5OJqdHWfYz3x09ACo=; b=dle+Mi1VPF/YEg0HL+VpfB4ZORQJ7JCjRF9OJahYpaKMAcwD7uSDVOjRZ2cBLVG4EE 7qnIVv+NUZ3RanxfbHnitzj/LBfufYDj5r+iQ/bkMXIOg/yRZWY1vcK1z8KnSYGfS4Yp /+EewbIFXobX7E1TQtlLC0MMObq0/EyFPcGJ8b7XHNTUv/lp4K/f7K6OwKtVX1mJqLNN mZ0fZT2UuRDx64zJtzwcaJgRsDVx6cV3MJzCgjwfHkv6uWGKAQ69SCEBSpf5FGJ3N+qz 9qEhcshFRINhzfp4Q6hg3TSVvo+YCgojywp6me8pLp5HATl+Q508AptnJI8I06cn8T6f ZguQ== X-Gm-Message-State: APzg51CuMd5Lfod8hCB7TcTkOsIrJL8u4kbpUYEDCINKnah6BJdJUDvX KP89NXVncYHaH2uqUBtkcjqGpFYrOvA= X-Received: by 2002:a02:97c5:: with SMTP id v5-v6mr8154135jaj.72.1537537240722; Fri, 21 Sep 2018 06:40:40 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:40 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 05/26] nvmem: use list_for_each_entry_safe in nvmem_device_remove_all_cells() Date: Fri, 21 Sep 2018 06:40:05 -0700 Message-Id: <20180921134026.4596-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Use the provided helper for iterating over list entries without having to use the list_entry() macro. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 72313a1d215f..0e963d83a099 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -308,14 +308,11 @@ static void nvmem_cell_drop(struct nvmem_cell *cell) static void nvmem_device_remove_all_cells(const struct nvmem_device *nvmem) { - struct nvmem_cell *cell; - struct list_head *p, *n; + struct nvmem_cell *cell, *p; - list_for_each_safe(p, n, &nvmem_cells) { - cell = list_entry(p, struct nvmem_cell, node); + list_for_each_entry_safe(cell, p, &nvmem_cells, node) if (cell->nvmem == nvmem) nvmem_cell_drop(cell); - } } static void nvmem_cell_add(struct nvmem_cell *cell) From patchwork Fri Sep 21 13:40:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147258 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837205ljw; Fri, 21 Sep 2018 06:40:46 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZm9zQ66kDKf/AY9SXIhbAMacifmkohilBlfWeYwbj1VF/XOjTx8F6sBnLlNTRnnc7REB4E X-Received: by 2002:a17:902:82c9:: with SMTP id u9-v6mr44503793plz.138.1537537245866; Fri, 21 Sep 2018 06:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537245; cv=none; d=google.com; s=arc-20160816; b=TL740uIJD7w2tKhkV+E69Zt51kiDvLNNWdZxs0A71MCl/ss7TOlzHs0OSix9Cx9eJL nACqdtVeNuXgWRGQkFcCfhvjPeyqdvQC7mZ000CKbPBejMNW/XAyNsSW6QuwTpYrmwYm qjHON4mkGya1JZPjnkCB4qDxslZ2MaEsev0ZmiZ7qHcnm5Wy/tRKRIt75pJbt+9xa643 07Re0853w13PZeHHJXyaNnFjr+pLIwJ3cLm7f5/Qpx0OO7AYZw7wEKzubnPe03voOmR/ YdWxw+Hlh35jVRrwtm0l51tpKe7Ize0yQau0m86bjokWwaLcx+zi4PqS/7meq+4izaDi X1rA== 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; bh=ov3wg4XZJI4qwoa7b5oqsUQXgLTAbqq1B8k7ALORMss=; b=a9nSzi0j3XVuxTgZmYpbfhwzOtyifYixIXQtpuORYCrOR5V1KyF+VetaBKzSKQJbES Yu9XlJd750jgV7nWxEfdM5aVsiyZDEErpPpCYrdIakuvz/FtLCpu4aPMdxhroIXixzV6 ar2eQKmVpJ1RXEYn+xJyT/cprutggs0rHBypFu9xFBpoQ/6afAiPbFhAStO8WhSnx+aw QOSVLzx51Rrb/CBCpizXkIKaoQLV77YaZRZK6M6c0eA16RgvZQ20aFLccTxtVDm3jXtN /ptWpxuwuJMCf4rsQgBUZK8AInvbqcL1xSNqZm2HxNOrdYcpVBMwkpzNyYy8yzY9pSc0 6nag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HaAFIofQ; 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 b61-v6si29217419plc.499.2018.09.21.06.40.45; Fri, 21 Sep 2018 06:40:45 -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 header.s=google header.b=HaAFIofQ; 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 S2390169AbeIUT3i (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:38 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:37137 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390137AbeIUT3h (ORCPT ); Fri, 21 Sep 2018 15:29:37 -0400 Received: by mail-it1-f195.google.com with SMTP id h20-v6so1931861itf.2 for ; Fri, 21 Sep 2018 06:40: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=ov3wg4XZJI4qwoa7b5oqsUQXgLTAbqq1B8k7ALORMss=; b=HaAFIofQsH7OlyhY1W4YajH08ToS8S2F6h5xezXwH8DfgrbGD4rp+9bwlYp710SzEO RlsHzFFxd9jmmRsgdcXkyYG95b52+VyaUS8asB2BNZbBoXTmsjRmJtIBMVq1XgHaltxU JIF2fLggLduKODY5jkHyOANftP75tpX4i4YKY= 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=ov3wg4XZJI4qwoa7b5oqsUQXgLTAbqq1B8k7ALORMss=; b=j6EB6vOUJ0Id2JFiQWZXVATj3sqo+roGgexDwpjumfjI3fJ5FJ5rqcXBjdS7vEE1Bq UojizeqK1W33SjFAbHEoR9UuOjh7n/2OoPLyec999NDImjvhM2fXKvkOX4b8ys1llIpT +w0jhxy36F0sHdrSyt4S0eyamzLcTsIG9FuQVoFeZ6oGQ0kxt8piAgB5txywsEG0gRgS i9tSpwqCQfH4mTIoDDwo2NBQxxI8bnR3eGkHcI3Sm+V3RWjvVqP1CSvUZ0moJVS9CNrv aLaDq7hiJeG7Vg0iKzZe6IRff+ASC8lLb/1SGk1k4RcjMMd6OL1XoGln0giuDdvig+Pn PLiQ== X-Gm-Message-State: APzg51Ce+SSdGQka45KbhTVbBejnMO8vLI4/fMR9dMMTL8hdzawphgrS XHUmf3J3DZOnAf0JFAwwOhGNtg== X-Received: by 2002:a24:6b0d:: with SMTP id v13-v6mr6089307itc.16.1537537241722; Fri, 21 Sep 2018 06:40:41 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:41 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 06/26] nvmem: remove a stray newline Date: Fri, 21 Sep 2018 06:40:06 -0700 Message-Id: <20180921134026.4596-7-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski There are two empty lines between devm_nvmem_unregister() and __nvmem_device_get(). Remove one. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 1 - 1 file changed, 1 deletion(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 0e963d83a099..1ced9caa811b 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -613,7 +613,6 @@ int devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem) } EXPORT_SYMBOL(devm_nvmem_unregister); - static struct nvmem_device *__nvmem_device_get(struct device_node *np, struct nvmem_cell **cellp, const char *cell_id) From patchwork Fri Sep 21 13:40:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147278 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp838917ljw; Fri, 21 Sep 2018 06:42:30 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbfsaZ6EcAMt3Y1PGjtbaTN37dr72M9NMXkbFYpvKcYyrLRdPVe7F4RRtykhAibvKoW357o X-Received: by 2002:a65:4384:: with SMTP id m4-v6mr41505597pgp.265.1537537350826; Fri, 21 Sep 2018 06:42:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537350; cv=none; d=google.com; s=arc-20160816; b=od9ZUm40XsBGZ/l5MD/QYk29k9tA48b56PH9kyIRS9ItSdS4yQYtU4XyBnw8mkkfou E4Wkykj8VKqRBT0AlqLpH/wgS2pXUA/+F3ifjHwuCINf1Vt+qtsWsV3ZXnPWH0T3E6Xu vMP7o/TrdxvrOTWJfK2WcQIR8tDlvrc9B/2ipnk1Kpav+ODoBqATjRpXhhWq6/viswOb mF1RfKR8TioHG2bpJ698dN9wmge8uzCjDa896pQGXz7Wte6Xs7iz6CmtOQnuYhcY3tn4 D9zRSw38+C+8POP2ZyRBnLVOYfZN4LL+LuQ7B0ZtBw68daXWfcy2QpYdLy0qrQbpXo4p MAbw== 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; bh=B8MUx6E9DqKVpcFO4+o4SdtmZtHPgBuDxKs+F+ULmhc=; b=YV+S/NaIcoo8iy/1VgIASuYqp6IFliHOp6tvP4DPHND0XZqBgedGjMqF8cW5TM8IUD opz5ivTZv9278rZqPAYnw75cvaReFSTD05mX4Co3bqJCfS02t8LALpq0uXzKk4W66GV2 V4cPlhA1DhmFu73Z9ZzKPFFeHYKp3pyvRNQsAEC1qGWm8mDcDWKkBwRn/jLoxO6kscx5 ysJrHEWJluluE071VW5H8Y9XB/aaWinMItAhCv16y0Kyd7AiWO+Swkx+iQflnQXzo1P4 LZmv7WOpWNcR4HZeTAcithCFM41Ur/3lXOsmachmDuTwUr2+LRO5anNCc+4BXSuEsYtV jsQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WlL6WKz2; 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 h6-v6si24641803pls.150.2018.09.21.06.42.30; Fri, 21 Sep 2018 06:42:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WlL6WKz2; 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 S2390475AbeIUTbY (ORCPT + 32 others); Fri, 21 Sep 2018 15:31:24 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:38640 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389870AbeIUT3h (ORCPT ); Fri, 21 Sep 2018 15:29:37 -0400 Received: by mail-it1-f194.google.com with SMTP id p129-v6so1931820ite.3 for ; Fri, 21 Sep 2018 06:40: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=B8MUx6E9DqKVpcFO4+o4SdtmZtHPgBuDxKs+F+ULmhc=; b=WlL6WKz2mOgkorbaT1BwHyRjM1RjxiL+avqMGmExl+ycqFj3m9IaoHF4nPDOHc8Bf1 0Xb7/iSzprTmjhP5IUnHmjse+ptxjk8SiK52VErC5PBcWC8zJDtRgvyXkqHYtz/L6Nb5 PfG2UbRAEWpeL4HSmXQKyT4F/ZuJnxhb0iW4M= 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=B8MUx6E9DqKVpcFO4+o4SdtmZtHPgBuDxKs+F+ULmhc=; b=ufn6DiMeDeUfof1AxOLS3VFLO2H3EnHIo5kss5rdjnJTBEavntSIgGtBk1HT0C7EoA 7c3ht8ViQDyFTgOo7Tu/Tuz/DcZLWn18IV3oOtiYkvNQxhFOI+mS5gVV8vtpfHy5p9E8 B3XYJpmjDhUL68jXPB6F96BpiVZKEctLt3cXT+2vN5gGFr6fc9lOnMRMI6jzJVzr2yXt gnGqXZnrLSatoi+oTLoDKhFRvUWSzJFELI1YS+xGSIg3N4JLEwGsymqumZR/MNgc5zDC BWHNn61bUZHhLMdPYNenVbB1qhsnEQA7uVJT71qhUUpAP8x32XVQt4Gzolj9U7puyXuk L+eA== X-Gm-Message-State: APzg51DIaqJ/zYJPUAMuqrGMwfNhlba5Ocxha7Yh9Kr3urgsGvhNjt58 iQgKGAajS6lMhcel4lOYbxQdzw== X-Received: by 2002:a24:3d52:: with SMTP id n79-v6mr5756180itn.68.1537537242725; Fri, 21 Sep 2018 06:40:42 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:42 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 07/26] nvmem: check the return value of nvmem_add_cells() Date: Fri, 21 Sep 2018 06:40:07 -0700 Message-Id: <20180921134026.4596-8-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski This function can fail so check its return value in nvmem_register() and act accordingly. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 1ced9caa811b..0ef84441ebe5 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -512,11 +512,17 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) goto err_device_del; } - if (config->cells) - nvmem_add_cells(nvmem, config->cells, config->ncells); + if (config->cells) { + rval = nvmem_add_cells(nvmem, config->cells, config->ncells); + if (rval) + goto err_teardown_compat; + } return nvmem; +err_teardown_compat: + if (config->compat) + device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom); err_device_del: device_del(&nvmem->dev); err_put_device: From patchwork Fri Sep 21 13:40:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147259 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837236ljw; Fri, 21 Sep 2018 06:40:47 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ+RExFkCN4UPj/jjY3YvIz5r4EN6SF+GGtfPdLNZVwrB7vJyOpLyvbJE2aTmEOiufpydas X-Received: by 2002:a62:23c2:: with SMTP id q63-v6mr46622708pfj.116.1537537247557; Fri, 21 Sep 2018 06:40:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537247; cv=none; d=google.com; s=arc-20160816; b=HXlrCcfKqZUzJcCqnPrjBa6tlGgWG3m86ZdTojTJX7KfGr62bvyOmP4GgLkkS73syJ 9RUeVvmSgx3hEZA/890SZ3WMSnr2NQY8y8ZQw8QvKqbDFJx39a+MgQRSX7P1MRGAreN0 MGWNmEd3iA5eCzAzq0KW+uR2dMlJuQcHidAIXOojQVpfslT0xaMTREzZUEyCIBF6Zq+z ZELa5UBFkYiVRGCECB68PuUWgKIU3dIS7cw5jr2N7YgqJCsgJ3QAeobbNKOAWy2pKreH 7i4w4Jl6VJo5tnS2aTHzCnJCMQk8CUwzyzSxHRBpw4Yx0ONhZSY2i56HZAQA/qimcatW A38g== 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; bh=uyo2v8Q81f5j5TT9ArxjR0qlqnA7vKY1hVWSAJE87jI=; b=LZ5xE1oOh4wk4H/8p3j9rIvbtJip9wcvV1OPsvMUIjpPDXzq+L3Objj76ZbAYlBcj9 OnkD8kvqAQYvy8veE8XWuisDlPEosYs6I/P3kqsYOTh1AOyQ5SQiyI628QD90Y/c77o3 9gxZSCHVGii6aHQQDlR/EtJSQUJcu6HmOtkpbmPABIB/x42GmRfhv/C8HeMY2JrTcMOC kJnNplP4sThQNvpGLiw7KQ9SBBgwTGkgkqWKzfLtC075p0qzIoGS6fku2TCg0Q/NAbuz nXcAfHdn1hXWVTbJz/TTfZ5zwrN0dhbnedtxBVaIoJLAZaREsVx3BVsGystxWYHZl6qy il9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="D/33HqbK"; 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 b61-v6si29217419plc.499.2018.09.21.06.40.47; Fri, 21 Sep 2018 06:40:47 -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 header.s=google header.b="D/33HqbK"; 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 S2390195AbeIUT3k (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:40 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:43764 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390137AbeIUT3j (ORCPT ); Fri, 21 Sep 2018 15:29:39 -0400 Received: by mail-io1-f68.google.com with SMTP id y10-v6so12199787ioa.10 for ; Fri, 21 Sep 2018 06:40:44 -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=uyo2v8Q81f5j5TT9ArxjR0qlqnA7vKY1hVWSAJE87jI=; b=D/33HqbKd5pZx/nzfIl24UnrbAa8X8/e+b/fwg+pmCIuMmmvEbwz01sdS14gk18Fxm 94mvUlkVuEPObGVtHy8PdS9+4rBDpY/H5QOuPm16bjYJCREmbaX0RIIWoAhg6IvXWQfj zB5R8Bw8Z13dz3FO3+/MjUksjjmmaatnDVRTU= 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=uyo2v8Q81f5j5TT9ArxjR0qlqnA7vKY1hVWSAJE87jI=; b=U+x2FNH8AUFS5KEvSpmLd2zbmoYUTgo6K5IZEkZP9+aaCw1baZB85v+O6u1K+WyLyu 4zzC8RFz0CM032q8UwAhEW0SlB2auTqfrWww7jjs11AgCOTCrWlg4gKpmLYBvKgpkpnG 2wNmOER/T7wVppBN6hTiMVsNxkfoLFR8s5FyVHTov851SV73rSiiApwoQDhGfDDD5mHi WzOOASNd7zpyNqH0xgF9aksQs0VpD5hdvsVMLNnpEqFLkY+S5zZ9yf5Dngw9CIof9UOB yvDj4tlpDO7b+LbKqbIb+kykatvIt719EhmsVf+34CIG685hBqcmoFuoIyt4Hxizon0D Bc3g== X-Gm-Message-State: APzg51BukIVFPA0rd4Y5ELvG6tBX9RCRAJoWMbvXGZPRRfeUv2Mo08QC 3Qj1jJwIr2x/MN+K1ZVYhVw40g== X-Received: by 2002:a02:c7d1:: with SMTP id s17-v6mr39843839jao.27.1537537243739; Fri, 21 Sep 2018 06:40:43 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:43 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 08/26] nvmem: use kref Date: Fri, 21 Sep 2018 06:40:08 -0700 Message-Id: <20180921134026.4596-9-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Use kref for reference counting. Use an approach similar to the one seen in the common clock subsystem: don't actually destroy the nvmem device until the last user puts it. This way we can get rid of the users check from nvmem_unregister(). Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 0ef84441ebe5..920b56e500cc 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -31,7 +32,7 @@ struct nvmem_device { int stride; int word_size; int id; - int users; + struct kref refcnt; size_t size; bool read_only; int flags; @@ -463,6 +464,8 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) return ERR_PTR(rval); } + kref_init(&nvmem->refcnt); + nvmem->id = rval; nvmem->owner = config->owner; if (!nvmem->owner && config->dev->driver) @@ -532,6 +535,20 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) } EXPORT_SYMBOL_GPL(nvmem_register); +static void nvmem_device_release(struct kref *kref) +{ + struct nvmem_device *nvmem; + + nvmem = container_of(kref, struct nvmem_device, refcnt); + + if (nvmem->flags & FLAG_COMPAT) + device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom); + + nvmem_device_remove_all_cells(nvmem); + device_del(&nvmem->dev); + put_device(&nvmem->dev); +} + /** * nvmem_unregister() - Unregister previously registered nvmem device * @@ -541,19 +558,7 @@ EXPORT_SYMBOL_GPL(nvmem_register); */ int nvmem_unregister(struct nvmem_device *nvmem) { - mutex_lock(&nvmem_mutex); - if (nvmem->users) { - mutex_unlock(&nvmem_mutex); - return -EBUSY; - } - mutex_unlock(&nvmem_mutex); - - if (nvmem->flags & FLAG_COMPAT) - device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom); - - nvmem_device_remove_all_cells(nvmem); - device_del(&nvmem->dev); - put_device(&nvmem->dev); + kref_put(&nvmem->refcnt, nvmem_device_release); return 0; } @@ -647,7 +652,6 @@ static struct nvmem_device *__nvmem_device_get(struct device_node *np, } } - nvmem->users++; mutex_unlock(&nvmem_mutex); if (!try_module_get(nvmem->owner)) { @@ -655,22 +659,18 @@ static struct nvmem_device *__nvmem_device_get(struct device_node *np, "could not increase module refcount for cell %s\n", nvmem_dev_name(nvmem)); - mutex_lock(&nvmem_mutex); - nvmem->users--; - mutex_unlock(&nvmem_mutex); - return ERR_PTR(-EINVAL); } + kref_get(&nvmem->refcnt); + return nvmem; } static void __nvmem_device_put(struct nvmem_device *nvmem) { module_put(nvmem->owner); - mutex_lock(&nvmem_mutex); - nvmem->users--; - mutex_unlock(&nvmem_mutex); + kref_put(&nvmem->refcnt, nvmem_device_release); } static struct nvmem_device *nvmem_find(const char *name) From patchwork Fri Sep 21 13:40:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147277 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp838801ljw; Fri, 21 Sep 2018 06:42:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaLKOW790EVHWyuFmTj1GZuYC+YDbVy5JFR+4CWj9dgvtGiH6rUfyPaP/GsL07+0pRzKlTD X-Received: by 2002:a62:51c6:: with SMTP id f189-v6mr46819724pfb.7.1537537343218; Fri, 21 Sep 2018 06:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537343; cv=none; d=google.com; s=arc-20160816; b=OsKXh+AkfRtEf5gUAqHmd3Jmnki+AkX/5lU4UkDdaKVf2oQJE7k01b9sTZP58pU2da yP36rnVVqgSBT5RXlh6XH6qNHTz3zTnn4yVEwctrU6C6vMw4bOT5hp7DQT76Yx3lqH2E LeHS/+dgC8GihxlHswOv8e0UjDenU+5zobKAT/ObpvffrVVs18tUIrtQx7pcuK+BMdiS mM0k66c6VjOT/tTzGYGUHS+765xnu+NiIHBu9HF0WiwFNe9ut0BJumVFUicy4547QIeW bGQ0dNrlVUX98zLRj1LCHHtBBmUQFLoST4EPYLjXkGHArWVMK/7rTvi3IPu7UwC1Srdv bolw== 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; bh=1WOadb3iuIVom3UaIoauT6I1srE+Zn3wqDVMF0ti348=; b=KVIcM7GcvTfNgQ8jfq41VdhPZs/gCCN9Av+q2P/5CkmksK+qDHX0We4ZqggLtNvE/l 4dzQgErAm4V+Z+bx4lGYMLhWZ1m5BVqIvjml2+n4ViM05RbhfgmesT5RYrd/M+a82btR F67lZbeYXAFtQakkNwIlTpDbScupl5PeEBVUX5pMRAohhIYtsi1o/DE+1fh495Y3pAnw nWZa95o5jmwez00sxwbUedizdp4tDxYHoP2AQ5vI1ESLbs8j/XUuV58CFHcJ1SCVaxew tWPiF4pzq8AjqBweU4N1IQXwA8HSvsPp/I5t7MP3+X5ZJhfcdAwFpJgtWnrRnolCqBTU RhIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ELHuP3Bm; 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 h6-v6si24641803pls.150.2018.09.21.06.42.22; Fri, 21 Sep 2018 06:42:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ELHuP3Bm; 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 S2390464AbeIUTbQ (ORCPT + 32 others); Fri, 21 Sep 2018 15:31:16 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:37140 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390171AbeIUT3k (ORCPT ); Fri, 21 Sep 2018 15:29:40 -0400 Received: by mail-it1-f195.google.com with SMTP id h20-v6so1931996itf.2 for ; Fri, 21 Sep 2018 06:40: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=1WOadb3iuIVom3UaIoauT6I1srE+Zn3wqDVMF0ti348=; b=ELHuP3BmUjiKqyZgLxnGxM/oKiagySfCrVKhE/rXo2Krw+e4XJwLkxp/n1d8aiXtdY h0iVo2H+8G+nOT8hihm4MHIKfHQy1p8jC60rqAWEf8nOOKZFb4SKv8U2Oh3zUutGBTDl fkdbGKo7SsSxITTcqiN4cKEsSMdZhib1O7Vng= 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=1WOadb3iuIVom3UaIoauT6I1srE+Zn3wqDVMF0ti348=; b=KjhMIPT5kZYghUGhJ68o1QmlRXT078BdMJGN439YT+Ou5GNF8nJBecOC5VAvdiEGwf 03WMk0No8YYWJ1/RwQwfMqcrGjnyAFOdFGxRKJd3WfdrwuGBbBr3Fphpanuxx2js+D0f w8CKn6rBZ+9QNexEZ5qK2WvWvxsQZCuha4e871VYq/WjCkj0MqqZstjyAAYHST2cnNV4 cP2KK4sJTunkLeABJMNQk88/bYtLR3to7ZITkQdoZ7esTZFR1UbcET4tQMyaXjzSIKjs 54ApcO+pwKAljO/HWek3YHDiFJ9uUI3uA9EonMktZcTulUL6fgQEyeP3U/lT/fDuo3R/ qiwA== X-Gm-Message-State: APzg51AvkZWHCJJdy9WnStsCQ8sSgGRI52xjZ+nQ+o4o0uMUVep4tsLE hJlzLk51IptPm4LgNNa0wzW+gw== X-Received: by 2002:a24:d507:: with SMTP id a7-v6mr6054608itg.7.1537537244799; Fri, 21 Sep 2018 06:40:44 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:44 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 09/26] nvmem: sunxi_sid: return -ENOMEM if kzalloc() fails Date: Fri, 21 Sep 2018 06:40:09 -0700 Message-Id: <20180921134026.4596-10-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski The driver currently returns -EINVAL if kzalloc() fails in probe(). Change it to -ENOMEM as it should be. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/sunxi_sid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.19.0 diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c index d020f89248fd..4d0b7e72aa2e 100644 --- a/drivers/nvmem/sunxi_sid.c +++ b/drivers/nvmem/sunxi_sid.c @@ -187,7 +187,7 @@ static int sunxi_sid_probe(struct platform_device *pdev) randomness = kzalloc(size, GFP_KERNEL); if (!randomness) { - ret = -EINVAL; + ret = -ENOMEM; goto err_unreg_nvmem; } From patchwork Fri Sep 21 13:40:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147260 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837282ljw; Fri, 21 Sep 2018 06:40:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYrXqc9QYd8lAI8/GTVedPZjIN0eDKswCzI7q1mGYPYBsDKG+H1iiXcpVQlrN0+BsGBeTmo X-Received: by 2002:a63:7f55:: with SMTP id p21-v6mr41678152pgn.285.1537537250240; Fri, 21 Sep 2018 06:40:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537250; cv=none; d=google.com; s=arc-20160816; b=T8j3fd1rU3LvgmQ+oDRx1lkfA/iGXQo8kivbaX+1oO4lP4PsO8MM5337EYkWiw2amB cxKmbyEwmXeDjshwDk95CJeBCK170vujB6cQSpBFOdHmNMvS35uVH18hGvo6DzoeqMup dpHJ48iEu1JwBdh+CxJG440tvY0SC0lPDfmotxs8gM5jWnaChhNeruFcrBqXhbvHZPgD LDU4CVtrk9WG9DgBs5Re0sloQQkUyNWsdd7k4MaFefSLdSI4oVCcM9rt7W3MvCaL4bqD 8qcwbJO1j+tBjHrnXXxEBNJpjS6rYO2gc6g7tY2eg007btGKkQ33w9r7ALJzkQfIM6Ot 3msw== 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; bh=Ttqe+UCwyMe7WVvDlGEx6hIjqgfZCL2tUPGredWpOM4=; b=Rk0VH/Q6AMfk/vP/sHZ9XEvmB9IdPG166nN9Jde161Dbq1mPE2onbTB2LWtDUi7to4 fojb8AJiQT9iprFC5VdkzPvWnVY8YLgIziA0Yz3CQJzaV22DXan4RT5//HUiMLjAOpA8 z962QrorSqsZSbQKZzf8+2KBsDkrHXK3CJjpXIy6rwOL8+qUKnaj0Fy6PAJ5zxU+4PCn 5w3LOjHQLe3IS0tb17Tlrqwc2Dw6fOMt8oHKBVsqxOUwWxf2apjxRNujABEKX3phGp6T EyAgDv+Nw77mODT73qX0b0x0RA2g+f7U31Ce/7XwVcgbVRGk5riqoXjurRhqbY91tkta yvTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ffEcIkRc; 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 d31-v6si27175860pla.479.2018.09.21.06.40.49; Fri, 21 Sep 2018 06:40:50 -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 header.s=google header.b=ffEcIkRc; 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 S2390218AbeIUT3m (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:42 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:39563 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390137AbeIUT3l (ORCPT ); Fri, 21 Sep 2018 15:29:41 -0400 Received: by mail-it1-f195.google.com with SMTP id h1-v6so1929818itj.4 for ; Fri, 21 Sep 2018 06:40:46 -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=Ttqe+UCwyMe7WVvDlGEx6hIjqgfZCL2tUPGredWpOM4=; b=ffEcIkRcUe9fys/MpcTBH8yQPBg4Izfl+n8OSAAqxW5vHX/Bu/0FtnyKqjib7rq5jg WnqW2hv5VfppEtoxEs9ofQxvqLra8BN4JvDQhfnq/0fQ1GTzQ5FOWCoMexuJFwOSx2nH rBMC2pDFoKjSyYMNhctQKjgw3pTwsd+zIBz+g= 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=Ttqe+UCwyMe7WVvDlGEx6hIjqgfZCL2tUPGredWpOM4=; b=pUCnemx3XvBqhXro55MYYHRC8X5h3pdFMNwofLYwMm1FQKJKEchCHrY/Bp+3k02vgK jIp4Wy2YEo8dIXrOKWldnJfeVkihsyKjazNXzhu3Fe746aKDSX3RUboXO4mJRArYSt5h wUpy7hZ0ZKDT2npWlyxx8zwVtC/m8eocxiiv/hziruWttkuvgNGcPw12Axv/iNJsqH6N wxOcouaLplyy7LBEq6FH+z6B8shSoEFs683ZXa6Qrygt7+qWcQws/DQtX3ViuRO8dMr9 278RzCMAnguyrOdqkZmDCVOM5BC1/88JyKjNtBmQWXGFnorWjYE2Lu8UnTlph2HNknN0 6dqg== X-Gm-Message-State: APzg51Bf5aPQ3f3vNfAsP2YPgaqiMAd0rzW5lIPJzuxiyxQxtJv7DR13 z8wOfJNvZg1ry1Xou3Il2BtwyxV7TMw= X-Received: by 2002:a24:fac7:: with SMTP id v190-v6mr5928222ith.78.1537537245971; Fri, 21 Sep 2018 06:40:45 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:45 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 10/26] nvmem: sunxi_sid: use devm_nvmem_register() Date: Fri, 21 Sep 2018 06:40:10 -0700 Message-Id: <20180921134026.4596-11-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Use the resource managed variant of nvmem_register(). Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/sunxi_sid.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c index 4d0b7e72aa2e..1310f8af37f8 100644 --- a/drivers/nvmem/sunxi_sid.c +++ b/drivers/nvmem/sunxi_sid.c @@ -181,15 +181,13 @@ static int sunxi_sid_probe(struct platform_device *pdev) else econfig.reg_read = sunxi_sid_read; econfig.priv = sid; - nvmem = nvmem_register(&econfig); + nvmem = devm_nvmem_register(dev, &econfig); if (IS_ERR(nvmem)) return PTR_ERR(nvmem); randomness = kzalloc(size, GFP_KERNEL); - if (!randomness) { - ret = -ENOMEM; - goto err_unreg_nvmem; - } + if (!randomness) + return -ENOMEM; for (i = 0; i < size; i++) econfig.reg_read(sid, i, &randomness[i], 1); @@ -200,17 +198,6 @@ static int sunxi_sid_probe(struct platform_device *pdev) platform_set_drvdata(pdev, nvmem); return 0; - -err_unreg_nvmem: - nvmem_unregister(nvmem); - return ret; -} - -static int sunxi_sid_remove(struct platform_device *pdev) -{ - struct nvmem_device *nvmem = platform_get_drvdata(pdev); - - return nvmem_unregister(nvmem); } static const struct sunxi_sid_cfg sun4i_a10_cfg = { @@ -243,7 +230,6 @@ MODULE_DEVICE_TABLE(of, sunxi_sid_of_match); static struct platform_driver sunxi_sid_driver = { .probe = sunxi_sid_probe, - .remove = sunxi_sid_remove, .driver = { .name = "eeprom-sunxi-sid", .of_match_table = sunxi_sid_of_match, From patchwork Fri Sep 21 13:40:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147261 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837314ljw; Fri, 21 Sep 2018 06:40:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaHuc0/V9E7lihyWOY9sQQ4KmWQDNZCKDRng5t/JkI33hXPhPUGZg7ka1sERCcNOwPF1Aoo X-Received: by 2002:a17:902:f209:: with SMTP id gn9mr44437888plb.173.1537537251640; Fri, 21 Sep 2018 06:40:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537251; cv=none; d=google.com; s=arc-20160816; b=kf5faEnXNElV6jqYxTEMACahyyVk4sjsI/QeWHr56Ol4zvzc0NwBtU4QKX+0GSS815 swD8ADlnwoVVhCUoncPY/8iMr96J/QncpqTl9Jgdp4TmE1cCiF1QK4UtD1cSqiDMaFgf lqBG2gkWL7hJ7Z8Xhk0o4Fjx+kXTwUxMpC/Al1xz/O7uQzc7FTWzKq4Q9gITZsNpYB1a v9PqduzD+CPBN3lgA7aQwVAxcR9R6uopJoGY3kT0Qm93+4QUMpM/Plz6epAaPqDiQDj4 bSGg3HrKqK4np9KaXmLqcuW9JjmxOsVFdti6hOpn5PD4a9kevH3h8FByPBa/dZL6lkLc E6Dg== 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; bh=08TSpeJeZkfX8ro4yZ1U1ymVD6C3Yb4G89YnYCiuJos=; b=DFIRY5/i7FawVxHolhMNdzoTh3cTex1v4hnnGibObA/X98x7UdyTxco2vorekBc/At LJTjC+MWv+e3VDFwAZmI5KdrcmRII2vRDq+lnI1ocPXB9F0gZjfePw7Zv1yvX9APc62l tvvIJqOgieS+mujJc6SnZCL2boBvj8SjlXNgt4+9HRUzeQW+f95uT1lWzh7O2TUl11wl UOE2w2UJCgxqSHSlceeoZTEPtx643RLUUFXMnA+SrBAvglDnNYsdW/IIKccXta7cQ2hK QVNbTHZ4hbLmeeTOucXzaMPkAz6hxvcc+Eetdz34YissJpWS9MLVBOhkoVThg17MMwC9 dS8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f+YC378O; 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 a95-v6si28093983pla.514.2018.09.21.06.40.51; Fri, 21 Sep 2018 06:40:51 -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 header.s=google header.b=f+YC378O; 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 S2390235AbeIUT3n (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:43 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:40168 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389463AbeIUT3m (ORCPT ); Fri, 21 Sep 2018 15:29:42 -0400 Received: by mail-it1-f195.google.com with SMTP id h23-v6so1930376ita.5 for ; Fri, 21 Sep 2018 06:40:47 -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=08TSpeJeZkfX8ro4yZ1U1ymVD6C3Yb4G89YnYCiuJos=; b=f+YC378ORDYvGRfze+FXjdkUWYuShnzubMklTFJhPg4e3fVrFhN/YBf/B1rqS8FrHJ UixqT1kXoJIC7MF5UFh+IMAzMHjj2uz8/B4kQ+hxE/olVepwE1RZo0m4CMU3Z/vt1bdN pUQKHUV3/+lyoJ+EOoEoZvWkBcuZBur8lzFR8= 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=08TSpeJeZkfX8ro4yZ1U1ymVD6C3Yb4G89YnYCiuJos=; b=cpx/MmK/8sv9jJm1kOUioGDs5d4XFFTk6n2wsI47qvuvOEymPkZv/vMmP3DK3GBIWJ MH6SBJy8rfZES0qPut+VAXHD5M191cGyHjCjBWdD5NjxUL4bacoOsHRsTqx2CK9e2EMP zx2NmCu4Lv2snBoTk8CqhjrcoOYm0NWYyFyIwqpFPuUPqrjJwCr20mG8EuideOw9aNjG 42GmOjTHKPJfye8YvlGszHHRJ1ttEFm1Ou2e0WOOwAfYiPgj2Wye/aQvbCGw4mrC1ASI tZaLux9xLEHQRaSD8tsQBZNYiTH64Gu+pFg7XmLqbyjL+apWpAEFdPzrN6n4X84ogdrB sd1Q== X-Gm-Message-State: APzg51AlIJMfHnim/X+7MJ4FuXCqmjOLwTrPcvw/ZXwlf30Ion3epNNc rgkkaRUcpb1Nf/rI2UO+bzj4LA== X-Received: by 2002:a24:e4ca:: with SMTP id o193-v6mr5999958ith.132.1537537247155; Fri, 21 Sep 2018 06:40:47 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:46 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 11/26] nvmem: lpc18xx_eeprom: use devm_nvmem_register() Date: Fri, 21 Sep 2018 06:40:11 -0700 Message-Id: <20180921134026.4596-12-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Use the managed version of nvmem_register(). Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/lpc18xx_eeprom.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/lpc18xx_eeprom.c b/drivers/nvmem/lpc18xx_eeprom.c index a9534a6e8636..b42dbaddb419 100644 --- a/drivers/nvmem/lpc18xx_eeprom.c +++ b/drivers/nvmem/lpc18xx_eeprom.c @@ -236,7 +236,7 @@ static int lpc18xx_eeprom_probe(struct platform_device *pdev) lpc18xx_nvmem_config.dev = dev; lpc18xx_nvmem_config.priv = eeprom; - eeprom->nvmem = nvmem_register(&lpc18xx_nvmem_config); + eeprom->nvmem = devm_nvmem_register(dev, &lpc18xx_nvmem_config); if (IS_ERR(eeprom->nvmem)) { ret = PTR_ERR(eeprom->nvmem); goto err_clk; @@ -257,10 +257,6 @@ static int lpc18xx_eeprom_remove(struct platform_device *pdev) struct lpc18xx_eeprom_dev *eeprom = platform_get_drvdata(pdev); int ret; - ret = nvmem_unregister(eeprom->nvmem); - if (ret < 0) - return ret; - clk_disable_unprepare(eeprom->clk); return 0; From patchwork Fri Sep 21 13:40:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147262 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837343ljw; Fri, 21 Sep 2018 06:40:52 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbTvPh4ew8xIQQoOoX+mKnH49m5ROzi3FL8VgxrnElc6mmvAd7KH4F7Ezhq6D206gBgv/0l X-Received: by 2002:a63:3741:: with SMTP id g1-v6mr10010875pgn.59.1537537252848; Fri, 21 Sep 2018 06:40:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537252; cv=none; d=google.com; s=arc-20160816; b=XbWh4bBc6Ec5ca2OzsCf74hnO8GeBBau2mKY/prEcobRCUQTjT4JkhhX5SvFn+Fzko dE6tVCbrCvEuCGpt2+stwXYpNdQWfg7yB6sWjXxCUe73DmakhCtgt//qsBqgQqjui0mX BZ99QIw2c8cakXg2JccSsprWkiH2diuB+LTn7orCNDJTZZG/ao2g8Gm3WtxR4F6MNC6G I9GUnM0Wu4pPtjzY9Kh7n4lgqGUGjyYmunYXoL2YIBDml7LQjTiN5QPYu4eqIMQMVyba uuDMiRq2D3u5imBZIxpgF4l2/zkogMWriM+KbhEwotgppAFDxKTuipwL9Mr1sQfHxX1B gqig== 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; bh=cXmp87CurS0y2IxorCWvR9CIJ3TsSUwOh7LASSZh2R4=; b=wXk5mwDBopCxPxEQ+6GFrDCAaGDP8esjOKIrTQQ/tVGTe+qySTpZaMd7z9Jij53BGW MjBh4ilTxNsaiNrC2GgJgDqKRUY1F13Agr14AuEWS3ipwX7A7ermkziiIQaJZUDn58Rz z+CuSp72SAkT+UpjfEfJQ2PiFhWon3dG3lLDTZzAV3tBCw8IlLAaLSg2Sb0NpFhONldt DWxsaMipDkL5YJdo8nJA7DQppCz7kz2eh03d1V0QFbU/1153WlWIAeFSm/RLE4hFZOgc HprCEhTUccV8/kOcNvaC/TBIUkadHdgYGktKUkpNuQm4T/kRAdS0TdQnv93z94qd0heO Mi6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A6Qbu09j; 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 k91-v6si27665483pld.187.2018.09.21.06.40.52; Fri, 21 Sep 2018 06:40:52 -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 header.s=google header.b=A6Qbu09j; 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 S2390251AbeIUT3o (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:44 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:41443 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727392AbeIUT3n (ORCPT ); Fri, 21 Sep 2018 15:29:43 -0400 Received: by mail-io1-f65.google.com with SMTP id q4-v6so12225059iob.8 for ; Fri, 21 Sep 2018 06:40:48 -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=cXmp87CurS0y2IxorCWvR9CIJ3TsSUwOh7LASSZh2R4=; b=A6Qbu09jzFs1MEjA+D99lpA9jHfb3Ii9YTjxpQCQv0amqSqER0FOlP2j52W1vuXOK/ BsxOhQRoqMcEHPwJ8tFQG6VBzipg5+uHfen3j9KVB50tNDZ6q7PInYzCYxMIeEmjGcjI bKdM/1mxj0q0PTxrtEK1JP43vsQS2MXRsceK4= 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=cXmp87CurS0y2IxorCWvR9CIJ3TsSUwOh7LASSZh2R4=; b=h5iR7jOR6UCjPIwPBDzwk+BCzDdw2NOgLPGuSkZbUKDay0mqig69Z/PcIsIs54DR3t QdjqkrkRU/mqE/cvLsNWDOnSqyQ/Y1eS9rzqcbXjD1+do9+eJwDFROTpzTbFNjMtz57n el8ZHMkN4Rexj3UTZ2PwENVPv4orut04hnCtGGvRmB3SJNgFM7V7gJTq3fJiv1vZlh89 nz5fBT7YFTNfr8dRDLFCJ0BPbtRe2uF6QXZcrYMh3R/X/CAC8oXNxDs74udC0po72Uzk thcMVeP2cpf4sc8NhGe+WvdcV/wvlMFaVmHcLBEBCKgPftADRk9mmlia/KeNT+EMRrPi jhfw== X-Gm-Message-State: APzg51AG7QMrtlzvSP6apdSyIvX1mGICqn4fw8NBRaapnxTlFhIot8mF guNPHbgZC0o5TQXHWwrwAqly4g== X-Received: by 2002:a6b:9895:: with SMTP id a143-v6mr38774602ioe.290.1537537248231; Fri, 21 Sep 2018 06:40:48 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:47 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 12/26] nvmem: mxs-ocotp: use devm_nvmem_register() Date: Fri, 21 Sep 2018 06:40:12 -0700 Message-Id: <20180921134026.4596-13-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Use the resource managed variant of nvmem_register(); Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/mxs-ocotp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/mxs-ocotp.c b/drivers/nvmem/mxs-ocotp.c index 7018e2ef5714..53122f59c4b2 100644 --- a/drivers/nvmem/mxs-ocotp.c +++ b/drivers/nvmem/mxs-ocotp.c @@ -177,7 +177,7 @@ static int mxs_ocotp_probe(struct platform_device *pdev) ocotp_config.size = data->size; ocotp_config.priv = otp; ocotp_config.dev = dev; - otp->nvmem = nvmem_register(&ocotp_config); + otp->nvmem = devm_nvmem_register(dev, &ocotp_config); if (IS_ERR(otp->nvmem)) { ret = PTR_ERR(otp->nvmem); goto err_clk; @@ -199,7 +199,7 @@ static int mxs_ocotp_remove(struct platform_device *pdev) clk_unprepare(otp->clk); - return nvmem_unregister(otp->nvmem); + return 0; } static struct platform_driver mxs_ocotp_driver = { From patchwork Fri Sep 21 13:40:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147263 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837364ljw; Fri, 21 Sep 2018 06:40:54 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZmXvfajnCzKpvrtZJMNuKZMz22y9wozn3zcvRhD0gMf6M+INvZ8JK4RjtR8/yh72sBKnwA X-Received: by 2002:a63:a5c:: with SMTP id z28-v6mr40496077pgk.209.1537537254051; Fri, 21 Sep 2018 06:40:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537254; cv=none; d=google.com; s=arc-20160816; b=Pa6BQZfSIVBDYWjzzxXt8EpV/WjnHohRHp/QyfFIfeUwX/6VLwvWzHKPqgWU8l3ray /dfNJF/eOAZxetTm9AECbpvYJdB0xLwewNxQPOfKD4Ns391qQxlenR6FNs25cKWZme8t PPXFZkft0xEiv4DbIFTZbplxIjZoGll1xbnjy2L7Q4JxoXox7/+icIBuOE29luxcIvYd qvd6ydYGFe89mfuH198//J6f5qMoWK3eB6tV3aKm3O1X2c2Fy/f1p/kvY0ZncEDUeO15 7iJy0EfM0azJpT2WrRnJJCB6Q6H7sHZHTgDRUdenQ49cU0n4E0L5T7gILyGWhkiKMs8G i+JQ== 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; bh=l3sT58gzthwq0kvVJ4CsyyveZVtgLHLAG2tBKFHIZlU=; b=j9kvwxqhNIMU567iZTix8yYnwUwplXEOKojRlPzRonDb1KnLFEpnR1zhUM+7zpF7uT ljYz02tXUaBESvTAfqlymu5fSNycoU1JUVUMogDvnN7JaCUmpiMrv7FT/ie9LDxpD5+Q 9co8t00AniW8nzAGds8IuzZQZEE5itIJ4Z+cQXxnhVF3yKZw24VR6EPM07YiwEYdsYu1 3sV4nVzy9mMwVYqzqYMiEwupcA3IFxIKJJlQgZX+7HdnOkDwjQgNDBVvoYGKjvVUEMWG xjVQOiVP1NeXQ8xRUGf9Xc94LPEbKMXvpcz/y/tLI4Qk1I/utS4HzJyLF++cav168A+o Ucow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JqSJTbxE; 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 x185-v6si28285126pfb.306.2018.09.21.06.40.53; Fri, 21 Sep 2018 06:40:54 -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 header.s=google header.b=JqSJTbxE; 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 S2390267AbeIUT3p (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:45 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:47090 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390237AbeIUT3o (ORCPT ); Fri, 21 Sep 2018 15:29:44 -0400 Received: by mail-io1-f67.google.com with SMTP id y12-v6so12191420ioj.13 for ; Fri, 21 Sep 2018 06:40:49 -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=l3sT58gzthwq0kvVJ4CsyyveZVtgLHLAG2tBKFHIZlU=; b=JqSJTbxEKQvQOXaEkfQjp/iRQ7x9puYJ+QW0uHOhB3uJSYlNbp2DuJ68X/Wyklbkym KrhjyLcD/Dznzou1QA8u81mSiqtTgGxZL1oC9ZzMH0Z8De+3SI8wowWOWQZdB4HJV/FF 4PEOmjyOM9UVX5cEtdde8ErQA7P7YLygjQ9U8= 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=l3sT58gzthwq0kvVJ4CsyyveZVtgLHLAG2tBKFHIZlU=; b=lWYD3/6FB9TudvOETcaaLIxZY6p2R8/cf4cgXwppWygwYMsHBNMmvLTxZhP910GwEJ XEFHQ3+7ZtbTKzgWWcyaebb6AWMqNrX09WX8ywSaNJoL40b0Z28i0ItII95vw50tcJSj 8Fspq8/P4P0R9Dx1rvP1/ncO3sVKbY67iBOV8iXEvgehxFFinwqKkQoDp2izBVHK2Vmg lILFB16oMLyCKQ+KXmEibvWaMgXBeM4aDHtd2FSXsQBVqqrgkNv6c9EWNSEPTlrGGQ6k tsuYD6HMkXpLEvpzWcWnSxmhLBIUv6gsNmEASb1c8CyfUI8bb91IEF3Un8e8YhCfwj0x 60qA== X-Gm-Message-State: APzg51D1ZzRtIoodXnL8KF5Wf1jLiUtklWBYltOaeyimKxU0MadWI55v pNoxs8pqzWOcYHnexKRFVreEQw== X-Received: by 2002:a02:ba98:: with SMTP id g24-v6mr4497339jao.73.1537537249218; Fri, 21 Sep 2018 06:40:49 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:48 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 13/26] nvmem: change the signature of nvmem_unregister() Date: Fri, 21 Sep 2018 06:40:13 -0700 Message-Id: <20180921134026.4596-14-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski We switched the nvmem framework to using kref instead of manually checking the current number of users in nvmem_unregister() so this function can no longer fail. We also converted all remaining users that still checked the return value of nvmem_unregister() to using devm_nvmem_register(). Make the routine return void. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 8 ++------ include/linux/nvmem-provider.h | 9 +++------ 2 files changed, 5 insertions(+), 12 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 920b56e500cc..bd14d04782cd 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -553,20 +553,16 @@ static void nvmem_device_release(struct kref *kref) * nvmem_unregister() - Unregister previously registered nvmem device * * @nvmem: Pointer to previously registered nvmem device. - * - * Return: Will be an negative on error or a zero on success. */ -int nvmem_unregister(struct nvmem_device *nvmem) +void nvmem_unregister(struct nvmem_device *nvmem) { kref_put(&nvmem->refcnt, nvmem_device_release); - - return 0; } EXPORT_SYMBOL_GPL(nvmem_unregister); static void devm_nvmem_release(struct device *dev, void *res) { - WARN_ON(nvmem_unregister(*(struct nvmem_device **)res)); + nvmem_unregister(*(struct nvmem_device **)res); } /** diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 24def6ad09bb..0f357d0c1e75 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -70,7 +70,7 @@ struct nvmem_config { #if IS_ENABLED(CONFIG_NVMEM) struct nvmem_device *nvmem_register(const struct nvmem_config *cfg); -int nvmem_unregister(struct nvmem_device *nvmem); +void nvmem_unregister(struct nvmem_device *nvmem); struct nvmem_device *devm_nvmem_register(struct device *dev, const struct nvmem_config *cfg); @@ -87,10 +87,7 @@ static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c) return ERR_PTR(-ENOSYS); } -static inline int nvmem_unregister(struct nvmem_device *nvmem) -{ - return -ENOSYS; -} +static inline void nvmem_unregister(struct nvmem_device *nvmem) {} static inline struct nvmem_device * devm_nvmem_register(struct device *dev, const struct nvmem_config *c) @@ -101,7 +98,7 @@ devm_nvmem_register(struct device *dev, const struct nvmem_config *c) static inline int devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem) { - return nvmem_unregister(nvmem); + return -ENOSYS; } From patchwork Fri Sep 21 13:40:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147264 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837394ljw; Fri, 21 Sep 2018 06:40:55 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb2QE9DxYXT48eBaEjmrKkPXG45JocWux2YikS4dpBywQUiE0maBvesJ4T7nPVG/WG2hUX5 X-Received: by 2002:a17:902:ab87:: with SMTP id f7-v6mr45021204plr.268.1537537255221; Fri, 21 Sep 2018 06:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537255; cv=none; d=google.com; s=arc-20160816; b=gqVjGNdCeBm9m4EBciRiyThmYsG2660TfaL+rL6Lx4LHxHvmm2ArUsKu7ou2VnLndg NE7Gj8LxHZhD4yCZ9cXU4PhOf7A9JaR+MyOm3mBBIXX8ztveCjni2axyvsmmCmsQp4hh xLN2lH7c6V91flHC0Zce7xqviKYiCimuBxhMJgmNMLjKJNX7Vrx4Ozv0Jt+U+NpE2EUI QOg5080P1MlRySnSTG2Sfonrps5HrgwI+tSOtx7whapv8bVHhv8w1id0tEjdN+BzPR6M hUyww9TffA79BvSWc6HQhV9YsbAFZRMbJs5486jwSEtCphaeAwgCi5adXxufgwwtfWNu 0tTQ== 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; bh=ubyyzpqjZo5EwJuJjP578r7LdpokWJHLiT1J1QDuKOM=; b=yTtFjF9jIVHgUQ2bycfz8vRD6nYvQhfDp3yEcs1raOxfjqs2RVGqajovxoDVW+vlc2 w1dphk1wDEqURqgL8PP3jcZUSgvqbA5cR8OEH+lwQL8FYCD/j9FgFbQPqMuWJjKukVKO N6/YJ0kQGOf355Gy/E0d1B23Z8x0E0HvMwyeMJ/G4f3VlTiD0fK4qj/9LJT2Zia+7YBR CC74PGdksu6iTZa/H2xXD+xK0DrZLc0hOu0M8CoVwZyVy7/CS++jDVHSDt4R+YQiJyEC AwSILA4Wepb3bCoS9o9fIfWCE/mHiY/5vO+LZgecJnFphhJxuDw4jcHPohT3KK4rNtNd TWsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UrVkCcR1; 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 f95-v6si29235480plb.373.2018.09.21.06.40.54; Fri, 21 Sep 2018 06:40:55 -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 header.s=google header.b=UrVkCcR1; 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 S2390286AbeIUT3q (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:46 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:39505 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727392AbeIUT3p (ORCPT ); Fri, 21 Sep 2018 15:29:45 -0400 Received: by mail-io1-f65.google.com with SMTP id l7-v6so12226907iok.6 for ; Fri, 21 Sep 2018 06:40:50 -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=ubyyzpqjZo5EwJuJjP578r7LdpokWJHLiT1J1QDuKOM=; b=UrVkCcR1izauToD6NsmJi2a9cfwTwb8CC8uvNHaIEcDaomsuSLIFdLd29wv7TYIFzp CQHITuJBM+dCUNAXiwCAookZz3zlu8JpIzdmPg6uaLDsNnqgb//UjAiyu8TCiaU1nnlA dDTeL1r1K4jHEfDxVBoAcRO64bxXrFhpk95tU= 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=ubyyzpqjZo5EwJuJjP578r7LdpokWJHLiT1J1QDuKOM=; b=OvF5g6nsjakjiAVkBVk/8+b4NBM1Se2jg2tG5aiRXnLwNlkTtkeglK2DS9zXg0fmKE r/Eg7nK8QECQg2lSn8QnI/917rlBF/+MTMMrgsP1wsEWVKCtDCPl0pYEmffFoYG7Gd87 qu9NAnPui0Pc+lvumXas2VVUd6Z2rEJEmJAphzRg739y0ldGGwm0p9/m0jvNXRD0kola iFN1fZjOvxbCHtloZDGoWfTV2f5VfVlYrOC+X8B9Ng1zXhlN1k85u8m4CP+CHPmtkwrj xtkSwJ8vhK68ECzy1ZRIqtQCp4gPCesgo4IR/AwR4O5am2Er+2QOW5g0sfhyO0b2r1Ps jVGg== X-Gm-Message-State: APzg51DBysh+rx4sED+NEvtLYtlxanJI20sWRsxGqERbJVKQNVMbxHR2 JOR0jUWZJQKJABoVW79uWnGH3A== X-Received: by 2002:a02:9936:: with SMTP id r51-v6mr40293149jaj.46.1537537250319; Fri, 21 Sep 2018 06:40:50 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:49 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 14/26] nvmem: remove the global cell list Date: Fri, 21 Sep 2018 06:40:14 -0700 Message-Id: <20180921134026.4596-15-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Nvmem subsystem keeps a global list of cells that, for non-DT systems, can only be referenced by cell name, which makes it impossible to have more than one nvmem device with cells named the same. This patch makes every nvmem device the owner of the list of its cells. This effectively removes the support for non-DT systems, but it will be reintroduced following a different approach in subsequent patches. This isn't a problem as support for board files in nvmem is currently broken anyway: any user that would try to get an nvmem cell from the global cell list would remove the cell after the calling nvmem_cell_put(). This can cause anything from a subsequent user not being able to get the cell to double free errors if more users hold reference to the same cell at the same time. Fortunately there are no such users which allows us to rework this part. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 64 +++++++++++--------------------------------- 1 file changed, 15 insertions(+), 49 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index bd14d04782cd..ee794613024c 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -38,6 +38,7 @@ struct nvmem_device { int flags; struct bin_attribute eeprom; struct device *base_dev; + struct list_head cells; nvmem_reg_read_t reg_read; nvmem_reg_write_t reg_write; void *priv; @@ -58,9 +59,6 @@ struct nvmem_cell { static DEFINE_MUTEX(nvmem_mutex); static DEFINE_IDA(nvmem_ida); -static LIST_HEAD(nvmem_cells); -static DEFINE_MUTEX(nvmem_cells_mutex); - #ifdef CONFIG_DEBUG_LOCK_ALLOC static struct lock_class_key eeprom_lock_key; #endif @@ -282,28 +280,11 @@ static struct nvmem_device *of_nvmem_find(struct device_node *nvmem_np) return to_nvmem_device(d); } -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 (!strcmp(p->name, cell_id)) { - mutex_unlock(&nvmem_cells_mutex); - return p; - } - - mutex_unlock(&nvmem_cells_mutex); - - return NULL; -} - static void nvmem_cell_drop(struct nvmem_cell *cell) { - mutex_lock(&nvmem_cells_mutex); + mutex_lock(&nvmem_mutex); list_del(&cell->node); - mutex_unlock(&nvmem_cells_mutex); + mutex_unlock(&nvmem_mutex); kfree(cell); } @@ -311,16 +292,15 @@ static void nvmem_device_remove_all_cells(const struct nvmem_device *nvmem) { struct nvmem_cell *cell, *p; - list_for_each_entry_safe(cell, p, &nvmem_cells, node) - if (cell->nvmem == nvmem) - nvmem_cell_drop(cell); + list_for_each_entry_safe(cell, p, &nvmem->cells, node) + nvmem_cell_drop(cell); } static void nvmem_cell_add(struct nvmem_cell *cell) { - mutex_lock(&nvmem_cells_mutex); - list_add_tail(&cell->node, &nvmem_cells); - mutex_unlock(&nvmem_cells_mutex); + mutex_lock(&nvmem_mutex); + list_add_tail(&cell->node, &cell->nvmem->cells); + mutex_unlock(&nvmem_mutex); } static int nvmem_cell_info_to_nvmem_cell(struct nvmem_device *nvmem, @@ -465,6 +445,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) } kref_init(&nvmem->refcnt); + INIT_LIST_HEAD(&nvmem->cells); nvmem->id = rval; nvmem->owner = config->owner; @@ -626,29 +607,14 @@ static struct nvmem_device *__nvmem_device_get(struct device_node *np, { struct nvmem_device *nvmem = NULL; - mutex_lock(&nvmem_mutex); - - if (np) { - nvmem = of_nvmem_find(np); - if (!nvmem) { - mutex_unlock(&nvmem_mutex); - return ERR_PTR(-EPROBE_DEFER); - } - } else { - struct nvmem_cell *cell = nvmem_find_cell(cell_id); - - if (cell) { - nvmem = cell->nvmem; - *cellp = cell; - } - - if (!nvmem) { - mutex_unlock(&nvmem_mutex); - return ERR_PTR(-ENOENT); - } - } + if (!np) + return ERR_PTR(-ENOENT); + mutex_lock(&nvmem_mutex); + nvmem = of_nvmem_find(np); mutex_unlock(&nvmem_mutex); + if (!nvmem) + return ERR_PTR(-EPROBE_DEFER); if (!try_module_get(nvmem->owner)) { dev_err(&nvmem->dev, From patchwork Fri Sep 21 13:40:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147265 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837423ljw; Fri, 21 Sep 2018 06:40:56 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ82XU6ZMUU+M6cNzi2U1WNX/FACxqS07AvxVWLPrnnTciLC/ziOlqzWNNZumG7Qlo8oVbq X-Received: by 2002:a17:902:bb0c:: with SMTP id l12-v6mr44721180pls.5.1537537256606; Fri, 21 Sep 2018 06:40:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537256; cv=none; d=google.com; s=arc-20160816; b=Re89tcKsIdKgi+qZqz1Owi/tZYkF/Do8dsu9qhz7tJRKxjcmQR2dP1/psWLwMShDCc xvWAIcOt9xLKb0OlFZvmxXLcCeJmVBJiLyDrsTjMMgpDJHVE6H8qYjtwr1L6cmBmURfB 5hZx045UfAAsy+1DrEV7JKyb/aOFv9rmKCi45VKZUNaCJ2D1kMBVzWFLVKFwq+B7yLdL mRQPAmQILKD1qMK6S/gRQuDPj2SE8DVvnn3moiyAjoej+mN5focbZ3LmxEEJ2qyGhdYi c7PRLMJURDAnu+dGMhdJyrkeumWBR7J1bYjeCvuZNosnADiA7AvShCGJv0k55qbXCM9g v46g== 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; bh=Be5Wxl/ZhFGQZlTZi2pcgnpIkLC81q8e0uMdVQBLmAo=; b=PrtrMfLkKBD/k2O0jIj4k4/+Y45rMkxLvSbAxpwLLOfC1Vc+vQX+gX7b+OJsIvCK7V XphzzLRRZt1O15fsS6ncUc6qnMq0vL1Ci5lw0cOkqLMt6v5bOVwe7XtiCaeU+FhA3qO3 nmhrPjapgboWvc6BvqvzFX5vmxRqU6EbwrFn7OfcpW93gxt3UJEqPIMelmM1S+pOvPBW ahIoro6mnfAoQiMyAUypsCBkz0Wa5w0Uh6fn6S2EGxGLcIZe87iIswRukv4JZI8HRlXV c3gZUeJ0CTSv5PN6XJyTjRnQH48IcLY5+NryO6lmPt6Ka244W6NC3yMHX3Q0YbsC0HqR RUXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fQ8aq3lN; 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 e1-v6si27447847pld.408.2018.09.21.06.40.56; Fri, 21 Sep 2018 06:40:56 -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 header.s=google header.b=fQ8aq3lN; 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 S2390302AbeIUT3r (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:47 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:35654 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390271AbeIUT3r (ORCPT ); Fri, 21 Sep 2018 15:29:47 -0400 Received: by mail-io1-f67.google.com with SMTP id w11-v6so12244587iob.2 for ; Fri, 21 Sep 2018 06:40:52 -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=Be5Wxl/ZhFGQZlTZi2pcgnpIkLC81q8e0uMdVQBLmAo=; b=fQ8aq3lNT7/EcKAsyjoDtHm2fMnSeiakQpbwaU6iGpuXRQJ9jWSzJPvTZmQ0TTcqVa 1KirwLdhSoxtNcqjWLLNiBysjezqM2gOQzxYppiicGM2BhH+V62J540diAGQcuv7hVAr Weh6GUB5xzJW3nGsj6CuA7q8g512x+kUO48Og= 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=Be5Wxl/ZhFGQZlTZi2pcgnpIkLC81q8e0uMdVQBLmAo=; b=t1HcYrY0aLJAd5EZ6x9pIXJSRmEyPuWVS4lrMbLEErV4Ua2r9sHLFKlxiDY7mO5oWs JoLyH4ONSyQZ5KK6Yi5dmACfmUs/CcXB92zta27HxUYmqgglHLt7PxO1989ifSK8cnq+ 3K13Hg8cUpw1G6hQbxwB1E73w+poxCZqabF0gzwkoyHuuq+64IbSHMdByKLDz6rKb8M+ 2M+8Rg7xdYWPL9Lvl+UlJoEdGR1kvnNG0VYE02n/jzQIoLWazW5y9+H/R8QbgD+g0b+q nG6Fcys4qp/0NvuOCufM2OJy+9rS8KeEyLfpaeIUxMtpO9dWPfJRmNBhGSocFUNafABD iN3g== X-Gm-Message-State: APzg51BTirN7p2zk4QsSD6O5L/wfgHqBYg5tNb3SQU3jMvW8EFcLOjvJ mBsp4MpzsEkAjgssy7oO+8wMdA== X-Received: by 2002:a6b:d307:: with SMTP id s7-v6mr34023840iob.190.1537537251587; Fri, 21 Sep 2018 06:40:51 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:50 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 15/26] nvmem: add support for cell info Date: Fri, 21 Sep 2018 06:40:15 -0700 Message-Id: <20180921134026.4596-16-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Add new structs and routines allowing users to define nvmem cells from machine code. This global list of entries is parsed when a provider is registered and cells are associated with the relevant nvmem_device struct. A possible improvement for the future is to allow users to register cell tables after the nvmem provider has been registered by updating the cell list at each call to nvmem_(add|del)_cell_table(). Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 72 ++++++++++++++++++++++++++++++++++ include/linux/nvmem-provider.h | 33 +++++++++++----- 2 files changed, 96 insertions(+), 9 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index ee794613024c..8e0108806e65 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -59,6 +59,9 @@ struct nvmem_cell { static DEFINE_MUTEX(nvmem_mutex); static DEFINE_IDA(nvmem_ida); +static DEFINE_MUTEX(nvmem_cell_mutex); +static LIST_HEAD(nvmem_cell_tables); + #ifdef CONFIG_DEBUG_LOCK_ALLOC static struct lock_class_key eeprom_lock_key; #endif @@ -416,6 +419,43 @@ static int nvmem_setup_compat(struct nvmem_device *nvmem, return 0; } +static int nvmem_add_cells_from_table(struct nvmem_device *nvmem) +{ + const struct nvmem_cell_info *info; + struct nvmem_cell_table *table; + struct nvmem_cell *cell; + int rval = 0, i; + + mutex_lock(&nvmem_cell_mutex); + list_for_each_entry(table, &nvmem_cell_tables, node) { + if (strcmp(nvmem_dev_name(nvmem), table->nvmem_name) == 0) { + for (i = 0; i < table->ncells; i++) { + info = &table->cells[i]; + + cell = kzalloc(sizeof(*cell), GFP_KERNEL); + if (!cell) { + rval = -ENOMEM; + goto out; + } + + rval = nvmem_cell_info_to_nvmem_cell(nvmem, + info, + cell); + if (rval) { + kfree(cell); + goto out; + } + + nvmem_cell_add(cell); + } + } + } + +out: + mutex_unlock(&nvmem_cell_mutex); + return rval; +} + /** * nvmem_register() - Register a nvmem device for given nvmem_config. * Also creates an binary entry in /sys/bus/nvmem/devices/dev-name/nvmem @@ -502,8 +542,14 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) goto err_teardown_compat; } + rval = nvmem_add_cells_from_table(nvmem); + if (rval) + goto err_remove_cells; + return nvmem; +err_remove_cells: + nvmem_device_remove_all_cells(nvmem); err_teardown_compat: if (config->compat) device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom); @@ -1306,6 +1352,32 @@ int nvmem_device_write(struct nvmem_device *nvmem, } EXPORT_SYMBOL_GPL(nvmem_device_write); +/** + * nvmem_add_cell_table() - register a table of cell info entries + * + * @table: table of cell info entries + */ +void nvmem_add_cell_table(struct nvmem_cell_table *table) +{ + mutex_lock(&nvmem_cell_mutex); + list_add_tail(&table->node, &nvmem_cell_tables); + mutex_unlock(&nvmem_cell_mutex); +} +EXPORT_SYMBOL_GPL(nvmem_add_cell_table); + +/** + * nvmem_del_cell_table() - remove a previously registered cell info table + * + * @table: table of cell info entries + */ +void nvmem_del_cell_table(struct nvmem_cell_table *table) +{ + mutex_lock(&nvmem_cell_mutex); + list_del(&table->node); + mutex_unlock(&nvmem_cell_mutex); +} +EXPORT_SYMBOL_GPL(nvmem_del_cell_table); + /** * nvmem_dev_name() - Get the name of a given nvmem device. * diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 0f357d0c1e75..5c9f205cac8f 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -67,6 +67,25 @@ struct nvmem_config { struct device *base_dev; }; +/** + * struct nvmem_cell_table - NVMEM cell definitions for given provider + * + * @nvmem_name: Provider name. + * @cells: Array of cell definitions. + * @ncells: Number of cell definitions in the array. + * @node: List node. + * + * This structure together with related helper functions is provided for users + * that don't can't access the nvmem provided structure but wish to register + * cell definitions for it e.g. board files registering an EEPROM device. + */ +struct nvmem_cell_table { + const char *nvmem_name; + const struct nvmem_cell_info *cells; + size_t ncells; + struct list_head node; +}; + #if IS_ENABLED(CONFIG_NVMEM) struct nvmem_device *nvmem_register(const struct nvmem_config *cfg); @@ -77,9 +96,9 @@ struct nvmem_device *devm_nvmem_register(struct device *dev, int devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem); -int nvmem_add_cells(struct nvmem_device *nvmem, - const struct nvmem_cell_info *info, - int ncells); +void nvmem_add_cell_table(struct nvmem_cell_table *table); +void nvmem_del_cell_table(struct nvmem_cell_table *table); + #else static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c) @@ -102,12 +121,8 @@ devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem) } -static inline int nvmem_add_cells(struct nvmem_device *nvmem, - const struct nvmem_cell_info *info, - int ncells) -{ - return -ENOSYS; -} +static inline void nvmem_add_cell_table(struct nvmem_cell_table *table) {} +static inline void nvmem_del_cell_table(struct nvmem_cell_table *table) {} #endif /* CONFIG_NVMEM */ #endif /* ifndef _LINUX_NVMEM_PROVIDER_H */ From patchwork Fri Sep 21 13:40:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147266 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837460ljw; Fri, 21 Sep 2018 06:40:58 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZukmbbR89b3DOD5omM9n6if7e/zx/3BWDl2jO4yP9YjFi4Xva8onvhVOGs0y8Lz1lOrPP9 X-Received: by 2002:a63:2043:: with SMTP id r3-v6mr41431432pgm.105.1537537258692; Fri, 21 Sep 2018 06:40:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537258; cv=none; d=google.com; s=arc-20160816; b=AZTpRnQzUjLA+AtJuUOb5XTOoxI50SU5s8smch9pOEeUtb2leG+HNTntliIc5CI29g B6QL5THH/2mejTbWAT57IdbXPV5gVtNlIS63v2N5AUH8XT+4kEBvPWsbnuwNrnSBg0JH zjm4ZxOiqKomfqLp+ouA1lmyvPLNKzictRenDcG2YS8G/cDJSXHhLTf2M0rDaUvRQJE1 ZxmRmPkDx/EJkfkewykwcRDpZT+r9dGY7gqgYKiMxAPEM+JFxPTfHl5FHh+W2AKE9nms cwOy0EP5/p9YgsNhbi7EtLbilNozh9HG5o7XedfZj3ROYK8Iul1rBGkalqEhCCro+srr q0Zw== 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; bh=mHJaK/5Wii4q77d39T++u+f9ggbq7rkhl2Ebzv7oirA=; b=kf4jFlcj3nehju5gqjkX0ATufBfLaZ82NYSwSmjm2VWn3TXR0DN88IsmT8R9PpTYWO iCE3FCDQqXxcOuWPPGYH9e/tpDoMxedASpAKV4W9FYR9sOxqXrP4L+iB2ZW75Ve6yZEV n30Lvmnvxi/uR0hFXwMIpWBZJnbk+PuQ7f0Xb834wB6FeaG83Tatuhw3Qha1tm/+yRS6 LySukkSbfEn3NL6MB4OX+yvwWuB8VA6b2lf41MbMNc7CCzm+X/PgxQa1GSdAgrcE89SC CXFTwpEyOOxVvy3IXMV01nMD+a8kW9cgVhozjkO5ryO76L/ufHK7jrXp4hoomaZAxKi9 pYkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iyFdghxZ; 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 64-v6si28876870pfs.7.2018.09.21.06.40.57; Fri, 21 Sep 2018 06:40:58 -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 header.s=google header.b=iyFdghxZ; 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 S2390322AbeIUT3u (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:50 -0400 Received: from mail-io1-f43.google.com ([209.85.166.43]:33320 "EHLO mail-io1-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727392AbeIUT3s (ORCPT ); Fri, 21 Sep 2018 15:29:48 -0400 Received: by mail-io1-f43.google.com with SMTP id r196-v6so12252546iod.0 for ; Fri, 21 Sep 2018 06:40:53 -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=mHJaK/5Wii4q77d39T++u+f9ggbq7rkhl2Ebzv7oirA=; b=iyFdghxZBnvMsQybolqnAmvVzfYhhceINI+QYgAHmUtSCrpj6WeVfYi/rP1lKswSqU imPx8WTXorzrGjIq6Oi9dl7RoZ/6cV9Q9y6j6+ZmznBj6yeVAZc4Z+UpH6o6hjkqmKeq qjGcqxKU46qaTK4n52i4yyf7FK/K66W5VEtFM= 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=mHJaK/5Wii4q77d39T++u+f9ggbq7rkhl2Ebzv7oirA=; b=JwFRvGjpP0qbiHpN/2jQiSnZPC3HDJh2tQHN7+tnet6Ynqh5oRZZ1byYEZ9Ejqi/SQ OnY/vboEpPI/CKOGJYerksGJsIfOhc8on9StqXEYwyrMl0WEUCKi0bEujgBvz9WO7cf6 BT00sgsp3NFev2YjKHmEtDOZXHsC6WMjOtckXbHK91DSHxgCCEmEGpAdGmw8uFxr1n63 sPMidr+XIMVGj/nDKOIudfLsdpYm5DMLmGuzEtn33CYd37vlMirQ9JKoE8+8YfLY1LfD xZU0x5lOEZx6cJgYy8EAhEI+PVXcsVFw2uYu4MlImEkVXfntOEZfOIldfMpPpjEO7zZd /FDA== X-Gm-Message-State: APzg51DkJXKslLVn09mv+i78yt+mDs2LUxWCFi6NRM+dBYBrVsIBopZD bCx00weOPlkYu82FZKkI/ooK8w== X-Received: by 2002:a5e:8510:: with SMTP id i16-v6mr36127203ioj.301.1537537252662; Fri, 21 Sep 2018 06:40:52 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:52 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 16/26] nvmem: resolve cells from DT at registration time Date: Fri, 21 Sep 2018 06:40:16 -0700 Message-Id: <20180921134026.4596-17-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Currently we're creating a new cell structure everytime a DT user calls nvmem_cell_get(). Change this behavior by resolving the cells during nvmem provider registration and adding all cells to the provider's list. Make of_nvmem_cell_get() just parse the phandle and look the cell up in the relevant provider's list. Don't drop the cell in nvmem_cell_put(). Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 123 ++++++++++++++++++++++++++----------------- 1 file changed, 75 insertions(+), 48 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 8e0108806e65..74b6b97680d5 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -456,6 +456,73 @@ static int nvmem_add_cells_from_table(struct nvmem_device *nvmem) return rval; } +static struct nvmem_cell * +nvmem_find_cell_by_index(struct nvmem_device *nvmem, int index) +{ + struct nvmem_cell *cell = NULL; + int i = 0; + + mutex_lock(&nvmem_mutex); + list_for_each_entry(cell, &nvmem->cells, node) { + if (index == i++) + break; + } + mutex_unlock(&nvmem_mutex); + + return cell; +} + +static int nvmem_add_cells_from_of(struct nvmem_device *nvmem) +{ + struct device_node *parent, *child; + struct device *dev = &nvmem->dev; + struct nvmem_cell *cell; + const __be32 *addr; + int len; + + parent = dev->of_node; + + for_each_child_of_node(parent, child) { + addr = of_get_property(child, "reg", &len); + if (!addr || (len < 2 * sizeof(u32))) { + dev_err(dev, "nvmem: invalid reg on %pOF\n", child); + return -EINVAL; + } + + cell = kzalloc(sizeof(*cell), GFP_KERNEL); + if (!cell) + return -ENOMEM; + + cell->nvmem = nvmem; + cell->offset = be32_to_cpup(addr++); + cell->bytes = be32_to_cpup(addr); + cell->name = child->name; + + addr = of_get_property(child, "bits", &len); + if (addr && len == (2 * sizeof(u32))) { + cell->bit_offset = be32_to_cpup(addr++); + cell->nbits = be32_to_cpup(addr); + } + + if (cell->nbits) + cell->bytes = DIV_ROUND_UP( + cell->nbits + cell->bit_offset, + BITS_PER_BYTE); + + if (!IS_ALIGNED(cell->offset, nvmem->stride)) { + dev_err(dev, "cell %s unaligned to nvmem stride %d\n", + cell->name, nvmem->stride); + /* Cells already added will be freed later. */ + kfree(cell); + return -EINVAL; + } + + nvmem_cell_add(cell); + } + + return 0; +} + /** * nvmem_register() - Register a nvmem device for given nvmem_config. * Also creates an binary entry in /sys/bus/nvmem/devices/dev-name/nvmem @@ -546,6 +613,10 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) if (rval) goto err_remove_cells; + rval = nvmem_add_cells_from_of(nvmem); + if (rval) + goto err_remove_cells; + return nvmem; err_remove_cells: @@ -848,10 +919,8 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, const char *name) { struct device_node *cell_np, *nvmem_np; - struct nvmem_cell *cell; struct nvmem_device *nvmem; - const __be32 *addr; - int rval, len; + struct nvmem_cell *cell; int index = 0; /* if cell name exists, find index to the name */ @@ -871,54 +940,13 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, if (IS_ERR(nvmem)) return ERR_CAST(nvmem); - addr = of_get_property(cell_np, "reg", &len); - if (!addr || (len < 2 * sizeof(u32))) { - dev_err(&nvmem->dev, "nvmem: invalid reg on %pOF\n", - cell_np); - rval = -EINVAL; - goto err_mem; - } - - cell = kzalloc(sizeof(*cell), GFP_KERNEL); + cell = nvmem_find_cell_by_index(nvmem, index); if (!cell) { - rval = -ENOMEM; - goto err_mem; - } - - cell->nvmem = nvmem; - cell->offset = be32_to_cpup(addr++); - cell->bytes = be32_to_cpup(addr); - cell->name = cell_np->name; - - addr = of_get_property(cell_np, "bits", &len); - if (addr && len == (2 * sizeof(u32))) { - cell->bit_offset = be32_to_cpup(addr++); - cell->nbits = be32_to_cpup(addr); - } - - if (cell->nbits) - cell->bytes = DIV_ROUND_UP(cell->nbits + cell->bit_offset, - BITS_PER_BYTE); - - if (!IS_ALIGNED(cell->offset, nvmem->stride)) { - dev_err(&nvmem->dev, - "cell %s unaligned to nvmem stride %d\n", - cell->name, nvmem->stride); - rval = -EINVAL; - goto err_sanity; + __nvmem_device_put(nvmem); + return ERR_PTR(-ENOENT); } - nvmem_cell_add(cell); - return cell; - -err_sanity: - kfree(cell); - -err_mem: - __nvmem_device_put(nvmem); - - return ERR_PTR(rval); } EXPORT_SYMBOL_GPL(of_nvmem_cell_get); #endif @@ -1024,7 +1052,6 @@ void nvmem_cell_put(struct nvmem_cell *cell) struct nvmem_device *nvmem = cell->nvmem; __nvmem_device_put(nvmem); - nvmem_cell_drop(cell); } EXPORT_SYMBOL_GPL(nvmem_cell_put); From patchwork Fri Sep 21 13:40:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147276 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp838354ljw; Fri, 21 Sep 2018 06:41:50 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdak4RK0NNKAVAFRWv+lMi3h3wnjOj3KYhBJg/IBsGoOkfPK0urJ3iwVAF8dcjsy47LBeYuv X-Received: by 2002:a63:7c5e:: with SMTP id l30-v6mr2981764pgn.45.1537537310419; Fri, 21 Sep 2018 06:41:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537310; cv=none; d=google.com; s=arc-20160816; b=M5gvVPz8WZDmV8uZIFT4u2/axK2UFtZmK0n0G8B3VsMWnkzuurvPapombO0z3yeBTx uhWIk2sXjZ0IW8jfpFJpJbYRGJWeBfIwYT/Kohjpgh3ZmyerEc6iCqEyYjly2wh47i2S bC+qljarvPjDvEir/TiPmKjcIwYmJS3b3cT8aUs9QHIJ4qxEN4RbuiilihPvvPV5Z6Ov AZ/fLi66/f+ljGHyLAzX+pdHnpC9f292B5dXPWCUEinwFCL6vESmtIzeLVHk+qvYExvC C0rB1a4rrg6jq9utCmGcuNzpjUYQKycRMe0w1QPkFr95Nu3z5Q1cexAqYLdrpQlPpTo4 QI1g== 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; bh=KwrD04MgFgOeUQZBSrXnx47IBYL7knnGsXG4NHQ+G6s=; b=TZHsi5g9sixRHYSHqWrsvxGEZokL3/HL3JUKM4LMDxxfTo19vU5iX3l7Fqzt5U1Yat ap/ej+YxEd6Ah2GT+8GAL054kSGW7eq8oKb21/Z2NGVpqj5MCFUlX2ScFhAOLao1b6Sy o55+ERjVaqKUH4j6jdLH+sMT2jf4ldHfWX7MVQ2LUAOjwEIVlPm6BiEZJHh6JS4UKWbn pJ78rCrNTkZVakKWP2pj8H6bJ39yDFJHDw+qH3UccsGwGSigxKMTXRcOG5Gy22BJd3b/ d/4xS2WxhJxhnHplRkD5wKDnDQmiqhPlrHMv1vyM9ICzlbSDZjXYUybEuA0Xr816suWT AGww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ejBM1933; 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 cb14-v6si29608068plb.178.2018.09.21.06.41.50; Fri, 21 Sep 2018 06:41:50 -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 header.s=google header.b=ejBM1933; 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 S2390460AbeIUTan (ORCPT + 32 others); Fri, 21 Sep 2018 15:30:43 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:35022 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390304AbeIUT3t (ORCPT ); Fri, 21 Sep 2018 15:29:49 -0400 Received: by mail-it1-f194.google.com with SMTP id 139-v6so1929875itf.0 for ; Fri, 21 Sep 2018 06:40:54 -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=KwrD04MgFgOeUQZBSrXnx47IBYL7knnGsXG4NHQ+G6s=; b=ejBM1933gCBH9ofQzSyD7pAEVip49gPG0FYMekfu6JhOgcsiliY/+7ZWzGghCo2ltx S5RAhEa9YUvKFM868iZzNnh4CE1eBBgDhPThTz3EJUx4p0FURNMLmxec7hpPFeLTM/gf /agSECnH5F9adK9YAPb8fISPwPqmUX0Ve4stE= 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=KwrD04MgFgOeUQZBSrXnx47IBYL7knnGsXG4NHQ+G6s=; b=OLv5BdYPzG0cy3uluuhPTRTRF5f4oErfyGG74H5843ImCTdfK3rDq6SrEQNyrhCExh tqclgG5KbMhAdSObgU96Gr1Wb0EO2E53UFXTLBU9dG+QD8TmlIy0yspwdevykyxP/GwA bgqCsELTIqLOlpjtRXyo4hyMA4SAjDMUoF33Hk4CqxCGJsiSzFO8bXXZuSdbpPYHIvxN fo9y3afLmWlZw4uqCRs/o5T6CA9vgmjCvsQU21inWNbm1mjy9HcVZEXbdSxQuFiJUV/g 7GIaYyZGS3OL/oiNbm3obKIXc1SLCM7L1Bt9wBb95F168zVxpEJmDfCHXV+jHAwXu/ik uCOQ== X-Gm-Message-State: APzg51BtTZx1teCFujs9pkeQ4xxpdDq4s4BUNR+sMWfz4e72u4oTyWre B+T+1aQe9Yk5M73ciaDE5M5rhQ== X-Received: by 2002:a24:cd81:: with SMTP id l123-v6mr5874663itg.7.1537537253968; Fri, 21 Sep 2018 06:40:53 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:53 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 17/26] nvmem: add support for cell lookups from machine code Date: Fri, 21 Sep 2018 06:40:17 -0700 Message-Id: <20180921134026.4596-18-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Add a way for machine code users to associate devices with nvmem cells. This restores the support for non-DT systems but following a different approach. Cells must now be associated with devices using provided routines and data structures before they can be retrieved using nvmem_cell_get(). It's still possible to define cells statically in nvmem_config but cells created this way still need to be associated with consumers using lookup entries. Note that nvmem_find() must be moved higher in the source file as we want to call it from __nvmem_device_get() for devices that don't have a device node. The signature of __nvmem_device_get() is also changed as it's no longer used to retrieve cells. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 129 ++++++++++++++++++++++++++------- include/linux/nvmem-consumer.h | 28 +++++++ 2 files changed, 131 insertions(+), 26 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 74b6b97680d5..9cc86d131e1e 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -62,6 +62,9 @@ static DEFINE_IDA(nvmem_ida); static DEFINE_MUTEX(nvmem_cell_mutex); static LIST_HEAD(nvmem_cell_tables); +static DEFINE_MUTEX(nvmem_lookup_mutex); +static LIST_HEAD(nvmem_lookup_list); + #ifdef CONFIG_DEBUG_LOCK_ALLOC static struct lock_class_key eeprom_lock_key; #endif @@ -283,6 +286,18 @@ static struct nvmem_device *of_nvmem_find(struct device_node *nvmem_np) return to_nvmem_device(d); } +static struct nvmem_device *nvmem_find(const char *name) +{ + struct device *d; + + d = bus_find_device_by_name(&nvmem_bus_type, NULL, name); + + if (!d) + return NULL; + + return to_nvmem_device(d); +} + static void nvmem_cell_drop(struct nvmem_cell *cell) { mutex_lock(&nvmem_mutex); @@ -472,6 +487,21 @@ nvmem_find_cell_by_index(struct nvmem_device *nvmem, int index) return cell; } +static struct nvmem_cell * +nvmem_find_cell_by_name(struct nvmem_device *nvmem, const char *cell_id) +{ + struct nvmem_cell *cell = NULL; + + mutex_lock(&nvmem_mutex); + list_for_each_entry(cell, &nvmem->cells, node) { + if (strcmp(cell_id, cell->name) == 0) + break; + } + mutex_unlock(&nvmem_mutex); + + return cell; +} + static int nvmem_add_cells_from_of(struct nvmem_device *nvmem) { struct device_node *parent, *child; @@ -719,16 +749,12 @@ int devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem) EXPORT_SYMBOL(devm_nvmem_unregister); static struct nvmem_device *__nvmem_device_get(struct device_node *np, - struct nvmem_cell **cellp, - const char *cell_id) + const char *nvmem_name) { struct nvmem_device *nvmem = NULL; - if (!np) - return ERR_PTR(-ENOENT); - mutex_lock(&nvmem_mutex); - nvmem = of_nvmem_find(np); + nvmem = np ? of_nvmem_find(np) : nvmem_find(nvmem_name); mutex_unlock(&nvmem_mutex); if (!nvmem) return ERR_PTR(-EPROBE_DEFER); @@ -752,18 +778,6 @@ static void __nvmem_device_put(struct nvmem_device *nvmem) kref_put(&nvmem->refcnt, nvmem_device_release); } -static struct nvmem_device *nvmem_find(const char *name) -{ - struct device *d; - - d = bus_find_device_by_name(&nvmem_bus_type, NULL, name); - - if (!d) - return ERR_PTR(-ENOENT); - - return to_nvmem_device(d); -} - #if IS_ENABLED(CONFIG_OF) /** * of_nvmem_device_get() - Get nvmem device from a given id @@ -786,7 +800,7 @@ struct nvmem_device *of_nvmem_device_get(struct device_node *np, const char *id) if (!nvmem_np) return ERR_PTR(-EINVAL); - return __nvmem_device_get(nvmem_np, NULL, NULL); + return __nvmem_device_get(nvmem_np, NULL); } EXPORT_SYMBOL_GPL(of_nvmem_device_get); #endif @@ -890,15 +904,43 @@ struct nvmem_device *devm_nvmem_device_get(struct device *dev, const char *id) } EXPORT_SYMBOL_GPL(devm_nvmem_device_get); -static struct nvmem_cell *nvmem_cell_get_from_list(const char *cell_id) +static struct nvmem_cell * +nvmem_cell_get_from_lookup(struct device *dev, const char *con_id) { - struct nvmem_cell *cell = NULL; + struct nvmem_cell *cell = ERR_PTR(-ENOENT); + struct nvmem_cell_lookup *lookup; struct nvmem_device *nvmem; + const char *dev_id; - nvmem = __nvmem_device_get(NULL, &cell, cell_id); - if (IS_ERR(nvmem)) - return ERR_CAST(nvmem); + if (!dev) + return ERR_PTR(-EINVAL); + + dev_id = dev_name(dev); + + mutex_lock(&nvmem_lookup_mutex); + + list_for_each_entry(lookup, &nvmem_lookup_list, node) { + if ((strcmp(lookup->dev_id, dev_id) == 0) && + (strcmp(lookup->con_id, con_id) == 0)) { + /* This is the right entry. */ + nvmem = __nvmem_device_get(NULL, lookup->nvmem_name); + if (!nvmem) { + /* Provider may not be registered yet. */ + cell = ERR_PTR(-EPROBE_DEFER); + goto out; + } + + cell = nvmem_find_cell_by_name(nvmem, + lookup->cell_name); + if (!cell) { + __nvmem_device_put(nvmem); + goto out; + } + } + } +out: + mutex_unlock(&nvmem_lookup_mutex); return cell; } @@ -935,7 +977,7 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, if (!nvmem_np) return ERR_PTR(-EINVAL); - nvmem = __nvmem_device_get(nvmem_np, NULL, NULL); + nvmem = __nvmem_device_get(nvmem_np, NULL); of_node_put(nvmem_np); if (IS_ERR(nvmem)) return ERR_CAST(nvmem); @@ -975,7 +1017,7 @@ struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *cell_id) if (!cell_id) return ERR_PTR(-EINVAL); - return nvmem_cell_get_from_list(cell_id); + return nvmem_cell_get_from_lookup(dev, cell_id); } EXPORT_SYMBOL_GPL(nvmem_cell_get); @@ -1405,6 +1447,41 @@ void nvmem_del_cell_table(struct nvmem_cell_table *table) } EXPORT_SYMBOL_GPL(nvmem_del_cell_table); +/** + * nvmem_add_cell_lookups() - register a list of cell lookup entries + * + * @entries: array of cell lookup entries + * @nentries: number of cell lookup entries in the array + */ +void nvmem_add_cell_lookups(struct nvmem_cell_lookup *entries, size_t nentries) +{ + int i; + + mutex_lock(&nvmem_lookup_mutex); + for (i = 0; i < nentries; i++) + list_add_tail(&entries[i].node, &nvmem_lookup_list); + mutex_unlock(&nvmem_lookup_mutex); +} +EXPORT_SYMBOL_GPL(nvmem_add_cell_lookups); + +/** + * nvmem_del_cell_lookups() - remove a list of previously added cell lookup + * entries + * + * @entries: array of cell lookup entries + * @nentries: number of cell lookup entries in the array + */ +void nvmem_del_cell_lookups(struct nvmem_cell_lookup *entries, size_t nentries) +{ + int i; + + mutex_lock(&nvmem_lookup_mutex); + for (i = 0; i < nentries; i++) + list_del(&entries[i].node); + mutex_unlock(&nvmem_lookup_mutex); +} +EXPORT_SYMBOL_GPL(nvmem_del_cell_lookups); + /** * nvmem_dev_name() - Get the name of a given nvmem device. * diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index 0389fe00b177..27eee3945405 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -29,6 +29,24 @@ struct nvmem_cell_info { unsigned int nbits; }; +/** + * struct nvmem_cell_lookup - cell lookup entry + * + * @nvmem_name: Name of the provider. + * @cell_name: Name of the nvmem cell as defined in the name field of + * struct nvmem_cell_info. + * @dev_id: Name of the consumer device that will be associated with + * this cell. + * @con_id: Connector id for this cell lookup. + */ +struct nvmem_cell_lookup { + const char *nvmem_name; + const char *cell_name; + const char *dev_id; + const char *con_id; + struct list_head node; +}; + #if IS_ENABLED(CONFIG_NVMEM) /* Cell based interface */ @@ -57,6 +75,11 @@ int nvmem_device_cell_write(struct nvmem_device *nvmem, const char *nvmem_dev_name(struct nvmem_device *nvmem); +void nvmem_add_cell_lookups(struct nvmem_cell_lookup *entries, + size_t nentries); +void nvmem_del_cell_lookups(struct nvmem_cell_lookup *entries, + size_t nentries); + #else static inline struct nvmem_cell *nvmem_cell_get(struct device *dev, @@ -151,6 +174,11 @@ static inline const char *nvmem_dev_name(struct nvmem_device *nvmem) return NULL; } +static inline void +nvmem_add_cell_lookups(struct nvmem_cell_lookup *entries, size_t nentries) {} +static inline void +nvmem_del_cell_lookups(struct nvmem_cell_lookup *entries, size_t nentries) {} + #endif /* CONFIG_NVMEM */ #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) From patchwork Fri Sep 21 13:40:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147267 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837474ljw; Fri, 21 Sep 2018 06:40:59 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYCy84UPq1kpV5vIEFLh6+d15N+8zyGsGl/4UkKnuf0JOa4Y6Sf1X2e4L6T3cyhKY0HX5A4 X-Received: by 2002:a63:6507:: with SMTP id z7-v6mr9898423pgb.200.1537537259327; Fri, 21 Sep 2018 06:40:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537259; cv=none; d=google.com; s=arc-20160816; b=CqFTO/ZiczzevW3i5yaChNZMWExvQxNnzWeOvG2HElgsQoQc6uW01sJ00Z7m8z7j4p RcxsFKdseMUW/BwZSWRbmABdwLFO2x5OeJQCzFK/E8kKjNaAj2yoqWl4l36Ir1G26pEM dI+MZqcjHQsKii6lw/SM7zrvSijCU/L+JdTbCQTzXj03BbgGPXYdHLgz+G7fr3os0C6y gfggK02cvVzFc2zIgGXiZWn+2wFKCyoxs0fGZP9TNr1HjDQ3NlZqIe1PlW7n9TT4o5Vh 5jX5eZCQ+O1RXJWvBbEuxCLQwZSOJjQ/f4+XzFYb3j/l21WJIaCt2bQAAZ+YCV3q6GkN /QqQ== 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; bh=t41XhcCcu+sGwNEig7soNugPq9+VfgPhE6sHZdyZ9I8=; b=RnUqTofOX5vPV3R7XNFtk1E71qUxc87zSygFNzEFT9ipPJmRIaPXfQFIvFreSFIMi3 Tv5siwZ59ZUcn6FCsjXZX3YH65KEpyU6D4E2q6BV6RDkgYHFk8xjOSqnDOho4JKCyZUL cXxYPNSBLQpQn7IBSoHFZcGefqaPXgaL1kJynFPEZ1XgscChqJ3/Gngj6w3VI/hNTasP e3WT0euNXUr++c7NRFXl7+XcSUlksowNBzWtILLNgtygxPxaQ75r/w7Dc+GIxWa4Gp7h IeK1mPc5TwjAvtkjX9lZt0Zy3GXjaI+94D2k/umw2RUnqpPkmGpKhmehZFcU4Q/7KsVF bP1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=arHHQRsW; 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 64-v6si28876870pfs.7.2018.09.21.06.40.58; Fri, 21 Sep 2018 06:40:59 -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 header.s=google header.b=arHHQRsW; 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 S2390335AbeIUT3v (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:51 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:45256 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390310AbeIUT3u (ORCPT ); Fri, 21 Sep 2018 15:29:50 -0400 Received: by mail-io1-f66.google.com with SMTP id e12-v6so12191870iok.12 for ; Fri, 21 Sep 2018 06:40:55 -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=t41XhcCcu+sGwNEig7soNugPq9+VfgPhE6sHZdyZ9I8=; b=arHHQRsWgLw9a+xbYf0I699ti6n5RgDJkui6P8tuwANMwow1cB+wNvT6dO/2dkv3Rm 5j2KRiu92BYDk583OkNHSbtZTe1kUSL+1zjiw8odH4dwQrcFhqI9/i5hsumlq69LqkGD 3vW7IPp2NhW3fbQ5NQ+UmITXr2gsr8I3pZKPA= 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=t41XhcCcu+sGwNEig7soNugPq9+VfgPhE6sHZdyZ9I8=; b=ugNskS35D5yerIJWIk37Zi4typW7y5NrCwQEMpKfrs2R3tti7l29x5k2HRjDhseZMc sK5GbKff+l/ilHWbsDN7tUgXjWnMoXSPfUs19CaGlCPh8XA+Mp5+3BypqTD+WKAFJH9G W2Eua2qPFaRRSv0LAjXnSHJOaNux9P1kXR8kDBv8b3ZRxgTaJVhxMhLG2eh8EObvT3WN CpWK4KaYc5fr0IBT62u0DZnBybd7OO/ecZxHcUtQRuPV2VohEOpWHxWYiSZXjFK9/lfH KdN3+ECdAgYeWop9FYeRs/66djXDu43q+qm25H1e51eOKUY/HOYce2ULjaBhSJq4Is/Q k2mw== X-Gm-Message-State: APzg51Cdq9FoujZEng8d5LwnfgguVZ2W17PoW52xWA3JJpZIrsh+eQ0a U5oqpg7ZoREStQEmEbUp77M0chqxuKE= X-Received: by 2002:a02:380c:: with SMTP id b12-v6mr9634597jaa.42.1537537255094; Fri, 21 Sep 2018 06:40:55 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:54 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 18/26] Documentation: nvmem: document cell tables and lookup entries Date: Fri, 21 Sep 2018 06:40:18 -0700 Message-Id: <20180921134026.4596-19-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Document the new nvmem kernel APIs. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- Documentation/nvmem/nvmem.txt | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) -- 2.19.0 diff --git a/Documentation/nvmem/nvmem.txt b/Documentation/nvmem/nvmem.txt index 8d8d8f58f96f..fc2fe4b18655 100644 --- a/Documentation/nvmem/nvmem.txt +++ b/Documentation/nvmem/nvmem.txt @@ -58,6 +58,37 @@ static int qfprom_probe(struct platform_device *pdev) It is mandatory that the NVMEM provider has a regmap associated with its struct device. Failure to do would return error code from nvmem_register(). +Users of board files can define and register nvmem cells using the +nvmem_cell_table struct: + +static struct nvmem_cell_info foo_nvmem_cells[] = { + { + .name = "macaddr", + .offset = 0x7f00, + .bytes = ETH_ALEN, + } +}; + +static struct nvmem_cell_table foo_nvmem_cell_table = { + .nvmem_name = "i2c-eeprom", + .cells = foo_nvmem_cells, + .ncells = ARRAY_SIZE(foo_nvmem_cells), +}; + +nvmem_add_cell_table(&foo_nvmem_cell_table); + +Additionally it is possible to create nvmem cell lookup entries and register +them with the nvmem framework from machine code as shown in the example below: + +static struct nvmem_cell_lookup foo_nvmem_lookup = { + .nvmem_name = "i2c-eeprom", + .cell_name = "macaddr", + .dev_id = "foo_mac.0", + .con_id = "mac-address", +}; + +nvmem_add_cell_lookups(&foo_nvmem_lookup, 1); + NVMEM Consumers +++++++++++++++ From patchwork Fri Sep 21 13:40:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147268 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837512ljw; Fri, 21 Sep 2018 06:41:02 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYYUVWIE7fRTJS3Zb02IVXQ+/irwJg14kexqN4HQPpMH9Ckgac44u5oEJwgdOe9iD5SB5fT X-Received: by 2002:a63:7f55:: with SMTP id p21-v6mr41678797pgn.285.1537537261875; Fri, 21 Sep 2018 06:41:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537261; cv=none; d=google.com; s=arc-20160816; b=sbwzmvmMIbcfrFUan7wol0T1eHGGAans4iqanugX+PHmrWehWtanUlAk8AavUCRgG4 /onoXFtp9iXhgl0lPGkfYN3s37Rybwpkf/OLA94cnR4mEzc9kfhn+1WZBwkG2a+5g627 B1dyk5My887crEEc7y7tFeCCUeushEb6/+9oYtj9vi2kqXDzloDBASR/ybjY+k+wbfW7 PVj5/MBo1pt5wfqcJg5EUUzgdbJh+72q11nl7G86SJ/hR4x3bKCaRe0/mPJ+PVgpO/7x MAlV6P7leNZyvX0hSupepNABRe9Q5e44bO8NwiXlHNwMb479/dGK0dIpVzR6mTWA/uDx oimg== 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; bh=Y6AQFtCxDMBe/+LC3WwqONRwK0sR7JzE1ciKHcTzQ+E=; b=k1trvpOD0A3Efj7ufcF9B/FF0oxRNFQTJXEjyPjbAyQMSnoCmvDSG6GP4y25FQQ61q 5s4P2U9iQD5wbMEvmBIxf73p8eujj+Liqx2c9w76ha80ct+nYuTpfCzkg+PT1iAfg9jR vOjTW8vQ5pDzooam9BKJLbnUroYbsVXOBdwKrIbz7OzWPBIaxCv5iwIpV9+g5SYRlVTM er/CIKq2Kg71njnYv0iv4bIFOcKtPUrLxHhrjgTohG1Vlk27k9A+nisW3uZn0xkxFfiK qbtFnkfNvEo8d/SwudkHXbW/srWRqhvIxZWwUA2W1TtJkFcwDnmnJ2ki5jgdJZvlTab+ FidQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fw3vQk++; 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 h86-v6si28585312pfj.120.2018.09.21.06.41.01; Fri, 21 Sep 2018 06:41:01 -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 header.s=google header.b=fw3vQk++; 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 S2390345AbeIUT3x (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:53 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:35666 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727392AbeIUT3w (ORCPT ); Fri, 21 Sep 2018 15:29:52 -0400 Received: by mail-io1-f67.google.com with SMTP id w11-v6so12244868iob.2 for ; Fri, 21 Sep 2018 06:40:56 -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=Y6AQFtCxDMBe/+LC3WwqONRwK0sR7JzE1ciKHcTzQ+E=; b=fw3vQk++17y/nADSmLry/AWNZiC+yrOMXdyRvGVIgah6wufj6EP3wue6BZjQ9rWj46 HJYcY/N9oNYom+j1vBZ0t+uEBmqt1n8yxgjt+T8+x9wYtlD1Ct2k/3iLUbBFqzK1t1S+ e4PeXHkZlEOBfTTE5dcEmQQFlD+oRXec6KNIo= 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=Y6AQFtCxDMBe/+LC3WwqONRwK0sR7JzE1ciKHcTzQ+E=; b=oYFnwKIJEuvDmhU+0Hjkt6ZlDHa4F72YejURTNfdqFAgryrdoleAZfxLGn+2BAapcH vu5wGbi5ZprhD2r3uXKXxtDXOwNMvP9COvZxoXdGSqd2NTlDn50t5t/5Nq1iKPC9pvtR zITaGaj2959l/7TxRVKg2+9vwC/hCkAoY/ubTHU8vxKd0SlNlaWegKSRfG1RPHYVGE6s suykT8OWqWves0s2rkkCSKWOgCeu1HYpMl3c4xqwpQ/kYx2/1kEZSPoxr5xYla13QvDn j89LSASV/6qOtc8R1ykjn3jCGimdBUzmx08WIk+a+/hgnQuUBRC/aEFWUwsaYPyxtPzY KC+Q== X-Gm-Message-State: APzg51A1vBhiwWQUUo0WO5mvBbubxlDnovoEpKJaq6Eg46OYQ4swLEBB jQPwShAKpOifmmebVLziC7MeXapSTxc= X-Received: by 2002:a02:85a3:: with SMTP id d32-v6mr39043206jai.119.1537537256136; Fri, 21 Sep 2018 06:40:56 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:55 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 19/26] nvmem: add a notifier chain Date: Fri, 21 Sep 2018 06:40:19 -0700 Message-Id: <20180921134026.4596-20-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Add a blocking notifier chain with four events (add and remove for both devices and cells) so that users can get notified about the addition of nvmem resources they're waiting for. We'll use this instead of the at24 setup callback in the mityomapl138 board file. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 36 ++++++++++++++++++++++++++++++++++ include/linux/nvmem-consumer.h | 21 ++++++++++++++++++++ 2 files changed, 57 insertions(+) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 9cc86d131e1e..da441019b609 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -65,6 +65,8 @@ static LIST_HEAD(nvmem_cell_tables); static DEFINE_MUTEX(nvmem_lookup_mutex); static LIST_HEAD(nvmem_lookup_list); +static BLOCKING_NOTIFIER_HEAD(nvmem_notifier); + #ifdef CONFIG_DEBUG_LOCK_ALLOC static struct lock_class_key eeprom_lock_key; #endif @@ -300,6 +302,7 @@ static struct nvmem_device *nvmem_find(const char *name) static void nvmem_cell_drop(struct nvmem_cell *cell) { + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_CELL_REMOVE, cell); mutex_lock(&nvmem_mutex); list_del(&cell->node); mutex_unlock(&nvmem_mutex); @@ -319,6 +322,7 @@ static void nvmem_cell_add(struct nvmem_cell *cell) mutex_lock(&nvmem_mutex); list_add_tail(&cell->node, &cell->nvmem->cells); mutex_unlock(&nvmem_mutex); + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_CELL_ADD, cell); } static int nvmem_cell_info_to_nvmem_cell(struct nvmem_device *nvmem, @@ -434,6 +438,32 @@ static int nvmem_setup_compat(struct nvmem_device *nvmem, return 0; } +/** + * nvmem_register_notifier() - Register a notifier block for nvmem events. + * + * @nb: notifier block to be called on nvmem events. + * + * Return: 0 on success, negative error number on failure. + */ +int nvmem_register_notifier(struct notifier_block *nb) +{ + return blocking_notifier_chain_register(&nvmem_notifier, nb); +} +EXPORT_SYMBOL_GPL(nvmem_register_notifier); + +/** + * nvmem_unregister_notifier() - Unregister a notifier block for nvmem events. + * + * @nb: notifier block to be unregistered. + * + * Return: 0 on success, negative error number on failure. + */ +int nvmem_unregister_notifier(struct notifier_block *nb) +{ + return blocking_notifier_chain_unregister(&nvmem_notifier, nb); +} +EXPORT_SYMBOL_GPL(nvmem_unregister_notifier); + static int nvmem_add_cells_from_table(struct nvmem_device *nvmem) { const struct nvmem_cell_info *info; @@ -647,6 +677,10 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) if (rval) goto err_remove_cells; + rval = blocking_notifier_call_chain(&nvmem_notifier, NVMEM_ADD, nvmem); + if (rval) + goto err_remove_cells; + return nvmem; err_remove_cells: @@ -669,6 +703,8 @@ static void nvmem_device_release(struct kref *kref) nvmem = container_of(kref, struct nvmem_device, refcnt); + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_REMOVE, nvmem); + if (nvmem->flags & FLAG_COMPAT) device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom); diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index 27eee3945405..0326b52e906b 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -14,6 +14,7 @@ #include #include +#include struct device; struct device_node; @@ -47,6 +48,13 @@ struct nvmem_cell_lookup { struct list_head node; }; +enum { + NVMEM_ADD = 1, + NVMEM_REMOVE, + NVMEM_CELL_ADD, + NVMEM_CELL_REMOVE, +}; + #if IS_ENABLED(CONFIG_NVMEM) /* Cell based interface */ @@ -80,6 +88,9 @@ void nvmem_add_cell_lookups(struct nvmem_cell_lookup *entries, void nvmem_del_cell_lookups(struct nvmem_cell_lookup *entries, size_t nentries); +int nvmem_register_notifier(struct notifier_block *nb); +int nvmem_unregister_notifier(struct notifier_block *nb); + #else static inline struct nvmem_cell *nvmem_cell_get(struct device *dev, @@ -179,6 +190,16 @@ nvmem_add_cell_lookups(struct nvmem_cell_lookup *entries, size_t nentries) {} static inline void nvmem_del_cell_lookups(struct nvmem_cell_lookup *entries, size_t nentries) {} +static inline int nvmem_register_notifier(struct notifier_block *nb) +{ + return -ENOSYS; +} + +static inline int nvmem_unregister_notifier(struct notifier_block *nb) +{ + return -ENOSYS; +} + #endif /* CONFIG_NVMEM */ #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) From patchwork Fri Sep 21 13:40:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147269 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837545ljw; Fri, 21 Sep 2018 06:41:03 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYf0jW9rUDxXtWgHvEcta2PjfHY3AwclLWok55NICNCfUDy3Q7rznunJb9AsDIFGgyv1xg6 X-Received: by 2002:a17:902:7c07:: with SMTP id x7-v6mr44520885pll.113.1537537263711; Fri, 21 Sep 2018 06:41:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537263; cv=none; d=google.com; s=arc-20160816; b=kE9ZmU+vqtXPxM+j5CMLjB8wCSQIui2sZGOzCZeIW8P3+nkeK04J13O8ZiDEJXpij5 oAH31G1EZ+kC5rd6jdpZ35G9GwhxxPXxdt5/zZBWJu/rOCQ6LKcKmoe0FZoCqGUrVyqS KAUdHh6mK6bzq/a+J8eORttVHdXRMJOo+HOtEBo7uqSXPPW+m7H+0qlqZ0yX1/PWADz0 tpnwlEbUznMMxSewmsQ+RYnISu0H0j0RZEyi2okC7i8zj6B0eD9EirLRuow/72NJvDtn LdU09Vs6kKp1RIh7Jtn3diKxm/aRAfb43EGL0sUfGmtpetPXP8OUCpKYBcxMyoA287N5 VelQ== 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; bh=1QUCykCd+zPbMYhS3RXT52FLcWJbeQ6yo4GZXbZwr1A=; b=JYIYehbmt9mcfRvm1MHjVFmIl6IcYkE8EwNsQd+2/fksJV+syDdYwAP+2wdfLRKslw 1q2ygkL8Tz5IrUrdT9gdkphNT+QOTRZOxLEtUu2vrdzLWTmdJe4WJB1G5POQnh3AxxKR IqfAY6I1wEJgfmrTStKL+xPEBfhM35kSBa3ZU5kEt5BGhJbp0WtY3isrkqj84SrS+I0Y /8L1mp6dNt8Hi1uC1l9dzL0oyjmeXGk/K5xQBPAtrDCdpPP75FXpGOlkPNLgTu1ATxiZ sxARTZ25gWIK2FKzvICLHc6shu0TkQxDrjTsFeRO1y2J6K56nAkEHrWlVtP9/IoOPxGF y2rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hDFbQw6m; 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 w11-v6si1251229pgs.377.2018.09.21.06.41.03; Fri, 21 Sep 2018 06:41:03 -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 header.s=google header.b=hDFbQw6m; 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 S2390374AbeIUT3z (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:55 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:43795 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389657AbeIUT3x (ORCPT ); Fri, 21 Sep 2018 15:29:53 -0400 Received: by mail-io1-f68.google.com with SMTP id y10-v6so12200613ioa.10 for ; Fri, 21 Sep 2018 06:40:57 -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=1QUCykCd+zPbMYhS3RXT52FLcWJbeQ6yo4GZXbZwr1A=; b=hDFbQw6mOibqPkrlpjjf/6dkuwdxVYdllNgBKp4+vJ06ncLmGBIzI5xVjW97HhJQm7 du2eteRfuzrbJ0OPOlp6LOPEKsk800KOSkNCF/xmElrKP+1z5qqBpQ59tWULcQUEMvAW iFfB4+7mNt9ONUt/Wmvcr9PA46cRt44ngpDEY= 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=1QUCykCd+zPbMYhS3RXT52FLcWJbeQ6yo4GZXbZwr1A=; b=ItyXzRce+1EIgEtfsI6QThMKbseUjZfxhnfmI6W3UwdF9KxwSSdFZ0VXGqg9gWYZrq 2L/c/NwP9QOSrUqBpwXdHyLJjVUZZaLl5D4s2X6arwQz72PZ+wA9MRV3AfndTNmpihOD JjXctVhP0yJ8uFWSf/mwBM07HsDlhd9SC9NrqezR1rU8wbtOmUEHw+A9GJme//cKYJM9 mbV9KlLpqYFCBUudz+n3hWbjeTpkXArzfLgVubr7CVO22O35MXGqv2W/lvzl5oYildUe MmSpBt8VmsTluL9XKWCGjZ4r002mAdeIktClH987LsBrkovWsnugl7/xGjwkrHemS8GZ c1+w== X-Gm-Message-State: APzg51DX1DY6aMHsuCQQcEkdrcrYMfKFvdGvWxZXQx9eidsIv+vNyucE R8XQYKy2wWLrTQJOC23HBJG78Q== X-Received: by 2002:a02:b690:: with SMTP id i16-v6mr8785127jam.18.1537537257453; Fri, 21 Sep 2018 06:40:57 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:56 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 20/26] nvmem: use SPDX license identifiers Date: Fri, 21 Sep 2018 06:40:20 -0700 Message-Id: <20180921134026.4596-21-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Use SPDX license identiefiers to core nvmem files and remove GPL 2.0 license boilerplate. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 10 +--------- include/linux/nvmem-consumer.h | 5 +---- include/linux/nvmem-provider.h | 5 +---- 3 files changed, 3 insertions(+), 17 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index da441019b609..ea05219e60b4 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -1,17 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 /* * nvmem framework core. * * Copyright (C) 2015 Srinivas Kandagatla * Copyright (C) 2013 Maxime Ripard - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. */ #include diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index 0326b52e906b..d18caae2f7ac 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -1,12 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * nvmem framework consumer. * * Copyright (C) 2015 Srinivas Kandagatla * Copyright (C) 2013 Maxime Ripard - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. */ #ifndef _LINUX_NVMEM_CONSUMER_H diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 5c9f205cac8f..8ae012f6545a 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -1,12 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * nvmem framework provider. * * Copyright (C) 2015 Srinivas Kandagatla * Copyright (C) 2013 Maxime Ripard - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. */ #ifndef _LINUX_NVMEM_PROVIDER_H From patchwork Fri Sep 21 13:40:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147274 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837988ljw; Fri, 21 Sep 2018 06:41:28 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYamIpqXieBjLoUzN3mKhYUG+3fGYTiG1y+byQOhRBK7Swwr96XuWvSLyaV/TNWLarnOKKD X-Received: by 2002:a62:fd06:: with SMTP id p6-v6mr46675709pfh.167.1537537288017; Fri, 21 Sep 2018 06:41:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537288; cv=none; d=google.com; s=arc-20160816; b=BjVl5S7owmHxMdNA8yLv/ip4nG9gZzK8MJOwIh+XTAE0S4cgjeM37c40tfZGFukMMs NQU4zn398JDMtUT81GIdp8jsTJvLHgtrl1D+szEh8vHzYKVUQdZ/SgLiRYWGu/3nUvHj Xfvt40xWupG0vM8UuVjo47zxNg5VlNwlniyH+hLI1tW0SYkwhe0Bf5UlUezeXu1ID08Y LuHl2XgY+gv7IiuODdlntnN8tMzEex7NB9Xkk+Xf404GHxujsO31wgBHRtmiiylKNYOm KbFt8ee6k+j1WCxEEgM0Gv3E9/vrNqjGOwh+FDK0JAGX6ZCw0gKp3BZcAUWMVstiTXFS L8rQ== 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; bh=rYfkkRdXDRGe4eMcBTmCOIyJ++AOj8HTrI8YUTC2k2c=; b=pKK/1vD3vKpAcNB3QP3/q+sxn1uQRptL3JoPb2ryAefpIpe5cHoVACh+LU/W5bpjdm 7OHjI8Qyo5VVpfMkeIMM3klz5XPEX8SKR0f/uEkMuRALZaFJddu+pQlb12D1WJoDLcNi l/3sKx/fsCPOcFz829Wibo+Trx7F3/z10h1xrDSwt5srZojdqcV1VWwT7i2fjQyWwwgw j/+KvxFBNQDSwQDZqV9Lj2XtrLYX82Ac9yahVA2tFnFakwVBPm6MgddZfbdDSZwBD38J CSzrACgr+Vyp+cX02U1x1sMiF9B6hBh9lp4lcraPPtcTFpLtgJoN5V6MjitWLigRP4X0 GSxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PGtLAAB6; 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 j3-v6si26087992pld.402.2018.09.21.06.41.27; Fri, 21 Sep 2018 06:41:28 -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 header.s=google header.b=PGtLAAB6; 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 S2390359AbeIUT3z (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:55 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:51107 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390344AbeIUT3y (ORCPT ); Fri, 21 Sep 2018 15:29:54 -0400 Received: by mail-it1-f194.google.com with SMTP id j81-v6so2001975ite.0 for ; Fri, 21 Sep 2018 06:40:59 -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=rYfkkRdXDRGe4eMcBTmCOIyJ++AOj8HTrI8YUTC2k2c=; b=PGtLAAB6HkSTOzqWPzEk4AdRYYfemoPDa9bcyjBu/ZwstdWGTVSf8FzWX3e5ILLB3U 892+PASxEphJ7OOAJiX0kAmo2bk4gfuToEk3k372h3eEDrgymPXfgqwkBpH+IiwdfcZQ DSxUCaqffhiA2gIhdjoQKFkEU3gQreUGPjBwQ= 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=rYfkkRdXDRGe4eMcBTmCOIyJ++AOj8HTrI8YUTC2k2c=; b=m0RGnqfSz64Hb90aQ73WlQs6i9CzEwczD7nyn0mPJwmS15OtS/e8iHvIANCKjZqGNU 7yJj+fk5HlUln8Acteho0LW5xR7tnsD+IWAfSdKn75tjLGMqkLMhYo+3Nm7heFpT29JG 68Xjx2itl/xL/B0nE4LHL85ThXCBG2c4dGEQwVtRZxDtQtEnZHPKB4lpDaRBn9jRJ9V6 6fRieiqaUk40b6uJLY69zMEBkQDaES0IzZY+6uKMQRQNzTherd0mlRqWKTko6kZ6WuaV bo+RnNJUYh/BKQSbG0udK7CJ0fEwLRc1/H5u/BgtjD6oEh0EQUULDI6qpnUDw3bHj5jK haBw== X-Gm-Message-State: APzg51CO9QzdPS1WJDvAbDffQB6p3w88JJUat4Eba5PiC6/m9hPn+DTL 8jSIR2cNDNNPBTq2YFLDtlcXMA== X-Received: by 2002:a24:e904:: with SMTP id f4-v6mr5870844ith.19.1537537258626; Fri, 21 Sep 2018 06:40:58 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:58 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 21/26] nvmem: make the naming of arguments in nvmem_cell_get() consistent Date: Fri, 21 Sep 2018 06:40:21 -0700 Message-Id: <20180921134026.4596-22-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski The argument representing the cell name in the nvmem_cell_get() family of functions is not consistend between function prototypes and definitions. Name it 'id' in all those routines. This is in line with other frameworks and can represent both the DT cell name from the nvmem-cell-names property as well as the con_id field from cell lookup entries. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 27 ++++++++++++++------------- include/linux/nvmem-consumer.h | 12 ++++++------ 2 files changed, 20 insertions(+), 19 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index ea05219e60b4..ff21402fbd7d 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -977,16 +977,15 @@ nvmem_cell_get_from_lookup(struct device *dev, const char *con_id) * of_nvmem_cell_get() - Get a nvmem cell from given device node and cell id * * @np: Device tree node that uses the nvmem cell. - * @name: nvmem cell name from nvmem-cell-names property, or NULL - * for the cell at index 0 (the lone cell with no accompanying - * nvmem-cell-names property). + * @id: nvmem cell name from nvmem-cell-names property, or NULL + * for the cell at index 0 (the lone cell with no accompanying + * nvmem-cell-names property). * * Return: Will be an ERR_PTR() on error or a valid pointer * to a struct nvmem_cell. The nvmem_cell will be freed by the * nvmem_cell_put(). */ -struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, - const char *name) +struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, const char *id) { struct device_node *cell_np, *nvmem_np; struct nvmem_device *nvmem; @@ -994,8 +993,8 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, int index = 0; /* if cell name exists, find index to the name */ - if (name) - index = of_property_match_string(np, "nvmem-cell-names", name); + if (id) + index = of_property_match_string(np, "nvmem-cell-names", id); cell_np = of_parse_phandle(np, "nvmem-cells", index); if (!cell_np) @@ -1025,27 +1024,29 @@ EXPORT_SYMBOL_GPL(of_nvmem_cell_get); * nvmem_cell_get() - Get nvmem cell of device form a given cell name * * @dev: Device that requests the nvmem cell. - * @cell_id: nvmem cell name to get. + * @id: nvmem cell name to get (this corresponds with the name from the + * nvmem-cell-names property for DT systems and with the con_id from + * the lookup entry for non-DT systems). * * Return: Will be an ERR_PTR() on error or a valid pointer * to a struct nvmem_cell. The nvmem_cell will be freed by the * nvmem_cell_put(). */ -struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *cell_id) +struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *id) { struct nvmem_cell *cell; if (dev->of_node) { /* try dt first */ - cell = of_nvmem_cell_get(dev->of_node, cell_id); + cell = of_nvmem_cell_get(dev->of_node, id); if (!IS_ERR(cell) || PTR_ERR(cell) == -EPROBE_DEFER) return cell; } - /* NULL cell_id only allowed for device tree; invalid otherwise */ - if (!cell_id) + /* NULL cell id only allowed for device tree; invalid otherwise */ + if (!id) return ERR_PTR(-EINVAL); - return nvmem_cell_get_from_lookup(dev, cell_id); + return nvmem_cell_get_from_lookup(dev, id); } EXPORT_SYMBOL_GPL(nvmem_cell_get); diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index d18caae2f7ac..e17617fa034f 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -55,8 +55,8 @@ enum { #if IS_ENABLED(CONFIG_NVMEM) /* Cell based interface */ -struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *name); -struct nvmem_cell *devm_nvmem_cell_get(struct device *dev, const char *name); +struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *id); +struct nvmem_cell *devm_nvmem_cell_get(struct device *dev, const char *id); void nvmem_cell_put(struct nvmem_cell *cell); void devm_nvmem_cell_put(struct device *dev, struct nvmem_cell *cell); void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len); @@ -91,13 +91,13 @@ int nvmem_unregister_notifier(struct notifier_block *nb); #else static inline struct nvmem_cell *nvmem_cell_get(struct device *dev, - const char *name) + const char *id) { return ERR_PTR(-ENOSYS); } static inline struct nvmem_cell *devm_nvmem_cell_get(struct device *dev, - const char *name) + const char *id) { return ERR_PTR(-ENOSYS); } @@ -201,12 +201,12 @@ static inline int nvmem_unregister_notifier(struct notifier_block *nb) #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, - const char *name); + const char *id); struct nvmem_device *of_nvmem_device_get(struct device_node *np, const char *name); #else static inline struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, - const char *name) + const char *id) { return ERR_PTR(-ENOSYS); } From patchwork Fri Sep 21 13:40:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147275 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp838017ljw; Fri, 21 Sep 2018 06:41:29 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbkpr4qYW+S4gn9CPljtntDyYr738ZKNrw3KrjJHGMz5YKLnbW6EknNEC3UWWEssy4RzhmZ X-Received: by 2002:a63:c14a:: with SMTP id p10-v6mr41673355pgi.305.1537537289663; Fri, 21 Sep 2018 06:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537289; cv=none; d=google.com; s=arc-20160816; b=t8MrWUbnc3rmWaLFVJLvQY7+EPSrd3bZ4t90n5joxcGAojKAH3YaKThPoV4ufajylb BQZUXdpLQBZrudjowmf+z1DearIdydfuFJYaJxjNIZigoFiD1w4k3no/WLow5d68Zukm skGENKUWS/c4EJUR24BH9ANn2Nrb1xWzM6dN8SKdT4ukFCu91Fg3Zdpv7E1HWTbMky0p cM8DUp7yr8g+rxd+v/ZPD+chAtRKmBtDQ0VZRVU873StBOSdDLxF5jTJicVOSyEbvdKx Xo0FqA4dkyQp6w87NqmQP1VJkjJGz312ogvCwba4ieVSK0TIPRCxWuY5Dyt21bjycuMW 7M1Q== 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; bh=oNzBGYfihuawjyk/eCJAx/BEOcMsD5l1BxHm2sP+SPE=; b=tFW9YonHE2CIk7G9+Tb4pPtvxnn46a9O2pTmqpv1s2lpCUcWO4NkKGcuI3KGHjL5ug PmaNk6USL8dyPGJri3OkHdZ/1Nnvkr/dnNY93zspYTj6bZ31ZH/H8LvYRts3f7PIavuh g2XzAWKkPYvtYlwqzB9uQgOt8NPjy1W4d8lpTCOQPRd7Fl0WoETeTSUR97xIYWLzgN6H 53zVGKnY8rJqwSiLcNRt7otT1GEnN14Mn9GPkh7zkK/snh/AwrvcS3Ei1DAkfUM7lj/w 01D5yVg73mxedDIBQgNU7foB7HxkH7wgG/JjovhA9ksNigELZq3uT6Eq8I0iYE4yR6+D JiCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kG0RuytN; 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 cb14-v6si29608068plb.178.2018.09.21.06.41.29; Fri, 21 Sep 2018 06:41:29 -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 header.s=google header.b=kG0RuytN; 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 S2390445AbeIUTaV (ORCPT + 32 others); Fri, 21 Sep 2018 15:30:21 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:52113 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727392AbeIUT3z (ORCPT ); Fri, 21 Sep 2018 15:29:55 -0400 Received: by mail-it1-f196.google.com with SMTP id e14-v6so1998580itf.1 for ; Fri, 21 Sep 2018 06:41:00 -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=oNzBGYfihuawjyk/eCJAx/BEOcMsD5l1BxHm2sP+SPE=; b=kG0RuytNiqPZF0EWBZu0w4pNEoDzXYRk2lp8weJQ3KsrINeTJCKiYbQFS93Zju+Wo8 TAr8/d5/vPhE7O6fPkXVN2wPaF3H3n/VfeNa213BMash6kIWX3TOqaRVWIh+YIs6Ypmu u4r1mwzAs33ttH/jpPuaWaTDNrHtlwzyMvp5k= 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=oNzBGYfihuawjyk/eCJAx/BEOcMsD5l1BxHm2sP+SPE=; b=K6K/rmhahyh8lx9Ju5flyO6Ahk10NCphJ4imK0TPkM/HwV/XTrEdeA1d20fvjHtPRv ca0r+/fslwvWdwBtS1cdsmTFu4jxCldBDNknz8cVYAljt7yR6GUN18fnIcjfDyXyCRUv 5oHktFOzMTEideP4/7j01O3bGCyRfovtQcl/CAm4W5CyUqZKCfjtqbrpa75fVaiOkUl1 dN+GIx1fki57NWGrZZGjBf9NUsQvP5K547oEKBP5XtT6rCk7k4BNGnS3e7jT5Xn0hgR3 Kbt4T4sooksd/S6pJbJEfwgq1AmysFadioHB5hEPsxGLHg2pVcdSWqrlBbwD7bMezX3T a5Kw== X-Gm-Message-State: APzg51Ca2i0eGDl2ro9JtWlfr3msNMi7u/+7Fhx8TEjSaYn6VQLeRaPI NaY4b7DQJknZhZEXukip47rLkg== X-Received: by 2002:a24:5c8d:: with SMTP id q135-v6mr1594167itb.93.1537537259723; Fri, 21 Sep 2018 06:40:59 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:59 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 22/26] nvmem: use EOPNOTSUPP instead of ENOSYS Date: Fri, 21 Sep 2018 06:40:22 -0700 Message-Id: <20180921134026.4596-23-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Checkpatch emits warnings when using ENOSYS. Some of the frameworks started using EOPNOTSUPP as return values for API functions when given subsystem is disabled in Kconfig. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- include/linux/nvmem-consumer.h | 30 +++++++++++++++--------------- include/linux/nvmem-provider.h | 5 ++--- 2 files changed, 17 insertions(+), 18 deletions(-) -- 2.19.0 diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index e17617fa034f..312bfa5efd80 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -93,13 +93,13 @@ int nvmem_unregister_notifier(struct notifier_block *nb); static inline struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *id) { - return ERR_PTR(-ENOSYS); + return ERR_PTR(-EOPNOTSUPP); } static inline struct nvmem_cell *devm_nvmem_cell_get(struct device *dev, const char *id) { - return ERR_PTR(-ENOSYS); + return ERR_PTR(-EOPNOTSUPP); } static inline void devm_nvmem_cell_put(struct device *dev, @@ -113,31 +113,31 @@ static inline void nvmem_cell_put(struct nvmem_cell *cell) static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len) { - return ERR_PTR(-ENOSYS); + return ERR_PTR(-EOPNOTSUPP); } static inline int nvmem_cell_write(struct nvmem_cell *cell, const char *buf, size_t len) { - return -ENOSYS; + return -EOPNOTSUPP; } static inline int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val) { - return -ENOSYS; + return -EOPNOTSUPP; } static inline struct nvmem_device *nvmem_device_get(struct device *dev, const char *name) { - return ERR_PTR(-ENOSYS); + return ERR_PTR(-EOPNOTSUPP); } static inline struct nvmem_device *devm_nvmem_device_get(struct device *dev, const char *name) { - return ERR_PTR(-ENOSYS); + return ERR_PTR(-EOPNOTSUPP); } static inline void nvmem_device_put(struct nvmem_device *nvmem) @@ -153,28 +153,28 @@ static inline ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem, struct nvmem_cell_info *info, void *buf) { - return -ENOSYS; + return -EOPNOTSUPP; } static inline int nvmem_device_cell_write(struct nvmem_device *nvmem, struct nvmem_cell_info *info, void *buf) { - return -ENOSYS; + return -EOPNOTSUPP; } static inline int nvmem_device_read(struct nvmem_device *nvmem, unsigned int offset, size_t bytes, void *buf) { - return -ENOSYS; + return -EOPNOTSUPP; } static inline int nvmem_device_write(struct nvmem_device *nvmem, unsigned int offset, size_t bytes, void *buf) { - return -ENOSYS; + return -EOPNOTSUPP; } static inline const char *nvmem_dev_name(struct nvmem_device *nvmem) @@ -189,12 +189,12 @@ nvmem_del_cell_lookups(struct nvmem_cell_lookup *entries, size_t nentries) {} static inline int nvmem_register_notifier(struct notifier_block *nb) { - return -ENOSYS; + return -EOPNOTSUPP; } static inline int nvmem_unregister_notifier(struct notifier_block *nb) { - return -ENOSYS; + return -EOPNOTSUPP; } #endif /* CONFIG_NVMEM */ @@ -208,13 +208,13 @@ struct nvmem_device *of_nvmem_device_get(struct device_node *np, static inline struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, const char *id) { - return ERR_PTR(-ENOSYS); + return ERR_PTR(-EOPNOTSUPP); } static inline struct nvmem_device *of_nvmem_device_get(struct device_node *np, const char *name) { - return ERR_PTR(-ENOSYS); + return ERR_PTR(-EOPNOTSUPP); } #endif /* CONFIG_NVMEM && CONFIG_OF */ diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index 8ae012f6545a..1e3283c2af77 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -100,7 +100,7 @@ void nvmem_del_cell_table(struct nvmem_cell_table *table); static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c) { - return ERR_PTR(-ENOSYS); + return ERR_PTR(-EOPNOTSUPP); } static inline void nvmem_unregister(struct nvmem_device *nvmem) {} @@ -114,8 +114,7 @@ devm_nvmem_register(struct device *dev, const struct nvmem_config *c) static inline int devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem) { - return -ENOSYS; - + return -EOPNOTSUPP; } static inline void nvmem_add_cell_table(struct nvmem_cell_table *table) {} From patchwork Fri Sep 21 13:40:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147270 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837562ljw; Fri, 21 Sep 2018 06:41:05 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYU1s/cJ3hGIek+d9cqwnqjzWjVBUiaGMDCbwshqGyOe6nK43kU+HNeZQF0+F/90SkGRZMN X-Received: by 2002:a17:902:7e06:: with SMTP id b6-v6mr45416088plm.230.1537537265283; Fri, 21 Sep 2018 06:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537265; cv=none; d=google.com; s=arc-20160816; b=ZpcfGstiozw4HBCkIRl0vZm6hUMTyl4/wYK60P7AkfwFPAwz1H3O2zjg28/nCBuj+G HUnCOAQCtBBEkKNXOVskJc4cq6GkXZNAiCXAvssq5aTeSPbedP6pH/z+tyMjKZNL+O/B fOOHaQzxaKqst8avxangJAywnHlzEKSUkcZ2FdCQ77ipGijjVDPrcaKHtoZbPTo7zhTe PpBxsfTAYXc1wl1GMNzzlbLqQaNJWfN5G3OFnrsLRCoNKPgrFkm910cNFoNrcWVeqNrq oXnEOrgsj755gYkaazqaGUKngpZSA4UpsLCFRTnGdlIsGZ7riQB0T/WPhlyJIDqwrZh2 W/gQ== 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; bh=NQJQYueES4psX0iGxyT2wAKnP/SWUtQBqBYjkByNhug=; b=C5YSSBxLH+6L/hirSuaW2mMMFSo0BQSNqNEQ3x/tMFsB030wW6TiuVcdjZ4IcoI+br WtSfpBit/0hYE9q32D0GDnbjvS6fYG5c1+H8KFHDUw3roqSMkM4RiM2xvYmBvy02bOn3 3jRTaQfJ/aQj+dlqOipXu2m3iPTgzWUlrS2YB2o+C87cUjf3XWK0P5CA1vwfWq3g+xog MmAekoNDJe1Qb4QGZMTChqSZmJtDd7pWdVUNvJBZd+21ztp1kTBLgwCxZv9Pd6qjaMOB h2lJlNoxpPELkZyQRdZw3hOx9pMt+qLwPN6aqyoIBcMOXLH917sG7q7mQHY58jzFaYWL 02vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WDIreCev; 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 e30-v6si780353pgn.594.2018.09.21.06.41.04; Fri, 21 Sep 2018 06:41:05 -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 header.s=google header.b=WDIreCev; 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 S2390391AbeIUT35 (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:57 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:37159 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389657AbeIUT34 (ORCPT ); Fri, 21 Sep 2018 15:29:56 -0400 Received: by mail-it1-f196.google.com with SMTP id h20-v6so1932783itf.2 for ; Fri, 21 Sep 2018 06:41:01 -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=NQJQYueES4psX0iGxyT2wAKnP/SWUtQBqBYjkByNhug=; b=WDIreCevCdOq9+pFiUQ3+dOq76o2JZUpWEGf71pQ6GGu94MyY7yrke0XCm9scLM4eA XjuTkq7ehnAYm+NUbvEuK4FwxTdgt/SsBNk0M34L/TFz8cntfhSisVKyr7j32zF6YOMX hRlMry2BxFXHolNbPiRDo9DnQ/d4ZMlSMsapM= 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=NQJQYueES4psX0iGxyT2wAKnP/SWUtQBqBYjkByNhug=; b=Bva/Zu4z9kiy24mUiAFm2cvEFuen4cd0REVms5YIDc1UeQtmxqAD++VLy7LWmRxmJ9 2/b5dCxJra2xonOIENAbnx/KhAMedZxktNScnZO9n6ZfzD/uPYMNswB+PpsInRNKvelO NTr/F2DkIVcjjDgKRPiIZ/7Hmq2mqQNEiqC4amZ4rHy8Q7pWQDRIq09E/G5LeR9p2HUd JMsvSnkoiyy16F/5OQYAaX5PrTDAV3+b3lzzKi8Pns0jjbVquXNGZFk8hSOkLcuZgaAv cpc3tdiKb7fa9F9hdegeRnvxZqAkcBXouHdRATjeA5HPRIoAv/V1yIqytrbXAX5C0loF OhKg== X-Gm-Message-State: APzg51Cc7+qUAOCznfFViUybeHJHXjpJ03oiSuRoevdVV/I8xJVBzcp0 gnUkqJjS21yuB3cD/ELqjO+wUQ== X-Received: by 2002:a24:90c6:: with SMTP id x189-v6mr5939272itd.108.1537537260951; Fri, 21 Sep 2018 06:41:00 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:41:00 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 23/26] nvmem: fix commenting style Date: Fri, 21 Sep 2018 06:40:23 -0700 Message-Id: <20180921134026.4596-24-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Remove a redundant '*/' as pointed out by checkpatch. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index ff21402fbd7d..e44a1860a2b3 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -1374,7 +1374,7 @@ EXPORT_SYMBOL_GPL(nvmem_device_cell_read); * @buf: buffer to be written to cell. * * Return: length of bytes written or negative error code on failure. - * */ + */ int nvmem_device_cell_write(struct nvmem_device *nvmem, struct nvmem_cell_info *info, void *buf) { @@ -1430,7 +1430,7 @@ EXPORT_SYMBOL_GPL(nvmem_device_read); * @buf: buffer to be written. * * Return: length of bytes written or negative error code on failure. - * */ + */ int nvmem_device_write(struct nvmem_device *nvmem, unsigned int offset, size_t bytes, void *buf) From patchwork Fri Sep 21 13:40:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147273 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837808ljw; Fri, 21 Sep 2018 06:41:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaotWCLyWrNiTUBEFlT6jhGhNMnLWP2Y2IzvxE3GhGUyZSz8y+Lyclxah0DSEaWNf7Xt+dr X-Received: by 2002:a62:3c7:: with SMTP id 190-v6mr46127973pfd.145.1537537276715; Fri, 21 Sep 2018 06:41:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537276; cv=none; d=google.com; s=arc-20160816; b=qI/cI6nMlbnn+FBRsl5ndh4EhnNd2Bx6c+ZSRu4RVaGQBCfxUaY9gYY0bu5nvLyj01 BDLMrtxwg0emz6ObxuNTvkn/LUumy9L52ZnHRWswX93Qk4NQPEaOh9djLq8KqGx2gklS ejUvHLl8O8LV7PB5sIWx2rvV9Pkjf9V/pE1N3My79LtnRyFgNm/oYzJ7m3a9NkQnBxwa NX9FSRPpDItnfHkF0bir/HtV5J6Un3+9fvpBDVbCDYeD5H9G93MzrrftJ8dhbPemM/oE NBdgBhhidiIcke6OgV82hVbKeXeILrLeKT78Esa21nl4G+oRUaOtWK6e/y0xEHWGINeo GXDA== 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; bh=H7nLG5v+XSqLrjx8hRfsy4SA1JMyZyl0jYSSKjsVG1s=; b=ZJx6l3SmMbF28RVLGHj+VhsuvkPQs1JMUnx8dfGQJgaXmdhFBhs0SYvUKXncjmuSZ8 +gLEvR5lD/yjYDtjy6VXb8P3Qs9CcwRc1ihKGuRlGgxIAw4SasbVPkGlP5qlWu/G5JVB 1VQJCoTBIBoOYrygkVLlIO6wpzo+L9cKheixtF50OHSobt6sVyb5tb0oVJCsaReWg2A2 6wykWZLP0cO0dNcr96UqVWDWl3tVF25EQzEGvkGNccC6n6IGoRtzSzBj6sxP+XyXKDa1 kwSMJEuS36u+jTFtAx0LtMxNMWBZUydVreKBHmEYurKAlPbJh5tp7m8FcBXveEYJohTw 04sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Aj9uvoe0; 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 j3-v6si26087992pld.402.2018.09.21.06.41.16; Fri, 21 Sep 2018 06:41:16 -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 header.s=google header.b=Aj9uvoe0; 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 S2390407AbeIUT36 (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:58 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:37162 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390376AbeIUT35 (ORCPT ); Fri, 21 Sep 2018 15:29:57 -0400 Received: by mail-it1-f196.google.com with SMTP id h20-v6so1932842itf.2 for ; Fri, 21 Sep 2018 06:41:02 -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=H7nLG5v+XSqLrjx8hRfsy4SA1JMyZyl0jYSSKjsVG1s=; b=Aj9uvoe0eLljVycNPUgMl8KfyKKtmTVjl4ncO91AB7s/R59ohfDeKrxHPC8grr6z5l IaxlVFM1EmQkV71zmYHKdXFd5xhmfi2OQWmhRdb7e6ycYAGDVXtGQqfI9cSCqta+BJVg z6BCyBXcGxKzHvJVpFirK41vRs+ob5SvC6h1M= 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=H7nLG5v+XSqLrjx8hRfsy4SA1JMyZyl0jYSSKjsVG1s=; b=exDQOibIZDqAeO+T8NR6qXxUOvYLhBoXNqpLohPheG9fn1Ca6PVOZqGsrq7aYS5Brl VKgjxEjdc2MwHarqMxFUd3PPAfOE0qGsjOwODTFraJUg1M07UuEpOmq4JCamZ100ADNx yH4PScBJZ8rrgsLugBHgrpG4w+XECreJeGkpoQfcZQWgKQs8sYoP1Tl8AqN6UcGcZm4D aSYQ96VjxyhfltphTgGPAbvvlYakGEzrq+kOETmQNm1qzlzRZBIaMRvHnffHLIa0RumP u5ZGn1NxAzDo9QK9pY5y+d8tFo78zI5+nmawzTBZ1HIvXw7rkohIZW9o2CS0ILOHVwx9 ZASA== X-Gm-Message-State: APzg51CF1AWWMe81Sgbgf278Ff1bqQSxu+0LSH5N2xKFg0t4WkL1EQg7 SgxXhkzcL3QSuwhwNtODdsELjw== X-Received: by 2002:a24:60d:: with SMTP id 13-v6mr5848982itv.1.1537537262087; Fri, 21 Sep 2018 06:41:02 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.41.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:41:01 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 24/26] nvmem: use octal permissions instead of constants Date: Fri, 21 Sep 2018 06:40:24 -0700 Message-Id: <20180921134026.4596-25-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Bartosz Golaszewski Checkpatch emits a warning when using symbolic permissions. Use octal permissions instead. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index e44a1860a2b3..ad1227df1984 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -154,7 +154,7 @@ static ssize_t bin_attr_nvmem_write(struct file *filp, struct kobject *kobj, static struct bin_attribute bin_attr_rw_nvmem = { .attr = { .name = "nvmem", - .mode = S_IWUSR | S_IRUGO, + .mode = 0644, }, .read = bin_attr_nvmem_read, .write = bin_attr_nvmem_write, @@ -178,7 +178,7 @@ static const struct attribute_group *nvmem_rw_dev_groups[] = { static struct bin_attribute bin_attr_ro_nvmem = { .attr = { .name = "nvmem", - .mode = S_IRUGO, + .mode = 0444, }, .read = bin_attr_nvmem_read, }; @@ -201,7 +201,7 @@ static const struct attribute_group *nvmem_ro_dev_groups[] = { static struct bin_attribute bin_attr_rw_root_nvmem = { .attr = { .name = "nvmem", - .mode = S_IWUSR | S_IRUSR, + .mode = 0600, }, .read = bin_attr_nvmem_read, .write = bin_attr_nvmem_write, @@ -225,7 +225,7 @@ static const struct attribute_group *nvmem_rw_root_dev_groups[] = { static struct bin_attribute bin_attr_ro_root_nvmem = { .attr = { .name = "nvmem", - .mode = S_IRUSR, + .mode = 0400, }, .read = bin_attr_nvmem_read, }; From patchwork Fri Sep 21 13:40:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147271 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837611ljw; Fri, 21 Sep 2018 06:41:06 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda02jLOYWs/mTDzAMIGyrGM27fcMe42AX7fa/u/aGrVKxsYD0Oi8CFAX1Fj8TOf7e9jbzKm X-Received: by 2002:a62:9e07:: with SMTP id s7-v6mr8150603pfd.110.1537537266687; Fri, 21 Sep 2018 06:41:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537266; cv=none; d=google.com; s=arc-20160816; b=V4B5pqq2dVddNZ0WZo4bjsQGfDIYDGFjVkEwb19LD2BwNUpmGASs8kIHRJa6OeR3iv 81HA8KE06D6vHsZ4Dk9j3ONsXjEeSqpmAdGff1V9Muo/Bx8P+uZJArs8amvSfYl2NJ68 frngCz0NeWzs7ExyupkXZsdzsXuQQvTBw6+IhAQSjwb24C+5BT+PdXK27fiiBtnrupPX 2hP56Vx0egLsq1Cf5NGAUvcmMPgcKSc6jmqodkwJQxWzOzafXCK9DmNEb/0iY6KgLk6x b6jQ7GR3LTBBzYSZNMPMIBvoLuL58iHBiHsfbpiFL2nMk4nuHoNs41SZr+U80PPec5SB DwYQ== 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; bh=3uDbLTzNxTj5EpbFkmxIXP5huf1tEDTFmj6fZv8t3Vk=; b=Nva1uH2y847e/2wMZ0LS/H4w6SGQI9qfRTtpgm8FezyDs4POMjgfdqhGzZLpYKxDoM gmD3b5wx5Exqjy79/MhhNSf7cKbVIUszb8IiLRzDUe7a5hmZy7Lv2JDGXq7/9yjPiW36 S4FU9c7KEuEmtV08+KEMlCJ4LD1jzazRniAo2V8OruhUUmhypWbLb0dveLJaJ1I3nLze KputBWxVmPbHXt2+jswxRUb4BzqRr1JVyR6sSE8sGpRkHA/1MAUp0kzlfswSGOsjJQPh 7riz+OFEV2VK2f4I2X6iWMZ/EM3ZkBRrb/MHfRNtLgGI9pIPCUv2fo3lbL8wcp/DTAAK L91Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VlMNkJr0; 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 j3-v6si26087992pld.402.2018.09.21.06.41.06; Fri, 21 Sep 2018 06:41:06 -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 header.s=google header.b=VlMNkJr0; 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 S2390422AbeIUT36 (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:58 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:51113 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389657AbeIUT36 (ORCPT ); Fri, 21 Sep 2018 15:29:58 -0400 Received: by mail-it1-f193.google.com with SMTP id j81-v6so2002187ite.0 for ; Fri, 21 Sep 2018 06:41:03 -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=3uDbLTzNxTj5EpbFkmxIXP5huf1tEDTFmj6fZv8t3Vk=; b=VlMNkJr0iVKdRxtmjRLashHgxEVWMK9U/Zw91zA5n0jDxzncwy3Yj3sAmQFP4OjCK7 wk9j3Hz7LENB4phV2xLeMMCIKHfwMRsb6LDrUMThpJ2eFAGUPF3wF3Bvxphwz/U2otXV MWhtDjNIi8wK78lQK3Uj3NQm+YLA98T7e3X2s= 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=3uDbLTzNxTj5EpbFkmxIXP5huf1tEDTFmj6fZv8t3Vk=; b=VxTDelhN0gGUWbQXmbIrR2t8tQtoNlUqfZl3nWXXRIqjNX1DI/VvqFiHWgnidU6vfH sW2E928z2xnA2IJyUy+Wo5o8fIr0BsxrQa327+zzG5whrAqwxNURtPOtYWDbaht2nAWc 3HGHkwe0x+I477f9IMZPNYtQB3+3r6dno229LaVvn+JXuSNETq9qJmE0sy4PNoTibPLN Qq51tnMDEv6Xt1DQbFKK/PMhnX0GAyJZw7akiIBX8PsTOjtk7T85RmfWPWHmfwXee1Zk U1Wjm+aVZ1ZmLcg4x+ro3Qjie6hskAwsFrXo8nJM8aHbzoxREX8efSs1YM9cFg3VYl41 T+Wg== X-Gm-Message-State: APzg51BYtlvQHZjvJwiwc//0JZDmzjv6fcCTHahkRQlvto0YFumNfm8n ell5zk9p3hPba3f0hpDpDyYCdg== X-Received: by 2002:a24:96c6:: with SMTP id z189-v6mr5614142itd.41.1537537263024; Fri, 21 Sep 2018 06:41:03 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.41.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:41:02 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH 25/26] nvmem: sunxi_sid: remove unused variable in probe Date: Fri, 21 Sep 2018 06:40:25 -0700 Message-Id: <20180921134026.4596-26-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Srinivas Kandagatla This patch fixes below warning: sunxi_sid.c:157:6: warning: unused variable 'ret' [-Wunused-variable] Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/sunxi_sid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.19.0 diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c index 1310f8af37f8..570a2e354f30 100644 --- a/drivers/nvmem/sunxi_sid.c +++ b/drivers/nvmem/sunxi_sid.c @@ -154,7 +154,7 @@ static int sunxi_sid_probe(struct platform_device *pdev) struct resource *res; struct nvmem_device *nvmem; struct sunxi_sid *sid; - int ret, i, size; + int i, size; char *randomness; const struct sunxi_sid_cfg *cfg; From patchwork Fri Sep 21 13:40:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147272 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837652ljw; Fri, 21 Sep 2018 06:41:09 -0700 (PDT) X-Google-Smtp-Source: ANB0VdadW8BRpDKYyqQ90A/S1fxaKgdYcQpHI/Md+poGeEE5Yv9YNRNJHSnlJKP1xBETvo4PyqyF X-Received: by 2002:a17:902:70cb:: with SMTP id l11-v6mr9398837plt.330.1537537269092; Fri, 21 Sep 2018 06:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537269; cv=none; d=google.com; s=arc-20160816; b=Bk9Q+Sgx0BWjfsabbmoY8XpYepU5NLb7nxEVtZuZoFX4XrW1hw1yowBcZHnqbzk8wj n+enGGw90wKELd1yCs975LhQaYkXc+kvMgDmzLvaE2XO9IjRzxl9jPKTnbc/yd0BI0sl qLwf97ixnDavop0kUcigfAiN6Fx7XvUKhwD6/bduoAdWaZqlaJC+CA6/qwsE5jz8cChP ybD3EyOIg/tFYoE/jFNH2ViHMbFtbQvRuXN85nIZQtZOlDM0zTxDFdmiqLdCJlSQHbXy 6l05BKpzgrg1OfQ50xzo83i7MbKcY9q85MRIQVhiY6g+q8W+8Lzyec9o0xTGQWZMTETl V66w== 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; bh=NTCthlsQ4NxuVZ0rEdDOEgk9ZVevHtsMIIbl81M9etE=; b=z8abDjS2TeXezvsONrQ2iAEtqqsmSocjdq44PFLPNBH5scRq8O04ZbvUU27/vU4RYZ lnT1r97Qesq+XxqAd7RZ2yRrhHcx6S1qTp7/hTIhkEgfqPGeVnFstpg0UDB4re0SYXy5 aq7kjZ+FXm+1gxlTLNfVsETALTG24MUOjNig//j2ciNWNMNW1UQ2wBdhap1QN3/Izzy+ oUyx10aigh3+9TSRIvJzGD56dKoA4CdsTuulj5jLx33yBsyXDsq+hgZqsszg9INAAl2F tef+DN7BJOg7nZhspV0iNMqlZU7fC/0SGGfLfQ3N4f0KFCr90S6IjOngh4sRmcZ6rrvt ryow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jKw3g0ru; 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 j3-v6si26087992pld.402.2018.09.21.06.41.08; Fri, 21 Sep 2018 06:41:09 -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 header.s=google header.b=jKw3g0ru; 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 S2390438AbeIUTaB (ORCPT + 32 others); Fri, 21 Sep 2018 15:30:01 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:52121 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390424AbeIUT37 (ORCPT ); Fri, 21 Sep 2018 15:29:59 -0400 Received: by mail-it1-f196.google.com with SMTP id e14-v6so1998874itf.1 for ; Fri, 21 Sep 2018 06:41:04 -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=NTCthlsQ4NxuVZ0rEdDOEgk9ZVevHtsMIIbl81M9etE=; b=jKw3g0ru+DaWYGSva7WRJUIz9I38AyS8QUSiQXdb5JARDa4L6dSYn+qBebXd43z6SB QGupkSfV1+MAPKWU8bc3AB1MvoBnWArT1BKAxfAD18BL1irP599SZsrlTQAki2YnGX9b MpL/WtDAb+k99dY08vrXB4ehKqEqrYCyt8yIY= 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=NTCthlsQ4NxuVZ0rEdDOEgk9ZVevHtsMIIbl81M9etE=; b=Fk8YQsNO6db0uukKrsHJ5+OQrZtVyMU1bPn3NcCKK5bGJdTsGxYurwDDPs/Yo72ABH 2sozkTCSwE8PwhduX2CYIKjY1rPO2SZzYKlY15u51w/meq1UJaFEGQztR+w7Wi8lH0pV gQ7u+LgtEAbcZmOtkK1py7e23CUvdTbP5yWM3vBoTsU6A0o4or/Lq0HfUvdLKS6PL8sE +2xTQICIbVONeU7A9zmGbLRQbvOSL+kcL+M9bGNDIVIWTetwcLgFqrbuTkpPjqY8N26T AFAd7tY/79zvZlXFoperv4bzkzm7FqmeP+Hc/yERiPDfAAvOMPKfacKayaLAV8E5292l Wkig== X-Gm-Message-State: APzg51CHMdhlzmho7onDOMj3S+RkrBdCHem6XO025MuldN0qajqs8NGm sv6xngO0QA24QCWWnh2DD+MikUaZJKM= X-Received: by 2002:a24:de0a:: with SMTP id d10-v6mr5670938itg.124.1537537264449; Fri, 21 Sep 2018 06:41:04 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.41.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:41:03 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH 26/26] nvmem: make nvmem_add_cells() static Date: Fri, 21 Sep 2018 06:40:26 -0700 Message-Id: <20180921134026.4596-27-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-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: Srinivas Kandagatla Now we have new api nvmem_add/del_cell_table() we do not want users to use nvmem_add_cells() anymore. So mark it accordingly. I guess it was missed in original cleanup patch. This also fixes below warning: core.c:355:5: warning: no previous prototype for 'nvmem_add_cells' [-Wmissing-prototypes] Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index ad1227df1984..cc815bb2eebd 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -352,7 +352,7 @@ static int nvmem_cell_info_to_nvmem_cell(struct nvmem_device *nvmem, * * Return: 0 or negative error code on failure. */ -int nvmem_add_cells(struct nvmem_device *nvmem, +static int nvmem_add_cells(struct nvmem_device *nvmem, const struct nvmem_cell_info *info, int ncells) { @@ -391,7 +391,6 @@ int nvmem_add_cells(struct nvmem_device *nvmem, return rval; } -EXPORT_SYMBOL_GPL(nvmem_add_cells); /* * nvmem_setup_compat() - Create an additional binary entry in