From patchwork Wed Sep 12 07:51:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596913 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B7A113B8 for ; Wed, 12 Sep 2018 07:53:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F137F28A11 for ; Wed, 12 Sep 2018 07:53:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4CA929693; Wed, 12 Sep 2018 07:53:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5DB3E28A11 for ; Wed, 12 Sep 2018 07:53:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Tb6iH7dPTLPcEFvti92PTAHnTjgwdsn2llxqG0kWUqg=; b=gT1FWv3MpL+afmt3tm2jOIay1J ec7xF5CZMLQtr9VNHuZJbR8NCa1ZtlzxsQJ7xCcte61PYy90HdGnTjg0mb41t7EXZutCc+nOibcmx Nwu/ewMtu+5eTb9tEfTV/iFKrVL4AB/wpvPa8S1ULr2ADcKVUvzVu9JokRhqOcnsnfyKF+Vz1fKwJ +EPNTzolIefbX3RqKL3JbWsZpF1Bm75ra5Aw4jgG8jfVhkTTjOXDDTIw9hvMfNljaeQbsh/zOMHYb 2eF7hlQ64pkcqECg2EG5fpDSfeJ82uMGnjJ0aW/mzcv7VSsPiZFr5TEj9KHu9aQN68LizYS534RLk AW+arqeg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzxJ-00059V-3f; Wed, 12 Sep 2018 07:52:57 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwH-0004MC-CA for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:51:54 +0000 Received: by mail-wm0-x241.google.com with SMTP id t25-v6so1225180wmi.3 for ; Wed, 12 Sep 2018 00:51:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ckie7x+arONEAftwpr6LcpA8Mb8Zyx+Fo4gw/6J/zcY=; b=zs6/61vGHBZTsYmpPbe28hWPy5qln7SosFQigSIWV4cZWoIMA0YgCjoQmf2MUN9xUc 61QRLLmGGMbbMJToneRfro/rbwpK15/wcCi7DiQ5wfsgL+RpeJrdztCLeeKGldxpun1j hJZkzvDRA2SUe3DGDeqI/B/H8fyZ1P9P6AxoZEHkOPwILDBbT8NAiTs3hwIbECH2qI3x 1UVa2acWNn43Wn2PXr4vKoqYTse8PSv2b25TajmpEGrcGMygdgzm0HAbgGts94EufDz2 mHR849VSZGUu7GpTFg8vPXRL0Dtmw8QP2073bqmaewCwBnZv864wYfYVL3kuqmOMrZab bWyA== 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=ckie7x+arONEAftwpr6LcpA8Mb8Zyx+Fo4gw/6J/zcY=; b=Hq710zEBkzZXTjh3ElKcE0Y30X3pf/Y19hkMV4Plp4zY10wE1vH0Nz+lGxzyn+bxxP UOVh4Wb+CncEmm1+AnJFbX/9IqR9i1X1srIpc9lxXkO+eNxEgjRWK0yk3EvmdSHyTzO6 Twpp7OwU0WAEnsucD9mm9EqoAXeQtqRl5PyisCbSccQgaIXZScQQX7s3xX1Ab67z7Ixf UkKwwcQITP9+GhJvRzyex7E6iWXiRn91947C9+9VOi6DXyZX7tILqI0WEoR3tQQSRtq6 jzZkEoo3QDmKGbN9K0nOSolJDFPDKCTWcS77p4huPBwpS9NgP563swSzp9SXQ0psbYy8 rDVg== X-Gm-Message-State: APzg51Amp10xZK8C3He7rbeGEjjausZkQJhqAcmF0UHgHaGeakQxWSr6 wpz9YxQqP8Se1dNxmuoFCevQFg== X-Google-Smtp-Source: ANB0VdZlpQ2VPazYZtBeW7AdYQ3u4wBswYXV9AigJF76u0oZm+I5V/qj1bM2ItdcEGtUvRz6jZTEQg== X-Received: by 2002:a1c:8893:: with SMTP id k141-v6mr754279wmd.36.1536738701788; Wed, 12 Sep 2018 00:51:41 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.51.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:51:40 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 01/21] nvmem: provide nvmem_dev_name() Date: Wed, 12 Sep 2018 09:51:09 +0200 Message-Id: <20180912075129.25185-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005153_418943_ADEEF295 X-CRM114-Status: GOOD ( 15.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/nvmem/core.c | 13 +++++++++++++ include/linux/nvmem-consumer.h | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index aa1657831b70..d96348ae0f37 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 Wed Sep 12 07:51:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596915 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7B8A13B8 for ; Wed, 12 Sep 2018 07:54:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C68612969B for ; Wed, 12 Sep 2018 07:54:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8B0C296AA; Wed, 12 Sep 2018 07:54:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 47D322969B for ; Wed, 12 Sep 2018 07:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=vQyENN+KvgdzC5Ks8yJCyG26J6cw/tq0dVx3xMVay3s=; b=eWDevcupMaJEynapP+NGQ6aMp4 OTCpVc+5065VsEjEbQfcwRgt8skuvQz9h0W0RK9I17MnD74ilMmb/Iuivhb3i2VdGi3Su9S2Hs8rW W2ZTZTsE7lwqp7jF1ENIejtmOx/NaFoyQQoE3wjGLWjMnMHzxhrMzgvgFppn4hn+Kl5hEsN48QMlM LkzT7vmih8CgspPl3OhiCdnKoGR1w/m9rrzwjq8i2edfT+q5y4X6HGFnkyh2kKefxczBbziX6aqS6 lDAslaG9ahCpFE2LVSpo0qLcobnibeaTi7C8OjXCBif8vN6dR93xMZMmepnzDokAkO7ERAt6B4giJ wrJT5fxQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzyD-0005Uy-AY; Wed, 12 Sep 2018 07:53:53 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwJ-0004Mf-4d for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:51:56 +0000 Received: by mail-wr1-x441.google.com with SMTP id v16-v6so900999wro.11 for ; Wed, 12 Sep 2018 00:51:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=To/SQLBCgeq0lnY/26X7cnEpcdLcDIuj/UXMlG3uaxI=; b=U5e4qxYZDq0sIHyWyZrFlnqVXVUPZTGpquDb26zZzLQdaJfq6Iw0UB2wJPzxl/BTy6 Fm2TOQabJk7wq7hk/whzNBenH4c8wybwsil1+pcqhCTVxVJVcp8VXblX5+iBl19NAobi MQmiK9eThd1W3wIOePjJ81//0CDPIuOU2Qix+mljM87cUfTSrYOUNEw6hkdUEz0UuijI lYiDG858c3/og51eoo+4l5WrI4GcdPMFTL900W01TLcO/uUwTG1MFrOsHk/fgeD+wEv5 /1etGhftAfq9sGHn0572rgOeyL4yFcyvQkMdZ+3geRc6XHEnqniwO1Q/wk0zbnrLgcAu f4Ug== 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=To/SQLBCgeq0lnY/26X7cnEpcdLcDIuj/UXMlG3uaxI=; b=OlnSwWMzNR7e52QW+JwQAgdn9iiX+AZgxHVMT0wikCv4Bj25FPjIB3YWeVWLbNwPaB EzQiyHGwi2Ba90LWgWNyzxoHN3x0ylxPEy5iHG9ltoA2cpglTByVRWEjZB2zmwecVZD2 lGIi3pd/ZroTu4JQGy8ixpj1ktZpwOTp5HOdamyfjkm42eJR2XeaY8+Twu42LPNyU30Q W/RPGW/E0yI7TuZk7NvQHyo7vNgQlBDwiCLy3k5MbOn9Xh3ZM+akakCj1vL3q4f/jBdK ugWVAxjwlngmuXxepDlG2JLmkNpxHJThPhV/XWqbC+rHbelThV+zKiOu5BY+X/GaCG2Z mtfA== X-Gm-Message-State: APzg51CHgLp+B0FXD6l+O+8CnlmAa50JM7OpbZFU0cgMkJgcwcHFuyaQ jLBLHf7tyz6Rhz5sUGNap8CaZg== X-Google-Smtp-Source: ANB0VdarJ0J0MvgBUorYHhtJphzZzqcXqTMzumPQBhHlJDxLQ35awmtqkI4Bzje4oHRh7PPtDzc5DA== X-Received: by 2002:a5d:55ca:: with SMTP id i10-v6mr530270wrw.38.1536738703451; Wed, 12 Sep 2018 00:51:43 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.51.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:51:42 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 02/21] nvmem: remove the name field from struct nvmem_device Date: Wed, 12 Sep 2018 09:51:10 +0200 Message-Id: <20180912075129.25185-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005155_194967_FEFFA96B X-CRM114-Status: GOOD ( 16.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/nvmem/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index d96348ae0f37..8987da0f7456 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 Wed Sep 12 07:51:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596923 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 815A113B8 for ; Wed, 12 Sep 2018 07:55:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73A40296A2 for ; Wed, 12 Sep 2018 07:55:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67FEF297B1; Wed, 12 Sep 2018 07:55:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F15D4296A2 for ; Wed, 12 Sep 2018 07:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=LtK98uOl3ZAUfGBQz1/TUquKPb/3SWs4QgjGc7zHoxg=; b=ovzju/i608xt39oa1I+Uxe+/6T TOAIkGJjTTEGTQ9/j+nYFlv7Lvot8EYXRfSROMdyx/JmNvfMT04tBNlz74DqhZ7x1p1j8ZoeWveCA I07RWpPpNp/Hq1pBL0FJeIAJELeMVPczkQXBvKBezDB/8WOGjdweQyz652vmb0nE2JBq1ZCPo+izG OLJo6rJc5vYsvnjUXCKm3uX3eZuqYNI1WkyfHLoDF9/FJYheUZ6xItWbnPEohQR5Et98t9K3O6Lgq jeBYDkstrOp4PODsJAd/8xPCxr0vrpa1JZUzutJAJlcc0KYUo7/LMnPK+LAvj+KMYSC0f9lnoSEj9 ZgJlOgUA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzzj-0006ht-97; Wed, 12 Sep 2018 07:55:27 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwK-0004Mp-Tk for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:51:58 +0000 Received: by mail-wm0-x244.google.com with SMTP id y2-v6so1258910wma.1 for ; Wed, 12 Sep 2018 00:51:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=j5VzygIMcTmrTIR1xvM1gLa6GSilUZBltKq95M6HHPU=; b=xfyQEbeSSIOhQjPm2M8xq5IuxCUW5ZE+jrYMUGwP3JswQrO0gUeb/Jv2OpMJbnaKTr Z1sdPfWiFUDlfwsZjKmewnL7Q7QXkcUX2Hwv8tOrA0WWcEw+ou7nnkMxzZROeoXlSNoM ByaUpxUgEM1kfKM27VGv9yQclzOIs8AObHcJkiQES1Wwd9q0rM4AIFMsq4yoskYLmyeQ qWmXU5SfV3WRBLfl/zkMNw/Y8FxrLPFsaadkB06Pbvpw5Szb7SCff+5RaNVfzH0cI4Ek HxqFrYTteZ3hrXLDfdADqmu0NjWfF/gP9lIPPLqLtiqzOA5Kc2Ph6GrZYWv5oov2a1aQ mCtA== 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=j5VzygIMcTmrTIR1xvM1gLa6GSilUZBltKq95M6HHPU=; b=SfidZiFLiMgoji0LfTMej+z67FBhKo1KDkSSEpBpt4/SjhAdShzg5o26SshTg6aYUy zi2gI3Tj2nYJQYX+nQlkHCAZcutfNr1inYlazalZjS8LVax9A+IEtFD60YLrhenqBkDO jBpoF+8jXpZtz1eLoDjsYKWg4VaQy1cyIOGByqqFDa1kcYaWBX34XPfzZjkvmRevouDn lwuuFpbsNLgFGf/zbdHQoRGSE27Vf6YRocj2CxNPzykWZA1YOBYwrTy2wxViHVFB6XiO SsgFX7lxL7gexVgl19JbWSfbuK7tCvUvXbVyI7/LI+W/sugdVzWKQupWUv0gndivRhLQ mRLA== X-Gm-Message-State: APzg51AYixuRn14Ed8ICnyRy1wmn6QuTPUCUTQMGwJyaefEzL0o91lg+ h7q974r3LEFeS3GsAZj/1A+bVg== X-Google-Smtp-Source: ANB0Vda8BtBT8qIYWfYEgPeRr6DolxslojMdC1lgwV8UoYlyVe/XBQO0mNTIUzrRxo+dGlXRhXcrUQ== X-Received: by 2002:a1c:bb85:: with SMTP id l127-v6mr696892wmf.156.1536738705210; Wed, 12 Sep 2018 00:51:45 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.51.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:51:44 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 03/21] nvmem: use list_for_each_entry_safe in nvmem_device_remove_all_cells() Date: Wed, 12 Sep 2018 09:51:11 +0200 Message-Id: <20180912075129.25185-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005157_013025_62AF3E5F X-CRM114-Status: GOOD ( 13.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/nvmem/core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 8987da0f7456..b69005367908 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 Wed Sep 12 07:51:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596925 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 19F9413B8 for ; Wed, 12 Sep 2018 07:56:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 079FD296A2 for ; Wed, 12 Sep 2018 07:56:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED398297B1; Wed, 12 Sep 2018 07:56:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 814A4296A2 for ; Wed, 12 Sep 2018 07:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=6loovYvtbR/an2ow4+5x2GwPQNLALxX6IquPAMZs5go=; b=sk3qrlLj1gV59X2hJsbhr+xbLX ACJjN29JftMezJPuQkeoECFAg7zpzWB7BfWuI19XyMRtncBhnZK9IS8pirQLiPsfyqV32C8wnPWIc ekBXEEsHeRrCamBBX/Mu4gq+K5aA8YcPHeecAPx1Ohs613yPLH3EAZP5B/9kv5rJvpCqx5hQxxVmb Skgc/QvgmE1wZbQwU5idemTy+aWDuvN9wUXzPpMks62crWOqIi3FYvAAKaV0y7qFG9eBe4404vU9j 8NkquK+EeLwpp2HGgax8gw1c7fXLqDc6InYOKxIHN3LFDY4mb4e6++5NnXRmHPkScIwCBzkUeNNLh SEPwddCA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g000Q-0007aa-CJ; Wed, 12 Sep 2018 07:56:10 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwM-0004NO-RL for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:00 +0000 Received: by mail-wm0-x243.google.com with SMTP id c14-v6so1237707wmb.4 for ; Wed, 12 Sep 2018 00:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LlD+NifSVaE3IfYdeYyWcCIMEiVmFR39vy4y8WN8rv8=; b=OJ1gcqKUTo9i439LzMcwsF6etRJBBp4US94hluDxZHEXDWwFhKCv4ZcQD7q20Ed16D ZWAfiAxGseknKWlw5zkrsDQBcwZ1rwPQuBjc047bnELgiOFUO0EOhmwmQIvcSxTvPBEB szAnPmGwQO0YBKF/xFGJdEpuKXM3S9nLsrzjjWnHujj1+nRAingIb/97B+dXF8zwV//k kmA2b7Y/pWm7Fj9XDOP4ey8U/3FJOdpMAcllYBvuUBW7+9MMQATrU4H4EuShkWTbJzAO dZvZuTuE+lYJWU2KZnDIoKxr1u7Re/bB85lpgwsDRUhJWEd8JtCA2Pit9ZJTI79co3H9 0bCw== 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=LlD+NifSVaE3IfYdeYyWcCIMEiVmFR39vy4y8WN8rv8=; b=aHW/7V7+l0O8Qqf/NE6PNGoVVDgbPCY0wDzORB3SgQ+MjFiYy8AArvaLa3yycNbIby LQXZjNQEkh6JJcBxDf1ACwXbbibw1ZqyoijUi66EplTkmQvj4x1XXlbA9odEDeehByjJ 3AQ8AEe5XuK8LeVxE01vm0GNS1E+Pz9E5m7ylsUCC12hYwbMf9BRD/OwjSLU2hhp5oLv XvDeNAAzFMse+ZLeuqr1rMdLI5QtSuvV7dVpUJbpYUEku0aV7+pEjHZRvFavr6bRZI88 MnZFauzVpC0uenEab00wRbrd3kUJPmepZgiXSCN4yieoNu/1XTwxSWJbHpoe0LfdSoCB tRYg== X-Gm-Message-State: APzg51ByVuhorwPpxA/Bi0OzH7HNCTxXixVboa26H6ngDS7NsfwMpB5V w/GuZhA68DHYZu9kSv8LbxyuUw== X-Google-Smtp-Source: ANB0VdYzXxZCwxoeF0Ng8W5MFFsYuUnxyL1JI3gJ+sW6XcEdvJoNMGndDT5TueCa37rM6Xxt8S9FhQ== X-Received: by 2002:a1c:1a48:: with SMTP id a69-v6mr711877wma.43.1536738707218; Wed, 12 Sep 2018 00:51:47 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.51.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:51:46 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 04/21] nvmem: remove a stray newline Date: Wed, 12 Sep 2018 09:51:12 +0200 Message-Id: <20180912075129.25185-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005159_005842_53AFF937 X-CRM114-Status: GOOD ( 12.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski There are two empty lines between devm_nvmem_unregister() and __nvmem_device_get(). Remove one. Signed-off-by: Bartosz Golaszewski --- drivers/nvmem/core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index b69005367908..b469f700c699 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 Wed Sep 12 07:51:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596919 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68356921 for ; Wed, 12 Sep 2018 07:54:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5674E296B2 for ; Wed, 12 Sep 2018 07:54:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 481D3296A2; Wed, 12 Sep 2018 07:54:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C3791296A2 for ; Wed, 12 Sep 2018 07:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=PIq6UtdxwIkWVpmUyGrh7vae5i72ikV7bJNM/5BwrqU=; b=WCyEXxzjfuR/I1pBzbTMXwh8Cb E8lfYnHRB+Rl7cjPYcr1DXmLf1TYvYJc5jpzOTwJ6kQe1VvwZLQdErFoUBKVd4bvMpf5FkqdXzOp6 xhF4a2xHkq2zQj4D9c9kYZyg7yQoVOGa3wnRw1vfvFn/q/7sUfJMVoqn+dkTbXlFMNCBhr6Xu3S72 2KRqvw1zG+GeEKIrUEyZ+THevQAMyFteAVkmEFufO6BUL72C9OhgmwpJDMJvcx+QATzJHzBt5a4Dv kNsWccOGL579M7nT4/72ZBWmXhEHlrpZ0K0WW5IGwCef4jnO7zcKGO0/XmFizgzMNBrNbvGtzCozb rKa6T+fQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzyv-0005mu-In; Wed, 12 Sep 2018 07:54:37 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwJ-0004Ox-4a for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:51:56 +0000 Received: by mail-wr1-x441.google.com with SMTP id k5-v6so908119wre.10 for ; Wed, 12 Sep 2018 00:51:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5hy1cImwFLaoJYAZMstJrgaN4xDvjcz+dii9EY6OQ8c=; b=XXvG6u2gG7rNv/I/2LwPIM9cDaetie4JtmDL1OdR66w0yhrzL6pIPyL6qvO29pwmol Ukimo+k1/7M+Z5B8sI6L97p2IIjILQq/0TTzp6QuqtX/3/R8E8L7cWJQsPVpCWV2ZGtk psGickRtJKX+Gx5GaL7ato3kN3bfSyPQrNDgiDCANTLyz0AKxbcddu3M9mEmOm+UW+P3 PqT1mkuYoN3rLAb+2Bd7ezIzlKBzbLmSSk1JAaKt6tD+uu3m6Qz/Ah2invQUxQdH140N 7VU+LEyrvHJiODoauHLMbr9T1Xu61MLZf2vUUQSSC7THhsxFHwKsi4QBu3+nFJRMiz4O Fvmg== 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=5hy1cImwFLaoJYAZMstJrgaN4xDvjcz+dii9EY6OQ8c=; b=tbGh+UQrPdl2fZ34moQQFOX+essP1h5pgExLKTufCoXBGI+wO/JWMyC2ICoHVCvsu0 mW8B1IOpE6hjZm1hMWtKYMUyLAt8P5nNW8MyzCEI6Vl8EgJUZI1d/L0MgFzKGJqFb+7Q Z/MuAQJAAZDgPioaSteZW/bJMWdt3zFCGnJFNbQAJdcss/VCWESeGtUTGjJnGIkSbZUA 99/W5JUerq75b+E08SBg2D3E96059V/jPt5JSAtPF9DKPYwqCLTROB0siL3PFfHMKG0d WJnG2VW7SAdeZw7Up38IdGg8m6FJb7/qXIoRhgtFJddlPnFNQqm8UGl+0Xt3hIXglXWE WCoA== X-Gm-Message-State: APzg51AZzBsGTOFT89MHDPmxq5jzyKhh90PNr4gqhth09xdMpa33yFBk d2JQ7QzYLGLlvKa9WxIUBd2QKA== X-Google-Smtp-Source: ANB0VdZQ31WUf+5NQRUNzqHvVsZvtEdKF3VvVrNP2ZlXhf1yxQQtvQhInfzTd2A5/hGMfg4XeepC4Q== X-Received: by 2002:a5d:490b:: with SMTP id x11-v6mr500134wrq.114.1536738712365; Wed, 12 Sep 2018 00:51:52 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.51.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:51:51 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 05/21] nvmem: check the return value of nvmem_add_cells() Date: Wed, 12 Sep 2018 09:51:13 +0200 Message-Id: <20180912075129.25185-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005155_221671_840805DF X-CRM114-Status: GOOD ( 14.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski This function can fail so check its return value in nvmem_register() and act accordingly. Signed-off-by: Bartosz Golaszewski --- drivers/nvmem/core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index b469f700c699..ffed8fa16936 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 Wed Sep 12 07:51:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D9837921 for ; Wed, 12 Sep 2018 07:57:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB215296A2 for ; Wed, 12 Sep 2018 07:57:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF3C129927; Wed, 12 Sep 2018 07:57:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 363DA296A2 for ; Wed, 12 Sep 2018 07:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=JWo4b7LYDzLmm1Qo5AeqgCBh/roaIOS0AzFW2ljPXz4=; b=UAbNnheBUowL0trYSvHda+uxvB 1USIy8rLRPmRILWKwSkMrMjqpjit4D22TNJgRhsaMklIsWzgovgdg4Y3C23ts+ZWn1pqmYdSLY82u 8N1Fbe/x4Oou0bM4vl19GOu4R1nit3wXSQm/2/aKA3hDMydLiYO6juz57MV4QbSO0xj44Ep2eTzuY BIDB8L1XNi6zkGQ3Sh9xQPvwmQF2Zvf354r+V+kskJs2xWdQicrDDv6iAEdAddmB9vW4dqHndKWhv +dSTaHfBZU5cTrWIlZO0NmSwQxDeuTZhP4cSv4iw8OzT514Hafr3JLhPsqIAO6XeYi2M1GcDftxLE XGfYJ4Xg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g001H-0007wO-Fp; Wed, 12 Sep 2018 07:57:03 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwT-0004Pt-Vq for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:08 +0000 Received: by mail-wr1-x444.google.com with SMTP id g33-v6so937814wrd.1 for ; Wed, 12 Sep 2018 00:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ItU0oQ7oWgVAhdtVOsH1jZ2YSN2mvMhQOChLXBHLTVc=; b=QKerVmLgEa9MhPpA5DrugeHfPPXHbPbl3lysNUipRnwfLAvdZCXFaKOpP1fHWrSbxA 1t0WY5c7PxqYiiBvmyAjjm4V7zZDLaAWEkCOobFzZJAzRsruKhWFO3cKVt70PhYlP2kc JYFjWfdjuDTHqjwoodzmsrr1DmxF+5hk3OY3GGi7ZVsHY2aJvYHU54Slsm7VZBsL95F6 xvcIl0fXUDy2CPRz7ZXn+QHKs4VZxF44r8nliNieuLpmeQH0q9zvD7S22UqSkie8Y3Of QHUNsWKAbbr6cxRSLYIVHQrCWk8tf46Gq3AE5XOA3bVYPSYY6qN3nVQWZCBn576/WW2f 4PlQ== 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=ItU0oQ7oWgVAhdtVOsH1jZ2YSN2mvMhQOChLXBHLTVc=; b=kTkS6RIReopxMOmTPj6UoZsjJ3xs+mJeEKaniJCnDvobeVrmIhY944W16xcdLNkD9e pIY1ISm3bYlgmxpP49Xw3H3xmcOqFl462J9c72xb7VAACEp5H7OFoJ639VMaFCSpAmyz MRrot+lIjqxE/9win4wBg9W9YHtRVphvJT2kaOcItK9PnFFk2bMdv3MgxKHXDLmIP6Ae nAoLYDmUX8UeKWGnJTlsxn+4tAKd9gx/NOlZQcxpWkoTTkOzoQYZTcmpFr15sRDvv/zI 4xGdVbdEcD/nyCOaa8uWlA4WV811ATxo5Of8WXjRjL9qx2qDETsNIrlg53ofMzyGIpFS kmEA== X-Gm-Message-State: APzg51BcdlNMfJqOFwqvs15tDprVfoCm8JsRAS2k0drEonypMr93O5bZ I5AsD8ocq2pKkmqs03gOWg8RVQ== X-Google-Smtp-Source: ANB0VdY3f4r+JIaMf98kujtiUQkmCan31/qtBuY/3w1ab+18PE5Y+YRrYfsMDJ+uoGbT+WJMhij57Q== X-Received: by 2002:adf:a644:: with SMTP id k62-v6mr521369wrc.78.1536738714185; Wed, 12 Sep 2018 00:51:54 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.51.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:51:53 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 06/21] nvmem: use kref Date: Wed, 12 Sep 2018 09:51:14 +0200 Message-Id: <20180912075129.25185-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005206_206830_27E6540B X-CRM114-Status: GOOD ( 17.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/nvmem/core.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index ffed8fa16936..552ffedce38e 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 Wed Sep 12 07:51:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596931 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B3DDB13B8 for ; Wed, 12 Sep 2018 07:58:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4501296A2 for ; Wed, 12 Sep 2018 07:58:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96161297DE; Wed, 12 Sep 2018 07:58:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 050A4296A2 for ; Wed, 12 Sep 2018 07:58:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=G/OgudrqnlaJKDPcEsO1ngPAck7SlmjDTUB/eooLbTU=; b=S7Z+lXdr87UWy5Q6xnH8yNcZyv 7rVLk2WM+ZTCIM5ayyLRVhxl95FquYA3GalEDcIww0+IBPLN6KdCkyUxe/xWFywFJYI5c1EUX1o71 CnvmRbSNi4G6AqnIBD8ej1hHekcoWAKhhgIkdije2B7Uaa9lliEhndB5SY77hg67+RAsudv/2JZpa BSYl8+cTM8RZ0T6l+5wjOuq/amxpbP2pfm5H7+pJzFGY8L6DFL8SACy1aWLTqNQi5C8voCtgiXrdG CDVHvv20s86IpYMWfAfRK1xBDmptPlfsUs6om5SXnw7is+yEeaUjifY1utz96l7nxHaRSDoIlejNw cOm65nfA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g002p-0000FY-8b; Wed, 12 Sep 2018 07:58:39 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwU-0004Qe-Us for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:10 +0000 Received: by mail-wm0-x241.google.com with SMTP id b19-v6so1244075wme.3 for ; Wed, 12 Sep 2018 00:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1PFkzde7HIbembuPSuldz/+wF0MJkUfGiNxQy31YmBk=; b=Dd7gl4SiLS2CTwbYqt8gDFxF41lxBpmvFFXyYZ3P2C/mGY9+tVdlm3eqOobDQK9OJ4 DpE4xBE3Ho0ccDT7IN4cCTwSieU/HJw6mTK7QFJ+60up39tV7S0b9tGzB+8zCgOVkEJ+ 6l1RTUokGr2sbJ3seQKkmmytvIA0CQc+SNyRkIXmodsd/u2s1qs14Xzim/BOolIHwsaY APrcYC5zVsgf38egRn041cZG5zBMfCjOjOhwiKMaOlM+xdHs/IztV9GmzjNzqD5z/VyK ywgR4ckPEO0ET3zASULpqtFLZtV3shVG0pvUyofAYWLVkqsTWBP7RsngAZxDR8rCraUf 7GfQ== 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=1PFkzde7HIbembuPSuldz/+wF0MJkUfGiNxQy31YmBk=; b=MhZXNsAYBT0XAbGf/d9XtzDuvlO0iWKL19l+JNt62fSbnaiHxBSl2+kq05AQbzkPFj 1yFnEOJcZXw74//e6kW76fe03q+lOW+uECAHZ+NGspr8trbEB0Ew9COZeZqeT+aL6hNz 4OvofDQMBlOilArpg/MB4UPh5a/h6fkbn8Z48455uR3VJnxWNEEi7Pyd++L9vSVgY+y7 pFttu5pis28eslikhLcCsrb1XWh6EEvHniDPMOACZ0IC3dWE/J1XY0YboKtLTt2zfzyd /5QidjeUda6uAeHs++TVsTD5KGFQhe9Sthi57W5qlA+1cyBEYPd1KJZgGx3JXTqL5O33 o99A== X-Gm-Message-State: APzg51DQ0DGJxY/L0UNikubUaBG+E9R1aDjziznwTrff9i9DHnXE1/4K wzUQyr+JmWEXmzpWL3yLgGSr4A== X-Google-Smtp-Source: ANB0Vda8oRA8IzsbDf0mP70ZuFj+ZhEMQ0NduvjVP9Z2klDOrntiWoEoEu62nPm5/7OviM7JUI2Oww== X-Received: by 2002:a1c:ca17:: with SMTP id a23-v6mr721806wmg.122.1536738715613; Wed, 12 Sep 2018 00:51:55 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.51.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:51:54 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 07/21] nvmem: lpc18xx_eeprom: use devm_nvmem_register() Date: Wed, 12 Sep 2018 09:51:15 +0200 Message-Id: <20180912075129.25185-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005207_069345_673ADD34 X-CRM114-Status: GOOD ( 15.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Use the managed version of nvmem_register(). Signed-off-by: Bartosz Golaszewski --- drivers/nvmem/lpc18xx_eeprom.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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 Wed Sep 12 07:51:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596943 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 81D2B112B for ; Wed, 12 Sep 2018 08:00:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73C15297DF for ; Wed, 12 Sep 2018 08:00:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66CB1297E8; Wed, 12 Sep 2018 08:00:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C8727297DF for ; Wed, 12 Sep 2018 08:00:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=k0zCU1Dtxok9bQ+qyYHXkh9wkIMHHtEWwu2W7UNkyG8=; b=KECP4F2Uxsqf55GylXkN1r0YqW SIGjLJhsG4iypRAG3bNjts5RqcmPMV7oaPRuZ4QBxHNU1jbCGkZJDKxy6YSUPWnLKpeqzHVxZIfEa 07RKxT5mN+ipZIwlt7p1Ekmknl12JOg8qsT0UfO1v/KnOgWVm4GpJCj1ztz+bpHya1EfEFICiFvE+ RYVOjUwnFG8EoVkg7IlAsokVu7hKlv2SVGdwEUhI/vTyPPINAABS4NZvrgIaeyvZs4ict6unBM+Kj 3RrXq1a1vDU/7Dn0DHSTkBJKjccIIKP0XgeTStLg6r0DsxREdNtKiAIIycWKKFmh8V28GrYsLSfuO /C/Da2VQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g004F-0000qs-8G; Wed, 12 Sep 2018 08:00:07 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwU-0004RM-Uv for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:10 +0000 Received: by mail-wm0-x241.google.com with SMTP id n11-v6so1235617wmc.2 for ; Wed, 12 Sep 2018 00:51:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=874CbkmyKCyBfTs9WgjHeXXK4p9vYZrCF79UGreNijg=; b=0fcmkAdGGjX6PqCjtegwJhJeQhl48mWkz1eQv+8PZwAHo/5hd+j3atP4b/u0VjmmlA MTal8Ku460qYWGwIeAL659rffFpPc7eez67ISXar9sEWrQzGRQ+54ICt+evGI/fpuxoj 2sHyzLW7feYy70LMaFSyjx3ca3A342/hAhIY4I8/ADzPFgPWouwsIon49aYIIAosIqTm F1IbwFbcxmxIs+kphF3MDOu+2hk6YTTd1r5DaE/imjpQLs+XlZHrpHp5qJ8F4s0xRPLt S4/PfwV7O1O0wwfNLqJ118AWdg9Ntyp6UIeZXn1w9+48I+FjfZ7lmpaxn52ylqhWjDKH c7qw== 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=874CbkmyKCyBfTs9WgjHeXXK4p9vYZrCF79UGreNijg=; b=qP47mZfNWgAOt4zSWPRIC9JSfEZDwGFR4HvUidD72MhY2U7b69D2HeKo9fej0toVou BBmG8a/ihzdoOOU0ZqIXQ6txwP7sdDyRkBLEBtzIvAfERUl2Ym5JOdLusrQ46mADGJUj CUNSL5ECSvS/Zcz3NkUVBsnt8EgnoJp4rR+zSaPNOTNHWlqMT88JwY/swxKF/KEAXZFS Oxnz0hCUfCvD3JuP9oRcUGKk6TCNYhXUln93tK+a7/y7X+LGBfFBSbShRcSPf8dndUJT 7lpxLJwMog/FK29p0dTQM4RNVKGPL9miX9d69sPyYa9Qb0C1WNB6xHG7LRhwUPBCuefr Wv4g== X-Gm-Message-State: APzg51BvAOWB5GKM+p68DoPypQgXpmr1nJq2+xASvIpvvsHAxaI0Zw3h lvTLFMRnovGGr2rBSssYfIPWEw== X-Google-Smtp-Source: ANB0VdbYu2ZmSnEPzAYWqzN/NKyhQxTv34ot517c7yXNzw9NIn7TMv4uhlcVQQW2vZSLwxUgs7tkKg== X-Received: by 2002:a1c:9c56:: with SMTP id f83-v6mr662825wme.135.1536738716982; Wed, 12 Sep 2018 00:51:56 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.51.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:51:56 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 08/21] nvmem: sunxi_sid: use devm_nvmem_register() Date: Wed, 12 Sep 2018 09:51:16 +0200 Message-Id: <20180912075129.25185-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005207_088508_CDF6E10A X-CRM114-Status: GOOD ( 16.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Use the resource managed variant of nvmem_register(). Signed-off-by: Bartosz Golaszewski --- drivers/nvmem/sunxi_sid.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c index d020f89248fd..0296c23db322 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 = -EINVAL; - goto err_unreg_nvmem; - } + if (!randomness) + return PTR_ERR(-EINVAL); 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 Wed Sep 12 07:51:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596941 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8203313B8 for ; Wed, 12 Sep 2018 07:59:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 690ED297DF for ; Wed, 12 Sep 2018 07:59:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CEB0297E6; Wed, 12 Sep 2018 07:59:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 02EFC297DF for ; Wed, 12 Sep 2018 07:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=V4U/VlmG5JWS3uODLSAR0HE88DftOmP2cW2rKHjWQRM=; b=LEQua1eDXwVMHU3JHjR3ai5TV2 RotllTw8sDY2/Bs2D9YNbZ1dwZ+fAJSMLzL/AgebzLiZabV18HQk2E6ZW6XxwAOCVa4UrXCmV1nIV nP1wuuniPLbfluy50/cLV9tsraoP671C/eRe2eBpEkGtSfXzs9J86kwy700rTWL6RczIuE6vyLfEk vQausU+4V2XCOS2gPJb+Vem9a8USl8n2lJ0IDR2YTFjKabJcvLLNlh6hnQ2gRQjY/zM3DM2muHryi LBcpGb+Yg4T8QHi1DglS1rTQS59u1faLAt/AN+qb8tJ+PAJjm/lMN4hV4HlKpJEggWDovyNwykHcI 714yqK0g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g003X-0000Wr-2X; Wed, 12 Sep 2018 07:59:23 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwU-0004Rh-Uw for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:10 +0000 Received: by mail-wm0-x241.google.com with SMTP id c14-v6so1238322wmb.4 for ; Wed, 12 Sep 2018 00:51:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=enYwgS0Z/OX0ykxo6KT1YIz+qVBOPAuLng+TvhpgC2Q=; b=wdLW1Tcw2CPABQPZEQhA4DxeaA1J71Qx4oJERKBJ5zwSWV8zhJXcXI/ra1B4w7/h8k FAxhpXCRzpKAnlqIWtg95+eUsuPXntQ4DOdbhpF1f6CHHEdlqUNO8+28MOxleaCKjXL9 40rijCgtPdmtHKODn4w+o6qar5Re33d0y0E1babeWA6yJOJiGPpZMbqCDibonOru95Hh W3ES6A9+wFr/GDHr8IFOeBHix5qlP0dgglHXzlruxJI5PxgJMwFFDxCQ14byniEWUSV1 R6v01dlVHyr9jL5YCbF6pffXXv5HDqc5UKOP9uO0md/DNcDP0Q6vNI26e7623tjgbNtK +luQ== 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=enYwgS0Z/OX0ykxo6KT1YIz+qVBOPAuLng+TvhpgC2Q=; b=sAFnjyKzFG7ZTg5R+UINRs1sZd3OuexIscArtu01UOXSlGc/j2dPeDF8buRdbzbXdB PmJ7Kgkd8Y8Y22z6NpIEToWzpzTXPc1X8dE/5ZdHckmk4yhXo0OnpmqbYDNYaR9W/tln ZYOtrUCFyoY2JEvl9GdT6czw1LxuTMZJJxo8OYf1/fqYFvPxELkYp25RF9kSZdInrh2s uZMq2gBkAv0I4zACZkeHIbqBlF0dM3ri922fEwtvsu3qQ8E9+Xm0Vc5qlAij8AdOyQFp bkCpEEQZ3+ONHMtDwgEZY+V0L8aNyzTR59BgxxTxb+vVesoditSwrYqMAmCIhCwuXHUv +5oA== X-Gm-Message-State: APzg51AQdr6dL6DKL/kVNznc2koOf+ei7T7MOHcR5s2RULRrBUBAbETU 8bAfsP84NEaoMPnt4Z7CXLAaZA== X-Google-Smtp-Source: ANB0VdZFFqyJaKSGzkYb3Y+wcOqFkd7zRny8K2kXHtqDE1Pz7BCT56tB2AAc2ku9D6MNPnpYKWD4KQ== X-Received: by 2002:a1c:3d07:: with SMTP id k7-v6mr749591wma.146.1536738718471; Wed, 12 Sep 2018 00:51:58 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.51.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:51:57 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 09/21] nvmem: mxs-ocotp: use devm_nvmem_register() Date: Wed, 12 Sep 2018 09:51:17 +0200 Message-Id: <20180912075129.25185-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005207_051095_336F590C X-CRM114-Status: GOOD ( 15.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Use the resource managed variant of nvmem_register(); Signed-off-by: Bartosz Golaszewski --- drivers/nvmem/mxs-ocotp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 Wed Sep 12 07:51:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596981 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 706B9112B for ; Wed, 12 Sep 2018 08:01:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60393297E8 for ; Wed, 12 Sep 2018 08:01:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5193A2980E; Wed, 12 Sep 2018 08:01:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C5385297E8 for ; Wed, 12 Sep 2018 08:01:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=PL81RU3CYsEhwq3aMUJfZ+xNYcvqIcRsh9xBbSnNrNk=; b=WbwwDcnAitP+QynUbjW9mVv3j5 VHLrEdLhiIwHQPUKKlgz+l9HNZ6+QrFju1HMXrOBmrgFYMjw3tWQbi5QLO8SzZotakJpoQehhZwLl BxLQbXSHU/Ij52FtcyO15SxXM5dCUE8+gW/HSvlDDLPE9W/5fgWS00ZZKQMdaty8gtlw1pVGhWoMu vMJIQ1aXHSmcjzNdqYftV9WLJeTVvb+zO4SF7/xv1h0Rk/OxU03F//iLJugVVWDpoTHAYrO3DTRjz phT94QFvp7nKcMDCSSYOFfHTKi2mcjUP37pXUtyhoH2rhPzL24Vi3JmH+X/fdpEHY4WmM1wKz674U 1BFyt2Og==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g005d-0002bE-6O; Wed, 12 Sep 2018 08:01:33 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwZ-0004Sa-An for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:13 +0000 Received: by mail-wm0-x244.google.com with SMTP id y2-v6so1259689wma.1 for ; Wed, 12 Sep 2018 00:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=k5yxIXhSHg7bpz4pLJ1Q0FLt3HidWjwucjgci+GeA8c=; b=af5vzXGaR5Frlti+DQ3wvprPAl5RfialBE83+2/EZFV3YsyuSiGI5sqA38YmPcsD1/ svi1+uuGsL3QIFWX8Ske6Ws/GikTz9MKvCN0ucOZhnyPLU+zxpFGcRPgrw2tqiJq/ihM jqe7cXPOgbdQEQPdj34wqtB7HAAa2ooc24nPACICJZzt1jjU0alpLcZL+6pSVZ4joAKU Wj7ruNOIMGrFFoqasLZG/Q1oD8OJpCEaoRqcRxAij5D8zbHVRVtzY+nYHLmD9L+TF4gr d1Y5GBr9Lux6lYZTM98nWDI403W1PwgDBs5Oi0d9WQoIbUUu4PMMzQGWN9gPF2cD6pmD XMHw== 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=k5yxIXhSHg7bpz4pLJ1Q0FLt3HidWjwucjgci+GeA8c=; b=AxDDjuOQqvsKBf8Q6vHTqa9/Lq51WDr7ZSjiF/64RkeQ9JH8ZQ5USArb1ySKZecRwB XgcaxuXiAgiIysVC8Pz85G2zsatdG8T5LVqzLLtbyi5S3H5Sou4ufrzqa6Q8Eo50RQww 3MIMTntoC4JrqfNp9d02SEhrMj1gnr0G5FOvDikTTNTWG2NgXICQ91GbD+AR1ClNmxFW h0jjckoGBP5aVK+go8ma0tD++yhgci6ryrSVO6FCsRlVh0JvExn+X6E1sMyAM/pQ6Z0n bI7slfvgZ40mp3CDQhPZvqfIVlJJCyWzeWoAaBYAzvfkCkDiYWLcgFGp1u8jcpkqVXnW kvYQ== X-Gm-Message-State: APzg51BU/4JMZ7dKqA90vShmvasYhsQOIDjpfn+c4aW5+77ujGJBor2c uD1gNv6PxjHROIlGV31y38LBnA== X-Google-Smtp-Source: ANB0VdYzD1Oqnd50HfQsossSncXp9AfGsuZx8m8Dn8JshEwtPYZovwPTJW5nRMo6u1rOru28lt2+hw== X-Received: by 2002:a1c:9215:: with SMTP id u21-v6mr703832wmd.106.1536738719900; Wed, 12 Sep 2018 00:51:59 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.51.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:51:59 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 10/21] nvmem: change the signature of nvmem_unregister() Date: Wed, 12 Sep 2018 09:51:18 +0200 Message-Id: <20180912075129.25185-11-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005211_426033_42C7BDD8 X-CRM114-Status: GOOD ( 16.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/nvmem/core.c | 8 ++------ include/linux/nvmem-provider.h | 9 +++------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 552ffedce38e..c950d54bb69d 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..033c9c3c80a6 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 ERR_PTR(-ENOSYS); } From patchwork Wed Sep 12 07:51:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596929 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4139A13B8 for ; Wed, 12 Sep 2018 07:58:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E19929423 for ; Wed, 12 Sep 2018 07:58:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D7822942A; Wed, 12 Sep 2018 07:58:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A8C4029423 for ; Wed, 12 Sep 2018 07:58:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=vOeI0raPCSQrIDtEHD8pwyeekfggZu+TK3r4e383vlU=; b=g1Z4SLHOBxMKXSwIJlxhaAVkAe o7QPKMT0kXtDEZ5QmTaIp4ncsBInXO7fKSrOkODlJ6O/cPgAdCzMKe/vZJEev5Gid6m3QFCSkeyWi mNWhjpdtqIfJ+hYRLSisVnO6g7CcjyBagXt4GzLRQLIjp2y8XaHmA0lL9wQPJ7lEB5rZPG4eVcWYc FlqD7PU7S6kRLcW9D9kMsyaGU2wEwzryye5wQ6KoUqFVb9N2x1DV52wqL0ZCF9QcVswzFHJcAY8uF nGhiCNeuafC3wQ6LxcE3jRwVLXmX4B/Zv5msim3D8RanqGEeH09K3JaB3e233EdP8V3FTOeqHXw3Z vG5kk9Pw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g0020-0008PX-DX; Wed, 12 Sep 2018 07:57:48 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwT-0004TP-Vq for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:08 +0000 Received: by mail-wr1-x444.google.com with SMTP id u12-v6so921530wrr.4 for ; Wed, 12 Sep 2018 00:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iacN5A7LU/wkiibiq8lC1h7AfXkWsMWEAz/JdUQ5Jmo=; b=f0t7ybkeDcxsrZtiPfr9XhApUN7VoI75Td7Tg8qUGRyNFEsiabQRh0tLycXKefP8JO 6W+qqeWf7h3cZxz8ZRXJqnHsO8LCXMFxVXwPe/bff8yrMNDpf73O03JYez2zjFzC4A/i cCQPAHzgRBU/B4kEtIfb+lUVg3m8wpkBIYz/KlzxMSKp9FOBFqbWAFYz3br4SvQD/0Qj K6xDwu4kqgFh1xC6ggHo/buOiq6QjZVbCz43WKpeABWWWzwpEzlLbtVXIu/RZ1k37ue7 wRJXOycPo1qZ6qzDE5cRNzf/aG+55tMQCvR9xdkouMVCZv7oi+om+KAKttb0SNg4XVcq iuYQ== 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=iacN5A7LU/wkiibiq8lC1h7AfXkWsMWEAz/JdUQ5Jmo=; b=MHF8z5rkwqKSeK4WmjTWmolPvyNQXBTOVB/g30yUsKsXWzvvtnh+DYc87pYXib2uOp apTeqjwYIjG6VMGKgmLpG53ONNana0SFhrNhMeEMl+wsz9ur2HxYb2up+oLwQBwitZNI XuTjSmwkdmUtQWlU2yzJg4Tc6oOApOBMD4g7GVICC1NYsuipFNbvTuAjR2LLF21Yw31u QvCxE6Dn6BLYQgMZ5tK7CQ4sVbxrOo+5NVgzYWUpq5TTByL4oIp3+IYLQGiDOWYKqAAs 3tj1QL5dTRJh9e+TAQGORCj9g/xklzN8eRJDCuFHd/Z8JXWc5ERjUlmsdckugmN6VTwz Rk3Q== X-Gm-Message-State: APzg51D2gDTkUu0p7U/rCFYDhsNwlmc/ZZQdIlkTuGuET2yisJYZTlK6 4Mhe3d2UwMh+oQZv2Q5TlleX8Q== X-Google-Smtp-Source: ANB0VdYXoUYOsOE7XelM1OGIdQbGWCTRmml+PEc2oh8xUbdPQXf86CZ9VyBSEC131V1xF7jMTerlyQ== X-Received: by 2002:adf:9c12:: with SMTP id f18-v6mr542703wrc.93.1536738721329; Wed, 12 Sep 2018 00:52:01 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.51.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:52:00 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 11/21] nvmem: remove the global cell list Date: Wed, 12 Sep 2018 09:51:19 +0200 Message-Id: <20180912075129.25185-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005206_194004_533DBFB4 X-CRM114-Status: GOOD ( 21.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/nvmem/core.c | 64 +++++++++++--------------------------------- 1 file changed, 15 insertions(+), 49 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index c950d54bb69d..585688ea2152 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 Wed Sep 12 07:51:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596979 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8C37A921 for ; Wed, 12 Sep 2018 08:01:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E7E1297EC for ; Wed, 12 Sep 2018 08:01:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71AA72980E; Wed, 12 Sep 2018 08:01:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B0A2B2992C for ; Wed, 12 Sep 2018 08:01:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=uRM+Z1/D4cia2d4W62309YgbT0YF6ZNTUaan05hFmlg=; b=ZAjTSKTSIXXZqTw3tnm3RIE0b1 2d8ZAGBgqo6ysbSzYhsHbI01t/ydfKEiJSwO7ZHK+EpZ3/n1Y9lkEnyKDGLpzOEBIXhXDnyTnDrzX p/lG0TVzbcLru18UpkDjlenOAGBzpLf1/UZkTjQpw2LKZ2EZm6WYc8AjE79AYqnSZZTB86tfT+n/8 E9S7BMb4lQKzn+Kuijc7ukpSykfI8LKFUxwPq3Kf8Gu1Oph+Je9/yXUpx9TYCVweJWWa8OajI0Izr mHTqz3Ux0GirhaciD/m0AvU1X5Q/vH/YSLddXB+qzLM2yFm7i+J1NDCyYFTKhMMN+eux5Wmzur0eR lLWvXzgw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g004x-0002L0-LU; Wed, 12 Sep 2018 08:00:51 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwZ-0004UJ-AQ for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:13 +0000 Received: by mail-wm0-x244.google.com with SMTP id j25-v6so9761510wmc.1 for ; Wed, 12 Sep 2018 00:52:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OpjSmMMz3ZEAvxqGc8CNl11ld9hMLbfGr3rUWVD1yZE=; b=p+guW6Ph7H5/z1LmsmfR7+rt5eVWhNfX7zkAjltQxYDtmjrDPiK91080DFjMHFIOUW Q41FF0CauJa2mHGX4RpIe0l3ADi2YnfBCZWRGCfqOhn06lGwQkNopZbMWc6T1jb4qNTr YY1ds4LAF9o3XkThLwHyQqnrtkLlME11Nsrmq7SrDSHfSKLAoWn9fZXsRFtoE7aPbDw4 Jwmn/u9plcou2f9XhnADQ9OlZhHWGZqOrWHYaKHRbJAQ4CwbgrNrmPN9aa6xS/fiomGm OgLKZwMgFleYyXsU/JPGQ/V+xp3yIWrJG7fX3ngMLbealemPXQbYwU7Nrp1koX6Xpl9I BfXQ== 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=OpjSmMMz3ZEAvxqGc8CNl11ld9hMLbfGr3rUWVD1yZE=; b=P0zHLcJuyYi8pumoc5Vhu/5NIS0A6rJdB2lS6Kbwk2uMqvYDRKlihGHUZAZ4MJGaPn 9geSpKpKS9etoA0Mj/TLWxEobvylQMCfK4BCclTWp/UTQWAJRTRwTVxsrhCLwBJgla1y +wQh73OoDOgF4QavaWiUUyG9LTk7hozFNUT8M899QnUMlNAUIscVNEGk11qwXr/pKDha cKXRfpT/oIRw/cqKUoeriaeTTb76g2dfSgD49kiw3ppmsEtb9jhnS9z9vMcFqkgTQcKg DafNg6RZ28vw3zWCAY+X5KpnTV6Eyu3VEHklhH18cDk6BcwyDxhw7e2keJaF31GWK9ak nd4Q== X-Gm-Message-State: APzg51Acdzbnl/NHD+DODZWhrH2HoHz3RpWqYDx1vyYGsXvTAI1TLK0z VGDfDAMg3SexCIQ8jvHp4h7owQ== X-Google-Smtp-Source: ANB0VdYlPbWb4N9mNeSypfc34l3UPHicco4bq8GiL1cnPYcWHsL2yehF8s/To7aWXCnqVo4SFbpFjw== X-Received: by 2002:a1c:e141:: with SMTP id y62-v6mr686433wmg.138.1536738722829; Wed, 12 Sep 2018 00:52:02 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.52.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:52:02 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 12/21] nvmem: add support for cell info Date: Wed, 12 Sep 2018 09:51:20 +0200 Message-Id: <20180912075129.25185-13-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005211_419980_D8C5B43F X-CRM114-Status: GOOD ( 21.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/nvmem/core.c | 72 ++++++++++++++++++++++++++++++++++ include/linux/nvmem-provider.h | 33 +++++++++++----- 2 files changed, 96 insertions(+), 9 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 585688ea2152..9329857f6137 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 033c9c3c80a6..df6c102b421e 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 Wed Sep 12 07:51:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596983 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 31B2C13BF for ; Wed, 12 Sep 2018 08:02:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22EF4297EC for ; Wed, 12 Sep 2018 08:02:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 170FE2985F; Wed, 12 Sep 2018 08:02:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 858B0297EC for ; Wed, 12 Sep 2018 08:02:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=2THXIwJNaFusjdLxjCFrqgDMZo0njnoV2p4HTI2RvGE=; b=q5uSbl0vn57JURObUBf+gbuADA wtpRqIzh+94ypFrXncQbRT4M83b5K3X78gHqzssbAdHrF5UUTAg3GaG7m/hLmHIgOWg+JU8kCxJ47 N6i1BYrP2k1ojy0kiUSwiH3weDyV+XL+D2/ZEg5xOoCu71f58V5cWZGdLiMd6QSAJT2l4vVDbDZg8 rDssU+HlZwGLuM61+9fQuwmUssk1gzuyxrhGoLV7cF8G2k2uG89KLRN45khVDgTW/9Z0CWbw/fGX0 fs707LTvVOvyrK+09e8aN6HmqAlOhMqEZlCexVyME3u8gNQhvnvOagXTgHy4+oMbkr/OyRSNgpVsL ZPYB58ag==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g006T-00037S-VI; Wed, 12 Sep 2018 08:02:26 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwe-0004V0-3n for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:18 +0000 Received: by mail-wr1-x42b.google.com with SMTP id j26-v6so932404wre.2 for ; Wed, 12 Sep 2018 00:52:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rZWO4kI7uqrNjBVMdqrBzKtvTAgfrsLuKZ1HGrmrsw8=; b=wUBOSoAM+7HznZEvxirpaqVF6BpViFlBP7MMiJTNgLqFX6UfQJkY78C/fyOdQrOKpb db4XP1vgOA07V7Z94bNSWYBfc361Wy+WfkwU3VoXXKuRCMzWoVTm1Ki+s+cqDwZXvDBn Ag+Q6L77uNpYm11bKCYevFcHNYqIgA1/GmG3KjfTdiJyVQCWGA4MP8kogN8Y7yaZb/t5 VgHyTwJPP5HlWq11Zfq6RWJcpIGR1QT9XtSbxaSSUMWbCgqqukdbDytbn5YckNiFARZA Fh3AA+SZlmvXndv/hTiQNFxP5zFKMPPGuoHgyxMG4q/Zd5pJSiB0mcz3+1HziJyzrM75 OVvQ== 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=rZWO4kI7uqrNjBVMdqrBzKtvTAgfrsLuKZ1HGrmrsw8=; b=Bua2HZHoLvMCE13zv/zS5MdAJsMKF1ttDevkd23rphFH8jnhWRP/aI8oC681sXTJNm 67e5hv4eBRbQ7PhiMzN8OFc7G6ZxKaWykh4OCf+/2c9jMbTVE4ZcYoRK0T86x38eff3l dJt0DjgyBcarXvTFoLDBeJpaGC2KGweB956focTUGtoDqwHNeaUOP2Nehw33A1PGrwXO /GCOCKnF4mKCXVmgH5+FBR/VVZeU7RiEO87yNj5fZUnm4mZcbeTTmXXfC8llzBvcp76B 1yKAJQbVPDJrle3mHVNXaY9yaHnu9gRzfF8XjI6k5CRTtbnoDaNWZwAB3tkDs6x7DDCf o38g== X-Gm-Message-State: APzg51AIOXeAqSeWGm85I0v8aJDH15Pjw1HqxFXftIZJ+YKRlpWyhIUh qKwnXZ5xSJHwrnYT/Kx3I4fpQg== X-Google-Smtp-Source: ANB0VdaQn2lzT/pZQ+K93Dse2VCsMgjkSsJSR6bYwrxDzJahk3CD9CIJTZF2tsM9RHzlhE1ooLB38w== X-Received: by 2002:a5d:6908:: with SMTP id t8-v6mr548229wru.170.1536738724333; Wed, 12 Sep 2018 00:52:04 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.52.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:52:03 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 13/21] nvmem: resolve cells from DT at registration time Date: Wed, 12 Sep 2018 09:51:21 +0200 Message-Id: <20180912075129.25185-14-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005216_214550_8ADADFB0 X-CRM114-Status: GOOD ( 19.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/nvmem/core.c | 123 ++++++++++++++++++++++++++----------------- 1 file changed, 75 insertions(+), 48 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 9329857f6137..13568e7ad178 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 Wed Sep 12 07:51:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596985 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8DC93112B for ; Wed, 12 Sep 2018 08:03:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F09529844 for ; Wed, 12 Sep 2018 08:03:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7293329848; Wed, 12 Sep 2018 08:03:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8826D29844 for ; Wed, 12 Sep 2018 08:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=C/jqlK7y+MzizaEZJUzyfSdS1AtUJ/g8Bf+ytgjQlpg=; b=UvbwAkmkRVaYxMREdRAOcaDb+b Ph1eoY/n/ORmBva19vpdvI1dsbXrPgsACoY9CQikPFqS4twmzomsx69pJGdbhoPA0FeBu3mGdgDYY dRHs+c+3wTd6BleXpaAcpUEQEoItd7gldc1Ipbn5yFLNrg2+6TVRX7qnxYox8STicvpUMT0Bz+hq6 hmqtb2k6hX2JFk0enugS+CHbksamEmohfLFGvvFRz9jt3w9T2/nxcetq2UcqHHEMPeTQo1naeXpcN 3u5za0cNmMQtORabGOFKagR5gh4I3A0/7YekRvakv/gVbU2jrZarAm/BZnHCp1sWMOip3vr3OPdDk +n0Tulmg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g007A-0003PK-Jz; Wed, 12 Sep 2018 08:03:08 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwf-0004WU-IJ for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:19 +0000 Received: by mail-wr1-x441.google.com with SMTP id k5-v6so908837wre.10 for ; Wed, 12 Sep 2018 00:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lLKK18pFJM5d1X9iNpVJoHXKMT+hCg6oOMMo9UfD6ow=; b=Fa24vuCMOjNUTBR5ac4mq0/BGhHz97k7rhZaazZN+EGE+6W711frTRSiK3i6jvriOV R9OXchT2tDU5SY4FO9wV1gELthijetAGtA6XQo/vyXeEFRLsQjEdZ5cp38TMm3Vubv4a IWYUIO5cmhJ5w8lcDa7d/2geBHU1C+b/gTEUQZGZf2RS4B8t2yTfhhkNzK089Fxx1Vky v87Wv6TuOkO6dIH953pmX1sWhBL90Mc+Utk2JajCflwBC8s32qitVRo0GSP0T1ZBn6sT 36zV+Xpi2XZE4QczYqhjKRCFhwuXQfMeaWI7rJaGV4nVf9MoDHnamysUiL8Hdc36W51z b/Bg== 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=lLKK18pFJM5d1X9iNpVJoHXKMT+hCg6oOMMo9UfD6ow=; b=kBM7kIWO9IIehbGjcIs6dFzECVv5p30GwrkPgymTA+zMfK5LnH1ks7a9hz0qpKT+gh AHr4Or1YMOsUEfNo2xJuueAAiVNzAvWyRCLBYXy4ILCCB1La4XG7fpduhSWa60nUlfKe Mi4uVjiWlZSkz5TIQtpRwexFaPrf+BKPNCoLyAZgDLnWH7prZR+QPXPi/rqNzBARZgwm tm+F5hxsEHKbkL+6DmFqT3tDfeczgBxAVzI9e1aUBU9YedlvfW1F5X45VA62FBKGKGgi m9hJeJxBSWD/dOlRiHwdpYe1AKyPuuN5nZ++F8PXKmyqcdjVLfmgMGnY3SZM091gpXYL 63dg== X-Gm-Message-State: APzg51CKueG0pmRfs87A68e1nbhqUfFnGLLkEGeUPQvz8p+d28GEoHTo FBGTFhZo8pa5NNZ5EEIBxCu9xw== X-Google-Smtp-Source: ANB0VdbV9mzFm0a1AO34Ak4ksncDimz1vfGd/D9UF5yj+XB7z2efDJz3h8UGLf3mQDdP4qXRQSqGug== X-Received: by 2002:adf:e5c4:: with SMTP id a4-v6mr533615wrn.190.1536738726091; Wed, 12 Sep 2018 00:52:06 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.52.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:52:05 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 14/21] nvmem: add support for cell lookups from machine code Date: Wed, 12 Sep 2018 09:51:22 +0200 Message-Id: <20180912075129.25185-15-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005217_656826_4EB0646D X-CRM114-Status: GOOD ( 24.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 moves 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 --- drivers/nvmem/core.c | 129 ++++++++++++++++++++++++++------- include/linux/nvmem-consumer.h | 28 +++++++ 2 files changed, 131 insertions(+), 26 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 13568e7ad178..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 NULL; - - 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 Wed Sep 12 07:51:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596987 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1DCA413BF for ; Wed, 12 Sep 2018 08:04:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FABD2984A for ; Wed, 12 Sep 2018 08:04:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0306829852; Wed, 12 Sep 2018 08:04:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 944462984A for ; Wed, 12 Sep 2018 08:04:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=6rqIHAVz8dCEdzoedI9vEAJiPyDTyvIHPrjWfOPP8HY=; b=TeyOodN8h+5GrW2v2y3LT7JuXk z8UT+eje+LZZW7iOLvfx0wbYFEa4y0H/CFslO8BRSZ3XtADts1dKfS4cZtGQ5lo7uaabv7ZYNsVB1 HQqAc25sp50E+Fh9A6FpNR+Wp13/puFHnbdfW6v1Yjr4w+C1zfO70w8xhGu4hPci2izl0nNDhwLY9 t03ob7f8OmuGbZ7PrRrsuw7RRVuXVv/S8NuIvuwMHTUrK9ZHGg3EN4FJ9rGozn1dnW4bdUon++B6s 5C+QRlSpDg0EalM2/4LBrpVDevkfgRDuETeUZUKt/5J6eOkK2BR2kGgjv5Nkw8xV07pI9Zp8jNowo MJn5b0bw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g007t-0003qm-CK; Wed, 12 Sep 2018 08:03:53 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwh-0004Xp-Lr for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:21 +0000 Received: by mail-wr1-x443.google.com with SMTP id v17-v6so914188wrr.9 for ; Wed, 12 Sep 2018 00:52:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rjARCe3NpsJLpu+gwm8Y4x+0pJknacrTsP46NqsklWs=; b=Fs1KPfuLGjhmN40UmU9tXCVjtd1Ypky/hXlcNhvJ4ZdsktmUGrwqy0BvQGNAHLkpDq PaA2Av+KU93GeJiQ8wuWtHdIMDW+Iu2zVIJ5R4OtD8jVebJUjPs/+3C4zeORQ0eXq2Oj wpJMZPM2UfWJLxOg7vBlDy6iNcCPpJwRSoqLiS4cMxuKEWqNij06Fht4kChaGdMBykkp 0rP/HJcEpcDum+pVMKYhRCCWvvpkmwucyEImPUkjvI93uQZTPxycOcbEP/lNC6K9t42Y gYFEb4MolHlGGzHSFeUDEVTENO9c6G4BWPCrkifFmwc2T145IOeI4KKHtvlgqbuk0aW6 YcbA== 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=rjARCe3NpsJLpu+gwm8Y4x+0pJknacrTsP46NqsklWs=; b=dO3YubBV1iRTLkwaBPk2ZUb92nrREz5q+8xtUCbKPcbAYuop5VWWr0oq91ngO2BYq3 kGnfBxmp5fsFYpCl/YNBSupS66StWNx3PNUOTHBq1neZ2fENTXJUxVS2MMyTXKoZPGKc kweKDyuXuQFZxjj7Ng7CNVhkZY+Qgmh0ol6N65m1L18HrCM+n78J1wVuE9jh3rH3tEUm iZ0gNSTcTmbrRIqdMdicwUHhlbXkHYgU5y8P8vFDzSiTqcqXy9jsx7EadMnhamgMI4Ri we8U1iA+m+zBaHjjphgQYoX+VBmVLvckZ0RuXqE3TFoJvkHKajZuc769m9IK64a/p/DP NPoA== X-Gm-Message-State: APzg51Boc0HpqP7g7dn/KmrhHZ7XivbgqZ/s10eGwm7xhU4KVc1UJmol JambutIp8qCtKb9UCL6O7Zcy0g== X-Google-Smtp-Source: ANB0Vdb0/pWaejo7JU4HxGj4loHJp95Ch+j4mzZMVwskZMBXfAsV3ywMBMXsUym/S6Acj1i9yt/xkg== X-Received: by 2002:a5d:55ca:: with SMTP id i10-v6mr531380wrw.38.1536738727672; Wed, 12 Sep 2018 00:52:07 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.52.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:52:07 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 15/21] Documentation: nvmem: document cell tables and lookup entries Date: Wed, 12 Sep 2018 09:51:23 +0200 Message-Id: <20180912075129.25185-16-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005219_782212_B445DD76 X-CRM114-Status: GOOD ( 14.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Document the new nvmem kernel APIs. Signed-off-by: Bartosz Golaszewski --- Documentation/nvmem/nvmem.txt | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) 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 Wed Sep 12 07:51:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10597011 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E2AC513BF for ; Wed, 12 Sep 2018 08:19:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9F7829949 for ; Wed, 12 Sep 2018 08:19:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD6D729974; Wed, 12 Sep 2018 08:19:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3967029961 for ; Wed, 12 Sep 2018 08:19:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ANsp3x5/IQgLqsytMXAA2YR8mRpDzG8RRRqBYLoIU0w=; b=AQwanTnvsIG49MBqhJyNfnq3IM LyxfNKiZ6jFiBV8k+gX/5SQGuINhQm19J7FETx6XyfOKmL84De2bHcspSgOF0MJTnlRueUAXBqeh4 JtVEjoqfRL8U8OXBx8XJFZEiYvoPaM3wTPq0KQmKxfZ31QS05itBpkokUI9ex9Mst1MMOY2Zj4eVI keAudsVml0TpIVber8QII9XgOeHX4wBDz9upcU0yDf1ToPxnDYfSVUINLAN7Wo4uZUw2U6aIyREdn HOjaplGn85yCQPETHS20xNYngDhcpcE2i8tNICoL3iJ6PG3qiMM+YiOJxRCDHXyvG3odKZ/3vkPcK 7ed+iGtw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g00Mi-0002AH-9b; Wed, 12 Sep 2018 08:19:12 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwj-0004Yv-CD for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:23 +0000 Received: by mail-wr1-x444.google.com with SMTP id k5-v6so909027wre.10 for ; Wed, 12 Sep 2018 00:52:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ONRPGmkEebVAn+Em0u14ctkjE+SPNF1nDYJohXjda1s=; b=qvItpAFIA/3X/EtDfp67HU5NjxuE3cAbpL8MLCh3D1XFACpaWiO1829tMp2pNzJmTi gynBFUzsPa6tNEMNyCxq8m/lG1vgNXTeZNlDCQvC+Ek2J300vFgaG5BQW9WDKIVUwZzY OmZyU8G3Q2R8MxPf+zWfqSLd/2UFdLcaYqzIoikfs930btSMvHEk4PElRhchvNYiIdpt 4xW0ag4N2aygeqzyPOJQdD2HbgPY9YKDIpyjMhLKE4tJ7+eG3633UYXXHI11zct0t6a2 uXIaJhlQoCuBIPS/XdEX5bmpEJ4PyBuyFIcjo4ZKJBc1eYfyloIw/CxSmGTJJ3AkwR50 gwpw== 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=ONRPGmkEebVAn+Em0u14ctkjE+SPNF1nDYJohXjda1s=; b=YiKe2eyEQVWg738AKplbiP2Lva+cfGdqSR/vCnUNI4Ptas4i2aLZrySSuSiSuu2+6k OSC0mEKyj1Q3KWq/mNipinU3k2cOEfNyA6i9+oseXlprkH3jfAWp3Ngl083+8a4q43ij Nk4H1k1oSNrle/1gO9CE9MEumuYG3v45qhPhWlJE1jlrUVPIQsMO43q5B4BXqouCInC8 gS86HG1NPmEOKpzMVGpWu0evGAbzoYL4kz9S+ZLcSx1VZzS0hUe1aQO4qQ4JteV1UFfv BOyopyT+KiiTwhCPZhdJlHKhDQWdViKoReuo5CX8epa0H+PLNV+bPAcuo0FwQxc0ftW4 9jdw== X-Gm-Message-State: APzg51B0Rj5z1Nqe6g+nSDriP12dDliisTVu/Pq/3YaKDOgQi6AEJGav 0/4O0b5moMW81L+t7za0JY0OBQ== X-Google-Smtp-Source: ANB0VdYlUVak9AjqeNrN4vunVrijFUrZrwOoN65g0hO7EDu48V0vPrOaPGErYEz13zRmx41BEBoL/A== X-Received: by 2002:adf:e8c1:: with SMTP id k1-v6mr499767wrn.43.1536738729835; Wed, 12 Sep 2018 00:52:09 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.52.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:52:09 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 16/21] nvmem: add a notifier chain Date: Wed, 12 Sep 2018 09:51:24 +0200 Message-Id: <20180912075129.25185-17-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005221_861679_66787FBD X-CRM114-Status: GOOD ( 16.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/nvmem/core.c | 36 ++++++++++++++++++++++++++++++++++ include/linux/nvmem-consumer.h | 21 ++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 9cc86d131e1e..af6f7163cb67 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: @@ -675,6 +709,8 @@ static void nvmem_device_release(struct kref *kref) nvmem_device_remove_all_cells(nvmem); device_del(&nvmem->dev); put_device(&nvmem->dev); + + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_REMOVE, nvmem); } /** 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 Wed Sep 12 07:51:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10597017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6FBD213BF for ; Wed, 12 Sep 2018 08:20:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EE9E29949 for ; Wed, 12 Sep 2018 08:20:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5314529961; Wed, 12 Sep 2018 08:20:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4556729949 for ; Wed, 12 Sep 2018 08:20:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=B1VDzgxJ9FZbSMt7jSK6AEoh1epBlAupSjqeIm0fVKo=; b=VKzt3uPVBkcvESLz+dU1SZfPBw mK32uchOxHvPQdQwU6XIxf/MuxyOyOKTBfIEncD+aNfWLDZNKXt2KHi5TMxnqvIYE8UYJiEMazlWi DjQSQrJOd7Lwr6GKVQzC4XkmyVPr62rVCDFD3FGBY77ZKhWNX1k0+dH+WBcTw5WOixaf2pCMNTcEm EGzlgSF8dmFV6jI1VdRX9tgni+/aVfcHt0FM9gf1IWLpmFQSL5neSln1fOp3Wrq8d90BqPPPG+Q38 NzYpxKJbozO+oSZc+aoMnQYKz3YgmVq4T9/aDYZu233a1M8c2qbcRoVWE5VMtKLjnNJqq64QPsSS/ UVv6Rzhw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g00NP-0002ku-Mg; Wed, 12 Sep 2018 08:19:55 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwk-0004a7-To for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:25 +0000 Received: by mail-wm0-x243.google.com with SMTP id c14-v6so1239035wmb.4 for ; Wed, 12 Sep 2018 00:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2HBpc2YKxYR/tjo9IhbY5O3/7V07JibCmPgWrXK4lkw=; b=PikW2ube6WJAvVWGLogrg3XfZycTdrtz6op3nD1Sbv/v8Y6X0Oud57YfsyhfUzMjwf bNYejvu9Xgafgej+bcWZFrEkFqPDIuwXM4nEz4/nxqV1tl15kOw33PjDZilW1xPL6HIx +01dzgfRoq3/T82x98kI0p3OTxB2mjwX5zZOmZ1K6H44DpyfnGoaqjezNgvIileaU0vq dLH2lB/VUGjyXz0Ew70ISr1bfe1xpeD/iC9WgxpggpesYKW2xw6OhSrSMTbQA34AfKn0 RmaDBnFx9UMKkbcqQeHFLaE0hthEdsiuHEvtaXPPe/90/VmqGosJ1vtNAjwTcOxzqJoZ PI9w== 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=2HBpc2YKxYR/tjo9IhbY5O3/7V07JibCmPgWrXK4lkw=; b=BQEWyTGaALF7Gt1PC+rH+ZCkg58uzXQbQNBE/PFcuRz2Sl6lPJZZydA4+rh7OJEJ8a DrACXljJWx/U/ylY3k6yBe5nA6V565Yz8I/UFtefwnA6hwjKMzy6uyO7Hp95+7DG458O V4/Ws7Ebwcu09LzBPnYpXjBU90gVeeD8BbfgP7i+7R8ObCYlcA0SrWvuyDdNGgfYawQP hkdoxCAoaMvsItM2rqgpOgIpRjuQ2zvIIFwHNwCVoUu1/xVqg5KSYXyET1f1w+NkWsiP Qi3vy4US2cxdCLQXYI1/PMj8vyY/JFErty6wEpr9JPZsGsEkPbTMg2WzSdPZWoGLXq85 lU2g== X-Gm-Message-State: APzg51BAXHITI8b3CUKvpNaTJVpP4lFqs+YhqUV5YjB+TqP+c08cAIVG R10nSOZuWtsQ1ikKejdl3Ft81A== X-Google-Smtp-Source: ANB0VdZmEUw0rcCxeV0+WQ2zwolNvHKn5Gj0CqKQIYiRD74eiXi+m/pYWTRnnRgMpWQZltQhlx8DrA== X-Received: by 2002:a1c:c44a:: with SMTP id u71-v6mr759896wmf.43.1536738731380; Wed, 12 Sep 2018 00:52:11 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.52.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:52:10 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 17/21] nvmem: use SPDX license identifiers Date: Wed, 12 Sep 2018 09:51:25 +0200 Message-Id: <20180912075129.25185-18-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005223_118087_0BB6F63C X-CRM114-Status: GOOD ( 14.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Use SPDX license identiefiers to core nvmem files and remove GPL 2.0 license boilerplate. Signed-off-by: Bartosz Golaszewski --- drivers/nvmem/core.c | 10 +--------- include/linux/nvmem-consumer.h | 5 +---- include/linux/nvmem-provider.h | 5 +---- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index af6f7163cb67..6cdf4f2678f6 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 df6c102b421e..d37785afd14d 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 Wed Sep 12 07:51:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10597019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C410513BF for ; Wed, 12 Sep 2018 08:21:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B135729949 for ; Wed, 12 Sep 2018 08:21:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4F0629967; Wed, 12 Sep 2018 08:21:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7A15129961 for ; Wed, 12 Sep 2018 08:21:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=+UxC8BbpOjiV+pneQefpf9Im+JGw+8D/DZPHr1B18go=; b=f2+0C3l10W4BJdQwSjGfsxOTLw u7lTDuGCRQsVthpx9jpArJV3ImareayGVnYZbbZ46Kag3yndGp+VQfLhJ8SnVy9/AcmgG8fStbgbc xZlH+cbi5fAnTdfm+UNqTnaoVzFcV8zVZGTZpdyihD1+u7EhvORHAFDSolW3ug8C3/gsACwYHIur1 agiVDC8aiREERqgcWmDloLW8n9oBP7G+XB9ln+XCTfk3Ka/meTL5nIFYJyR1XRp21JJ2FyjiZiBl/ EBXiChzZLh1IOdYd79dnu14NBr7OLy9QDFSt+rr1W15ghTtGcDU66sJRSu2gHM+QdaoHB0R5NrLaB guKiZKBw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g00OE-0004Hb-VB; Wed, 12 Sep 2018 08:20:47 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwn-0004b2-GD for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:27 +0000 Received: by mail-wr1-x442.google.com with SMTP id z96-v6so915090wrb.8 for ; Wed, 12 Sep 2018 00:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Qf5F4zQiRY1sa80CZGwpbNfNFuNr+OQm/6a5BbgsJ/E=; b=m3RXtFE3lF34IyYI/WJEStDcvX/dGKlbvFUtWyIa606CcNGS08LOhyItTD7Velw9ci p7R9L3OrQT21PmmSmGqEp6PmX9R3JHTFxVHrkBNvQ4gIE0+ai3/TlyOD83+i7jKYlodt 0n6a954VKbOlAS91dA4LgSpo7UJmJkIK+K8RbkccFoqLkasn0HEmg9Fi9Ad4rFZ6Gl4v bMVDaEb+Z138xZJD4qyiM0h0+jnOsRU89hjICaVe9/8wOOhPZcNHIm99AfSk/OcIWfRd 3Efp8ckcsqsapK5pdo/zety0tUOFLZ35Q6vtUNU51vNMY+f/ZpJCoaOYF/C+HfJY0Efa v/kg== 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=Qf5F4zQiRY1sa80CZGwpbNfNFuNr+OQm/6a5BbgsJ/E=; b=shSJS/jkNzTBm4Ctl8z+FMbKVirro+H/dL0bohdkqZSyP3SzwF28R2DJ1A3mREw0Vh M7DfvXmqKISiKs9LHTKG8RLQmKjj8l2bjDjSIg90PhS8zXNKY+13FvdD8+UFCjfzTzOY q4eHYp1yPADq2c0vpVePhkcsPwULo9NiIS3hkNxubsQ6d+4JZ7xMDmEnGwPQd2auJJTy 9I5siJckkSXMmX4LfoKrkSNRx0uLZ0he2LU7qnp4tAHk45BiNWY+3xO55dKgrdumrisc inogTCB2dlkARLEYKaeHtV7kX2saCeo4JQlgfti8nv3+hFpAn/CPJ9MpaCfGM5hSzsDm vAOQ== X-Gm-Message-State: APzg51A/sXBpxSYihQm8KzzOTX3Kk5btAOnQIxWMHWTDiyXxZxSa8JnH c2WOfqYJtpyByg0xCacz540LZQ== X-Google-Smtp-Source: ANB0VdZK1F/vtpw3CGekT+2tST3Z2ZYI2eZ6x/UkitKhkssbHd+ZVEq/bj4WDm03ZoCqVWJWv6P0Sw== X-Received: by 2002:adf:bd10:: with SMTP id j16-v6mr482270wrh.267.1536738733524; Wed, 12 Sep 2018 00:52:13 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.52.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:52:12 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 18/21] nvmem: make the naming of arguments in nvmem_cell_get() consistent Date: Wed, 12 Sep 2018 09:51:26 +0200 Message-Id: <20180912075129.25185-19-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005225_921482_12F1B239 X-CRM114-Status: GOOD ( 19.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/nvmem/core.c | 27 ++++++++++++++------------- include/linux/nvmem-consumer.h | 12 ++++++------ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 6cdf4f2678f6..f4930f605d4f 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 Wed Sep 12 07:51:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596991 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68099112B for ; Wed, 12 Sep 2018 08:05:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 595C829852 for ; Wed, 12 Sep 2018 08:05:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D69629858; Wed, 12 Sep 2018 08:05:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B5E5D29854 for ; Wed, 12 Sep 2018 08:05:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=vtFwtBVrNkDlLIh395aiLp75edwP431cRrzqP9B2D40=; b=jNber/C4ZPXSyPFi04ZCZzv2Sh Dyh9WFY+2IgdRcxxE22+pLjJiavamGUCVgkef0KaoNVE/qSqdz94JDXqWS+GArn5BPIB4GMjnN3cC 1w8kpMYu2T+NIGMVqh+TdfylbEKhj/zxoGU7Bq9vfTayIrQ5k40TB8W1y6lvhQIzxNyBedWDCX63i rpCgbc1BioCf5TEzGv/r62ObTobutoEyOt5LOCnA6lJH2/KsWXwWavR32LOUrbRQ/BNsyHkKnQuAf y4GE+pkcTcqk0kcvfJ3BeXjjujerKpFUb0k2FmhcmsHBpOnYWyv7K6olKufKo2LVuTGEO9MtvaZ5l xTv5+UJw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g009J-0005Mm-Tt; Wed, 12 Sep 2018 08:05:22 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwj-0004bq-C9 for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:23 +0000 Received: by mail-wr1-x444.google.com with SMTP id a108-v6so901518wrc.13 for ; Wed, 12 Sep 2018 00:52:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SlueuK3D0KeRnvcAEcelp7MxOUpOfwsUS5G08uyAGgM=; b=U/nS09/f1K13kRtxhqixd6Dz914B8d7hXMIHKUtMnIeNNjr+Z0W77trvKYXmkSteM6 4lxtSfrBtmxE7a2O+bWIi21v/27UIBSjUtReKA9Idy0maq9R6W7Xbcw1D2zgWlCfWlQb GDDAd7ORnGpshvQ5vV953c4uuODaYMfQ/BBQEt4N1c1o/TjyGZCx8Jy5GXb095OyZjws 0lkvv3uFz1+Wxl3QslvFyYs6nGb6sVUg00cM4HlCYQESQmuHWUzPLxIri8/ITNDkz51I fPF6Zq38Rxh0XFUanm/n+5D8lT2mDaZcfqcDiGJBbZ+RB9UDr55MpbUrckA0oZflav+w mcxg== 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=SlueuK3D0KeRnvcAEcelp7MxOUpOfwsUS5G08uyAGgM=; b=YCWnFDWKCRfIToYip7K1DJlskjfgmEWcbH0DqoayH2H5H1xarIRr+EaSdGXbTuMYzl xrRiSOuwHmMTg6Qx50IRL5ToGdiufxuq5jhZ8ur8gwvQt2vz/h8+dQtYsXur5IVzqM3C N03Z6sSZpfVQpwUrPG5jor+HWTwNLJ11IvuIxubCLJCizoqrypueFTVX1EYOm6AVLK/d vZixNyRmP7N2NSA+YmT73J2qsYgR7C57bvvIjqg7NLZ+oKkYM9C7kja5XWNoyuANXPMC 62T8KTyCfU6iVENHI1Rk+Z6oGAk/XBBN13HI+kiVkYx7YsuxzGVaVqqD0cov4tPWVdPu qI/w== X-Gm-Message-State: APzg51Bin7KqKnCGxy9vBt0hP7//DI8kG/esZESU22NHFguau8q6bYRJ 3AH1HdqDUfDdKfHHmyNfeDI4ow== X-Google-Smtp-Source: ANB0VdZx7bfMc2Yp6gvxO2lSWstnoWPtk5yyLobK8LITg+ehGl1Olf8+LNV5PkQ0RjlkGdvkRhxAdg== X-Received: by 2002:adf:ed88:: with SMTP id c8-v6mr518705wro.264.1536738734945; Wed, 12 Sep 2018 00:52:14 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.52.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:52:14 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 19/21] nvmem: use EOPNOTSUPP instead of ENOSYS Date: Wed, 12 Sep 2018 09:51:27 +0200 Message-Id: <20180912075129.25185-20-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005221_732927_62D79BEB X-CRM114-Status: GOOD ( 15.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- include/linux/nvmem-consumer.h | 30 +++++++++++++++--------------- include/linux/nvmem-provider.h | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) 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 d37785afd14d..01ad6895ea12 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,7 +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 ERR_PTR(-ENOSYS); + return ERR_PTR(-EOPNOTSUPP); } From patchwork Wed Sep 12 07:51:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10596989 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 519A1112B for ; Wed, 12 Sep 2018 08:04:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42A932984C for ; Wed, 12 Sep 2018 08:04:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35D1529854; Wed, 12 Sep 2018 08:04:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ADBEC2984C for ; Wed, 12 Sep 2018 08:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=mo2wVg12qyzcFXytwwjSjAnicO0Lg/M48CSgRHmjKjc=; b=QsOx09a8c2iwraJ+womSk5/E7w lYv7oUFeMiyjnG3Io+86In0LTcrL2IRFiK7R01gFavkN/L3Adcn7WDZguZk9l7xPN86vCiDStYUUt eeMW8TiyYtPtU3pjgcQVTkejnqAecXQtXxReRbAMBaFtSM+x0fXgFG0AsoD5yucgqkMI8vtUMmIIx d5bTS/vx9sJU/u4VOzHzgYMowOQVngXfmrH1iC1O8fm7t+/SmFU/yRxY8C/TGjS6/K1RHI7WJ38rY powLRZVBeSCF1K6GxBSyJUTs5Kb8/O89VJz86cz8aie7DO7/HOJB1qqqwfdfCZFLSzBlVHAomoXtl FrOGTM4g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g008Y-000485-Ff; Wed, 12 Sep 2018 08:04:34 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwh-0004dd-LH for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:21 +0000 Received: by mail-wr1-x443.google.com with SMTP id n2-v6so918401wrw.7 for ; Wed, 12 Sep 2018 00:52:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dAHd6MEwqXVGzwWm3SfLFdQRcyv3zBIXXYtbxX6zPOs=; b=XaWZU6ad83b8KhhFlV4kIuhwjf9l8fQ9CD79b3i8E/N71O/s5PrxgbCP+WRUK/lh7a oHixyJ0EmcVKFcl5AuF7DJ+YttTAiEwyME+XEc27jeHuQTFOO/DPTddm/qQ5i/3iFhee vkHvLekaeXU+WzRfWS3G2ky8LKh5TY8Lv6jvt9kq7fvrsz+mDbvqRtbHU6JbvVbM7Llq N6glSjbiNb84KETKKb2zv04n2Dek6NPXzZD+IlBhydI3OifZYSQB5iU2D7cu5Qinw7aR w2BRWl5uH8uyDR22XOHGKcgi3PLexnRxGtt8jyzLWFn+/xaWTzhv12ADW/+m62PjLbuZ qsSg== 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=dAHd6MEwqXVGzwWm3SfLFdQRcyv3zBIXXYtbxX6zPOs=; b=XZ6MhjZWWFu06Qg80y2fb1UPgSoOKY7DTofzxKA7Cg0XrTbLQYXW0JkMvp9NOYt775 wEQ2SLMFzuYS4DkzJ4IuL7cXa+sV61nvdFlwTM/O+kW66mGABq4v6fFEpejS9iFHSARD LDrjDNC7wllMXB+p0n5K1WLpos+xdYWPQWXNMNiUv8Bb5sKOBbrI+wYAPe0yZaSYUzWz bcD2z19w7VFTJxJ3nMPsk50hx46kcLIzEzXYToU7o+YLDH+7YkbSknS1Iyd4s5Vhn9b5 T7KG/U5DpbUg6NmCGWyvJ+f7KfZX3N5I9KOOcFp4FW8QEmgN+YzTIx699yGS7SVDVqSf tH+g== X-Gm-Message-State: APzg51BknC0kgEQFFj6CnfqLpCjppwJujN0LNvzmOnmOyPGOgin8xM7l +jUj1F/lijJwzKq9Q3brRMcKxQ== X-Google-Smtp-Source: ANB0VdYPOfHEh0p5hqqrJFe3PqNbdLOAQRydlahUEvxdCASABxV459to2tOuooXLz5xv03xmEp6cRA== X-Received: by 2002:adf:959a:: with SMTP id p26-v6mr493599wrp.202.1536738737336; Wed, 12 Sep 2018 00:52:17 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.52.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:52:16 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 20/21] nvmem: fix commenting style Date: Wed, 12 Sep 2018 09:51:28 +0200 Message-Id: <20180912075129.25185-21-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005219_746833_B0C679CA X-CRM114-Status: GOOD ( 13.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Remove a redundant '*/' as pointed out by checkpatch. Signed-off-by: Bartosz Golaszewski --- drivers/nvmem/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index f4930f605d4f..bc14ffd87ca3 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 Wed Sep 12 07:51:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10597021 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9657D14DB for ; Wed, 12 Sep 2018 08:21:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8481B29949 for ; Wed, 12 Sep 2018 08:21:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 785C329967; Wed, 12 Sep 2018 08:21:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 28CDD29949 for ; Wed, 12 Sep 2018 08:21:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=6nIeYojHDZ7M8LlSWLY4teE7581x49FDTHke9sV2UtA=; b=s2zBghPZ3EXgBBQELif5DyUOaw r4mrVgYSCIsOHGDe6e+6Wrnbgara1X/iMwg0egiNwFjYHQMUofsJxM5HU59jRZN6JiusHgtatqC6C HWVgvZBQ82j/ZYsv/I8Hm4W50D+7ziUnvOzK/dnDMTwlfz0pcgOZc1BiH5Ri1ETF6Y4EMkmzMMul6 Grj+k1YgGJe+wcG5OMht0SaMmnc1Zqrb8RIaYMXygOorgFeMPV/W31l/+3nYZr0QM3zeq9QzvFPdl eF3pLimPBJxgHXUluIf//K9ZTG99mkxj5COyd8FumsEPDR2JtEaC4jigu6vwHqD01tkpMUCVVUT4V 5We87VZA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g00Ou-0004YN-LF; Wed, 12 Sep 2018 08:21:28 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzwt-0004ea-1w for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 07:52:33 +0000 Received: by mail-wm0-x242.google.com with SMTP id q8-v6so1236110wmq.4 for ; Wed, 12 Sep 2018 00:52:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OFySLdUXLR62cbw4pNAPVJeRRRSSn5qAUSTbLxQWiuk=; b=DHyL/RiF5XgjsiKnEBzBYmh2kn/efYixJ5aUB8NNVONZRhbwU/th1otz6h4cEMpmmw NRLLPbqVe4ZzVTQcH+MdXt8yqUjErDQDxCuINucnYGZOb3+h8776OcezvuJtqWlzp7Fq Xse/g5vHWi8CcRK6V9p/VszR2ZK5TA9+mGsV5MiQRG2UugKLjGTD8sZjPqpODeOe3437 5oCoyyfNEEDqUE0jjGc7YxkMnQCPDrXcXO0Fn0/cr8zu1zDSWm1QyaLiV20mB4tzYUnV dgwz3EFwdE3Qpgp4icQprp3DtFr2SYpoK9EDrpDkEKgzbgJd+SOQpQG+tXantDd9ukul /wzw== 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=OFySLdUXLR62cbw4pNAPVJeRRRSSn5qAUSTbLxQWiuk=; b=GMvXC0j7o+CiL1S4wpCP4fu/8+JlR9zV15LWSZjPj8vSVII5M7rj1DHpRNkr9K3KlF GCWx3i3taIz31ZjqyXWU0SPceJjG6vl5XRO1wujWQfO+rLvtpZh3K3nt4/Jvyf5gtOGC Kxd32alMojYe2uZX6w6Pm0nvpHbGuAjN6gNOtczULV/KY4z6tUwraVh/fCMbPhEtlUBl Ok2Qqqbtx2sCbWE2bEgmznXc+9iKVa5ar40JADfxIlMafjUXOU/0nox0THisA1HQBCyn 5RX8/3KvZofJ1zsNJ/ZN6UPPkRdDpwSYy8wx5DsI0l3JmaLocPu25eVnRX08v/isIyT4 nKgQ== X-Gm-Message-State: APzg51AX0aQcZyduOFSWAWeQG8RDnH5pqQi+qSdlzdw3kLiFAnjA+Osd Do1OlgDRn30HkFoOAsYX6nRTBg== X-Google-Smtp-Source: ANB0VdZMuP8hdw6W5jip+1KH/V4Aqq14DjXxtevrsObaZHBLqEVYB8iFK3vpO5IsY9t3EQCDpsURMg== X-Received: by 2002:a1c:c3:: with SMTP id 186-v6mr753953wma.126.1536738739034; Wed, 12 Sep 2018 00:52:19 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id l7-v6sm169341wrt.67.2018.09.12.00.52.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 00:52:18 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 21/21] nvmem: use octal permissions instead of constants Date: Wed, 12 Sep 2018 09:51:29 +0200 Message-Id: <20180912075129.25185-22-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180912075129.25185-1-brgl@bgdev.pl> References: <20180912075129.25185-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_005231_198592_6DCE52DA X-CRM114-Status: GOOD ( 14.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Checkpatch emits a warning when using symbolic permissions. Use octal permissions instead. Signed-off-by: Bartosz Golaszewski --- drivers/nvmem/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index bc14ffd87ca3..e174b282cc1f 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, };