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: 10139743 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 0070D60362 for ; Mon, 1 Jan 2018 23:31:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6D62286B1 for ; Mon, 1 Jan 2018 23:31:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB6A0286CF; Mon, 1 Jan 2018 23:31: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=-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 50E94286B1 for ; Mon, 1 Jan 2018 23:31: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=ucWKITRfkxwWd5xzNynq3db1nPELIgOgB01aeApaI7A=; b=CTMTVOxd+532v7Lqqos9Aj55Sd CLJ2I1SxZzVFEkpGvu9Np4sPiVuLWkxxKf9vnEMRXtDtCYqQ/Yel5m7uOpnoeYClxPCWK81HCcv6p YGsTZd2jhM5zXn39fcCFLVp3LQ/l51yjb2dN4ldY6n7gvY9alr8qvBkZsd3Zk1MkfJIym1FvjBOiq Abb04V+TYfFdHsmERx1VrjqGU386ddrAwkb31d56PusRySaBgL1/5mYWsKnOG82EtaXyfRYCAUI7f GMyrWYqvkcSyl1MWPCnVoT52pkfM4h61aXhFvnhcXppESV74tyjqk2j3fw77xZnSRYN+wdxFctspq 9TMjmiFg==; 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 1eW9YY-0005jq-JP; Mon, 01 Jan 2018 23:31:46 +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-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 , 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-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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;