Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3606047imm; Wed, 5 Sep 2018 03:01:22 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbbIwp2XSZPVe8/CxX3DCKvTuuB5T0bAclmwgsRhOJzP+V6FOCJWkjLo9Qz4lc5Auyz5mQS X-Received: by 2002:a17:902:59cf:: with SMTP id d15-v6mr25802531plj.184.1536141681930; Wed, 05 Sep 2018 03:01:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536141681; cv=none; d=google.com; s=arc-20160816; b=Blw0EcbPyw+f3dRdhkbOjUyPJc3Fbu00jgG6PyL2bS/o2Lstfz/kZkBWAwGXTI8BbB Kp4Rmb+xWy+O4zge/EzeAeOcAq1ZUDNgSkVzNnyXF0xTT7zwQ1r6CTz082rlhJsBQUtK V3E7xSPJLJJmxFg3dYlHDUcMqAnPiCN0RBi8+KYMZRyOpRBcwcodKoNgftgNOTfIk11W ExHc6Umuq9v1uYgBNSyI8nIcRJa+IClm3dPh3Zdl1GBWkf/1h1JilYlhHo2ol6X6UopU 02Vdp0/EeZ1pkI0LXBeae3WQ7B9FH4BURyNb3hDVVTVY5ak5sre3usKVLKOaogGD/fQF ATcA== 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=j45vDkBOmdDOWBQ1a6J1jxXByydGfGnpBNiHLTOSQxOzOi+oMeXJvfiK59AKxMtd89 7g/UM/DbyYXnjO+AI/fKwcz/uF21MIqgZxJnqRii9eChpMVBqeKoftSEbF/FUWL02eh3 xKOFu1OuPurcZvOoCerMwHGx7ofQjTVMrAlJttgj5Rl5a986wmrOTEBwwu44nl0Mlc3g Ck+LnMNkOTdorkuMg5CtxC20WBkyKs9Mr2yPsE/PZeMamqAwnP22IHah89TjGnUCPJjL ZOC4o4HQUY2aIqYJCXHorX5oFFecqkmnwEavDQebPT1N0Uzon5fhbXZEcAIsXRHlXR/r AVnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=olnzXgTH; 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 66-v6si1469046plb.428.2018.09.05.03.01.06; Wed, 05 Sep 2018 03:01:21 -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=olnzXgTH; 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 S1728326AbeIEO1l (ORCPT + 99 others); Wed, 5 Sep 2018 10:27:41 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:44062 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728109AbeIEO1k (ORCPT ); Wed, 5 Sep 2018 10:27:40 -0400 Received: by mail-wr1-f68.google.com with SMTP id v16-v6so6925896wro.11 for ; Wed, 05 Sep 2018 02:58:12 -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=olnzXgTH3/Ltt1LMC3672ncThv0/yug+JO4S7trU/KYDABVP0vhUpxYXDuvwP3sNBZ ktplZBMkUoTbvNxwqhOv9/YX55QrlLFETdnfMNDwRXJaJgiD3AESGC1Up/3h7LUUrcSD wZLt9eyQvvQbFuiPMKxmgvMQNFWjpeYNBpAOc5fEyOqA4EZKMNZZtuSUA/mm8edr7udK GO5cpeM41Wh4Z7MA94GYwNMPA0Hyll7e+8k6KWHUb0pEwAJ+9Zps0D8FrD/CTt/9zpyN Kfk+NvNuJsPaDHDyFdmdN1hNoIn03XcU6/N9acno505xC/GFi4CJOmtJq0y0WxCZpbqL BfcQ== 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=uMREjm1i9OWFnTKBCo3FTgthGZeQTQav2soDyT2sE4pd5+GESX/6jo1t8T9pAscnwe /n7WuyTbk2eU/pBexoLMx5DarEJIm43aI4gjTiKETxLRW/dbQ9nutg9MNIH8jpBOV42q Dz4ylu4x65I3EYrRcQZrF6dX30Rfj/JdMgLCDvdmFyy7Zw2K591G1jYximYLaRw1SBR+ r/c6bIzWRaWANYlw+MNhJE9JZ+6l4l2omasA7HkJn33v4k6DuCuSjdIEUgdemV+tyr08 ZVLQWwDYUEo8n1PlmO6dZ5LouzsjhhPlDqAlW1vaGRqSvqsLb7B/F4ax94rl7Op9DVEP X1Bg== X-Gm-Message-State: APzg51CmELeib8zWkuID4QdGmZyZI/iEWiGqaXcT7oRdSMFzc2Z6Qa2X aY5Vxc8LAQKbPxvyKdil6g0vkw== X-Received: by 2002:adf:f687:: with SMTP id v7-v6mr26018446wrp.201.1536141491703; Wed, 05 Sep 2018 02:58:11 -0700 (PDT) Received: from brgl-bgdev.baylibre.local (AStLambert-681-1-33-235.w90-86.abo.wanadoo.fr. [90.86.152.235]) by smtp.gmail.com with ESMTPSA id l12-v6sm2127815wrv.29.2018.09.05.02.58.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 02:58:11 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , Joachim Eastwood , "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 Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [PATCH 06/13] nvmem: provide nvmem_dev_name() Date: Wed, 5 Sep 2018 11:57:31 +0200 Message-Id: <20180905095738.26406-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180905095738.26406-1-brgl@bgdev.pl> References: <20180905095738.26406-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