Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3104230img; Mon, 25 Mar 2019 03:59:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMmfdrlP6zZ0632lJT5Fe6LfSLkN3fMtwWSiZ+CPD9DJ+3x6FhNVVrAz3D9SKseAgleZI7 X-Received: by 2002:a63:ef57:: with SMTP id c23mr22637970pgk.176.1553511577147; Mon, 25 Mar 2019 03:59:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553511577; cv=none; d=google.com; s=arc-20160816; b=lRC0/9Hw1fKpxSuDeVamiGLKL54ZtntPv79iXuJpbBdjqCB6gnquGFxbEJRB/zv2MQ cza7dNjR9ziyhDdoT8nMKl7psudi9KoxOAGSv6J9ahFbz/Kk+IqO47KgTspqlp3tA5ae oKvYIc5uIKLjcSvXPI/i7gXCZN6ITf05pgaGMMP86MWKEQuUdDfloQHJYhWilBUKw8Tn qkqwaRyYIsSLjqNxVfaj5at31IYV9fsoe22ddtnNeGZJWTDKU0JErH8mNbs9ywUVLgGw f5TkYZs8040CHMmYm8R8Mr/RTIA2pXajPqt6bisY6jGndUv+816nhNejIwct6Pe2P6Ym YI1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=eILKmzMrpMZFo3dDcsQ+WEokZNTW7WudiyklPBTgKgg=; b=xAvkaIhvl7oMYx1apWGoBAOVq57tDGh0m2SG/Cq+U/QaQXCOm/hAyTiMeaNdbt5dhW sY/uwD4snmX0JpfNdyerUB7Li3CNzZnN6Gnp40QFiIf5By17A/KFsoy26dE/raRMeXzR ILANwNlXWKK0zf8a3Q8Hwad3JrV9hKbFIfTL3Xx4Wx3yuCUaZa7u1zkGkfitKmYQocA6 hSd6BNeYA1kZPFKZJBN16Mq5RtreSOxgMYYq5GHD5ViqzQujwz5QxjP05MrchNhTUCaH 524Bh1ZHq4klshwULkUN1lxWvJ7lz8nVE/zqh98i2VhKYCbsBz2JT8lAD4yD/Dz/xTOl rMXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="oqGU1/Jf"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z9si12972791pfa.97.2019.03.25.03.59.22; Mon, 25 Mar 2019 03:59:37 -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=@linaro.org header.s=google header.b="oqGU1/Jf"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730721AbfCYK6l (ORCPT + 99 others); Mon, 25 Mar 2019 06:58:41 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:37069 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730633AbfCYK6l (ORCPT ); Mon, 25 Mar 2019 06:58:41 -0400 Received: by mail-wm1-f66.google.com with SMTP id v14so8535634wmf.2 for ; Mon, 25 Mar 2019 03:58:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=eILKmzMrpMZFo3dDcsQ+WEokZNTW7WudiyklPBTgKgg=; b=oqGU1/Jf2LZN7TUMx9O6j7/WzFDIexPS79zAzMueXSbMCwHpqvBtETSitsbCp7uqEv fCVHHnQEBbX0ph1x1N9mJ2BpAkaH4aZ+6N1b086iRDYr+xzoICzb2UF8bH2O5gXrZi9w WA3uDj02C+CuiAsKEHth4VwoPzVsKUj7jbwlwc2AMP3EtpDQmVnyEFUh4OAZ8OHH3sDp yUolUyo3GQY4a1m6FPJF09qdD2f2il8tUMPaHq4tYPf8C008Ijn9LBoxO6ByXtJq9Vuo l/iqnSR9eaLe1oitGE+gB5XSKU2P87J2yD1lcif8Hb4mlSA7IU73vYIcL18VfCpEzazU Sttw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=eILKmzMrpMZFo3dDcsQ+WEokZNTW7WudiyklPBTgKgg=; b=KxmaqFB4XMPYV9+1Finfk1zkRjvw595AYdPpL61rRk+w2VEss7LQcaNPZfgk9ykYeB DRRwiWaDt+2Ix2sUNoeP6Yny0uvjaJQI+Kel7OtTSh4bpd793RqQ9kS85LWzWri7aZgu 3sUkiQZo1ggfOkJ8qhpAmnCI6wcYAYgDa4n5wJ2ZY81US4P8SYu/T7pl3qT9GSGIy4LV 7hvW1kViEmNmCqzodta3G6JG8goLpklgkDLEfqHckew8ikQ4mr3yWcUyqHvu0RNSFyyv gtXaLA2W/N4OIZ9/bR1WSd+zV3+msxGYrXbXDCB1/5XkfQEwCQ38I+2sPEFGL4lRPMzr z3/A== X-Gm-Message-State: APjAAAX+ZNpcoZ0Kn9pB+FL/rf84VXK+OJn/potHDO53v7I0nDVRypdX LdVzTUBOCfFuK4eUZnsDfa2+PA== X-Received: by 2002:a7b:ce1a:: with SMTP id m26mr4792005wmc.131.1553511519125; Mon, 25 Mar 2019 03:58:39 -0700 (PDT) Received: from [192.168.86.34] (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.googlemail.com with ESMTPSA id o17sm16815863wrw.73.2019.03.25.03.58.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2019 03:58:38 -0700 (PDT) Subject: Re: [PATCH v0] nvmem: core: Export nvmem cell info to userspace To: Gaurav Kohli , linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, Shiraz Hashim References: <1553061201-28894-1-git-send-email-gkohli@codeaurora.org> From: Srinivas Kandagatla Message-ID: Date: Mon, 25 Mar 2019 10:58:38 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/03/2019 15:25, Gaurav Kohli wrote: > > On 3/22/2019 8:53 PM, Srinivas Kandagatla wrote: >> >> >> On 20/03/2019 05:53, Gaurav Kohli wrote: >>> From: Shiraz Hashim >>> >>> Existing nvmem framework export full register space >>> as nvmem binary, but not exporting child node of nvmem >>> which is nvmem cell. Kernel can read the specific cell >>> by using nvmem_cell_read but userspace don't have such >>> provision. >>> >>> Add framework to export nvmem cell as well, So >>> userspace can use it directly. >>> >>> Signed-off-by: Shiraz Hashim >>> Signed-off-by: Gaurav Kohli >>> Co-developed-by: Gaurav Kohli >>> >>> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c >> >> Thankyou for the patch. >> >> Why do you need such provision when the userspace can just get the >> cell values using correct offset and size. >> This will also bring over head of managing entries dynamically + >> confusing userspace abi. >> >> Unless you have a valid reason or usecase I don't see the need for this. > > > Hi Srinivas, > > > This is mainly for user space convenience, In existing implementation > they have to do manipulation according > > to offset and bit, And with present patch, they just have to do cat for > cell name and which can also be easily maintainable Yes, that is expected I guess! > > for different soc. But with current, it is difficult to maintain users > space code as each time we have to change user space code according to bit. Which user space code/application are you referring to here? Are these open source? > > > This would also help to expose certain bit only as per the bit parameter > mentioned in dt node, which would also help to protect exposing of > NVMEM is not just limited for DT users, non dt users use this f/w too. So the problem is not as simple as it sounds. If your issue is just about DT, you could easily parse active device tree via /proc/device-tree and get cell offset, length and names from it, use this information to read from nvmem. There are other concerns about the userspace ABI w.r.t udev events. udev events would race with the creation on this cell entries resulting in a behavior where user-space applications would not see the entries after udev events. In worst case if we decide to go with adding cells to nvmem then we should do it before the device is even probed using group attributes. And this would mean that we can not support cells that are dynamically defined. And there might be some memory freeing issues in this method too! --srini > other bits to user space. > >> >> thanks, >> srini >