From patchwork Fri Sep 21 13:40:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147274 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp837988ljw; Fri, 21 Sep 2018 06:41:28 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYamIpqXieBjLoUzN3mKhYUG+3fGYTiG1y+byQOhRBK7Swwr96XuWvSLyaV/TNWLarnOKKD X-Received: by 2002:a62:fd06:: with SMTP id p6-v6mr46675709pfh.167.1537537288017; Fri, 21 Sep 2018 06:41:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537288; cv=none; d=google.com; s=arc-20160816; b=BjVl5S7owmHxMdNA8yLv/ip4nG9gZzK8MJOwIh+XTAE0S4cgjeM37c40tfZGFukMMs NQU4zn398JDMtUT81GIdp8jsTJvLHgtrl1D+szEh8vHzYKVUQdZ/SgLiRYWGu/3nUvHj Xfvt40xWupG0vM8UuVjo47zxNg5VlNwlniyH+hLI1tW0SYkwhe0Bf5UlUezeXu1ID08Y LuHl2XgY+gv7IiuODdlntnN8tMzEex7NB9Xkk+Xf404GHxujsO31wgBHRtmiiylKNYOm KbFt8ee6k+j1WCxEEgM0Gv3E9/vrNqjGOwh+FDK0JAGX6ZCw0gKp3BZcAUWMVstiTXFS L8rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=rYfkkRdXDRGe4eMcBTmCOIyJ++AOj8HTrI8YUTC2k2c=; b=pKK/1vD3vKpAcNB3QP3/q+sxn1uQRptL3JoPb2ryAefpIpe5cHoVACh+LU/W5bpjdm 7OHjI8Qyo5VVpfMkeIMM3klz5XPEX8SKR0f/uEkMuRALZaFJddu+pQlb12D1WJoDLcNi l/3sKx/fsCPOcFz829Wibo+Trx7F3/z10h1xrDSwt5srZojdqcV1VWwT7i2fjQyWwwgw j/+KvxFBNQDSwQDZqV9Lj2XtrLYX82Ac9yahVA2tFnFakwVBPm6MgddZfbdDSZwBD38J CSzrACgr+Vyp+cX02U1x1sMiF9B6hBh9lp4lcraPPtcTFpLtgJoN5V6MjitWLigRP4X0 GSxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PGtLAAB6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j3-v6si26087992pld.402.2018.09.21.06.41.27; Fri, 21 Sep 2018 06:41:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PGtLAAB6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390359AbeIUT3z (ORCPT + 32 others); Fri, 21 Sep 2018 15:29:55 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:51107 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390344AbeIUT3y (ORCPT ); Fri, 21 Sep 2018 15:29:54 -0400 Received: by mail-it1-f194.google.com with SMTP id j81-v6so2001975ite.0 for ; Fri, 21 Sep 2018 06:40:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rYfkkRdXDRGe4eMcBTmCOIyJ++AOj8HTrI8YUTC2k2c=; b=PGtLAAB6HkSTOzqWPzEk4AdRYYfemoPDa9bcyjBu/ZwstdWGTVSf8FzWX3e5ILLB3U 892+PASxEphJ7OOAJiX0kAmo2bk4gfuToEk3k372h3eEDrgymPXfgqwkBpH+IiwdfcZQ DSxUCaqffhiA2gIhdjoQKFkEU3gQreUGPjBwQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rYfkkRdXDRGe4eMcBTmCOIyJ++AOj8HTrI8YUTC2k2c=; b=m0RGnqfSz64Hb90aQ73WlQs6i9CzEwczD7nyn0mPJwmS15OtS/e8iHvIANCKjZqGNU 7yJj+fk5HlUln8Acteho0LW5xR7tnsD+IWAfSdKn75tjLGMqkLMhYo+3Nm7heFpT29JG 68Xjx2itl/xL/B0nE4LHL85ThXCBG2c4dGEQwVtRZxDtQtEnZHPKB4lpDaRBn9jRJ9V6 6fRieiqaUk40b6uJLY69zMEBkQDaES0IzZY+6uKMQRQNzTherd0mlRqWKTko6kZ6WuaV bo+RnNJUYh/BKQSbG0udK7CJ0fEwLRc1/H5u/BgtjD6oEh0EQUULDI6qpnUDw3bHj5jK haBw== X-Gm-Message-State: APzg51CO9QzdPS1WJDvAbDffQB6p3w88JJUat4Eba5PiC6/m9hPn+DTL 8jSIR2cNDNNPBTq2YFLDtlcXMA== X-Received: by 2002:a24:e904:: with SMTP id f4-v6mr5870844ith.19.1537537258626; Fri, 21 Sep 2018 06:40:58 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:58 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 21/26] nvmem: make the naming of arguments in nvmem_cell_get() consistent Date: Fri, 21 Sep 2018 06:40:21 -0700 Message-Id: <20180921134026.4596-22-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski The argument representing the cell name in the nvmem_cell_get() family of functions is not consistend between function prototypes and definitions. Name it 'id' in all those routines. This is in line with other frameworks and can represent both the DT cell name from the nvmem-cell-names property as well as the con_id field from cell lookup entries. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 27 ++++++++++++++------------- include/linux/nvmem-consumer.h | 12 ++++++------ 2 files changed, 20 insertions(+), 19 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index ea05219e60b4..ff21402fbd7d 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -977,16 +977,15 @@ nvmem_cell_get_from_lookup(struct device *dev, const char *con_id) * of_nvmem_cell_get() - Get a nvmem cell from given device node and cell id * * @np: Device tree node that uses the nvmem cell. - * @name: nvmem cell name from nvmem-cell-names property, or NULL - * for the cell at index 0 (the lone cell with no accompanying - * nvmem-cell-names property). + * @id: nvmem cell name from nvmem-cell-names property, or NULL + * for the cell at index 0 (the lone cell with no accompanying + * nvmem-cell-names property). * * Return: Will be an ERR_PTR() on error or a valid pointer * to a struct nvmem_cell. The nvmem_cell will be freed by the * nvmem_cell_put(). */ -struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, - const char *name) +struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, const char *id) { struct device_node *cell_np, *nvmem_np; struct nvmem_device *nvmem; @@ -994,8 +993,8 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, int index = 0; /* if cell name exists, find index to the name */ - if (name) - index = of_property_match_string(np, "nvmem-cell-names", name); + if (id) + index = of_property_match_string(np, "nvmem-cell-names", id); cell_np = of_parse_phandle(np, "nvmem-cells", index); if (!cell_np) @@ -1025,27 +1024,29 @@ EXPORT_SYMBOL_GPL(of_nvmem_cell_get); * nvmem_cell_get() - Get nvmem cell of device form a given cell name * * @dev: Device that requests the nvmem cell. - * @cell_id: nvmem cell name to get. + * @id: nvmem cell name to get (this corresponds with the name from the + * nvmem-cell-names property for DT systems and with the con_id from + * the lookup entry for non-DT systems). * * Return: Will be an ERR_PTR() on error or a valid pointer * to a struct nvmem_cell. The nvmem_cell will be freed by the * nvmem_cell_put(). */ -struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *cell_id) +struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *id) { struct nvmem_cell *cell; if (dev->of_node) { /* try dt first */ - cell = of_nvmem_cell_get(dev->of_node, cell_id); + cell = of_nvmem_cell_get(dev->of_node, id); if (!IS_ERR(cell) || PTR_ERR(cell) == -EPROBE_DEFER) return cell; } - /* NULL cell_id only allowed for device tree; invalid otherwise */ - if (!cell_id) + /* NULL cell id only allowed for device tree; invalid otherwise */ + if (!id) return ERR_PTR(-EINVAL); - return nvmem_cell_get_from_lookup(dev, cell_id); + return nvmem_cell_get_from_lookup(dev, id); } EXPORT_SYMBOL_GPL(nvmem_cell_get); diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index d18caae2f7ac..e17617fa034f 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -55,8 +55,8 @@ enum { #if IS_ENABLED(CONFIG_NVMEM) /* Cell based interface */ -struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *name); -struct nvmem_cell *devm_nvmem_cell_get(struct device *dev, const char *name); +struct nvmem_cell *nvmem_cell_get(struct device *dev, const char *id); +struct nvmem_cell *devm_nvmem_cell_get(struct device *dev, const char *id); void nvmem_cell_put(struct nvmem_cell *cell); void devm_nvmem_cell_put(struct device *dev, struct nvmem_cell *cell); void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len); @@ -91,13 +91,13 @@ int nvmem_unregister_notifier(struct notifier_block *nb); #else static inline struct nvmem_cell *nvmem_cell_get(struct device *dev, - const char *name) + const char *id) { return ERR_PTR(-ENOSYS); } static inline struct nvmem_cell *devm_nvmem_cell_get(struct device *dev, - const char *name) + const char *id) { return ERR_PTR(-ENOSYS); } @@ -201,12 +201,12 @@ static inline int nvmem_unregister_notifier(struct notifier_block *nb) #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, - const char *name); + const char *id); struct nvmem_device *of_nvmem_device_get(struct device_node *np, const char *name); #else static inline struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, - const char *name) + const char *id) { return ERR_PTR(-ENOSYS); }