Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1001863rdb; Fri, 16 Feb 2024 02:08:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV0MxVgWBtkOHHadLcGwBsIipVQJvDLyITjceZUNNw40KTRIrmGq7FLpinVkXVEkn9obDB2KPvcF5sQLX9feT5ISADHT7Y9Q3mRSpJeQg== X-Google-Smtp-Source: AGHT+IFurDJleV7tv1W1Pk2IRy0sB9YoXVAnsVD6gEbOGDl7drfNPPeKHLJqv9+dYYJ//Uw8O5uC X-Received: by 2002:a9d:6c12:0:b0:6e2:f3fb:4394 with SMTP id f18-20020a9d6c12000000b006e2f3fb4394mr4730207otq.13.1708078139082; Fri, 16 Feb 2024 02:08:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708078139; cv=pass; d=google.com; s=arc-20160816; b=DRAyGoWkV9RdkI7MwaU/bCRbDwvOzF7OtZ6WwgYAYMwHokl5vYYNJowr8gRSjzL4Y7 dnTLu+ZzCwfd/41mo9U1fT0EtTaXlzQ0GCSBV3H5JWmrh6uWWecifqmovppAtEAZtyOq 9/A2ssrRdxDtmOvRwkHBk3HsbBk4vxY8a+Mhk0p+Zs6duNHaRwXqBFOIbYqFh+68KMiC /Ppq/kPPYi9AJvshxYV2nYqP7SUTxGUDOyVFjMp7+Ddvm/RIHrlcBcDG4jprxaQT/WJu NSYbI/V/PNasAO9WLyW3w5XwzgfRIVO34AKtlBc06vrd51l2E8vfeDJznyej7bzHys/6 U+eQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=Do6/M01yM6OysnCsIBqfF2Sughin9uxdwPrfUPmskAU=; fh=cYF7b5oSYgRgucdFCJ/MAi7RL+mdP84oiuXeqjf5/0c=; b=rBTlcPQNOwOYc0MOnA187xkSnocRPQ2GcpqqXLOblrECzTpDd6ZJi3/p4CB6P58iTY TNlmxE9Xp83TH7TNkT15b7gOG9PG2Hmdt3tSPp1BI+2uBiXNlNWDSzthdUXq2z2r8c4p VeKZhHw8/1HHEai5ziYIc6VTqFpV7tvTFRinRg34TWA+QpMQRCgtr2kWmgIGMcm3YArw iNT3kOomb3HWCySIX/hOJPzA91YgjrunPwWldede2bhKqzBn8f3/1QukQrA6UCUPF89p y2VnhpUl+PSIHqAWDjyTeGs2vA6pajGqeFKSHcJvSxr7LtgfJevEJvgTAGFtXNkiowGJ DURg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-68414-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68414-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j65-20020a638b44000000b005dc9564a0adsi2785412pge.786.2024.02.16.02.08.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 02:08:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68414-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-68414-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68414-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8AA09284D03 for ; Fri, 16 Feb 2024 10:08:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 722EC1CAA1; Fri, 16 Feb 2024 10:07:58 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D57C1C68A for ; Fri, 16 Feb 2024 10:07:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708078078; cv=none; b=QjrJkUHgzmXYe+950sYHLIMFpNCnyMiG1yCOqFmT7PQ2ca/Qeg/l2a4H5he4asw6RFPjZIb0Nmh2eD7X22VE+1uLM38DFiiurpcbBORWwDapUQXVhRdvgQSB/QjJyBW/ZWNlag8ZITt8z5f7oeMlt9FcsP+TJngYKQPYyzyh1rI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708078078; c=relaxed/simple; bh=AADG2HmlRGRjpuTwPgfETjqT/JQObbTt3Wb/LldVn9o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EuXWjhwEJqtBvTjnwZtHyfq40eHf+19DrYQn2g+gkloqHCb+M4mLzTMHFyDHe12q+92s5RQubrMFRq2E3PqqWBCaWvduD96149kek/gVMUKSP7UMu+COg+h28zr5FGkcSUR33qR3eyw+0tqRFnrIIrFmRe7QC6C4dRUHc2RnzbE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rav8J-0005ZL-6A; Fri, 16 Feb 2024 11:07:51 +0100 Received: from [2a0a:edc0:2:b01:1d::c5] (helo=pty.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rav8I-0013Uc-6S; Fri, 16 Feb 2024 11:07:50 +0100 Received: from mfe by pty.whiteo.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rav8I-00BSzb-0J; Fri, 16 Feb 2024 11:07:50 +0100 Date: Fri, 16 Feb 2024 11:07:50 +0100 From: Marco Felsch To: Michael Walle Cc: srinivas.kandagatla@linaro.org, gregkh@linuxfoundation.org, miquel.raynal@bootlin.com, rafal@milecki.pl, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: Re: [RFC PATCH] nvmem: core: add sysfs cell write support Message-ID: <20240216100750.zxl4wncbgpulr2cc@pengutronix.de> References: <20240215211401.1201004-1-m.felsch@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Hi Michael, On 24-02-16, Michael Walle wrote: > Hi, > > On Thu Feb 15, 2024 at 10:14 PM CET, Marco Felsch wrote: > > @@ -432,6 +466,7 @@ static int nvmem_populate_sysfs_cells(struct nvmem_device *nvmem) > > struct bin_attribute **cells_attrs, *attrs; > > struct nvmem_cell_entry *entry; > > unsigned int ncells = 0, i = 0; > > + umode_t mode; > > int ret = 0; > > > > mutex_lock(&nvmem_mutex); > > @@ -456,15 +491,18 @@ static int nvmem_populate_sysfs_cells(struct nvmem_device *nvmem) > > goto unlock_mutex; > > } > > > > + mode = nvmem_bin_attr_get_umode(nvmem); > > + > > /* Initialize each attribute to take the name and size of the cell */ > > list_for_each_entry(entry, &nvmem->cells, node) { > > sysfs_bin_attr_init(&attrs[i]); > > attrs[i].attr.name = devm_kasprintf(&nvmem->dev, GFP_KERNEL, > > "%s@%x", entry->name, > > entry->offset); > > - attrs[i].attr.mode = 0444; > > cells are not writable if there is a read post process hook, see > __nvmem_cell_entry_write(). > > if (entry->read_post_processing) > mode &= ~0222; good point, thanks for the hint :) I will add this and send a non-rfc version if write-support is something you would like to have. Regards, Marco > > -michael