From patchwork Mon Jan 1 23:22:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10139745 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 8654760362 for ; Mon, 1 Jan 2018 23:31:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 788DF286B1 for ; Mon, 1 Jan 2018 23:31:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D41D286CF; Mon, 1 Jan 2018 23:31:55 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 1A21A286B1 for ; Mon, 1 Jan 2018 23:31:55 +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=KDuEP20nHZwMDcesEBa91dpazwtbsdjTxu2rwTV3ErI=; b=NleuKrCEBFrxY3BlreiKb7Vc0N /32owJr9kHultxWP+kBq2i8G1uP0lEMG3fZ0lKH8bU4jF23QExXAgoubDPChHEGYQ5hdkNMgy6ctW 5dialgeXe97UE9QMwo3qePGrH1bFxfSIkYWUgXh9DmLGTjMsXW/PbLghsJLsnYyMPP8xG9AiYXArI EC/valRsolegyPFhyU+Uf/tLxXTdC83uvj6TPktSdICO+l8Fsz+obv6vWQmTv0XCGey/RdH1h7A8p fhbb+hp8SYq4OlFQ4QH+dvTyPDQPOcVF3/cAv1t33r/w2kwk/UOCbY9sBgORoEo3hjJLxYzNw4o/Z rKjAbicw==; 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 1eW9YP-0005ev-M3; Mon, 01 Jan 2018 23:31:37 +0000 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eW9Qw-0007S3-Lf; Mon, 01 Jan 2018 23:23:57 +0000 Received: by mail-pf0-x242.google.com with SMTP id p84so25006541pfd.3; Mon, 01 Jan 2018 15:23:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=67895vJKWMyGWuudG6QpoONVThXhteKHAqdiBlFE/4U=; b=Pr1iMUhEGyp5syF3UZs4yv4bT0G9cquF0QVatW2SBY/sIiVeAN5juY7na6AP0lhG2b WIZSy1GRH0yEDgfJtMvXQZAL/LB1NWf+nJZfEeUACqb1BXuHOuy+xl1xEPhUPytoWWMB jm4rdBW8tDLiN0zvGx0m93sprR/g5FXKdHGP+1u4aM2cyMJ7wSGEOtPsjRQKuIL0XKYG qA2v5gbnwr8ibNQWOuSYSJ18IlF2z8lqXuF5BIEwSgqDv3neFXwfWqm0fMfq5Oxvv8zH 79+RWYJqiesbwVNoVagB68NGNILHGcxehYWDqr2yc6MC9/3zmGe8c/Hhz/IBdTTo+zf8 SUWQ== 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=67895vJKWMyGWuudG6QpoONVThXhteKHAqdiBlFE/4U=; b=X/oR11eFTs+YK/DO+jIWMEU+sw1jJmBQ6LmXcFXt0TmvyUGMCNYIfJ2jsszrNdsFOV Kb6+XnVdD52tTeh1wfhp+zE5Ou+RUg2msRuSSnUiB0QF1BRdQeSUl6vxi44JH0m3GeHY PUez3NN43yDUhBSgeYGnDBUHDBSlb7L/v6pioqOxDNxJtjDiPcm2zztNTYgqq16LNbQQ 2/+wYuP9t47EBAXAL1dZKWiKr4dOSt8d43Ql2YOFxzXETKwUYjblnlqQYp9+xi0XqCHL csE3FF8qLhnOPiypgx47/n1yXaWBlsItZwJqPmE0XDXb8huEQhq5oYZ+HimCimXRVKjM RQfQ== X-Gm-Message-State: AKGB3mJuvS8wDkLp6CODuLql1EAmm9OjlvqWdCnu0HF5iYkKt6zx+uyY zPzL6VAO/PYOhwlsK1pPi7I= X-Google-Smtp-Source: ACJfBouaC3EHSQqfHeNTcNcxOitaF10Ie9Xuvl8/o2gvDAh/2VnXMlseVpkOtPZijnddOTmf7Inhrg== X-Received: by 10.98.194.150 with SMTP id w22mr44235396pfk.67.1514849023721; Mon, 01 Jan 2018 15:23:43 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id t75sm90857156pfi.146.2018.01.01.15.23.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Jan 2018 15:23:43 -0800 (PST) From: Andrey Smirnov To: Srinivas Kandagatla Subject: [PATCH v2 01/21] nvmem: core: Allow specifying device name verbatim Date: Mon, 1 Jan 2018 15:22:50 -0800 Message-Id: <20180101232310.30420-2-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180101232310.30420-1-andrew.smirnov@gmail.com> References: <20180101232310.30420-1-andrew.smirnov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180101_152354_800192_B6666C88 X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@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 , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Matthias Brugger , linux-amlogic@lists.infradead.org, Carlo Caione , cphealy@gmail.com MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/nvmem/core.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 5a5cefd12153..57cbeacfbeb2 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -475,9 +475,14 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) nvmem->reg_write = config->reg_write; np = config->dev->of_node; nvmem->dev.of_node = np; - 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 = of_property_read_bool(np, "read-only") | config->read_only;