Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp364448lqo; Fri, 10 May 2024 02:09:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUH50R/989j6qctP2pTP1GEdMJTfef2tdXsbVqmp+xeJnK12/dutXCBlLUE2+ztEv5kRJLS4sj0MsR/D0Tuwtr8kli62UqmFJg+hAD6xA== X-Google-Smtp-Source: AGHT+IGKgP5glPqx8KxfnyGut894eWzf4Q38xHP0w7iYqFi+Fug48AhA5Tb4jVEtokbFKxWZUmDf X-Received: by 2002:a05:6a00:13a2:b0:6ea:b1f5:1134 with SMTP id d2e1a72fcca58-6f4e03466e7mr1816019b3a.27.1715332187380; Fri, 10 May 2024 02:09:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715332187; cv=pass; d=google.com; s=arc-20160816; b=WBCt04RxpCaV0K25J+mtVX9qPu/WxiRmEGh8N0Cps/L5PQRl1gwYu9bzbGI8ygr/W3 EtSzhgkHVetLFNge3uA6RW+b8D9lpssPu8oAWxtKGYcqgMBzJ8mhAOl9OBQOS17ta3Y5 72iFgYvYHz5Nq8AvOgo57tjvwkJ5fPN1f38IR9tweyGJ3EQvwhQuiotRQ1YQGU7+2axo 6AZ0Mk3MQBjf/IHL71sLW2jPdC8mwvSbezcZmydetEAs2V1aLFPZnveAk/AyFyKtWrsv L9S3v2sit/2t00iGpco3y+5xVwXurMS84JCiDNUkRbSh7GRAB9iTuNgQbhTzXEgzx8ZH fkww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=dnr78Drl0hwy8QosBN5FMiEeANWK1Ml2Xi29sDzFrpE=; fh=F6Xb3huzWENhnFWue/apXKBsuKVuntK31PnujWDed4Q=; b=BSXrbWMVuTtI1HfcAIS7EYqJuoDeocuHFrR9XAzPDvBMKoVKE+2ogMU/s9crQ2Mc8m xOGnLo7tx0Y65PQw5b9upz6B6PwrM3tGXgJ4ci3CZrU9J51sBJzPj/y/MuKee3F82yRd fjsir820z+0T/kARdzhWeRQiAEjtaXr8s3v/61qa8aQ4uO0p0vtsgjIIMCitrB7ZATcw ojOjwouB6A+6ZNKOwXU2bzD6xgroHLIDqdPA8gVFIz8Pv/yp/+iuM5VjS2NQVlpEagpr E9jNtlshIlwXSWv/DgQBBYhzbhIV3Y7Xvh2BSlhmYZniDN50i/cKWxceUyJBTyCMUHNX LugQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=t0w2zPD9; arc=pass (i=1 spf=pass spfdomain=flex--joychakr.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-175438-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175438-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f4d2a96d5csi3199300b3a.118.2024.05.10.02.09.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 02:09:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175438-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; dkim=pass header.i=@google.com header.s=20230601 header.b=t0w2zPD9; arc=pass (i=1 spf=pass spfdomain=flex--joychakr.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-175438-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175438-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 9A06728496F for ; Fri, 10 May 2024 08:29:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1978C16131A; Fri, 10 May 2024 08:29:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="t0w2zPD9" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59BA616191B for ; Fri, 10 May 2024 08:29:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715329786; cv=none; b=liOoocmrGwUlT4OkEhcCFt2cIK0BCpdtsiqi+Y9A+LqPZZk7Ryws+utJOMfTvtx8XFs2a0LeK0QUYoYd55nHgaexiPsPJwr4K1QADnqAADpGjhMmYxObiGQUnXE1EVwtuzev2Jgq4l6VgY3jAkAgHcebyYDh0ZW1HDkuVuh7Jhk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715329786; c=relaxed/simple; bh=7cev1urkkriXH1Kz2Kjf4vy0a3n4geUSsLoRNQ3CwIw=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=T9J9R1VFkVFK493P+q7MW7BM1soSuypCxz6f5ITnOVdMnGp8L1TLrcj53fZA/8iQWIK4egoS7mwRP/EUPqz9SqquduXxXTIrIDRA9yQ9K7yQuUJpIJqFfNAnC6GvVe1RZiIjMRdgDe8bqG8EGre2+c6UqJQkT/QMIyTh+1M9F5I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=t0w2zPD9; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-de610854b8bso3015558276.0 for ; Fri, 10 May 2024 01:29:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715329776; x=1715934576; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=dnr78Drl0hwy8QosBN5FMiEeANWK1Ml2Xi29sDzFrpE=; b=t0w2zPD9iw89N23PVRmDREsXj/Ma/C5dMdEP2G6CTrq3mlaxwmX7fxcZyuFflqoFGp 9hbdj0l+vvqKuYdGZZOnMExqBVEnNlhJH6CLh38D3UWs6/8iTYWZxNXZOPkcyMcjkimY QQ8mMq9sWQ9mkCKfVMPrBs+Xti3PLgLVI7uI9g1ygsFVKTEz/DKlVOrAH0KOcd5v/p5g O/ipwtybSsLBz286LncqhZ5IMnC47oZ0wKSobq+3rbBvrauIQK2LY2J7YgH7IP73dVdD 0DhBqxfkbot6LV6zIJRi3Ic+9BTdZeHKSuZAutinuv5eKajfSaRFH4P3Q6ux0J8eF5nk xk4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715329776; x=1715934576; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=dnr78Drl0hwy8QosBN5FMiEeANWK1Ml2Xi29sDzFrpE=; b=esOgYVDhky75p6DTUbZHTGv9bsG7GwlFspIBRC7jkiXvrmjJcweHWRkN978QOvcLD1 85a5kGtaCLujDD6fZVz4+XwoDaeaeC3UZt0ANwBVCGiYZuLEUBPD2iR6VMbj03ZqWvon qn1Uf8Mot6p4WmKviT5aDnZjOUd4gofQC/7e//K8nROFMlFn9UZfuDHqpBJW8Nqf8Zy/ tdKEe4LLPS37sW4mg6n0yqyVQSsGL/86chnJmdUiQIAwI+tnEte2mvfRc1NUCwi2AGk8 KmJWIDcP/nkmmSjhXrn+Dh29pAyOC9ZAlgx2Ul1P8WnmfbQyO2htNtGvs46uISZIDYpm Wphg== X-Forwarded-Encrypted: i=1; AJvYcCUXcXiAa03mbDTGxs0jMfZfvY4rsVfj7oCeyLBq1iCJsu6INEVNPd+b+oMJXYMCh5UX2QhgsUKjsYu/qriEsYJ5qQ4ThMABIjXwwpec X-Gm-Message-State: AOJu0YxiRr0oquKBlcziHDyI25nvfuOHunl7gpWvS7/Q31iTjQ6+75Dy QEorwlo/nAkA4tDonqFobPigbJfkT0RIFAhLD7ZLDil9C2oaeXWKK+oAKVLPFfyHRMC1BNs+S6s iOfHrtT+I9w== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:6902:c09:b0:de5:5304:3206 with SMTP id 3f1490d57ef6-dee4f52d715mr180759276.11.1715329776091; Fri, 10 May 2024 01:29:36 -0700 (PDT) Date: Fri, 10 May 2024 08:29:28 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.45.0.118.g7fe29c98d7-goog Message-ID: <20240510082929.3792559-1-joychakr@google.com> Subject: [PATCH v3 0/1] nvmem: Handle actual amount of data read/written by suppliers From: Joy Chakraborty To: Hector Martin , Sven Peter , Alyssa Rosenzweig , Srinivas Kandagatla , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Vladimir Zapolskiy , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Claudiu Beznea , Matthias Brugger , AngeloGioacchino Del Regno , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Orson Zhai , Baolin Wang , Chunyan Zhang , Maxime Coquelin , Alexandre Torgue , Vincent Shih , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Rafal Milecki , Kunihiko Hayashi , Masami Hiramatsu , Michal Simek Cc: Greg Kroah-Hartman , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-sunxi@lists.linux.dev, manugautam@google.com, Joy Chakraborty Content-Type: text/plain; charset="UTF-8" This Patch series stems from discussions in patchset, "[PATCH v2] nvmem: rmem: Fix return value of rmem_read()" (https://lore.kernel.org/all/20240206042408.224138-1-joychakr@google.com/). Where we come across the fact that currently the nvmem suppliers do not actually let the core know how much data has been actually read or written. Instead they are expected to return 0 for success and the core assumes that the amount of data written is equal to what the core has requested. On addition this patchset will also add some guards and checks based on the count of data returned by the nvmem supplier. --- V3 Changes : Fix return value of reg_read in sunxi_sid.c driver --- V2 Changes : Rebase on for-next. --- V1 Changes : Change read/write callback prototype to ssize_t and supplier changes to accomodate the same with core checks and bounds. --- Joy Chakraborty (1): nvmem: Change return type of reg read/write to ssize_t drivers/nvmem/apple-efuses.c | 7 +-- drivers/nvmem/bcm-ocotp.c | 12 ++--- drivers/nvmem/brcm_nvram.c | 10 ++-- drivers/nvmem/core.c | 83 +++++++++++++---------------- drivers/nvmem/imx-iim.c | 6 +-- drivers/nvmem/imx-ocotp-ele.c | 4 +- drivers/nvmem/imx-ocotp-scu.c | 12 ++--- drivers/nvmem/imx-ocotp.c | 10 ++-- drivers/nvmem/jz4780-efuse.c | 7 +-- drivers/nvmem/lan9662-otpc.c | 12 ++--- drivers/nvmem/layerscape-sfp.c | 11 ++-- drivers/nvmem/lpc18xx_eeprom.c | 14 ++--- drivers/nvmem/lpc18xx_otp.c | 6 +-- drivers/nvmem/meson-efuse.c | 22 +++++--- drivers/nvmem/meson-mx-efuse.c | 6 +-- drivers/nvmem/microchip-otpc.c | 6 +-- drivers/nvmem/mtk-efuse.c | 6 +-- drivers/nvmem/mxs-ocotp.c | 7 +-- drivers/nvmem/nintendo-otp.c | 6 +-- drivers/nvmem/qcom-spmi-sdam.c | 12 ++--- drivers/nvmem/qfprom.c | 14 ++--- drivers/nvmem/qoriq-efuse.c | 6 +-- drivers/nvmem/rave-sp-eeprom.c | 18 +++---- drivers/nvmem/rmem.c | 4 +- drivers/nvmem/rockchip-efuse.c | 19 +++---- drivers/nvmem/rockchip-otp.c | 19 +++---- drivers/nvmem/sc27xx-efuse.c | 3 +- drivers/nvmem/sec-qfprom.c | 4 +- drivers/nvmem/snvs_lpgpr.c | 17 +++--- drivers/nvmem/sprd-efuse.c | 8 +-- drivers/nvmem/stm32-bsec-optee-ta.c | 12 ++--- drivers/nvmem/stm32-bsec-optee-ta.h | 20 +++---- drivers/nvmem/stm32-romem.c | 26 ++++----- drivers/nvmem/sunplus-ocotp.c | 4 +- drivers/nvmem/sunxi_sid.c | 18 ++++--- drivers/nvmem/u-boot-env.c | 6 +-- drivers/nvmem/uniphier-efuse.c | 6 +-- drivers/nvmem/vf610-ocotp.c | 7 +-- drivers/nvmem/zynqmp_nvmem.c | 13 ++--- include/linux/nvmem-provider.h | 4 +- 40 files changed, 255 insertions(+), 232 deletions(-) -- 2.45.0.118.g7fe29c98d7-goog