From nobody Sun Nov 24 18:20:31 2024 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 1D1DF199935; Sun, 3 Nov 2024 17:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730653489; cv=none; b=Tqul43Kyy0P9lDf9WQgRe7nJMuvQJhz8Oq656HA6OqSEliDVnK+cYqq5Q8RE1L/2LLMRQRdMwGW7yr5kcpg6EtW/KNrjzlVKNEkIG4tQw79YC+w/SulIO40Pm8lAW50uSW50lzO+aCwQlh9oh1spcfrM6wLlVf5VUemo19Cfokc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730653489; c=relaxed/simple; bh=zDhPVchfMys7HnsVtwZsrXjRXhl5fZsRZ1XGARPtegE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fkhD6Z5snlp59gJxsgu5SGL+rIMM/uep4HvSXa3WEtd8feDGlBwxYgrjEbfB7FRbAM1leGW2pzusu1K4QI4LvkplQKZntBywpcwDcMWeBSSjLLJrkb7OLLTKSz6MP8TUuds2sU2h9ms9olDFuPdGTgZa8EhsGuEDHUrWF8TW1PM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=H75YdV+k; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="H75YdV+k" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1730653482; bh=zDhPVchfMys7HnsVtwZsrXjRXhl5fZsRZ1XGARPtegE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=H75YdV+k9aKMbCg3vYqkrITc/NSui5xg9ZVSt864cTzcQxw90svfufktDmLA8a2lW /dbglWlZm61tUtLow1Q3tyjkRdeCmG3i5aMEWTFNazRPqYODgYZJAsPEMnIPlThVwG y4spMmomoO7OqL8jTcXa0IsoXpoF9GwL6a0t8T0c= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 03 Nov 2024 17:03:33 +0000 Subject: [PATCH v2 04/10] nvmem: core: calculate bin_attribute size through bin_size() 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241103-sysfs-const-bin_attr-v2-4-71110628844c@weissschuh.net> References: <20241103-sysfs-const-bin_attr-v2-0-71110628844c@weissschuh.net> In-Reply-To: <20241103-sysfs-const-bin_attr-v2-0-71110628844c@weissschuh.net> To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Bjorn Helgaas , Srinivas Kandagatla , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Ira Weiny , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , David Airlie , Simona Vetter , Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky , Tudor Ambarus , Pratyush Yadav , Michael Walle , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Naveen Krishna Chatradhi , Carlos Bilbao , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "David E. Box" , "James E.J. Bottomley" , "Martin K. Petersen" , Richard Henderson , Matt Turner , Frederic Barrat , Andrew Donnellan , Arnd Bergmann , Logan Gunthorpe , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui Cc: Dan Williams , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-cxl@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-mtd@lists.infradead.org, platform-driver-x86@vger.kernel.org, linux-scsi@vger.kernel.org, linux-usb@vger.kernel.org, linux-alpha@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-hyperv@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730653468; l=1407; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=zDhPVchfMys7HnsVtwZsrXjRXhl5fZsRZ1XGARPtegE=; b=LIJoZnee0F8KxWypgifoxx5C03UWzUsfKRD3mTuXEg8GZQDzU4bKngbG7gE6mho+vvHyDPpYb T0csHWK0CZAA7NKHFKir+h35XqhjNK7+x/o8Rk9YXpQi/8Q7SU3s9Ua X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Stop abusing the is_bin_visible() callback to calculate the attribute size. Instead use the new, dedicated bin_size() one. Signed-off-by: Thomas Wei=C3=9Fschuh Acked-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 33ffa2aa4c1152398ec66b8dd7b30384c5346a6e..63370c76394ee9b8d514da07477= 9617cef67c311 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -303,11 +303,19 @@ static umode_t nvmem_bin_attr_is_visible(struct kobje= ct *kobj, struct device *dev =3D kobj_to_dev(kobj); struct nvmem_device *nvmem =3D to_nvmem_device(dev); =20 - attr->size =3D nvmem->size; - return nvmem_bin_attr_get_umode(nvmem); } =20 +static size_t nvmem_bin_attr_size(struct kobject *kobj, + const struct bin_attribute *attr, + int i) +{ + struct device *dev =3D kobj_to_dev(kobj); + struct nvmem_device *nvmem =3D to_nvmem_device(dev); + + return nvmem->size; +} + static umode_t nvmem_attr_is_visible(struct kobject *kobj, struct attribute *attr, int i) { @@ -383,6 +391,7 @@ static const struct attribute_group nvmem_bin_group =3D= { .bin_attrs =3D nvmem_bin_attributes, .attrs =3D nvmem_attrs, .is_bin_visible =3D nvmem_bin_attr_is_visible, + .bin_size =3D nvmem_bin_attr_size, .is_visible =3D nvmem_attr_is_visible, }; =20 --=20 2.47.0