Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1604954imm; Fri, 7 Sep 2018 03:11:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbSqGQnI4ze4zgCyJlGdUKsOY1WamfT+XRMuiy2DPLm+jLsnDxqjbRcV5smGQ/9h4XmgUcT X-Received: by 2002:a62:591a:: with SMTP id n26-v6mr7746273pfb.94.1536315111517; Fri, 07 Sep 2018 03:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536315111; cv=none; d=google.com; s=arc-20160816; b=eKGb8V2qUnEbPHI/NkkVZ1/tFyDfEKPRg619QheP/9fs0nJEMESbsJ1Ie94t7ctELD Ii0xyUbNZC8x6X+mbDLLhdx4JYNse2d6Hs4XIpSnUVzoPhKz4RXGntskGxGR6jLbtN6O I9n1lgNye4QOXeTh/D25S5wYWEpF3mb5r4TgJr4BVnvz9vq5et80bCvu01qAOQcNm/uX bsLV6OpHuOfp1PjYMbBIrLgb5hNZW8ld+9U9EM32G15GHM2z3RHo+nRWNOd0cchWttuJ xomcP6PRANIkVlPgL5iuEG4nkZfE5ux8h6hEfFODig82OiDF3H9Gs96jOFPz01YTGb2U jdLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=KZATZdgnPAoTpW/g3YD69XZQ2uG+BR5UrHmRyj2MT+4=; b=Dr3gveszvJj9oj4Em8CK0b1kH6AEdKvZN0Y9pzptRaFZI7dChhVS4f9/CB8YNBdI1U 4IOBdXAtLBwJjs7j7Oi98+n1I5+XIcM755on3dUSqMG7GgLFkNmYDoK360JJp9Fw6CGA ZfOvO9rt5/loAHRbFQlHvNAJvwYqtGeDrPrtPsKvggU2kQRjkStDRFi6zSu/J+osebuv 7s+wRMQfEHs6400/5355XuYudufYPt+EVfFV1hOxVBJmKbVg1Xq7Nzfn3CgJJgW9f0JN KkLT0WPwXlEL1IGNxTkvj3eEsX9Eeb4LivsNU0UwqaR+NdZ2XcCocDlVucsgCKn4gtmO ZaTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=pcULNN92; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h8-v6si7195344pgp.202.2018.09.07.03.11.36; Fri, 07 Sep 2018 03:11:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=pcULNN92; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728732AbeIGOso (ORCPT + 99 others); Fri, 7 Sep 2018 10:48:44 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:37219 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728510AbeIGOsn (ORCPT ); Fri, 7 Sep 2018 10:48:43 -0400 Received: by mail-wm0-f65.google.com with SMTP id n11-v6so14024432wmc.2 for ; Fri, 07 Sep 2018 03:08:29 -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=KZATZdgnPAoTpW/g3YD69XZQ2uG+BR5UrHmRyj2MT+4=; b=pcULNN92xTe/qjAuzPWSQQbdM1Ite5wqjDFVT8DvggEMW1fn5rpUwcZU/6rRh7mov0 fZdJHqHzazXw2lc4PNtyp09Sxh5O9+skXkL6+MbIbfTXsVtVxlRWkZHjsylt5emgansP zNwTjh0hUZqCZYofmDXMwFLCPs74wZ77Tn1eN8tnyg029pLHni2TC7xetFj7c8lBVyqW eziiBZaHyP/bbqL9zD58e9/GUwea0KZXxPJI2Yxl9DoD/TAWVdYJTWhH31YuaaDygeR+ 0LHlOQLrhwoN7CDAkzRBHepsMk3Lrs925N8KBejlMIKanDPIaQrARDlXvOnAH4y/OYwD 3CAA== 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=KZATZdgnPAoTpW/g3YD69XZQ2uG+BR5UrHmRyj2MT+4=; b=IasaIAdi8dP4AwUtkl+OGhmLZexd2TctGgXmkW7/A5si1T9YIhiL7dQv2OOa7Cs635 8S2rSusBEf6qmOReFHbsCU96RkB+PeXWiPz+UaXYkntk/EP7YnAcEKAqw3a+IVsm4ANB VKay0A/20cvHNoTsQYbDwp80biqfLwRZTAsjHiG6ekBTXK52ZBM6qP7Strfc6wC/5oMW nkP6YHxawNA9A8CX9KN+pBXU/KKqCjmpRmOSxtEBbAFw42lyRya1f3XWgRIyduoLnRwE WANLIWdoBeyH526sfY6+6RBA3hUJ1DvYO/TpEtFirB/c1RkhDOsntddeMo3fySBk/8CS yWVQ== X-Gm-Message-State: APzg51C8CMCYac9Cv4Ng5YQXh7vHKd8rrjMC1L66utdS8Z+qcbpE9olM yKQpjNjARKKxwhNq1rgfVQigUw== X-Received: by 2002:a1c:b286:: with SMTP id b128-v6mr4301857wmf.121.1536314908917; Fri, 07 Sep 2018 03:08:28 -0700 (PDT) Received: from brgl-bgdev.baylibre.local (AStLambert-681-1-83-232.w90-86.abo.wanadoo.fr. [90.86.25.232]) by smtp.gmail.com with ESMTPSA id 72-v6sm6631619wrb.48.2018.09.07.03.08.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 03:08:28 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [PATCH v2 08/16] nvmem: provide nvmem_dev_name() Date: Fri, 7 Sep 2018 12:07:42 +0200 Message-Id: <20180907100750.14564-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180907100750.14564-1-brgl@bgdev.pl> References: <20180907100750.14564-1-brgl@bgdev.pl> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 13 +++++++++++++ include/linux/nvmem-consumer.h | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 89b91f73d08a..364ee16e7d6a 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -1144,6 +1144,19 @@ int nvmem_device_write(struct nvmem_device *nvmem, } EXPORT_SYMBOL_GPL(nvmem_device_write); +/** + * nvmem_dev_name() - Get the name of a given nvmem device. + * + * @nvmem: nvmem device. + * + * Return: name of the nvmem device. + */ +const char *nvmem_dev_name(struct nvmem_device *nvmem) +{ + return dev_name(&nvmem->dev); +} +EXPORT_SYMBOL_GPL(nvmem_dev_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 7e9fb5a19d91..1313da6731ff 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -43,6 +43,8 @@ int nvmem_device_read(struct nvmem_device *nvmem, unsigned int offset, int nvmem_device_write(struct nvmem_device *nvmem, unsigned int offset, size_t bytes, void *buf); +const char *nvmem_dev_name(struct nvmem_device *nvmem); + #else static inline struct nvmem_cell *nvmem_cell_get(struct device *dev, @@ -117,6 +119,12 @@ static inline int nvmem_device_write(struct nvmem_device *nvmem, { return -ENOSYS; } + +static inline const char *nvmem_dev_name(struct nvmem_device *nvmem) +{ + return NULL; +} + #endif /* CONFIG_NVMEM */ #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) -- 2.18.0