From patchwork Fri Mar 9 14:46:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 10270749 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5A3B260236 for ; Fri, 9 Mar 2018 14:51:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D38C29E47 for ; Fri, 9 Mar 2018 14:51:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41BE829E4B; Fri, 9 Mar 2018 14:51:24 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable 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 4B66929E47 for ; Fri, 9 Mar 2018 14:51:23 +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=yU4iDQYn5phRSn2ZZEEwkawVEm90gEazlQP9G8of37A=; b=QbumwHm/ekOYnwup46MAqy2tZ5 Bin7uK7AIyH5ChLv8TUkpgkyl5ZZzdCjKAJgDt+E9Vbw840njShBChhVZNXoMs73n2YEeRyFQFu/c Rv92+buUakOGiS2rtcSBF+n9fugM8EEhW3/FcbPSeZ9OqPTWkoVhgXv0rYpLkbKVm4/PnXEzHFxXu KPUC9l257+cp9BnDlLVMsTaw8UagZSyc3UtBFqpgC4Piwgkn0MgvmA7n3nemO6rkTqui9X/jiJHQ/ exaDKpcBf17weisYVLaZ7hXnTodlqECxdOoP4LbCKOQMYmgnxywHzD0m43igNLEBmlR2iN1dlVOPI 89jdSpIg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1euJMV-0000lz-5R; Fri, 09 Mar 2018 14:51:11 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1euJLz-0000Oe-91 for linux-arm-kernel@lists.infradead.org; Fri, 09 Mar 2018 14:50:46 +0000 Received: by mail-wr0-x241.google.com with SMTP id r66so1681056wrb.6 for ; Fri, 09 Mar 2018 06:50:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mKP2TnGnWIK7Bi0xi2aUnSgI/KaYTC2r/mhx+bI51D4=; b=e8TBcfp0fVYGZzwb0+3DfUenLg3kgLADFzVIrrswDGbQPexM5qAVtZbaR5zzzPQ61s 4WvsbXlD9cI9Ynxx9xDlJSpAj0sgWWg92aE0dUAdbPTY2iRH6ndnqH2aJ6won86H1Erk qK8Tm9AXQ66RnfGmyUGSDN8fhuv0NSAHKT/1M= 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=mKP2TnGnWIK7Bi0xi2aUnSgI/KaYTC2r/mhx+bI51D4=; b=gO0zHcqmVE9qTSCi/ouVLHPilagPAPcSd+GhnB6R5K79DCxA2TE3kZ8JHh3RdiFypS PsYJaBbgzgwvwqz4vyG4v+6nzsutEkAAKPKUOAjPLpbQpHLpEM37N5O6cBxJu1k4BSMd PfhFn9iRTjnKlU6kqJenarjQ167LE8SspzNMO5mZJsLNOTs7Wg1C3VkC4c1NHJz4ewrU 5PtEOH7mB+9Gwa7O9ofngrdzG4QdkygVaPMff9d/4BLMvEFUH2RbwSA4pcBFQSz0QUj/ UQX5gijnpMrh7B4meIwPgAuAU1goM+a2KO+XqtYXs8mWjbVc6vR0rn8gT7cymOrnlpQe 6IVA== X-Gm-Message-State: APf1xPCFSm4Hj/o7ooEnzHLZ6Pc+dttWZE4dbR/HCNcPzk51dL3/h2Zz 2vcL2ctoZi64h6ZsBylqc0oJzw== X-Google-Smtp-Source: AG47ELtba8Iayxc46r0Ggb6c3eLGZ8f8m57saq1hbR3NL0wIqgzXQpMoLdKEKrcYBKYmVDTgtFt7zQ== X-Received: by 10.223.138.153 with SMTP id y25mr25606025wry.257.1520607028099; Fri, 09 Mar 2018 06:50:28 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id u48sm1191901wrb.85.2018.03.09.06.50.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 06:50:27 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Subject: [PATCH 02/25] nvmem: core: Allow specifying device name verbatim Date: Fri, 9 Mar 2018 14:46:56 +0000 Message-Id: <20180309144719.29904-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180309144719.29904-1-srinivas.kandagatla@linaro.org> References: <20180309144719.29904-1-srinivas.kandagatla@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180309_065039_462217_CBB5A841 X-CRM114-Status: GOOD ( 15.06 ) 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: Heiko Stuebner , linux-rockchip@lists.infradead.org, Andrey Smirnov , Kevin Hilman , linux-kernel@vger.kernel.org, Masahiro Yamada , srinivas.kandagatla@linaro.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, Carlo Caione , linux-mediatek@lists.infradead.org, cphealy@gmail.com, Matthias Brugger 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: Andrey Smirnov Add code to allow avoid having nvmem core append a numeric suffix to the end of the name by passing config->id of -1. Cc: Srinivas Kandagatla Cc: Heiko Stuebner Cc: Masahiro Yamada Cc: Carlo Caione Cc: Kevin Hilman Cc: Matthias Brugger Cc: cphealy@gmail.com Cc: linux-kernel@vger.kernel.org Cc: linux-mediatek@lists.infradead.org Cc: linux-rockchip@lists.infradead.org Cc: linux-amlogic@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Andrey Smirnov Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 11 ++++++++--- include/linux/nvmem-provider.h | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 35a3dbeea324..99e04cfcc723 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -473,9 +473,14 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) nvmem->reg_read = config->reg_read; nvmem->reg_write = config->reg_write; nvmem->dev.of_node = config->dev->of_node; - dev_set_name(&nvmem->dev, "%s%d", - config->name ? : "nvmem", - config->name ? config->id : nvmem->id); + + if (config->id == -1 && config->name) { + dev_set_name(&nvmem->dev, "%s", config->name); + } else { + dev_set_name(&nvmem->dev, "%s%d", + config->name ? : "nvmem", + config->name ? config->id : nvmem->id); + } nvmem->read_only = device_property_present(config->dev, "read-only") | config->read_only; diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index a39f76ff2ccd..b00567a07496 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -43,6 +43,9 @@ typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset, * Note: A default "nvmem" name will be assigned to the device if * no name is specified in its configuration. In such case "" is * generated with ida_simple_get() and provided id field is ignored. + * + * Note: Specifying name and setting id to -1 implies a unique device + * whose name is provided as-is (kept unaltered). */ struct nvmem_config { struct device *dev;