From patchwork Wed Dec 27 22:59:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10134147 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 A35B360318 for ; Wed, 27 Dec 2017 23:02:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95FC72CA80 for ; Wed, 27 Dec 2017 23:02:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AAB22D479; Wed, 27 Dec 2017 23:02:01 +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 3E1342CA80 for ; Wed, 27 Dec 2017 23:02: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=gnkClhEjOcBKU/rf31ym0oTg+hnjpjdm5LgMUdfXTME=; b=CTZA6l1FGaJ9DnytzpXZr1HpEy qDj4XOEXuiDgnxIcUKDCJEO20ORKaQZPqo/6fxxl7NzChk8mORs2zwpDkKhUDWKiFIKc4ZnSPbG/6 9Ayl7MGPvge31og+lfVo3ueQzLB9Z4z8k5GZ4xqmInpbLtVzxSJU31f2+lKq8WhkSb/0qT8yWKjcn ZHoLTYVGNwGNDSt2nktfk7XXyc2P9DiWQREN8mMDon9+cEBMEqmtZdeIEp3n128uSe3cUhvc6SyEW oswB+uAjTGywr90hHE5uWbsT82FgLPZyvV/FND0TeWgkrK2QJ7tTfzmRU+ytehVZC1rPAdCzs7trL Z3eXSMIw==; 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 1eUKhx-0005QN-J6; Wed, 27 Dec 2017 23:01:57 +0000 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eUKgT-0004RL-9i; Wed, 27 Dec 2017 23:00:28 +0000 Received: by mail-pg0-x244.google.com with SMTP id o13so8506753pgp.4; Wed, 27 Dec 2017 15:00:14 -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=BGwPzD9lsb7B5DDGm4ahMgppkUtj/4IHxa6tb79X27U=; b=QOePVFcHure/Jmq8Biug753L8HfJK9YJxDBbcG36Rd2dHsu2HxWyk8vj+5btiNnWBi 0JQBEbo1a8XYfYONsByiI53FpRq/OihldGQo/sBcj2Tchz5pD2plqQWT1F9YfSUufOd4 Zm69hhETjpVYSqXGIC42RX1PYIyPVeT5o7IcOT9bKcpZz0A0fL8CRaOSxfUOkgozjcg4 2HKoWgcYwYQGfnW64T3x420hBTy/KS4f6I0AfpxG55LqzmeTIkVKY1p2Pbc3aa3iOKjj ztoig7LBQbvyMD2jMum2IDdDTGVaIlCeHlOUV9VNqCSshI4nAUEfVdWFXaRreAx5E2KR 5jpQ== 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=BGwPzD9lsb7B5DDGm4ahMgppkUtj/4IHxa6tb79X27U=; b=AucHlftRjsk+UvVvZRnitSOub3K5Tycbk30m1FOUmJ3cC7kiPxc7KVfrCqmXqCWz7U fGIcdMu8NznFjl8GXVirxHOdcoz9/sWbGeVRxkE48YHYoYUaOd7eK8D6mIm/ybAXBMdu 2YCWMF8/Q7GClOq9Qsd/ZV7+LH1oeBu5jRUyptMXsPS2TvcLmKXXqiIyy3eDuljrMcdu 9Z41ze44jgGWjdJy7kUBKzn8ANKRGOvFPqcW++hRnbUSoyKm3Vbzw+XWcsHSm2rdXx1a n66L4X9LFkcFk/10YXCtfu1JnqH0omcWAfXeIQ98AqyEoXbNILJ5GHkYYWTUO4bTZyt9 NYDA== X-Gm-Message-State: AKGB3mJ0mZ8xQ4xTdtN9OekRPedwMiY+oBY/0dXE0mbsglF2Ux67WRbb k9SfigGMSEo2HLrfT5snCvo= X-Google-Smtp-Source: ACJfBou9TXQHxOB+lwaZQ8DAx11WUsYmNR2+OsSq/7oo4GJ2IelcxWy+vJan4Tlh00v2o+abdmX9Mg== X-Received: by 10.99.123.10 with SMTP id w10mr21234737pgc.57.1514415612932; Wed, 27 Dec 2017 15:00:12 -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 l19sm27810326pgc.57.2017.12.27.15.00.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Dec 2017 15:00:12 -0800 (PST) From: Andrey Smirnov To: Srinivas Kandagatla Subject: [PATCH 01/20] nvmem: core: Allow specifying device name verbatim Date: Wed, 27 Dec 2017 14:59:37 -0800 Message-Id: <20171227225956.14442-2-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171227225956.14442-1-andrew.smirnov@gmail.com> References: <20171227225956.14442-1-andrew.smirnov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171227_150025_407297_A8F40B7F X-CRM114-Status: UNSURE ( 8.76 ) 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 , Joachim Eastwood , 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: Joachim Eastwood 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;