From patchwork Wed Aug 8 15:31:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10560195 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7570B13BB for ; Wed, 8 Aug 2018 15:33:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6365429E6D for ; Wed, 8 Aug 2018 15:33:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55F7B29EBB; Wed, 8 Aug 2018 15:33:38 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE5DC29E6D for ; Wed, 8 Aug 2018 15:33:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727534AbeHHRxq (ORCPT ); Wed, 8 Aug 2018 13:53:46 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:37398 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727838AbeHHRxp (ORCPT ); Wed, 8 Aug 2018 13:53:45 -0400 Received: by mail-wr1-f67.google.com with SMTP id u12-v6so2411617wrr.4 for ; Wed, 08 Aug 2018 08:33:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=C1ENfkoTLjW8E17DVw+md+9F6tiK3Z1VCNCm2wV2Sh0=; b=jPZR1hu5zBkXG9rS/CQnTD+BZj8gpnkEM9pKhPLQz0sLHXzfppDAMqcLQFOncyiayL rcgsB1mru/+1XB8kdyDRoOaZWdkJ9787WgUisZ3SwQu6vxr0DWYU+8s7bZfb3tPHnOfx MN7FvU1aDT9UWADNBnCICEQRJeIjS9RXJ/vH0wJGuXyu3aG+C325BwmowNd64S6gSX3c 2KBqPJN/aZ4+c8BfDyWBd9RflXfeVcQcUEpO1Xk34IIirtmqfodmt/Q8onTCMOw43QZY DSmzGCckG9dDMZ4Ao9YVf9JvLyk4SdAkJwe7Ey3AjTpN9PSjaLtO/jqq+QkIdAybK02N Vq/Q== 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=C1ENfkoTLjW8E17DVw+md+9F6tiK3Z1VCNCm2wV2Sh0=; b=lnSl4rB4SKifbFj6A2fGI5HAU2Xw9TUJ/Ejtt64M0QpiijVt/rwyvqVN4p5gTfLK9J vP8HO2KB44FKU2HkQz+Q9AFBKWtB1NLkH6cX2DgknCLiZ+WmCRlXjM2XlMFxOAEk7A2e E2IqKqrfKGD5Zw3tZOpfMsfu9HRvozJkpe55q3igDSUYqB72BMiescm/pjTC1Fned+qx 8PBUArt6oLDuQ3EzJhRQX8ZTafyN/MjmVaXeXmtDpIoAuV+fs9QZ0pUJnjyYhHTlCKqS IanLEjCpToNQ8SVeHETYTHxfqI6H9Jj7tq5D1xkjQrkpQjFDlxterllTizuvWu2ob0lg mmug== X-Gm-Message-State: AOUpUlHfIUJYqzKaIJSboujP3tYYYeRXIOpwSb/BPzX/dITf7TGmC8IN XBm3kFYWCzPxu2N/aTekjVtCrA== X-Google-Smtp-Source: AA+uWPyeKUZkZ5lzpR7fQUL35EZxOiMcdK+l1BV3+kpdv59GQTqxqPRSG5Tzp1r0MeLy0jLVvWQO+A== X-Received: by 2002:adf:f091:: with SMTP id n17-v6mr2355042wro.49.1533742413825; Wed, 08 Aug 2018 08:33:33 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-MAR-1-609-89.w90-118.abo.wanadoo.fr. [90.118.185.89]) by smtp.gmail.com with ESMTPSA id s2-v6sm5240915wrw.52.2018.08.08.08.33.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 08:33:33 -0700 (PDT) From: Bartosz Golaszewski To: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, linux-omap@vger.kernel.org, netdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 04/28] nvmem: provide nvmem_device_name() Date: Wed, 8 Aug 2018 17:31:26 +0200 Message-Id: <20180808153150.23444-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180808153150.23444-1-brgl@bgdev.pl> References: <20180808153150.23444-1-brgl@bgdev.pl> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Kernel users don't have any means of checking the names of nvmem devices. Add a routine that returns the name of the nvmem provider. This will be useful for nvmem notifier subscribers - otherwise they can't check what device is being added/removed. Signed-off-by: Bartosz Golaszewski --- drivers/nvmem/core.c | 6 ++++++ include/linux/nvmem-consumer.h | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 128c8e51bff2..b040370292a7 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -1440,6 +1440,12 @@ int nvmem_device_write(struct nvmem_device *nvmem, } EXPORT_SYMBOL_GPL(nvmem_device_write); +const char *nvmem_device_name(struct nvmem_device *nvmem) +{ + return dev_name(&nvmem->dev); +} +EXPORT_SYMBOL_GPL(nvmem_device_name); + static int __init nvmem_init(void) { return bus_register(&nvmem_bus_type); diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index ae4d30347602..c4000a218f67 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -69,6 +69,8 @@ int nvmem_device_cell_write(struct nvmem_device *nvmem, int nvmem_register_notifier(struct notifier_block *nb); int nvmem_unregister_notifier(struct notifier_block *nb); + +const char *nvmem_device_name(struct nvmem_device *nvmem); #else static inline struct nvmem_cell *nvmem_cell_get(struct device *dev, @@ -167,6 +169,11 @@ static inline int int nvmem_unregister_notifier(struct notifier_block *nb) { return -ENOSYS; } + +static inline const char *nvmem_device_name(struct nvmem_device *nvmem) +{ + return ERR_PTR(-ENOSYS); +} #endif /* CONFIG_NVMEM */ #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF)