Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp253286lqd; Wed, 24 Apr 2024 00:44:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXgI3MQXEQRobLWbLDXKO1nDwI+aCTGMJOzvyzD5NuWpg9EspB7ngkAJqsrETcuhMGlqvUK6KcvNdI+AKTAZAsp9r/Z+wHHkVvfDlej2g== X-Google-Smtp-Source: AGHT+IGWDr8GiSRNjsgL8h+oqPiR5EFAij7bqQ4NHGDwzarH9VsKF3oNIXm03N0wp/y67/LCDebC X-Received: by 2002:a05:6a00:4f87:b0:6ed:2f53:8059 with SMTP id ld7-20020a056a004f8700b006ed2f538059mr2318541pfb.34.1713944655221; Wed, 24 Apr 2024 00:44:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713944655; cv=pass; d=google.com; s=arc-20160816; b=QrmQm7QF+PQA/T2r3hMwNCF2Zbsp+x4Al/D3TmFmyTxeVaWtK15x6wGkDFQ2m0aiyN gQPZTXR3sL9MnqkKvR/BGJ39mBFDl/F53KSb3zUWS8TjHrZKpsFr40fEU5WcRFTtGU+L eV21ZpL+RbbEQ4Vk4C07Am9F3AHgGxzsyJyxmRnE/rEETKPzK19zYzFlhFJsCNo/qvgE OqUGhg0326pLg/oJnKEWJnh3ks5OF0BCmp4xtLSvDMP+9EnRcLrBg1hEg4Kr2nygTftz fuaIhUKcS/hhhOC4jZFLEV7Rx9QGiji5SbVpCu0j8mvxUbpsTrOuoOsLKBneX1XGU9fT ZmNA== 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=Zl0sYd+valIIqLNedoYvnicwykqmWgTtyjDljuZmiec=; fh=5CN0/Wrh5QqiPpPu4BUPtv3a+B+e4OdHuXmVbSM7KGw=; b=HqPcLpNhXNZ9oDVfHgArSbOzTvB72icisC+9m7+rDeIgc1ZdCXBLg9VDOJddy0C3OL SEBSc9GViax7ARd5RjXN9KIjevinvfCA+8YKsdggS4FdDpIWEpLWOMG582/9EGjMzs1B HmLdAKLiW3A9XwSAcQDgDUmxOMx9/jtoHbYxyEmjSwlmoKm/bbMcvESFN/00wZomS4kn GUqh6V4xSTids+i8HTnqFSWt0DCPoTcFUAUF8dL5Zkb53W4i3vfvxx30oOaeNqXBYKB+ LkQA8HlS9H8igQYbq1+xe0n4VMmN6BHrE976+WVT31pRdN3hWZYH6BgqqBLE34jMwE5W k5Ow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=RVoIN6Uq; 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-156500-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156500-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p37-20020a634f65000000b005f751c3abdasi10606372pgl.713.2024.04.24.00.44.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 00:44:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156500-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=RVoIN6Uq; 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-156500-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156500-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 7349B282942 for ; Wed, 24 Apr 2024 07:43:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B209158201; Wed, 24 Apr 2024 07:42:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="RVoIN6Uq" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 B0B901581E2 for ; Wed, 24 Apr 2024 07:42:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713944574; cv=none; b=bRRy2tl89yB8ObGyuzA5Y6xG/hGSeC+M9mwawWPf2oPY/f/KiFtpfSaQgde7UO83OkNf0ibX4soMYfi9Ql2HblnLzXLbJIMjYoUZbQFwIeqFR9x/7y4JVsgxVJXGX1sjjQE1EN1z+EdLZh2PC9FkuL9qGnJa+s71AlbpgpHlyWs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713944574; c=relaxed/simple; bh=KEOY/H38r2q4LMqOZqaCRp80aSw3OHhkx+jVNw2tNvc=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=loOSBoG9bZrfU0Bmpac+NJlDw8RZd22IYjMrxKwuL5wRsvGpXUosEwcyW9uosMajh7ZLh2CO7O8Mvn6Embt8Kc0DH8BHQrd6Iu81ldD3h4gWXSoNbC0FjAC7Gf/Fufd0CRXdxwXy7mLLhpDgTpEX/Q919fpLehD9P+GFdSRx7oo= 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=RVoIN6Uq; arc=none smtp.client-ip=209.85.128.201 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-yw1-f201.google.com with SMTP id 00721157ae682-61ab173fe00so128958207b3.3 for ; Wed, 24 Apr 2024 00:42:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1713944571; x=1714549371; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=Zl0sYd+valIIqLNedoYvnicwykqmWgTtyjDljuZmiec=; b=RVoIN6UqYxyAd44cFqI4HdBfPPfIJNwdxG9tps4jglVmL9AYADYK8f0VP8KPPxHtjD xVmvSgIaUQWgZujAklMzOANFcLXv5IwX0BS/cRPwdYe5t4MachnUvaiOUxtjOM6SMmX4 3s39ErUlGb4zOgJTIi7rHwg+l378U4KKdalhkU2ZZ7hh4/i9t8p0cheuxblFAXqrhAbe f1wUjTjkrJ5B43u0RwswtYzosthTKGdFjyrBUfv7hT5zJ+71pUpUweZtbSsdhCqT9fcf DHei9J68gt9snSxlGnSvQxuPn34inQg/QfRnDRmFQq8gEZ5q7WjE6JwOJk3KdOQhl1Fh 4qfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713944571; x=1714549371; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Zl0sYd+valIIqLNedoYvnicwykqmWgTtyjDljuZmiec=; b=uZfQlJdczEsbNhuxvVf4TOcNCJNhvE6HeTO8cuN/3VeHKFrlLS92NdjH08hcBhQ2Jo 7XaXbK4Pwxpug58tXFp8ALyrNcPkgRSoXZcpmNqzErsIaK7XzWK2yCEdyl2BQNfLTfo6 SHW3FrYRHO/8V8us/LqbkZis9m+qTQLpetC1mRUVUvXWmgYsET3rBrXNLAitnAA5m/1H 1BO+q8k9wfHUtqNzSxC7uvPZFycpQ/NrqbxLL66nnY8ZM+pWoR8Jtdtl5e6i/iXEd9nh te6oIFPIlaHoVQBQXV1Gw+KKpoPTf8WWBIT1Ev23NonLlsBUZZzf9Y6YGAx5mhmhbc0N EXXA== X-Forwarded-Encrypted: i=1; AJvYcCWGW0qeaIEzoHraOpGgzrBFxz1e7oLWIfUTWLYmhKkK/wfiy0JDV8/abB4OFcf8S+LkszdHA+ssULy8gp4D2E18AnD8csjkNOJWq9Tf X-Gm-Message-State: AOJu0YxS6DQyCIBvfEnkniw5+w3U5ufoHffDD9HWohBwFxkxc1APvwO+ xk7R6gh6WwCXhwQkOTAYGoLTXV65S2Nguath/MMr5zEFa8Aku237n9Btgfb9HNEdbIRbKbcv1DR bFVNPJomrAw== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:6902:154f:b0:de5:1f88:ae4e with SMTP id r15-20020a056902154f00b00de51f88ae4emr651015ybu.2.1713944570760; Wed, 24 Apr 2024 00:42:50 -0700 (PDT) Date: Wed, 24 Apr 2024 07:42:41 +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.44.0.769.g3c40516874-goog Message-ID: <20240424074242.519895-1-joychakr@google.com> Subject: [PATCH v2 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. --- 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 | 15 +++--- 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, 253 insertions(+), 231 deletions(-) -- 2.44.0.769.g3c40516874-goog