From patchwork Wed Jun 5 17:59:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687260 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 BA8AC13AD22 for ; Wed, 5 Jun 2024 18:00:05 +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=1717610407; cv=none; b=dj8KwkIOif1Ew7pSvlSaeao9ORR0joe7YzG2lLdfcHW4nkpmZPcysKPEV7ECW99mGCTPWIJHdCPPbObH8tGa49nov7emJ9VEJWJkhnHbxPrzUIxLtjJ1pTxr4eLrABLQyPGVP2/o8PEJTN8nWcZ5Jk+bdF+U+8EXvNPMw/oFAKs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610407; c=relaxed/simple; bh=ipr39Oe7qflzshs+uqKeD5dsLOI2DywzVbGtmwc3XF4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=JUQPpxuQry8lRgbAkyZixMS8fgvYyLblUROg8WF7W1ezKR05sw12CQEKslUgthtKTQ2GW/qRIl/kF6ndpBPPAVdyH9txNcsZ0T5Tr4xTb2DDDEo8VfJx+cSxW/PdC7FuN7UQhMb6zApQnTEkZclcq8ovIY6+7lMfQBA3WHpvPFQ= 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=J4iEbje9; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="J4iEbje9" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-df7a6530373so127540276.0 for ; Wed, 05 Jun 2024 11:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610405; x=1718215205; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=nEr10taYCu3WGRiwn+CGqfggqJNbp7A+We0V3ygommI=; b=J4iEbje95ninWiXtqqt5T/9d9/rhCySu+uRgj5M+PAahakXxAmJMwbOM3Vl+q9ipwO cR2XMTaT3Cl6rtmhHcCzhm9ADVnFZb1p7yDmg+5o5KLMVVkrKunBBEwcfC6DifTaKXZY +22DMkjtteZbmFu3YZvAFV37gq3FnCxnNGemPsZXaxgCOZFtLwTgb/ySUoNoxgKThXqI /j358DaGUSozaVs/XrXx5gTTjXCJvJ2f3lRsZKCCy3KtAdh0gF3OvCEX+ecoMyu8HbjC QoZmOUWx+hkMmSCw6alLz9KvgAyuX7At1Lbtv2yzZUUbf2fKO7pPiVpatVP+Lflv7Hil VtlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610405; x=1718215205; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nEr10taYCu3WGRiwn+CGqfggqJNbp7A+We0V3ygommI=; b=PMShvVjbT1kWRlV62IGoponuJ7mFXvrp3Qobn1XBZ23DlBZSs2TxLKYMA6L8yJ0RuI JvCkT0DSe1SudhdjBJ9baUqvvJ9ENTd79NTg8YLgN0durTzqSixBoSjYp2BHd72X6kra Bx3LXY+dWmS+Qvhzc59u9xaJPGUzxUYKG7s413weqlyAMsEh6z4KYGOIhzNNgLy0Glk+ 1CO8an+2xC721gXnq0nTTjm7vNnsGJwYznOCBunfMNoQxzkdPi2kuyRfUzDzvWaJA6j0 RzMukN18odZUiIxovK5Qa4WjIgcT2s3JSxoZ/c5FNzhQwjzx0gYO9wWSPHKG0/YkmRpP njJQ== X-Forwarded-Encrypted: i=1; AJvYcCWwmTVrooh06uE8edlP0tki26QmCe29i6uMl3zaXnYdB9iDLXGNITO7KFoSHROvl4wpkAMmKvShYncOgqF2VSbkdBVUn7AMxwgM X-Gm-Message-State: AOJu0YwPYa5ZUu6Kr1BO2ht6+bd/en7wYeT46yviQYLCWPrxij9qZZzf 65Rkk5fHKL8xCl65hVd06R1bVnoSNRE6wMOpGL20xOR0vpsLoznO3pP9T4stpcFNX6Gp2Y8BZ7h y2oQ7OxMW2g== X-Google-Smtp-Source: AGHT+IEFfd1XOUpmBlCQ8OC96XaGHvsQJFoGDWo7KSg31aa/FmwG5qSwwUZMqSajPkXkOc1t6VuaS9UByNrZ0g== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a25:dfd5:0:b0:df4:eb0b:8fd with SMTP id 3f1490d57ef6-dfade9e0f4dmr76066276.2.1717610404805; Wed, 05 Jun 2024 11:00:04 -0700 (PDT) Date: Wed, 5 Jun 2024 17:59:45 +0000 In-Reply-To: <20240605175953.2613260-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-2-joychakr@google.com> Subject: [PATCH v1 01/17] hwmon: pmbus: adm1266: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/hwmon/pmbus/adm1266.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/pmbus/adm1266.c b/drivers/hwmon/pmbus/adm1266.c index 2c4d94cc8729..7eaab5a7b04c 100644 --- a/drivers/hwmon/pmbus/adm1266.c +++ b/drivers/hwmon/pmbus/adm1266.c @@ -375,7 +375,7 @@ static int adm1266_nvmem_read_blackbox(struct adm1266_data *data, u8 *read_buff) return 0; } -static int adm1266_nvmem_read(void *priv, unsigned int offset, void *val, size_t bytes) +static ssize_t adm1266_nvmem_read(void *priv, unsigned int offset, void *val, size_t bytes) { struct adm1266_data *data = priv; int ret; @@ -395,7 +395,7 @@ static int adm1266_nvmem_read(void *priv, unsigned int offset, void *val, size_t memcpy(val, data->dev_mem + offset, bytes); - return 0; + return bytes; } static int adm1266_config_nvmem(struct adm1266_data *data) From patchwork Wed Jun 5 17:59:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687261 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 532DD14EC5A for ; Wed, 5 Jun 2024 18:00:10 +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=1717610412; cv=none; b=G9HIJTTbTP1jQ4zYzR4Drd2BSQ6vEja9uCOYuE/n1gREiVv9nSYEqQz73yk+gDS4xAmsCz4Nfx4AytXBdwDgaZafX3mY7rB82VJMFVbNBT2nbRus7m6zFl08Lh/IrDPtjFh6B8W4vkUoYOL0Pqnt3Q+M78i3RrlzABe6jjrfTUg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610412; c=relaxed/simple; bh=8DJQonJqq5Z4yQRN/sDPNHSxx9pC4pBa8VVN/l35RYU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=kxc+hya6jy67u9RWDsjpQYEeLg9GcE4DFinStT5kveXg4iBDA0VhKRtNh5psYwrxNOvWzVCLF3lzBNYoqQUswaTCxnYnNofLd2SplGCjxlNI1Qa1G5QetGRgSAsVzL3K0TgoxwH7ue+Y1mEIWHdL8RZS+gwX1nLjDwaKtoHzgfs= 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=pfblUWIw; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pfblUWIw" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-62a08436241so312927b3.3 for ; Wed, 05 Jun 2024 11:00:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610409; x=1718215209; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=fOg+UnJ80V7MsfirTppZcqaQfW4UzyZaf6xSdj4zJek=; b=pfblUWIw3blD8wOp8WE8gt5Jq65lZWQ22oCeXFtUbZiptDqJ6zCGgQUbQ2cMmjfzOR YVY9lArA0jnY76ycsaDtnO0iySMxqBGUbKPwgSWLfmMjWDRqCqa3D4FivtdXwR2W2/rA PSMm2ZF1GAOgMvv4+jSZpC37R0p+9VLq5xjajPi9vrxJ/OSKjc7CmguroB+GyCDanVKd z/R4xPxhbGR6jwsUIC1ZIlDHMi9vBxK5m72lvAMghxlet3dTv2t6Ool24D5MKrdks4LC Wylen1dVC4VFLkiJdOno6Gy+Tt2EIltv91lvc+7T5XSjAT91a4fUKLkQJNYRn0GggObz T0Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610409; x=1718215209; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fOg+UnJ80V7MsfirTppZcqaQfW4UzyZaf6xSdj4zJek=; b=NCaoDZXBYdGabN8KnI6Ab6BmMdmqV9JErDG57fazfpA7LqoKIYwabK/UnIYURQlplY P67dwgDDfiW7QYhCDkPwj8pVJoFT5UCYFIUZ5hktr4wRSil+wqCUb9bglKj1lt1y/Qsb qdzISOrxA2PzUX6dlkopV9hukbcc8zjed7yqlcFbKvkF/ze7R3gsIfmpKe3W0wVuXUL5 +QYDvmjfUaWXR31ydccYg1Vvj8AAcz0R3xgA5NyHbm/OYyhE1dXTd5yrktaDfHMChgeN MaIJLa27PbGy/mxXnCdruafHT7cZI/F/GAQ8ZhQ7ImT9yBFnUO1sUI9E4agMKlb2XVeQ uHcw== X-Forwarded-Encrypted: i=1; AJvYcCWsoCcJYMOjhRybQ4SR9iiMWuKJk/EvPuMwOL6kpDlquyR4/sS6sQ9sS7OMzkd8CWyCIJnbo7xHhqmweADpciADnE4GPgBmBx7v X-Gm-Message-State: AOJu0YxwUkwVD4OULzjYXLRbyp/vFf2x6sJ9Hmz7m8VhjC+0A1qoCoXA v+SLeVkFdJGMUfI91JSIWpAclOC2tg+1B8KZxp4jOrHQdxZ0kDOHP+52HBgNyR5aQ9z8SDkn57b r02KxNtCtSA== X-Google-Smtp-Source: AGHT+IGVqeHwMyqXKI282yIc4vrmNhlrddNc8SUJnwKBYMg45bAMjkiEv9ztSUrQcKvlvHzhm96dBXxGRdgPkg== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:6902:b12:b0:dfa:7282:d6d4 with SMTP id 3f1490d57ef6-dfacac47b9amr605485276.6.1717610409394; Wed, 05 Jun 2024 11:00:09 -0700 (PDT) Date: Wed, 5 Jun 2024 17:59:46 +0000 In-Reply-To: <20240605175953.2613260-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-3-joychakr@google.com> Subject: [PATCH v1 02/17] media: i2c: ov2740: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/media/i2c/ov2740.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c index c48dbcde9877..0101ab55a5ef 100644 --- a/drivers/media/i2c/ov2740.c +++ b/drivers/media/i2c/ov2740.c @@ -1212,8 +1212,8 @@ static void ov2740_remove(struct i2c_client *client) pm_runtime_disable(&client->dev); } -static int ov2740_nvmem_read(void *priv, unsigned int off, void *val, - size_t count) +static ssize_t ov2740_nvmem_read(void *priv, unsigned int off, void *val, + size_t count) { struct nvm_data *nvm = priv; struct device *dev = regmap_get_device(nvm->regmap); @@ -1241,7 +1241,7 @@ static int ov2740_nvmem_read(void *priv, unsigned int off, void *val, pm_runtime_put(dev); exit: v4l2_subdev_unlock_state(sd_state); - return ret; + return ret < 0 ? ret : count; } static int ov2740_register_nvmem(struct i2c_client *client, From patchwork Wed Jun 5 17:59:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687262 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 BB366154C02 for ; Wed, 5 Jun 2024 18:00:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610418; cv=none; b=WShMzAX19dQ8JoMGJPy0vrPO79aIISSV1h7GG/vFvs+VsMC4I0WITrzKR1XFTLIHyPrtglXRwZccn8LEwi/uwfuE3EDlzOYjvxJEO9Miez4ESGqX75YqZZee9mYAy53qTmEOTcscvEDtiR/b1JZ648Mj+3nJcesqMOQ6xv7G/yQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610418; c=relaxed/simple; bh=fPdJt4Gydxsb6XLYSRdNJ8hD/W3THq9fKXubquLZs6s=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Eh5+gqLBYBe1cNwK7TL78TmKXfzONMLB2V0AHIoVGDkPWqU08PctkNLrpt/Y9nG82yxpYjwmgHZSXpbFGgGb4wwJPiThDUZjR57W0vQwYvajbIOX6gb5TnHXQysXEEPPTHWkwZ10B8MaNpZZ7tFABy0p7Imcl9QUEVWciX+QqW0= 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=yNqgUmHy; arc=none smtp.client-ip=209.85.128.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="yNqgUmHy" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-62a0eb1c809so264907b3.2 for ; Wed, 05 Jun 2024 11:00:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610414; x=1718215214; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=qvmsbFq1f0xb8qTUeLHIrwaOpt4YNpx3HYdX4+QrPhA=; b=yNqgUmHy2UkDE3heRRb8oMaXmLeLXyM1i27wFJS/QU6flgxbWEI6TZ7da1x1XjqPQO VlQ19oRwmx0Yd/blYB/OvER0B5Y/49RGI6us/PAl60yjXA5+o8wOy5hEfj5ZadolRbK+ XWIHPanx9sQPLs2/5sl8VyvI7v9OkxWCYCvKJqd4BWY60BaRMym9Ck/ROACMI/JPScoo WSekErhgKeJiiUPjrxf3KdbGf6pBiF0a1bGCPfBXHONpv8wSDHUMAThTTzKivKWkB3ub bbsqHW9iPJwiorjZWv1Xw6UL52JrjCEQWpvC3xexXC3j6MNOu7OViZQDgdh4MDbEtTMU WmCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610414; x=1718215214; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qvmsbFq1f0xb8qTUeLHIrwaOpt4YNpx3HYdX4+QrPhA=; b=uvSnCbQttxivPx7hOgWUkIAOl6VfJlpCwRP+G/OWcWEbd6pYWkf7591OvXsmqV18WH O5GQlpGa1anCWI2zgQ5W7UJudNUtbHzgrnIcyAFuaa8Y9FaX1V9FtJdIbmFhcyc5sa14 5z2LwQo8qoAIY0U+NAVyHPynTsoyd3JdsblljEgCktiv++KLTGaRDHDwio1YTeRhI5nU Khxjq36Awticzp9mzdJCs+++BBux51UkVapzETIvp9HW3p7JnqPhHBxdy3HHyttHTZGa qfG7nIIn73lCT6A5/Pu81LTcOD3X4zEZUWsiQ7MTDOqt1cYx8I2wwEkdmESNlv/fiqDg FpQg== X-Forwarded-Encrypted: i=1; AJvYcCVKL2lG+vRUav1BSY9Ppz6bITu6XrhMxH1fkkpwaLbGJp0sft6EJKQDkncRFGKeVaKcqJLoTYM4w2Ud7QHeY5aYsCZrgdGy5QVZ X-Gm-Message-State: AOJu0YwlLFolXzs6wkWq9rCaSp1GULwZRl39H71B7euRBzutYJtazbTK 0LJUONhn7X+NUn+iZ8DLorrxcjODc8X7FRxvOpSL07biNLMOl9tGL8VAATceIze0/kTCE5cD3dc TtK+/3G886w== X-Google-Smtp-Source: AGHT+IHixjuOYQ1InGCAjmo87JHH7BxdpNaY95UBwdRBHB8eZTSP6/tJXCeai8kdlzm5GsjEUY/q6O3hk54taA== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:690c:6688:b0:622:cd7d:fec4 with SMTP id 00721157ae682-62cbb5e6bc6mr8437267b3.9.1717610413829; Wed, 05 Jun 2024 11:00:13 -0700 (PDT) Date: Wed, 5 Jun 2024 17:59:47 +0000 In-Reply-To: <20240605175953.2613260-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-4-joychakr@google.com> Subject: [PATCH v1 03/17] media: i2c: video-i2c: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/media/i2c/video-i2c.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c index 56dbe07a1c99..2bfc221b5104 100644 --- a/drivers/media/i2c/video-i2c.c +++ b/drivers/media/i2c/video-i2c.c @@ -151,12 +151,15 @@ struct video_i2c_chip { int (*hwmon_init)(struct video_i2c_data *data); }; -static int mlx90640_nvram_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t mlx90640_nvram_read(void *priv, unsigned int offset, void *val, + size_t bytes) { struct video_i2c_data *data = priv; + int ret; + + ret = regmap_bulk_read(data->regmap, MLX90640_EEPROM_START_ADDR + offset, val, bytes); - return regmap_bulk_read(data->regmap, MLX90640_EEPROM_START_ADDR + offset, val, bytes); + return ret < 0 ? ret : bytes; } static struct nvmem_config mlx90640_nvram_config = { From patchwork Wed Jun 5 17:59:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687263 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.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 D889C15F40E for ; Wed, 5 Jun 2024 18:00:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610422; cv=none; b=D1oq8IZbE1phWLEtSXivFMGGJ7X0VOw9/IxUIFa8Fis5Etwt2gHZ3rgSEN7KoVs/GAWMavwwn7zSbECw5mVwpYTmCvkSPm8SVs4He0jzigXdmu93wFZ8T97v+mQPIMzayi3xlPLIq1ZuZHyj5Wcg8DfaQuFIhnenbVhRFdYnagw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610422; c=relaxed/simple; bh=DtpDZyHe3eugG9lKYAyC1ondYmKEiXhRbdfT84tszLE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=U5dXvzOpD5hcp030w2EpPrisZSytvt91l65rb8fCXt6XvnD3CoO5JXCOxk48GiIz8MzzY6BfS5ylg7BYwXBOIgz3HiwmHKUxH6vcmQ0d9WSNHQfnCO5iPXUsYpY59iNPw2IfzBNOyKl42C4Kl6g/Cti9ojZAdM9ORNbVS2Uzjis= 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=U52V+hRs; arc=none smtp.client-ip=209.85.219.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="U52V+hRs" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-df7a6530373so128325276.0 for ; Wed, 05 Jun 2024 11:00:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610418; x=1718215218; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=AwIs39A3C8kh3vVRuRyRYkps3QbjGarBaeH82L3DU0g=; b=U52V+hRsiJQjSRnjvYDtZ8nO3ttKXkTxiHrLjNmADwfjQ8plad8HEMYMkkxmvtoFIs QEZHHMmsbHs8oE4DsgfG7xV73VdpniuxJWGD1uX+sexyHuIPqMEjjQbpiFRleB333mzK cskQ8g8ioMRy6iE5yXCZP8fi72tXA3aLXSn2e//1mmOhKE3l2iZpjrsErUj6Nw8rXBT/ Ls5L9CJrzLx+rKGRzdTKorUXDwYGdNhd3A3/5vELUbwt6as3QITS3EdKaGbEVRNWJanK trjloEE6aIqij88o+jESh2lYoT7HqoWLxLTSIiCFGrQSEuGXKrYAGwKb/WUU8YLm9SV8 ouoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610418; x=1718215218; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AwIs39A3C8kh3vVRuRyRYkps3QbjGarBaeH82L3DU0g=; b=SomKYGT+33i5N+aye/TX1c6NyI5LRdgWGqUsA3U1k2ULuAFumN81Z5w4d7xlcKtiBG 6ZKebuzOjjGeizb/PssIfSTDKJQK9DJ9Yaj7ZIpB8NPaysSKGKNOnCIM60SVGs+8b8wN FLKpj7wEmBjZEB4On0GhkBStssqnbUCIuSVNaxrC+aKzencTSYyQAXNErRMtnAuKSBhM p07nozPpDNl6Va5JKE+1VZ2LLTFOW5H7Fjao4i5uMruuL5yYixWHlAYBMTsN8rQib6Xb TSMHet0Q97YUaX2OvVGjNpfpegUJZfudL7Eq/cDFV66zY+WXVD5lkbOmYACd9EPVnI1E 1Yhw== X-Forwarded-Encrypted: i=1; AJvYcCWrEtXsKs2ZChHN1F50HnebSsxlYrfBNlu3iDiUWUtv3HcsmpaY01PDZIfnemhHLZCrKuLjsbFWD1Ej1h2do6Ula3KdOXQqWSz2 X-Gm-Message-State: AOJu0YwlkDefyQSfMwlj1Vmw91PZ9WtVUAWiuyvLVN8aMluw255pdGrJ adLNss0aB612x9bXqfzB5SbKwYjre2mEchyfTBwd1yWBTRbyJMS+CFXd2UeA5ZfimiM+prLLj4/ nhOsSWo5Fzw== X-Google-Smtp-Source: AGHT+IF67RE9Tjmuj/kq/k/X6dA78e699FHOj3MI1LHmpXg9uh50LZwtSgAXRWUPUOYrgrIfYkhy+wDlS5BIsw== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a25:9004:0:b0:de5:a44c:25af with SMTP id 3f1490d57ef6-dfadec0b255mr68711276.5.1717610418012; Wed, 05 Jun 2024 11:00:18 -0700 (PDT) Date: Wed, 5 Jun 2024 17:59:48 +0000 In-Reply-To: <20240605175953.2613260-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-5-joychakr@google.com> Subject: [PATCH v1 04/17] iio: pressure: bmp280: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/iio/pressure/bmp280-core.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c index 09f53d987c7d..8d5aeabfa297 100644 --- a/drivers/iio/pressure/bmp280-core.c +++ b/drivers/iio/pressure/bmp280-core.c @@ -1465,10 +1465,11 @@ static const int bmp580_odr_table[][2] = { static const int bmp580_nvmem_addrs[] = { 0x20, 0x21, 0x22 }; -static int bmp580_nvmem_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t bmp580_nvmem_read(void *priv, unsigned int offset, void *val, + size_t bytes) { struct bmp280_data *data = priv; + size_t bytes_read = bytes; u16 *dst = val; int ret, addr; @@ -1518,13 +1519,14 @@ static int bmp580_nvmem_read(void *priv, unsigned int offset, void *val, mutex_unlock(&data->lock); pm_runtime_mark_last_busy(data->dev); pm_runtime_put_autosuspend(data->dev); - return ret; + return ret < 0 ? ret : bytes_read; } -static int bmp580_nvmem_write(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t bmp580_nvmem_write(void *priv, unsigned int offset, void *val, + size_t bytes) { struct bmp280_data *data = priv; + size_t bytes_written = bytes; u16 *buf = val; int ret, addr; @@ -1582,7 +1584,7 @@ static int bmp580_nvmem_write(void *priv, unsigned int offset, void *val, mutex_unlock(&data->lock); pm_runtime_mark_last_busy(data->dev); pm_runtime_put_autosuspend(data->dev); - return ret; + return ret < 0 ? ret : bytes_written; } static int bmp580_preinit(struct bmp280_data *data) From patchwork Wed Jun 5 17:59:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687264 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 8C6CA1953AC for ; Wed, 5 Jun 2024 18:00:23 +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=1717610425; cv=none; b=qB5jhvW3LjfFfKqB9iZ3Kw1uP47LwXElor1H4oqRFiB5GZnKJWjWGm/vScyZ7pBew5n8nw23a4cogGRhkobnNCbLlYFGLR2i4m1ipuc2dagSv44y8pMqQ2/w+5ScuLC6OevaOJveXg+BahrhtPuvb3KWPzAYAf9R6yi8fEX2wt4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610425; c=relaxed/simple; bh=M/eENeT34qITqyMJGoLfrkcDLPx6c2gqtgSpfyqShjk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=aDDKGm5My0fYuyu5hAJ6EEIgqc4ueyZpe2JhZCLYHImWJMI3dCln5CdIOgVWdoESJ5ppO3B+9ULTEmfZjEBW8r/nkK95rNYYXCgfPeXgPo6+5S+A5aoyaBSMdGLONTbIjQ8pHBiBtT8lTTh2c3sqIrcSDGf1IPppqHLHVCM4tsQ= 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=FJuZggmh; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="FJuZggmh" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-df7a6530373so128563276.0 for ; Wed, 05 Jun 2024 11:00:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610423; x=1718215223; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=oWEvs7lXuHPW/wbGZW3HASpAVL3QgOZ/ef+Ervw8nvw=; b=FJuZggmhFGhWp10YbseBbhbNSwZbD3YkwUxXiS6vcF3km6ch/KL4ccGCubjjUswrvs stPWi6m+aTLRC39j/3ob86S2Z6NSr8O8AxWYWzc/hE+2uMm67w4Lmz1S94v/l/H2c1hJ O+dO/BeG+dPImMkDS26dKkcAxhVypHz9QHnNm3SysGqu+1oZzO8mtV+2ZAtcfMJ6UYcp ai+ktg2KHiTPkI3n1qzSaKTw4JfArzruUWmO+bX2v6Wv+JKurz/SBGIfcsiP8wS4dc4B B6pVh21yuxtzozIJA2Lvp6iwb6u37kIgRlnXtqQ/gmB7Q0nOc3TCGGSkWeK8EtBzAwJO uA/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610423; x=1718215223; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oWEvs7lXuHPW/wbGZW3HASpAVL3QgOZ/ef+Ervw8nvw=; b=KiSrjuMW9TqKrjLfyXi4sLlgvYyIkUSojltr0a67SJlFvfN32599UIzFXM8TYvTc8Y 2Sb6+8fljY5D5aWHovIwv5Bk0TZpCTL6Oxyo2Qd6mDlZGnk1JNAfOaSs0IcXvnUmMKx5 DR2o7M54K9a2JAuLY5+2eo3Vh/smcEl5G0NFs/u0bWITgeB3lGsQr5t9cmQP9m8pWdWv Nokiao6m1ezV8XAX6jXFlYyiHv0RCEUmN0zrX/9/wLAK5RwJAQNtmGQb8c6LkN0nFsBE dlEWA80PegG7pJVy6QAMWNKpikeMQcpahqgQb6Rc06PxYI48l36z/ZUDj8XmkIq1MmN0 1V1Q== X-Forwarded-Encrypted: i=1; AJvYcCVF+JIv87ex/ZdADQLhu28yFQIJLHLKk+dmlvweYJTfbtzx7bqCwrE4Ag6XmN8gB3RWDVpkka7Iu4rxJYquWFqBOhmk0iYMw4oB X-Gm-Message-State: AOJu0YwuJB0WdwGZ6mSrniFys/VYt3oSdV1YdrOVS62yPMVSkR7JfuCm 6e6z1jnS3EL+y5uYTcozLxqTJmzTiy1LcwEs9zJUD0Jz5DxoxiqRIqmc60f7S5pTkkxmpCIxK4L 3bc+yaocYBw== X-Google-Smtp-Source: AGHT+IHzBpKnrggHmMHMkvKX90wRDGnyxC/rya4wNnolxBy/S7eZxADMs2JOhL4gs65LRvS4Cl380vcS0L4//g== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a25:9004:0:b0:de5:a44c:25af with SMTP id 3f1490d57ef6-dfadec0b255mr68771276.5.1717610422643; Wed, 05 Jun 2024 11:00:22 -0700 (PDT) Date: Wed, 5 Jun 2024 17:59:49 +0000 In-Reply-To: <20240605175953.2613260-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-6-joychakr@google.com> Subject: [PATCH v1 05/17] misc: ds1682: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/misc/ds1682.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/misc/ds1682.c b/drivers/misc/ds1682.c index 5f8dcd0e3848..953341666ddb 100644 --- a/drivers/misc/ds1682.c +++ b/drivers/misc/ds1682.c @@ -198,26 +198,22 @@ static const struct bin_attribute ds1682_eeprom_attr = { .write = ds1682_eeprom_write, }; -static int ds1682_nvmem_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t ds1682_nvmem_read(void *priv, unsigned int offset, void *val, + size_t bytes) { struct i2c_client *client = priv; - int ret; - ret = i2c_smbus_read_i2c_block_data(client, DS1682_REG_EEPROM + offset, + return i2c_smbus_read_i2c_block_data(client, DS1682_REG_EEPROM + offset, bytes, val); - return ret < 0 ? ret : 0; } -static int ds1682_nvmem_write(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t ds1682_nvmem_write(void *priv, unsigned int offset, void *val, + size_t bytes) { struct i2c_client *client = priv; - int ret; - ret = i2c_smbus_write_i2c_block_data(client, DS1682_REG_EEPROM + offset, + return i2c_smbus_write_i2c_block_data(client, DS1682_REG_EEPROM + offset, bytes, val); - return ret < 0 ? ret : 0; } /* From patchwork Wed Jun 5 17:59:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687265 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 947ED15FA72 for ; Wed, 5 Jun 2024 18:00:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610430; cv=none; b=GxDHDjFk7hocX1CzVfM8VCMeWEFPXxDj7dVnlqjr+cpGDrzBmX/Q3Cl77B+rmKIx2D88D2Kyohe10j6jlde8jX8GNLr663OITcRRHFMreN33OZamezhy+P+04vvqpO58Vj1B5pqKgtsnHskyenzVmNk0nWx7WSogMF/iNg+kDFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610430; c=relaxed/simple; bh=7s5ualCvDc0GEz4419Gj42eDU6iSkCy4DM1JO8Cp5kE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=gcXwjRHPLIHjd38770jg7TbChVOCtqayc11pdcTBCPKWvXyYYvubiLUPbcumBzl/6l11OkLfoTMllG45z0DdEXv8UacfYDMsb474qhgfL+PsEV6cL2FaINcq7m2NqCioPal0SvCbeapCoUar/zupckoWfsPLOOKLVZBf2DMTA+0= 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=yW9iJgkc; arc=none smtp.client-ip=209.85.128.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="yW9iJgkc" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-62a089511f9so15304317b3.1 for ; Wed, 05 Jun 2024 11:00:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610426; x=1718215226; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Kq8gN9PC4V0/WUeYJD+ngNL2/82oznUqnDRsVCEUyhc=; b=yW9iJgkcljzKSnVxoazsYECi5fP6QNHHLJ9IlEuTsYQL+RlaWWDmJD2d4e+DNhDTlm KIfryHEvd7FtNm8eHNyqjTI1XXd9/8uhvtg7pv/6kGvV3N26EfwVy000lhOWFWeeOYca tJ5tYDQzM0o210kyrr+IgjNfC2CA3bJ/iL77N6LlXzTEq98PU3R3wL/25tRG7uPbotgU cpbVNwzhr6IKc2fqP3RBBaMQHVM8jgX0F5gRXjSonWVCOuoyDtvr1Rlg6q+Zn0PJq947 LFpzYOwiH3TGEwZZHterdbmrVBOoTZV4ppyVHdrpANxTOrfCSPzqLu+DJ+cBDsXOimAK gLiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610426; x=1718215226; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Kq8gN9PC4V0/WUeYJD+ngNL2/82oznUqnDRsVCEUyhc=; b=rcU1if5L3wOn8jtdL3TiNq37tOLl1d+6uF7N1W5LG4EQjzu03+NMG1T3Jw0aTQJppf kt4/KTc1Se1ZIyfyi9/4FfxTG+SjMY6jud0ClXXxhnc+BgyzIHVYHqrBxsew/7SQKkaj kX7cZaF98nYiPlmmJ2rYt13+nstBpeJ5Y4S6mZQRSKz896WM01VHoX1pTFnm4bngBI9r /374gODIxacX8RUO0uHn5kAbn3ahNlmSZTlr4lhtdTaeAxde3ZQbxjOa4CmIU2gKzF3k CNKEvwhuiDa1k+VcssT4/8EvS0fSJPmIYC7zwPJEN9yPcThJjFttiNNzGen8GjMbZTgu TxQg== X-Forwarded-Encrypted: i=1; AJvYcCU8z4Su6YdLvYjhFoQ8URDTAQ8FpbYpoWcE6A8ZXLd3C6KZGGiCJG4VlEEAuQ5YJdm0Jo6YnFALwH2EkioG6b8+q0+SFuCy8ZLa X-Gm-Message-State: AOJu0YwY+CcZaOLkmUnC4vd7VIgRrcgl/c9nNvY+LnnjDZbynLGjfwkI pb9/Xp09aBtbw1iE4FJeihtXfXPt4qK53mFK+QoGAForj0nywD5hMFREeoPjGPMhLzYGjb9ZcEB 27DLm8h75Iw== X-Google-Smtp-Source: AGHT+IGpQQ4ibO82CB++j7EQg4rT4P/RHw0r35tzLXXxO3B/dL6yEQW14Z2L0s1fkq9sPWcVhlzFxs8YqockaA== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a0d:d4ca:0:b0:623:be6:d5e4 with SMTP id 00721157ae682-62cc71784bdmr605497b3.4.1717610426639; Wed, 05 Jun 2024 11:00:26 -0700 (PDT) Date: Wed, 5 Jun 2024 17:59:50 +0000 In-Reply-To: <20240605175953.2613260-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-7-joychakr@google.com> Subject: [PATCH v1 06/17] misc: eeprom: at24: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/misc/eeprom/at24.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 4bd4f32bcdab..0e8d92d6ab1e 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -424,8 +424,9 @@ static ssize_t at24_regmap_write(struct at24_data *at24, const char *buf, return -ETIMEDOUT; } -static int at24_read(void *priv, unsigned int off, void *val, size_t count) +static ssize_t at24_read(void *priv, unsigned int off, void *val, size_t count) { + size_t bytes_read = count; struct at24_data *at24; struct device *dev; char *buf = val; @@ -465,11 +466,12 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count) if (unlikely(at24->read_post)) at24->read_post(off, buf, i); - return 0; + return bytes_read; } -static int at24_write(void *priv, unsigned int off, void *val, size_t count) +static ssize_t at24_write(void *priv, unsigned int off, void *val, size_t count) { + size_t bytes_written = count; struct at24_data *at24; struct device *dev; char *buf = val; @@ -509,7 +511,7 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count) pm_runtime_put(dev); - return 0; + return bytes_written; } static int at24_make_dummy_client(struct at24_data *at24, unsigned int index, From patchwork Wed Jun 5 17:59:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687266 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 62EE7195B31 for ; Wed, 5 Jun 2024 18:00:31 +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=1717610433; cv=none; b=O9jnrrlGnKQvE4C9m39M/WC7qL4Smd/PP1MswA/m/T012lRtyiG+JF3a4Q3WT226usSTQmgpUNVke8nfVtfYIrt0QysnVYfoJuG+o3X4SxsDSMIMT6hikBdPja+ZEnKolYOqGoA3HhWQ1UrbSkEEn6OHlM9Muw4N+yjNxVmMgVQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610433; c=relaxed/simple; bh=7YntdTNu7aMZ5zLGGRpR3JsfAB0rBOtanC3KQe4XBYY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=gdJehf0c2kLwYEosKVvKC3M4s1Tv8/e0el3g5YIN8eAayg59qfvK2d4D8y9JvWNltMj3x6mnffS1CieHM5sS8qiQstj+pVAU6PbY5cm5xZ9LU7rVDkW3pM7tfX9zDapMPYtIMV1adAmmSRx/D1g4jit9nD3AVLF0UgZGziVsO08= 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=xh8vf0dA; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="xh8vf0dA" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-62a1e9807c0so743487b3.0 for ; Wed, 05 Jun 2024 11:00:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610430; x=1718215230; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=GabZAVwK9FSl0VODpa0rRnhc7Hb5WIAFsUpyNY/Jkgw=; b=xh8vf0dA+TFlUnkkazIa6Em6KzJbbntuGamI4Gn8Wj1jFYYx5ZYFkn2tA0alpWg68u 9jhNXfx2DxL9m7tqmgthqmC1rUSflk24zLEIHrstf3mW39EvFDR2FeelUhLsupY30DEi /gVZrfJA0Slzv9rEogcUVgXiY8hLFc0E46E+FUZ/X8hWU6PYTTTOsgDQPMK44rgcyi4X g7UTGxktSZ/IcwoGFDfvWXQYzCbWyLYks/FVJWCMOKozF5JwJ5koJWgZ7381pzPo2fKz JwnKZftDOTv9WkuxVVV5rBvZHglYy9BQThw/il2JbfCMaxHpHsqQPdwDUsOxRCnGKcAo B5jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610430; x=1718215230; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GabZAVwK9FSl0VODpa0rRnhc7Hb5WIAFsUpyNY/Jkgw=; b=p8txXxp7Txz/AjwpYrlrJWpIjKDVyydDNfqjXqUzKFc5UsmLgJs5kmlsGuvkToMLkR AybFbRW3hTc3jF5qN/NXpab2trNnXzaHfJwn8IcMP4JOww5q1KWEFRcsTWY2QPMbPSi7 XTnTYZ1nNcOuQ8qOUxL4D6KO3PF5Z/SPrt1780QfuAuyqKmyISBIe9rejCREDWwh9+FH 7dMCeYvTLgVUDhr6hbT5hhWg1xiMpffjpHlkl8TFm1jTKqSjML20WMn2siChA5JQ1TOT Y7DZ9UWLyyF1QOg9hJzI5kf9Bi8wpMXlyKPxuCdlSUQFtbUyTCSi5XxO0NvO0IaKa7py z9QQ== X-Forwarded-Encrypted: i=1; AJvYcCW2hR66iauLffyR5+AeNNVApGgXWoUP0qgBXfNg+OyIxwcOHnII+lnzi0Q6u0gtmMjdHm+gEh+xyjIwTdbZCQFi5HwYNgoq/LdY X-Gm-Message-State: AOJu0YyI1AOt9uon48rN4lBedbnxlFyHUpLjoOZT7ajSBcM0/3EX//JU CkN/76fHbmnsiY/3egBEkomqMspsaBE8jTFniRJXYzXxcNYdqCP0TBJ8b/gGoGqDj3oyPx6H23D oneDrR1IFFg== X-Google-Smtp-Source: AGHT+IEja+GLVOpS7V2U0r8IR9Z9ZB6nAf9rPU6225JSB7wTRYk1qUU4QFIkeBtYF/8VHx1IHDowrDp0WPzcZg== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a0d:d952:0:b0:627:de82:8077 with SMTP id 00721157ae682-62cc709af05mr798057b3.2.1717610430440; Wed, 05 Jun 2024 11:00:30 -0700 (PDT) Date: Wed, 5 Jun 2024 17:59:51 +0000 In-Reply-To: <20240605175953.2613260-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-8-joychakr@google.com> Subject: [PATCH v1 07/17] misc: eeprom: at25: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/misc/eeprom/at25.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c index 595ceb9a7126..73d60f80aea8 100644 --- a/drivers/misc/eeprom/at25.c +++ b/drivers/misc/eeprom/at25.c @@ -74,8 +74,8 @@ struct at25_data { #define io_limit PAGE_SIZE /* bytes */ -static int at25_ee_read(void *priv, unsigned int offset, - void *val, size_t count) +static ssize_t at25_ee_read(void *priv, unsigned int offset, + void *val, size_t count) { struct at25_data *at25 = priv; char *buf = val; @@ -147,7 +147,7 @@ static int at25_ee_read(void *priv, unsigned int offset, dev_dbg(&at25->spi->dev, "read %zu bytes at %d\n", count, offset); - return 0; + return count; } /* Read extra registers as ID or serial number */ @@ -195,10 +195,11 @@ static struct attribute *sernum_attrs[] = { }; ATTRIBUTE_GROUPS(sernum); -static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count) +static ssize_t at25_ee_write(void *priv, unsigned int off, void *val, size_t count) { struct at25_data *at25 = priv; size_t maxsz = spi_max_transfer_size(at25->spi); + size_t bytes_written = count; const char *buf = val; int status = 0; unsigned buf_size; @@ -313,7 +314,7 @@ static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count) mutex_unlock(&at25->lock); kfree(bounce); - return status; + return status < 0 ? status : bytes_written; } /*-------------------------------------------------------------------------*/ From patchwork Wed Jun 5 17:59:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687267 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 4019F5228 for ; Wed, 5 Jun 2024 18:00:35 +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=1717610437; cv=none; b=UjzJ2w69/6mbM0qGSchNSrsSfJxBDU3zYXcmY5/1UlY9T5gI+umzn5aHrqZVGVP23l4rb2m0JkHlR/gC+xRyJxcWPdE/IwjAOqOwmZoosJY98+c/3WfMsBWTmh49ZYokErHjKWmYQncqkx5bhG1+Q9PjSsFMdUpyphJ0aUB9Lao= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610437; c=relaxed/simple; bh=1Nr1idmwpwCu952z8yg01gYhGFCoooIcYkAZZCQGY7A=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=tR42IhF4LIGnKhW71oQFiM1Lh1IJV2dj6+45iFMem65/PLnxxx1fmqaRUNVf7uLPtfGOMwsNIxLvqq0UiVyqVSsBin+aVcvwYNMiXhZx5erK9v0cAEM+uO39OXsz78rQNjfLyAayx/WV3DAWJezPQzcpBJZN1I2W35x7EUGPDCY= 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=c1tBtF+y; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="c1tBtF+y" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-627dd6a56caso262577b3.3 for ; Wed, 05 Jun 2024 11:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610434; x=1718215234; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=MVw14u+NFBf2FJ7HWAHlLpDDoc6dqDnKHHZFCo9Dzmo=; b=c1tBtF+yJ8uoGUqKF3NY2+DNv0U+YbN7XP5vEddV+WJ7paLKxOEOglfOFz182dQWhI TpkluWnQxtAvQfp05jLsz4zT9dm3xfsdzDHh1yzr8/nmaSz10c9q8p1TSIS4ycb9XjL4 +kZT3Co4WBmgkH8T5xB5TRVYwTeQD9Vt+Y49WRFALEILqv0lqjfHvGNKs5cdrawGsQq0 zlcEIgFN0D27pd2iV8Hc8uPpS6COn5E86LdPT12ToZhOr4ISvKhsf5WLKdzwsRexu4qm 8nydig+D2wj90/ixelEJDLBX4o3t/wkbBmdzYkGeDePYPMVOnQXT2td5EkySC3qAkgu1 qPIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610434; x=1718215234; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MVw14u+NFBf2FJ7HWAHlLpDDoc6dqDnKHHZFCo9Dzmo=; b=lFd4/3jN+GJuMqXAo6JDalQB4bI+mOu0NIjW/8lMYFgd1PhZawNHlCKaro4t7QlVZa PtuPUu9PBpBT1zeybfRGCul8tIofvMKt4GyBcWV20dnheI8fYF5PBnOozqg9fF+yJQmL AKSI4jXM64xHHi9ysvmTKWcm9ODIJQJLKK5UDz8WpgSo2QKCPGIpojB8gOBxY93wJTeJ FK+Rv7cxGPjljkfW17nKY0dXhyPsoZKcKRWlzGeeap4uSJfyzVHUrf3yu4k8l7Y7cOml BaQaDqOMReobFN5vR9bHcQRHEBErpOXGIjqwRqAQpmYELuZSWL8tE0zQ+GDuzjskuPwI wVqw== X-Forwarded-Encrypted: i=1; AJvYcCXE2TtemBWB1I4JjHVcGxiGiej818fpvKTqFoBniFTr0ANIGZy/45kRwQQ5H1SRD9ZpaE1d07w24oZFgjyYtoXd0ArbTKKpXLmJ X-Gm-Message-State: AOJu0YxIxzgUJBYdvOU3QTY3E3xuHwZis+w6kKQ00Hlj/KoEHe+D87KH TzU0NvaDjwLhBRLvesTsCs2E6YedrNuT5bzJikL80szirSZK16+p+9CGUEAxc8j2Q6kfkFlO4pV hu04NJYbyWQ== X-Google-Smtp-Source: AGHT+IFNKfAUW4OMaL9qXpdep3tJtwg2SPr15+NfVtMPZB9WLEiwmeB7gCF1Z3uW4GFYC8/zL1lL4yiz6W2izA== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:690c:39c:b0:627:96bd:b2b with SMTP id 00721157ae682-62cbb596fc6mr8752147b3.6.1717610434368; Wed, 05 Jun 2024 11:00:34 -0700 (PDT) Date: Wed, 5 Jun 2024 17:59:52 +0000 In-Reply-To: <20240605175953.2613260-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-9-joychakr@google.com> Subject: [PATCH v1 08/17] misc: eeprom: 93xx46: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/misc/eeprom/eeprom_93xx46.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c index 45c8ae0db8f9..5d618a13fe5a 100644 --- a/drivers/misc/eeprom/eeprom_93xx46.c +++ b/drivers/misc/eeprom/eeprom_93xx46.c @@ -79,10 +79,11 @@ static inline bool has_quirk_extra_read_cycle(struct eeprom_93xx46_dev *edev) return edev->pdata->quirks & EEPROM_93XX46_QUIRK_EXTRA_READ_CYCLE; } -static int eeprom_93xx46_read(void *priv, unsigned int off, - void *val, size_t count) +static ssize_t eeprom_93xx46_read(void *priv, unsigned int off, + void *val, size_t count) { struct eeprom_93xx46_dev *edev = priv; + size_t bytes_read = count; char *buf = val; int err = 0; int bits; @@ -158,7 +159,7 @@ static int eeprom_93xx46_read(void *priv, unsigned int off, mutex_unlock(&edev->lock); - return err; + return err < 0 ? err : bytes_read; } static int eeprom_93xx46_ew(struct eeprom_93xx46_dev *edev, int is_on) @@ -258,12 +259,13 @@ eeprom_93xx46_write_word(struct eeprom_93xx46_dev *edev, return ret; } -static int eeprom_93xx46_write(void *priv, unsigned int off, +static ssize_t eeprom_93xx46_write(void *priv, unsigned int off, void *val, size_t count) { struct eeprom_93xx46_dev *edev = priv; char *buf = val; int i, ret, step = 1; + size_t bytes_written = count; if (unlikely(off >= edev->size)) return -EFBIG; @@ -304,7 +306,7 @@ static int eeprom_93xx46_write(void *priv, unsigned int off, /* erase/write disable */ eeprom_93xx46_ew(edev, 0); - return ret; + return ret < 0 ? ret : bytes_written; } static int eeprom_93xx46_eral(struct eeprom_93xx46_dev *edev) From patchwork Wed Jun 5 17:59:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687268 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 BDB2E168A9 for ; Wed, 5 Jun 2024 18:00:39 +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=1717610441; cv=none; b=PsqCCxpa6ciJr1cxBzTBrsryZPu2E9IcutUGtX1R9TykE/zv5ZDnxV6aCuUAds5D8obW0ndjDC07Ay9GMQk0hHzaxWZtP2D67XvZeRt+NMIX5BlK62gs/z8M1vGBKL9FPJnWU/Fk8VYuPH1E1QxgJ9+UISz3FGi2/+0cPrx4bJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610441; c=relaxed/simple; bh=W5M28gmX2P2bsv2kzALbrb00qFmArQmOjGRUC+k0KS4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=JWaL5QkNFqqr396Yxj4oznsIy4y8Rwytqup0BoERT2lGhd94WgJAGMDf4nrCk/hFH8rwPUlRV1M7i0+8wm+xyX/BtaBaEYndDirvELPU7vQjtBj+kGINxfD2oDotpvPMfCG+zn3kUOmezlW/VDn7iCfuYBZIgQtM30QE3N0nVpo= 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=BoWahOKK; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="BoWahOKK" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-62a08273919so324407b3.1 for ; Wed, 05 Jun 2024 11:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610439; x=1718215239; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=+5/Bg969zZ0eVFu5myprHh5fQqxMXbek8nDgGOBzWoA=; b=BoWahOKKkJ1D7kfGtrnP0cUxpIrNaZ2suLddLewzR2oz4u7CWziBpzwFHQ+ftzncIs eFtpB/1H9zyQlzicoMJtoEWPK3DPjQzpefAzkEwD6qaiDFV3B0gWZlDhSKPFv0kyzLES mK3VwWf9UebiINpOs4Y5YKaafb1YFVHMwQk3QrRe8v5CIiNxI1jeF5dttXUDVWoM7CnG Marjrxai/k2CObkQx8B/L/3vNKpz1bxj4bvREXGRI3sEGkj1WJCLGHIzNySao6ORHqDb qzF5yPhaXQSrvk1jdn3p9DrUhYQfLvZ2MNZglt0siqP5RZkjDQWbJGwgpmIA/iYYcKMP XYxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610439; x=1718215239; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+5/Bg969zZ0eVFu5myprHh5fQqxMXbek8nDgGOBzWoA=; b=Rc0u4cXghnkK4TBSqOGKNH4m/x9GKiOYdBlA7S8ciPwb2Sp5wpzEzthlVclQwXckvu LiuPEIZZOUqqhDQdPpkBksaFzzS0rliOvZeuXKjUjCRqEo5JNbXR322DB+8taLqhPD4a cUdKlz+gWKzrAL8jERDZeSZS8J8la64mX3i/4dg1VnNRjfSiri5WKIK3FdzSeHUGb1ku LY/Dvmd+Bw1SmnlZegbPsIuZnMnZokYa+mIu08d7Uim50ZaYLBSU5WOmut+cb03qWOH9 66JdgI6LuBa3vbhwnaQm8JXLme8OuEnkbRBY3dNtBQuk0zQSiZ+w3c9eaSW29kPz0V0p cpNA== X-Forwarded-Encrypted: i=1; AJvYcCVDdP/0eGIzDbBqBYorCWxDtiRW4eXiq5MO2daD3uCBswDuaEK7oKo2WqRRKYbtCt+YZ0T03YpZpoggfV8CJ9CLZW/AbmHCeIwx X-Gm-Message-State: AOJu0Yx/6MFA5aGG/OevJ0iOS9/0ybVTCk1pvphbndEYt6z86S5SNEki lbfOq9gAZNp02G2HUh/hXTwYg1Xv/L0UGwtrZyaOJBKeJ7GupmBwKGxJARP7SLO4S5uO5W2wg2R W8RYVh4hIHQ== X-Google-Smtp-Source: AGHT+IFfzGEzBdG0mJIzkY83NzFi7HVUzu/maRQ4zPj2TdB+TSZFtwNCtZCm0+GEQSlNaviP1mxKnEiXfVn+VQ== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:690c:d90:b0:62c:efc:38b7 with SMTP id 00721157ae682-62cbb4a22a0mr7561267b3.1.1717610438615; Wed, 05 Jun 2024 11:00:38 -0700 (PDT) Date: Wed, 5 Jun 2024 17:59:53 +0000 In-Reply-To: <20240605175953.2613260-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-10-joychakr@google.com> Subject: [PATCH v1 09/17] misc: mchp_pci1xxxx: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- .../misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c index 16695cb5e69c..817382c342d3 100644 --- a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c +++ b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c @@ -117,8 +117,8 @@ static bool is_eeprom_responsive(struct pci1xxxx_otp_eeprom_device *priv) return true; } -static int pci1xxxx_eeprom_read(void *priv_t, unsigned int off, - void *buf_t, size_t count) +static ssize_t pci1xxxx_eeprom_read(void *priv_t, unsigned int off, + void *buf_t, size_t count) { struct pci1xxxx_otp_eeprom_device *priv = priv_t; void __iomem *rb = priv->reg_base; @@ -159,8 +159,8 @@ static int pci1xxxx_eeprom_read(void *priv_t, unsigned int off, return ret; } -static int pci1xxxx_eeprom_write(void *priv_t, unsigned int off, - void *value_t, size_t count) +static ssize_t pci1xxxx_eeprom_write(void *priv_t, unsigned int off, + void *value_t, size_t count) { struct pci1xxxx_otp_eeprom_device *priv = priv_t; void __iomem *rb = priv->reg_base; @@ -214,8 +214,8 @@ static void otp_device_set_address(struct pci1xxxx_otp_eeprom_device *priv, writew(hi, priv->reg_base + MMAP_OTP_OFFSET(OTP_ADDR_HIGH_OFFSET)); } -static int pci1xxxx_otp_read(void *priv_t, unsigned int off, - void *buf_t, size_t count) +static ssize_t pci1xxxx_otp_read(void *priv_t, unsigned int off, + void *buf_t, size_t count) { struct pci1xxxx_otp_eeprom_device *priv = priv_t; void __iomem *rb = priv->reg_base; @@ -264,8 +264,8 @@ static int pci1xxxx_otp_read(void *priv_t, unsigned int off, return ret; } -static int pci1xxxx_otp_write(void *priv_t, unsigned int off, - void *value_t, size_t count) +static ssize_t pci1xxxx_otp_write(void *priv_t, unsigned int off, + void *value_t, size_t count) { struct pci1xxxx_otp_eeprom_device *priv = priv_t; void __iomem *rb = priv->reg_base; From patchwork Wed Jun 5 18:02:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687311 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 0ABC1144300 for ; Wed, 5 Jun 2024 18:02:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610567; cv=none; b=qAEmbhwDJOCLpXe3qgtfuIdEvjX6Ezx15KwPQv/euITInHVRuO8UTTW3DRjXfEuapRZBY5f5C8pe3ZqEG5+aDGuY060jAJUG7tiIBuZVAQilVno2mZzXshDfbI5DV39iHm/XoN52FokSIpqVPZ/6h/dfmZpo1yZ2wyZUQWeVqJ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610567; c=relaxed/simple; bh=eF30gjQEDuHJ/IYGm6d82rKPYlogi0y1Le1+CTBv8es=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=cU0BT3PLpQFZmVqkSuxMCBZLIUvoty1nizTaeXaWI7avo93RLyzgEzw6CEfY3Z27C/Je3TM5f4s75mVM6xIFkGft8qI6JIZkqcUbr/ii76Q026LQWaR1VPx5XTxlIqF7aqbn76Jx+hgT/T0bYYu6F57mqWHi2+xl4b0VJy8iAno= 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=bosRmD0V; arc=none smtp.client-ip=209.85.128.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bosRmD0V" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-627ec18b115so496207b3.1 for ; Wed, 05 Jun 2024 11:02:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610564; x=1718215364; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=y5YxZkBMx7xM0lBc97o2/iv7RwAsHr+ZFIuj4hushzk=; b=bosRmD0VAZb+uNeHi7HIWEvwXg4aQpu6UokJkBAlLIP/mwUBkraTcuWQxK3I7oKf92 IUqNEgKeAor+QlQfrxVSX46Wr8qSmnre7Lod1wkkTeP1WiYmtzlXHsm6O3NcweNaf3ya Qandj21eqkSssUvIpP1j/ByVvuTqh/97jqaJeYq3PTsSsF6edkETmP9wm72ftlMYpBuP miYX+L6h9T7WRJYqPenCfll5CtFtSZIBP1XQjvu5Eg6N2CYzUGIsxekAXrrCObtum9/3 0mZb0apPgAHlNJwLvOjE2WR6cA9sNf2aU7/wo0Eq6mAi9yMTDLfZS5nu4m+yBkRZ20EB ZVAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610564; x=1718215364; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=y5YxZkBMx7xM0lBc97o2/iv7RwAsHr+ZFIuj4hushzk=; b=T1TwsTmx/carGhBEJR5TgVG6co3uWdOgJXYbi1LBG2v1i0NCbyBtjzbZoE9PWDQVX/ LmM3VXB30K769cLjFNomyzA1A0EJjeWUjtbIyccwiyAbIrvsD6J64ia20hfXmNiyne38 zDNvUegjBTnWTkKdyQAYlW1nIG9nD/HhmpsZML3GwRtYNoNv5n2LQutGbg8GYb0blene i9wXKMwDC39+0M9DUtge5gLIRvvhqkGXFa33qlH45GI5zj3Cf/6rroTr18tiTp6GwzCl OZIfxN7uaAbsAJJ+tGP4NpBTVXZ3JTcwa3b/57PS1dGtZ3MQIroMnw/U/uXWU1dvoSRM SS1g== X-Forwarded-Encrypted: i=1; AJvYcCWe8u9EzSvrFNFP/AVpn6/e7oS5yuJsJ+491LWm+LXKIxHQppugWNxDJv24ERyq9oDJ1TO1i/GGj0mkjuw+KRTmfsTCmRF1CNHq X-Gm-Message-State: AOJu0YwCrBBJDivrmDHbydPB1LctdATRrGVoDKmSHSCm1ZFHSgVtFBwI yePwYaBKScixZgF12nZiAu2YxTi/EPvqimZ8vpfo1241l89FVwTHWVvU520mx1hMva15NYBabHO G89gdiuyeZg== X-Google-Smtp-Source: AGHT+IGCU+GmK3Rf3XT5eiVn8GBJTqffr6kRhdYR5C7W1ubGEWJe6ysf+n1fV0SHLE+oXrcbvgWtj6KwbrbfFQ== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:690c:884:b0:61d:3304:c25e with SMTP id 00721157ae682-62cbb5b3bc3mr8573737b3.7.1717610564108; Wed, 05 Jun 2024 11:02:44 -0700 (PDT) Date: Wed, 5 Jun 2024 18:02:31 +0000 Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605180238.2617808-1-joychakr@google.com> Subject: [PATCH v1 10/17] mtd: core: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty , kernel test robot Change nvmem read/write function definition return type to ssize_t. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202406050200.8BOdZUla-lkp@intel.com/ Signed-off-by: Joy Chakraborty --- drivers/mtd/mtdcore.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 724f917f91ba..b13752ec2f1c 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -530,8 +530,8 @@ int mtd_pairing_groups(struct mtd_info *mtd) } EXPORT_SYMBOL_GPL(mtd_pairing_groups); -static int mtd_nvmem_reg_read(void *priv, unsigned int offset, - void *val, size_t bytes) +static ssize_t mtd_nvmem_reg_read(void *priv, unsigned int offset, + void *val, size_t bytes) { struct mtd_info *mtd = priv; size_t retlen; @@ -541,7 +541,7 @@ static int mtd_nvmem_reg_read(void *priv, unsigned int offset, if (err && err != -EUCLEAN) return err; - return retlen == bytes ? 0 : -EIO; + return retlen; } static int mtd_nvmem_add(struct mtd_info *mtd) @@ -919,8 +919,8 @@ static struct nvmem_device *mtd_otp_nvmem_register(struct mtd_info *mtd, return nvmem; } -static int mtd_nvmem_user_otp_reg_read(void *priv, unsigned int offset, - void *val, size_t bytes) +static ssize_t mtd_nvmem_user_otp_reg_read(void *priv, unsigned int offset, + void *val, size_t bytes) { struct mtd_info *mtd = priv; size_t retlen; @@ -930,11 +930,11 @@ static int mtd_nvmem_user_otp_reg_read(void *priv, unsigned int offset, if (ret) return ret; - return retlen == bytes ? 0 : -EIO; + return retlen; } -static int mtd_nvmem_fact_otp_reg_read(void *priv, unsigned int offset, - void *val, size_t bytes) +static ssize_t mtd_nvmem_fact_otp_reg_read(void *priv, unsigned int offset, + void *val, size_t bytes) { struct mtd_info *mtd = priv; size_t retlen; @@ -944,7 +944,7 @@ static int mtd_nvmem_fact_otp_reg_read(void *priv, unsigned int offset, if (ret) return ret; - return retlen == bytes ? 0 : -EIO; + return retlen; } static int mtd_otp_nvmem_add(struct mtd_info *mtd) From patchwork Wed Jun 5 18:02:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687312 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 DAFBB149C65 for ; Wed, 5 Jun 2024 18:02:49 +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=1717610572; cv=none; b=sjpqsK91tLdLJlg8PnJJZuIMvrjjMyWS3dEFI+hJY6cVmyE7WoUTNVvlzJNwgdGOq07sg9aSViWWyZDc86qqO1qwr6FOPZ5QlpJ64tYhrkHYVhT4KpmMe+9lxAp71WBnAJkDHm9wrfw5h/5I28bAv40OXmCdrIJH7nfftyXAUPA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610572; c=relaxed/simple; bh=L6k+G2m+3j3md7/zl4VB2q4oF1PIwiQxOqm6LYJmtKc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=cIVt639n+UZUv1yDeBsisdM+FW8X7MrkpHyHLtpO6HXPLcC1MVsGF5hJslnTOsDFH33ND7S5G4oD+g2k9c7tzg/p+BnlHfVi6IC8VYZhs8fM2W5jhtw3DY544UJ7J5c1zZLZXgdACXbB4VH4dXm7/c9Qg0Y4T6S5GGcwBkIyEe0= 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=u2X6l/Cn; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="u2X6l/Cn" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-62a0841402aso266247b3.2 for ; Wed, 05 Jun 2024 11:02:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610569; x=1718215369; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=IUTCTG4PiwJpsjy0QKETkEiNDEwH04EYXsIQhajeZMg=; b=u2X6l/CnJHRqsHZ+uqWAuBZR2EDxEE7VQOHBGEJWO82zvjwXqD7qJxXBn9P3wlYn/S P4vKe/yG01XKq16yIxYARa/A+s6Mv7WqHlVYjACiA/gDL9Faq/QdOyj9IOzHvlkSJJ+o 503leGdALXnNTEdpjvOLYNt/GC44iG3fAc0ebZGxR12mgtPkH0ZXYmeFilrL6GAE64+0 8KFTsXahDn8y7qdHAv9bIAnBQMMV288ZcMOQh+ZTq5vbDThXjxT0KVce2mqe2CIc/nK4 BIUj+z4Ox71qKxUxvQTViK8c80aQX7iytCFYkqYku39TU847AsFpxldfDH73MxlqBpSi gEng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610569; x=1718215369; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IUTCTG4PiwJpsjy0QKETkEiNDEwH04EYXsIQhajeZMg=; b=CRMIy9vf94A6l+dgJ96ZutpYQmxmkFVQrHnZT4rmyIubeB1muxuC9mJUQ+CqsP0fZe +FMSESNjihIFu3I2k7ezqCyzzNr90ZHD3G8fdkWULNA1dk8M855YlBys43SsvP+y5wZn EVsgcixQdDrmMLFjmADwaNumE12BbOdgq9GowtnmUkUrQLCfpclmV+Z08okcU5R+hfrS gIN87kEahCwHTGYagsQrsjiJKkRZZkjQo46a1XDnMeFr3HC459SRYeiPN+X83CMltsem stj8b2PgA0ehyPO1+fV5f1wZMs34Qn+pMcMPdkt5zm88ZgkjHUFescWjGiCIuU5/n4iS wlrw== X-Forwarded-Encrypted: i=1; AJvYcCUy5RuaNkY9dvsyto3qa0xZYKPaGrdKSJ9QL/yPlG+/38P/iBbcmdAMzlXqNKsFf8rJiS3hRm4sYiA/VJ5QKkH/9IHZOEwTBx2v X-Gm-Message-State: AOJu0YyXPsuq2/lO7bfbBHla3Yb4sSDcjlRy4XIjd4Yyx5ObmBJp9heM oknXh3XocWcVMS5ZM5QSQAznok1RaoUN5ekGicJIEGyW7JO090C7xss+pYwc9Sa+GBPI4ESyQXR osJ1jl77jyw== X-Google-Smtp-Source: AGHT+IGRE1l9odt4GG6RaI8M/uHdLkQEjh5Taz0VKgQ269YOTeE9TiCNJPVhuqv1Ry405YEIQ6hIdx0yWPVe/Q== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a81:4c07:0:b0:62a:415b:a137 with SMTP id 00721157ae682-62cbb4a2295mr5047937b3.1.1717610568813; Wed, 05 Jun 2024 11:02:48 -0700 (PDT) Date: Wed, 5 Jun 2024 18:02:32 +0000 In-Reply-To: <20240605180238.2617808-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605180238.2617808-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605180238.2617808-2-joychakr@google.com> Subject: [PATCH v1 11/17] mtd: ubi: nvmem: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/mtd/ubi/nvmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/ubi/nvmem.c b/drivers/mtd/ubi/nvmem.c index 8aeb9c428e51..eab14821343d 100644 --- a/drivers/mtd/ubi/nvmem.c +++ b/drivers/mtd/ubi/nvmem.c @@ -20,8 +20,8 @@ struct ubi_nvmem { struct list_head list; }; -static int ubi_nvmem_reg_read(void *priv, unsigned int from, - void *val, size_t bytes) +static ssize_t ubi_nvmem_reg_read(void *priv, unsigned int from, + void *val, size_t bytes) { size_t to_read, bytes_left = bytes; struct ubi_nvmem *unv = priv; @@ -55,7 +55,7 @@ static int ubi_nvmem_reg_read(void *priv, unsigned int from, if (err) return err; - return bytes_left == 0 ? 0 : -EIO; + return bytes - bytes_left; } static int ubi_nvmem_add(struct ubi_volume_info *vi) From patchwork Wed Jun 5 18:02:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687313 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 CA6E314E2E2 for ; Wed, 5 Jun 2024 18:02:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610575; cv=none; b=jdo76f3fRHD1Mi8a10jdaBhtzzFyINc5TlT+J1BGqZpZZw89kBYJrN5zdnC902CNPHXNpo4+on4JFPc050ozgtEU6HlVRToGPZKLqFr7/4L3zPSF53z0jrLIRjWJfhUmpT80EmQjODrllKavOSfJOa+5gGwSjrQ9a8p1x3/Su4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610575; c=relaxed/simple; bh=3NTGVyytdVyzcHP8txKlFB9YPPGxIJEVxCzu2cUQr1M=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=WyDd2/iVUeMEaJnpsXlxYtKOFZjOEKaANz/jEhOuK6biHnPw+LexIqfu7W/4M2D1n21gRdjxmOhhQQ5wC0CqLADZTE2HhTN4j4ZTYOsvt7ijQSbyGAiR5VSH9KJYYFu6d3YadB+wqjuTzIPRuObNGhvul1w3o/jn1jZNoaYvVGU= 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=Zceh7r4D; arc=none smtp.client-ip=209.85.128.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Zceh7r4D" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-627eb3fb46cso320777b3.2 for ; Wed, 05 Jun 2024 11:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610573; x=1718215373; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=qDI8h7ZoQYy75CqD6I2McYIto2hpIA5emU6fq1I3LPI=; b=Zceh7r4DKjZxj+a9nK/QaXDX6PywKjBJO0UZV1S/xJdKXimp/nnCI0wZvsZf0UJhwK 7Q1RjJdda7ewUbgf1avKIEw/IlHVV0/kuQYnDpbGWhedQ8/BTcIzW73L2EnJUWVZdmg+ PZ9u65qivhbL3++hcgSBbL4DG4bWaaEbCO+dFoE8ACY4vUfP6RaLzkkrbcCyH5XWZISy wDGKnK9ja1EPb9k9WJHVTZJ5qM0WWQfoT1vIvHa7kLuHD+Sqbr7dPNAVmelsUyhgUAwX A2L8gG3AW7S8JXvOWrFgHP2ygYbSqPQRbESNpKB37Y6rSBH6lpRPJcUdj1DyHb9Jg1wz zX0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610573; x=1718215373; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qDI8h7ZoQYy75CqD6I2McYIto2hpIA5emU6fq1I3LPI=; b=ZntTShBz+w/FfTe6IijMFs7+tt9ppvSJFhP/5qvLqmyrqmBTUbkQuw650sENLm6bkT xGDMAa8eVhNiptLiKTBRIMitsUe2P3inErDNpKdDV2vmT+Y/mtVLBXWw61rYYhx7Thm3 jN76nt0y8h2IX1RQolNUU7uq8lpFf84gS/7xOm66gsaX92qfku7DQPb17trAx+muqM7g rs9RNSFiP5NRYhuNPfpeIVhW/rfQFIpBmYvoY+sWsZnaFX10TZvs+PMGlPlXa1yOZrNx CiE1mupKmsLDMTizREZni+2lg/DncEAzJysa5OVBCnAuK0tD3fqQQym8QAFhWFEi/Bhs fJJA== X-Forwarded-Encrypted: i=1; AJvYcCW5KRlJJ03IjzQZZ47Afeps3mJ6Ihlsm4TuP2BT3Qe9GrksSh3o8FYpe2vmJls+OjKZzkAkQNRvo3tUOfwrqW5I35tgTuWMnKvK X-Gm-Message-State: AOJu0YxhbDyPn0eQK7bsuwp7FOXJG+4nAkPEX3oXaQ/BYmsGW+11LSvS JWRxjfUloeXkpa2Tuc3tXCJs21C+bKFA68GsEBYWYn4sbUisHwkChAP6IrEeENXqasYvdyjYZw0 mUDQZff9m6g== X-Google-Smtp-Source: AGHT+IHsHtY+bAgPNOkcmVi64EeRKQimO371NMHALyHppPPqEXYX97pSerbED4x3JFp6tor3148MLJe9OAqS8w== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:690c:39c:b0:627:96bd:b2b with SMTP id 00721157ae682-62cbb596fc6mr8780427b3.6.1717610573043; Wed, 05 Jun 2024 11:02:53 -0700 (PDT) Date: Wed, 5 Jun 2024 18:02:33 +0000 In-Reply-To: <20240605180238.2617808-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605180238.2617808-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605180238.2617808-3-joychakr@google.com> Subject: [PATCH v1 12/17] soc: atmel: sfr: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/soc/atmel/sfr.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/soc/atmel/sfr.c b/drivers/soc/atmel/sfr.c index cc94ca1b494c..c1c8e59cf6fc 100644 --- a/drivers/soc/atmel/sfr.c +++ b/drivers/soc/atmel/sfr.c @@ -20,13 +20,16 @@ struct atmel_sfr_priv { struct regmap *regmap; }; -static int atmel_sfr_read(void *context, unsigned int offset, - void *buf, size_t bytes) +static ssize_t atmel_sfr_read(void *context, unsigned int offset, + void *buf, size_t bytes) { struct atmel_sfr_priv *priv = context; + int ret; + + ret = regmap_bulk_read(priv->regmap, SFR_SN0 + offset, + buf, bytes / 4); - return regmap_bulk_read(priv->regmap, SFR_SN0 + offset, - buf, bytes / 4); + return ret < 0 ? ret : bytes; } static struct nvmem_config atmel_sfr_nvmem_config = { From patchwork Wed Jun 5 18:02:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687314 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 4442914F125 for ; Wed, 5 Jun 2024 18:02:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610580; cv=none; b=bCcDKssybUqcWHJfK7IBC2SqVIM7woQ4iFMsx0R87dUoCeGLpqNMCckipdZ2Y1MAEkD+IEo6aidWvz2+nOUrhPoBhJvXPhKWElLQjNv/IZsKbgaiPsu2EEorBBwPGbGKMcio3pqAhhoIVXCOPLJgAwQc4TiueJ0KlwVJkbZo7D8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610580; c=relaxed/simple; bh=F7v/jReeX3F7roR5IktBU242vDNjjn7EqsY7CVC37N0=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=saBILyG+cE984zjuavWmMBij0Rk3RKjlvpSUndAYWAQ3lV8F+ept8YbTf8fxRE2oCT2q7BZ+WGl7qDOE3usDXqzvH5fZ1ijHu9MApFwmcXzocRqD6ritdIm6uXFJ9u3kL4ijIdKVJSQJPzZZwplaHQUk9K1tipjid/Jpz5Rm3zk= 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=kNi4DOsm; arc=none smtp.client-ip=209.85.128.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="kNi4DOsm" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-627e4afa326so301177b3.2 for ; Wed, 05 Jun 2024 11:02:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610577; x=1718215377; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=gIyLXo+tPpGJoYrLFVnPX7LJcwSjEvXHtDXEdVowSIA=; b=kNi4DOsmR2eFJD/ozPIJsZfY+u1FaWLBIwASVQfRGxgFjLlTOUI7zjev1aEAMfsKW/ 0yLbhyipzyZtFoC+DUR4FYJiSoXO5mH4/eulRQR9F6nT/ixTUVnH89p8nLpSKs+ryqZ6 PQDB5Kq9C8mDvTjazJGZigJLIebVnW2iS5jBdtWMwaDdH3Nm0KtC+riYBGgJRElKzcBc nb0zPBm9tbmB8B9Nt5DQWLR/elAziVjIPIPDCS45F2QREIVOQMwAJMr3aIZrSPFIy5N7 4I9Ab10rDhZjjGPg8NhmVnxMrZ1wybrQdk1R3hz/PGLFOiA1QeUxuqHLnxFWVNZSGdTh f60w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610577; x=1718215377; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gIyLXo+tPpGJoYrLFVnPX7LJcwSjEvXHtDXEdVowSIA=; b=TM2mHykdji49UUfYTo9ud1uaBvGMOSfEkymJVnuot6e//SrLrZ1+eByj8MvWXf0W2j eb8ILjhXEuY7QUJ40atsRG0nfpE14K3qvpd+sn8b7hLNhpbh3aXX4a2scZYxOrJo1M4m HehCFiOYxoyPz8caoNF1WhiUMuSsykO13UkOrlhcU/V4SFFEXc8RBH9rf+7Siqo+l//m SEqP6eI4s7DwlDEJCx9sz1mF3WVP5ARuqZSUq66AjwBEF8+zS+fznjZesG0fyZX30e8+ ibcbQ38n03Kr+RNphUPZb0WYxRxaViRguasJ4ywAZcUooLMASMWE8AWQfJPhVjHHD0WB pKWQ== X-Forwarded-Encrypted: i=1; AJvYcCXYuPtSAxeef+DBg1t6OcuFyBXeKPtcWk+80wvBZratUGSzu+kceCOpv106kji6vgzg3oXkJEaKrFHqLxZDmLi/A9fpYiYGDBJO X-Gm-Message-State: AOJu0YzDMTn3eUcDeoEL7LySRU2ImTQKKl/WR6kEHAdUwf8JmIAD4ZSy OtNV3xDcb9quNNiMMsWeBh2ZgTtFVTujUwOZ5H8jids0ykWtVWehs0OUg6C2UoN3Li8p8BFSObn joobXNXPQIQ== X-Google-Smtp-Source: AGHT+IHG2azfatKIs/LKs8bXyfwjNeJAhdZhoJHXxOf8ZfbWIWN9yiXy7wSmGDJ/xHP8XZ6qdqs5ZKpzypDE7g== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:690c:887:b0:62c:35fd:678b with SMTP id 00721157ae682-62cbb5ab5a2mr4622397b3.8.1717610577229; Wed, 05 Jun 2024 11:02:57 -0700 (PDT) Date: Wed, 5 Jun 2024 18:02:34 +0000 In-Reply-To: <20240605180238.2617808-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605180238.2617808-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605180238.2617808-4-joychakr@google.com> Subject: [PATCH v1 13/17] w1: slaves: w1_ds250x: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/w1/slaves/w1_ds250x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/w1/slaves/w1_ds250x.c b/drivers/w1/slaves/w1_ds250x.c index cb426f7dd23d..369de01cd84b 100644 --- a/drivers/w1/slaves/w1_ds250x.c +++ b/drivers/w1/slaves/w1_ds250x.c @@ -137,7 +137,7 @@ static int w1_ds2505_read_page(struct w1_slave *sl, int pageno) return ret; } -static int w1_nvmem_read(void *priv, unsigned int off, void *buf, size_t count) +static ssize_t w1_nvmem_read(void *priv, unsigned int off, void *buf, size_t count) { struct w1_slave *sl = priv; struct w1_eprom_data *data = sl->family_data; @@ -159,7 +159,7 @@ static int w1_nvmem_read(void *priv, unsigned int off, void *buf, size_t count) } while (i < OFF2PG(off + count)); memcpy(buf, &data->eprom[off], count); - return 0; + return count; } static int w1_eprom_add_slave(struct w1_slave *sl) From patchwork Wed Jun 5 18:02:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687315 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.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 8E3111509B4 for ; Wed, 5 Jun 2024 18:03:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610584; cv=none; b=nvUalA4P3QDQ7B406zWMtnSzptjsn5r8u9dIkME+xoY/N2/vNrLilUp8Nzaf7gIb/T093fabUYq5gwTsgvFU1e9E9FOxKnffKrDiuVjhrqDO7W8/EvB9oJzdBBZwn3Lu4mjxHTX3ebQnKaniV8AqedZEPHKOe6aQQwRS8TcT5O8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610584; c=relaxed/simple; bh=5F0WRZAIFyT/53498dR8Vin7Zzzm6LhYVaUBgnMWhtU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=BN93nv/rRIyhyceoz/nuFV5at2MXOSr/SktdA6+9lbJqGUmsykxNINbRZnJu5cNdwABTVKgfAxCo8QR9mNRZWVX2ukkzSAVWRswW/EoLmtK29bSWcuPadWU0adhPxK72aZRZv3xPWECxM1SuVturzYkjvIzrMPspWwOwcxidygY= 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=2sMENMgr; arc=none smtp.client-ip=209.85.219.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="2sMENMgr" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-df7a6530373so136774276.0 for ; Wed, 05 Jun 2024 11:03:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610582; x=1718215382; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=xwrLVVIieFUQPopwc+1tOr/or/db/Iy6oXeR6vbSkEA=; b=2sMENMgr5YU0+uYrV9r88nXRoiLkdjubyiDnP+vRHYdDCX8uQ7kxV6eFUIVPz9gXcN VePpd9IhHPjdKDz/kZVPcAO4vG8LFdXIKZiA+xYjdLFJ/3eqHwmG3feqUqUVpyJtpMVu VHomo3WoBa4vwKbtMFq+nyuRlbURKig31XwAON6kx5ZA5WH2nxVoIwxwaZCqUoRbt46A KggIhcQNptrrGDJSvCKeDp5ALOU4bfrH5187eCLF3a4S9W/GGoYJhjjzHyvm4CnT03TA 50V589hxvpQib07iz3C9e9MorTXjYwHsGGtiGmp9MxFx0T9Ax8IdXo2nWi0p+sLKIXfv X+KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610582; x=1718215382; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xwrLVVIieFUQPopwc+1tOr/or/db/Iy6oXeR6vbSkEA=; b=g0smIpLqBAr3u9JOvzbFaqrrt9A/Q9kZbfukBrsXI79z5gXZhejdOJS2T3iqTwzUv5 P60aSPOx+VQZyOEJl21GqNUaWroGL9ddI9iK1K6cj3W+nbY0GSWaIc7ehl5jI81HO4Jc 6eEygtIcZT17mtmnDCYA5PhsKhjH26XDCGNAXq5UcAnvyWD15IUAZvRbIS0IiilSU97e Sr+B71yRvSkh3c4Y3+nHC3SRDQ5/DoArtXq4W/pK1S4r71PnGJ3Ii17RDnGSTaP8JsDy NssX/rYdWAz3KLsEjqFY0S72X3PLttmiggzHv3dQZREmCZY6CcRve0bbSk91sRp6N3tE vIJA== X-Forwarded-Encrypted: i=1; AJvYcCUyKuCUoemKOGKcWy6pIGGX2LcPEQaDjgbCROnUQeDypeLU3ypxDnwbqwP8RGc7L6ii1OSMIp/aSx7QgiB/I5aR2vVkd6JT3KGk X-Gm-Message-State: AOJu0Yz9YLKLDaCPB/6Z8WMDf/Ztd6fKD80acAx/dGt1ZqepG6ctMwIc TziYRd7kBk91XObPAQrH9AyyfM7ljaw3FsiBe7zdSkud0oeB3oZLhJjqHe52Xq44S+JmDKhhyNV uZbpNmp3EFQ== X-Google-Smtp-Source: AGHT+IE9F8AaFWy+zkoE1AAtvE0JQ7XHHDVuIM2gnYtU9d2txGGQvOGhBI3kC4/nhW85Sx5cKDFxLERd+BeUJQ== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:6902:110c:b0:df7:9274:34e1 with SMTP id 3f1490d57ef6-dfadeb57766mr87616276.4.1717610581556; Wed, 05 Jun 2024 11:03:01 -0700 (PDT) Date: Wed, 5 Jun 2024 18:02:35 +0000 In-Reply-To: <20240605180238.2617808-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605180238.2617808-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605180238.2617808-5-joychakr@google.com> Subject: [PATCH v1 14/17] thunderbolt: switch: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/thunderbolt/switch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c index 326433df5880..35424a65cd3a 100644 --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -301,7 +301,7 @@ int tb_switch_nvm_read(struct tb_switch *sw, unsigned int address, void *buf, return dma_port_flash_read(sw->dma_port, address, buf, size); } -static int nvm_read(void *priv, unsigned int offset, void *val, size_t bytes) +static ssize_t nvm_read(void *priv, unsigned int offset, void *val, size_t bytes) { struct tb_nvm *nvm = priv; struct tb_switch *sw = tb_to_switch(nvm->dev); @@ -321,10 +321,10 @@ static int nvm_read(void *priv, unsigned int offset, void *val, size_t bytes) pm_runtime_mark_last_busy(&sw->dev); pm_runtime_put_autosuspend(&sw->dev); - return ret; + return ret < 0 ? ret : bytes; } -static int nvm_write(void *priv, unsigned int offset, void *val, size_t bytes) +static ssize_t nvm_write(void *priv, unsigned int offset, void *val, size_t bytes) { struct tb_nvm *nvm = priv; struct tb_switch *sw = tb_to_switch(nvm->dev); @@ -342,7 +342,7 @@ static int nvm_write(void *priv, unsigned int offset, void *val, size_t bytes) ret = tb_nvm_write_buf(nvm, offset, val, bytes); mutex_unlock(&sw->tb->lock); - return ret; + return ret < 0 ? ret : bytes; } static int tb_switch_nvm_add(struct tb_switch *sw) From patchwork Wed Jun 5 18:02:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687316 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 B12BA1514EC for ; Wed, 5 Jun 2024 18:03:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610588; cv=none; b=mqIP6v1AQPMuKxwLNC8jI/vBjnJTyghIZ3xiDwirF4lxAk5Os8G89ecoPaGvZhFcGvS+vGrTAyUxZYHY9tOpe/O1EEvtebH+WSlLRTUs0FvhDdUN+x9wjSZd9nRPfL50s5DPnpDGFCu11cOLefNEfFdTz2OqkmLdCgs3SNQrNbo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610588; c=relaxed/simple; bh=fQnAA6GcMGARJcapq8jrHjYduUARBDKjz1Q8WK0DSoQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=RC7v72nDR3YOoGN9DXkGiHzuJJUhl9A6VWLQ9bP/Epwj6WOtkBSQLGAzpz5MGtF7ja6dKAeBozhiCjWjWBSb6iXj5VPfHc55FZ93bFJv1pdCpFQmtTXHKrrEXg3Ugh5X7AyfK4xI2M3p5sttl7fii8yPX/lIMmKl2GlJtaPF0Ko= 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=lus7SPN3; arc=none smtp.client-ip=209.85.128.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="lus7SPN3" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-62a0841402aso270787b3.2 for ; Wed, 05 Jun 2024 11:03:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610586; x=1718215386; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=7kj3F75/M4iGlFf64jdDqM9oitcQAChmy+MmDZHUpac=; b=lus7SPN3C4HJv1tGJtCt1RIriFHVu8EEpVEMob2pAO8r6AMx5EAPSNiuPKl2bRzYQp s1VEWcfIPJX/KS4FEtXAzH5/f00aZVi036MesJXBGtTc2A7tCn5ogk7csm+q/YzoUbXH GH0559kuLCkRr5jzmVydtPupiX1A2bAQiKcMVjCUSgBob0nD02px43LZ5IZqWb2LoS2x rLr5E7NyLegGCjibJ5ymhaJPjRFTolRt848Hv7O7wDDA93AGyEP2J9W1cBN6JvbKRokx L0QkJRANeCLf0RE+Rzzj6A3TpVHJiPrK0/cw8lRtVLmlg4UX3Y78ruq1O3ulI9oG6zk2 kOXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610586; x=1718215386; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7kj3F75/M4iGlFf64jdDqM9oitcQAChmy+MmDZHUpac=; b=jsDSiwL5GJoTZUzmldAN3Ln/nXoDMCrkbGrmSLvjjXQw0qUydiawLO2a7tXwaB6fxV f7nf0l20h/hildlj6mW6PV7GhNmSYcLbzPahXqB/MxaEx3RAks4Bs419Y3TaWk+3MWeF pc3R/zJ5ixwfiLPJgbxSfDzRl5hiud/YeQehoA3Cy+/ENFDR7oc+VzpNjA9ZIcQDxQZG Pg0Pn7DBG7pG6veY9VmlzuqjEfhEU0FiylFRA0BcCE12j9+c3vLBJRONeIm59HIGLe3t FfV+bTJl+J4784g/ue3S5rzyvxlVTlYuCNyW3pwsyTrKd3OKEZrRhL3LWJkqA2iggr22 cy0g== X-Forwarded-Encrypted: i=1; AJvYcCXIuwV3KvPqMhrWR1Jjy1d75QfWDiLncYwIaXcwXj6cUL80pckz6jO7LyagVZvvV2w6H23E+ebqptXx14NDnjLrk/ROX1IWn3iu X-Gm-Message-State: AOJu0YwqASCLEZ7Ig06FmW1c24wuRP/5VSjjhUnmTs1Olor3SV8zHgT4 y80nv9FCOTStsfJNCAg3mKPhvKtD+XD2IDpnekecv5SCD8NOvAF9izQsli0xmnfN94nbM4sxjth cOgMtOuRbCg== X-Google-Smtp-Source: AGHT+IG6CBdANF91FP38CmQTKr/LfgQsOsOD0b5R4Rhez9xhC1dP1JVIrpq0leEJ+8nApvlRDSurrJhIyku1Vw== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:690c:c93:b0:61b:ec24:a014 with SMTP id 00721157ae682-62cbb309e5bmr5896267b3.0.1717610585878; Wed, 05 Jun 2024 11:03:05 -0700 (PDT) Date: Wed, 5 Jun 2024 18:02:36 +0000 In-Reply-To: <20240605180238.2617808-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605180238.2617808-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605180238.2617808-6-joychakr@google.com> Subject: [PATCH v1 15/17] thunderbolt: retimer: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/thunderbolt/retimer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/thunderbolt/retimer.c b/drivers/thunderbolt/retimer.c index 6eaaa5074ce8..fa52ea11ec28 100644 --- a/drivers/thunderbolt/retimer.c +++ b/drivers/thunderbolt/retimer.c @@ -32,7 +32,7 @@ int tb_retimer_nvm_read(struct tb_retimer *rt, unsigned int address, void *buf, return usb4_port_retimer_nvm_read(rt->port, rt->index, address, buf, size); } -static int nvm_read(void *priv, unsigned int offset, void *val, size_t bytes) +static ssize_t nvm_read(void *priv, unsigned int offset, void *val, size_t bytes) { struct tb_nvm *nvm = priv; struct tb_retimer *rt = tb_to_retimer(nvm->dev); @@ -52,10 +52,10 @@ static int nvm_read(void *priv, unsigned int offset, void *val, size_t bytes) pm_runtime_mark_last_busy(&rt->dev); pm_runtime_put_autosuspend(&rt->dev); - return ret; + return ret < 0 ? ret : bytes; } -static int nvm_write(void *priv, unsigned int offset, void *val, size_t bytes) +static ssize_t nvm_write(void *priv, unsigned int offset, void *val, size_t bytes) { struct tb_nvm *nvm = priv; struct tb_retimer *rt = tb_to_retimer(nvm->dev); @@ -67,7 +67,7 @@ static int nvm_write(void *priv, unsigned int offset, void *val, size_t bytes) ret = tb_nvm_write_buf(nvm, offset, val, bytes); mutex_unlock(&rt->tb->lock); - return ret; + return ret < 0 ? ret : bytes; } static int tb_retimer_nvm_add(struct tb_retimer *rt) From patchwork Wed Jun 5 18:02:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687317 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 5040C15380C for ; Wed, 5 Jun 2024 18:03:11 +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=1717610592; cv=none; b=AXlKONFinaFp9dDT5UQvtcNspNGgVoRSOzpBftRNKygSkk2mTHtnJJELgKDy4vwaU+b+siJxjmdRhcz2qwP9XX6p5ZskQNtF+Z+D8yA66hmU2jq+XBp7axW6eB27mzS5lxoQ99GfoBieIZSgxtvk2YSJpPv2WvbV3/I8appEuLI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610592; c=relaxed/simple; bh=e26lRTuAGuJgmNX9Kn+IMmOklmBtw9bMfbnFAWkr9AI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=vFsBcjU90PAGWolMrfDHX7qNT9i7YPfFFPzm9ZunNfro4bwc1XLG+Uj6SANzd/ZtbTcX2T6+pgT/tb7DgBSr1ZAusCmjm0P2EQgDmHSXL4ihvQ7hmyVcbZ+x9av0wbpUGo/bXyY3MFkW/PK36AQIop7S8X3D/4jp0PZcqCjDGeY= 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=XH5mJeVg; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XH5mJeVg" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-627f382fb97so298307b3.3 for ; Wed, 05 Jun 2024 11:03:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610590; x=1718215390; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=LqJdwI0kfu08l8zta4NZb2Dhq8rse0Xjye+A2f9mH7A=; b=XH5mJeVgmcHl8j+yAfDOF16fwTYZtKejt7N1AtlCr+jCLGqcaGoPbC1Z1OtBWbLeqR qu79bjTNXUQMB96hPCihyWcQ7C6/Xdw+CBz8yYYRpPef1O1wHiiuWHHNBbDn6basncKb feIXaxtnwyQFOXnN4GFHve22CLjHAlNw4tytPP/A1BS6KFsL/yDzrPALUUPMTBYiZfhz /ryZI+W919gn4EVH3x641KfCaNVJQjgsw4/EZWvrftTVoVBJm8vaVE+cvQcDoqWXj/KX CClLti2T1o6M0md9Eq1LS/CykQoF/EIHK2zXiNh5MwW8WJgwpltYQmZp/slPCc7x/UQZ lGeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610590; x=1718215390; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LqJdwI0kfu08l8zta4NZb2Dhq8rse0Xjye+A2f9mH7A=; b=YorKknqKdECP4K1szKxaZjO6kYgJ2yxfEfIXFWY7JvbB1ua+mCEA6Fr5Z8C/zBrGfx tBlbabJPRyw8lIL32PiHmPRaMhl/xrhj1WTxkxcT/ocyufz4SAMxbMTJ1KRnta2FV9GS 0wYHD0jIJuUqfIPhHlzhC/j7Eb7VZmMWd6R4pg+K9ekJSTPrLqV5U5jLexxVxj33uA8V TQO2VLhlUstWZfNo2CSQoSCKMG9Hnwlh8Ju5T5P1mdY/33IDMw65mlyaTp9IC2iOmAS+ /iO7sN8QNH3hoidIBgv8UETrBfMHMZv+4i+9eSJWCiYYfQ1QLBPFZe8FtdFbV913RaI0 +GNg== X-Forwarded-Encrypted: i=1; AJvYcCV4K7QsaKWbu5xYZuKX6sMtplJg4WSewUe40TtScpsaDw5Tprcgoi4oY0nZTa+YutOASJy/XMf61FAD5oZmqb6fZ5Ra9hlXmOOY X-Gm-Message-State: AOJu0YxqLHzIyOfWVX116bKZgEXjPlMe17THFAPdG/qwyF/pRQzJ38qf DdAmFnKCMLfnHvDph8uEaO1IOeG/B9X6YT/c1zooKTVxw+fJR7HGCH213b79YRr5lfjXMZzERzA 6+cif7QSPlg== X-Google-Smtp-Source: AGHT+IFarMTHRQyaGAXOhvjvZC3Ev9S2zTS3Kvs5hpqZrMnxro2/BzrazXCSnRirdCi4qPaGa/c0QONTMKwCWA== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a25:d608:0:b0:df7:d31b:7a29 with SMTP id 3f1490d57ef6-dfacad1dc1amr763889276.12.1717610590398; Wed, 05 Jun 2024 11:03:10 -0700 (PDT) Date: Wed, 5 Jun 2024 18:02:37 +0000 In-Reply-To: <20240605180238.2617808-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605180238.2617808-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605180238.2617808-7-joychakr@google.com> Subject: [PATCH v1 16/17] soc: tegra: fuse: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/soc/tegra/fuse/fuse-tegra.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index b6bfd6729df3..1b067dd8a585 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -96,8 +96,8 @@ static const struct of_device_id tegra_fuse_match[] = { { /* sentinel */ } }; -static int tegra_fuse_read(void *priv, unsigned int offset, void *value, - size_t bytes) +static ssize_t tegra_fuse_read(void *priv, unsigned int offset, void *value, + size_t bytes) { unsigned int count = bytes / 4, i; struct tegra_fuse *fuse = priv; @@ -106,7 +106,7 @@ static int tegra_fuse_read(void *priv, unsigned int offset, void *value, for (i = 0; i < count; i++) buffer[i] = fuse->read(fuse, offset + i * 4); - return 0; + return bytes; } static void tegra_fuse_restore(void *base) From patchwork Wed Jun 5 18:02:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687318 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 43544154440 for ; Wed, 5 Jun 2024 18:03:16 +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=1717610600; cv=none; b=UZF1y2c0t3rORdEnt7eAaoG9W3to1STB73rTduEdCFv8b/hRgGJJpx5PgkbTiGKOBEHp9AopbjdqHC6fg2rWrIF3u0l7O/Z/E9cPYCgoPxu6b7ChMqIRt8Qzt2896TQJ5IMDuSCrHyMGiRk4R5LTtEMtjAwi81UtpG63iGCPy1o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610600; c=relaxed/simple; bh=BLTJ41wpBtcf3kU8nmI3BatBDrznlk9b0FbiRiKJMtE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=lB9JBQ2DNgVCamZhLcWGNQg1exwO+uwkfRM2zmEaQy8AqWjB/nWSYEZs3EsCwQuFPI9M89SvnaA+6P/IGQXqHgKgiPNn3UjWbWaKNCqaXvjwd130vGMKqXXS9Nzl6VpYI4LqoSo8VkL0B/rotO0/u54gqULryVA0Rc1+WSo5hlQ= 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=ZhJ47nUi; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZhJ47nUi" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-627f20cff42so607167b3.0 for ; Wed, 05 Jun 2024 11:03:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610595; x=1718215395; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=agXJIWYTnSYKDeBOgiAFCjfM9OsVVF8iSwjgRkAIvFU=; b=ZhJ47nUiJ/ssmM6QwE9pShQ2Vsjv+7SrpBFVnjcStOBIjLOPfTJrn7D1mbjg+MeeHX WYWoOTtWJac438VRzV7T3YasQeqJECRxZHbafSlZ67ql5MEyNKNa/PLCCvXhzCUGR91V GxzyHs2Pn0LexJ1YvtHurKoyPgjO5WlDtH37WYyIg5rh0NaN4YOm9AQ74FJC78H3v6ff skNDJsJCuKeVRtcQptq4ws34Ym93FQswaHfG+93BuqSjxC4yGsY7fgXkUyrPbUUWWyRC 0JxdwrlqyDoFqLE9ntZn+XPQhEOMP1yawZ9fAfdW5qG6lsr58cUtc5P6CReDIa3dS/Hs 6YTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610595; x=1718215395; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=agXJIWYTnSYKDeBOgiAFCjfM9OsVVF8iSwjgRkAIvFU=; b=G+WowgDMKN32yuy0TM1vA8NNLOpIS0lh8mgPGtlT97Ata/+k5vUBNn2rJRaSI9TREV 2Wv89RVQW/wTZLsDHmE4D9LyXAzDbhnuc3jUw6J2sdtyewcUwo5Pw6GWhP3D4dDj6OUL nFtMFE2ZM58bPQHh3wSGeN5r0OXn0Wi2aR18z1IKMztjJ0635oynz9Hgcs1RlFYI8S++ slwKbDaOJbhCFm7XnL9vq5VCaxz1NU/De8mZ4vQ6zlzo45DwUjfPuqFHoDprjMQIruMA xGtkEHjuF7ujBEyzEwtQp5TydT53xzsLLjxQS6oWjuIFFJ5KSJisMDaiXL3JR1JvFdEz wFfQ== X-Forwarded-Encrypted: i=1; AJvYcCUsyjaXR0m4MmcID0iuWz9qgJAMpqSWXUaulk+k2oyIzpMp3zLaPilZQJIk94VNUdVF5SDFZSLZtDILqhiROq6Ay7olQg8V75Vz X-Gm-Message-State: AOJu0YyDKtnjXlql69DidUQouac5e4EVD9I5YiLBYHS5+mU5BcrQCMCq 8SddQA+u5cUpmU5zIPd3f2e6hhIAWBuW255gGrOJITeD2TTLgJ50bEsjzGNspIQXGTbBrehysjo GPhQeEzCy8w== X-Google-Smtp-Source: AGHT+IGibORXxKbpFL3XsRdYQmgXN/UUhng7olRjU4TOyjRaG1lHR7Rr+GK+/ZroyCG11D91URPzRvzxS4UOFw== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:690c:388:b0:61b:e519:4d93 with SMTP id 00721157ae682-62cbb5b4538mr8976767b3.8.1717610595275; Wed, 05 Jun 2024 11:03:15 -0700 (PDT) Date: Wed, 5 Jun 2024 18:02:38 +0000 In-Reply-To: <20240605180238.2617808-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605180238.2617808-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605180238.2617808-8-joychakr@google.com> Subject: [PATCH v1 17/17] rtc: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty , kernel test robot Change nvmem read/write function definition return type to ssize_t, which is inturn used by devm_rtc_nvmem_register() Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202406050200.8BOdZUla-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202406050356.LGDJ3PPU-lkp@intel.com/ Signed-off-by: Joy Chakraborty --- drivers/rtc/rtc-abx80x.c | 15 ++++++++------- drivers/rtc/rtc-cmos.c | 8 ++++---- drivers/rtc/rtc-ds1305.c | 18 ++++++++++++------ drivers/rtc/rtc-ds1307.c | 22 +++++++++++++-------- drivers/rtc/rtc-ds1343.c | 18 ++++++++++++------ drivers/rtc/rtc-ds1511.c | 12 ++++++------ drivers/rtc/rtc-ds1553.c | 14 ++++++++------ drivers/rtc/rtc-ds1685.c | 14 ++++++++------ drivers/rtc/rtc-ds1742.c | 14 ++++++++------ drivers/rtc/rtc-ds3232.c | 22 +++++++++++++-------- drivers/rtc/rtc-isl12026.c | 12 ++++++------ drivers/rtc/rtc-isl1208.c | 8 ++++---- drivers/rtc/rtc-m48t59.c | 12 ++++++------ drivers/rtc/rtc-m48t86.c | 12 ++++++------ drivers/rtc/rtc-max31335.c | 18 ++++++++++++------ drivers/rtc/rtc-meson.c | 18 ++++++++++++------ drivers/rtc/rtc-omap.c | 12 ++++++------ drivers/rtc/rtc-pcf2127.c | 20 +++++++++++-------- drivers/rtc/rtc-pcf85063.c | 20 +++++++++++++------ drivers/rtc/rtc-pcf85363.c | 39 +++++++++++++++++++++++--------------- drivers/rtc/rtc-rp5c01.c | 14 ++++++++------ drivers/rtc/rtc-rv3028.c | 32 +++++++++++++++++++------------ drivers/rtc/rtc-rv3029c2.c | 20 +++++++++++++------ drivers/rtc/rtc-rv3032.c | 24 +++++++++++++++-------- drivers/rtc/rtc-rv8803.c | 16 ++++++++++------ drivers/rtc/rtc-rx8581.c | 39 +++++++++++++++++++++++--------------- drivers/rtc/rtc-stk17ta8.c | 14 ++++++++------ drivers/rtc/rtc-sun6i.c | 8 ++++---- drivers/rtc/rtc-ti-k3.c | 16 ++++++++++------ drivers/rtc/rtc-twl.c | 20 +++++++++++++------ 30 files changed, 324 insertions(+), 207 deletions(-) diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c index fde2b8054c2e..415a575c904b 100644 --- a/drivers/rtc/rtc-abx80x.c +++ b/drivers/rtc/rtc-abx80x.c @@ -685,10 +685,11 @@ static int abx80x_setup_watchdog(struct abx80x_priv *priv) } #endif -static int abx80x_nvmem_xfer(struct abx80x_priv *priv, unsigned int offset, - void *val, size_t bytes, bool write) +static ssize_t abx80x_nvmem_xfer(struct abx80x_priv *priv, unsigned int offset, + void *val, size_t bytes, bool write) { int ret; + size_t byte_count = bytes; while (bytes) { u8 extram, reg, len, lower, upper; @@ -719,17 +720,17 @@ static int abx80x_nvmem_xfer(struct abx80x_priv *priv, unsigned int offset, bytes -= len; } - return 0; + return byte_count; } -static int abx80x_nvmem_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t abx80x_nvmem_read(void *priv, unsigned int offset, void *val, + size_t bytes) { return abx80x_nvmem_xfer(priv, offset, val, bytes, false); } -static int abx80x_nvmem_write(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t abx80x_nvmem_write(void *priv, unsigned int offset, void *val, + size_t bytes) { return abx80x_nvmem_xfer(priv, offset, val, bytes, true); } diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 7d99cd2c37a0..eb8e6947a7e3 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -639,8 +639,8 @@ static const struct rtc_class_ops cmos_rtc_ops = { #define NVRAM_OFFSET (RTC_REG_D + 1) -static int cmos_nvram_read(void *priv, unsigned int off, void *val, - size_t count) +static ssize_t cmos_nvram_read(void *priv, unsigned int off, void *val, + size_t count) { unsigned char *buf = val; int retval; @@ -660,8 +660,8 @@ static int cmos_nvram_read(void *priv, unsigned int off, void *val, return retval; } -static int cmos_nvram_write(void *priv, unsigned int off, void *val, - size_t count) +static ssize_t cmos_nvram_write(void *priv, unsigned int off, void *val, + size_t count) { struct cmos_rtc *cmos = priv; unsigned char *buf = val; diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c index d4de401548b4..d59798c93dd8 100644 --- a/drivers/rtc/rtc-ds1305.c +++ b/drivers/rtc/rtc-ds1305.c @@ -504,34 +504,40 @@ static void msg_init(struct spi_message *m, struct spi_transfer *x, spi_message_add_tail(x, m); } -static int ds1305_nvram_read(void *priv, unsigned int off, void *buf, - size_t count) +static ssize_t ds1305_nvram_read(void *priv, unsigned int off, void *buf, + size_t count) { struct ds1305 *ds1305 = priv; struct spi_device *spi = ds1305->spi; u8 addr; struct spi_message m; struct spi_transfer x[2]; + int ret; addr = DS1305_NVRAM + off; msg_init(&m, x, &addr, count, NULL, buf); - return spi_sync(spi, &m); + ret = spi_sync(spi, &m); + + return ret < 0 ? ret : count; } -static int ds1305_nvram_write(void *priv, unsigned int off, void *buf, - size_t count) +static ssize_t ds1305_nvram_write(void *priv, unsigned int off, void *buf, + size_t count) { struct ds1305 *ds1305 = priv; struct spi_device *spi = ds1305->spi; u8 addr; struct spi_message m; struct spi_transfer x[2]; + int ret; addr = (DS1305_WRITE | DS1305_NVRAM) + off; msg_init(&m, x, &addr, count, buf, NULL); - return spi_sync(spi, &m); + ret = spi_sync(spi, &m); + + return ret < 0 ? ret : count; } /*----------------------------------------------------------------------*/ diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index 506b7d1c2397..179bb3b930d9 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c @@ -1254,24 +1254,30 @@ static int ds1307_add_frequency_test(struct ds1307 *ds1307) /*----------------------------------------------------------------------*/ -static int ds1307_nvram_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t ds1307_nvram_read(void *priv, unsigned int offset, void *val, + size_t bytes) { struct ds1307 *ds1307 = priv; const struct chip_desc *chip = &chips[ds1307->type]; + int ret; - return regmap_bulk_read(ds1307->regmap, chip->nvram_offset + offset, - val, bytes); + ret = regmap_bulk_read(ds1307->regmap, chip->nvram_offset + offset, + val, bytes); + + return ret < 0 ? ret : bytes; } -static int ds1307_nvram_write(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t ds1307_nvram_write(void *priv, unsigned int offset, void *val, + size_t bytes) { struct ds1307 *ds1307 = priv; const struct chip_desc *chip = &chips[ds1307->type]; + int ret; + + ret = regmap_bulk_write(ds1307->regmap, chip->nvram_offset + offset, + val, bytes); - return regmap_bulk_write(ds1307->regmap, chip->nvram_offset + offset, - val, bytes); + return ret < 0 ? ret : bytes; } /*----------------------------------------------------------------------*/ diff --git a/drivers/rtc/rtc-ds1343.c b/drivers/rtc/rtc-ds1343.c index ed5a6ba89a3e..910ee0a0320c 100644 --- a/drivers/rtc/rtc-ds1343.c +++ b/drivers/rtc/rtc-ds1343.c @@ -123,20 +123,26 @@ static ssize_t ds1343_store_glitchfilter(struct device *dev, static DEVICE_ATTR(glitch_filter, S_IRUGO | S_IWUSR, ds1343_show_glitchfilter, ds1343_store_glitchfilter); -static int ds1343_nvram_write(void *priv, unsigned int off, void *val, - size_t bytes) +static ssize_t ds1343_nvram_write(void *priv, unsigned int off, void *val, + size_t bytes) { struct ds1343_priv *ds1343 = priv; + int ret; - return regmap_bulk_write(ds1343->map, DS1343_NVRAM + off, val, bytes); + ret = regmap_bulk_write(ds1343->map, DS1343_NVRAM + off, val, bytes); + + return ret < 0 ? ret : bytes; } -static int ds1343_nvram_read(void *priv, unsigned int off, void *val, - size_t bytes) +static ssize_t ds1343_nvram_read(void *priv, unsigned int off, void *val, + size_t bytes) { struct ds1343_priv *ds1343 = priv; + int ret; + + ret = regmap_bulk_read(ds1343->map, DS1343_NVRAM + off, val, bytes); - return regmap_bulk_read(ds1343->map, DS1343_NVRAM + off, val, bytes); + return ret < 0 ? ret : bytes; } static ssize_t ds1343_show_tricklecharger(struct device *dev, diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c index 8b087d9556be..87128130e106 100644 --- a/drivers/rtc/rtc-ds1511.c +++ b/drivers/rtc/rtc-ds1511.c @@ -245,8 +245,8 @@ static const struct rtc_class_ops ds1511_rtc_ops = { .alarm_irq_enable = ds1511_rtc_alarm_irq_enable, }; -static int ds1511_nvram_read(void *priv, unsigned int pos, void *buf, - size_t size) +static ssize_t ds1511_nvram_read(void *priv, unsigned int pos, void *buf, + size_t size) { int i; @@ -254,11 +254,11 @@ static int ds1511_nvram_read(void *priv, unsigned int pos, void *buf, for (i = 0; i < size; i++) *(char *)buf++ = rtc_read(DS1511_RAMDATA); - return 0; + return size; } -static int ds1511_nvram_write(void *priv, unsigned int pos, void *buf, - size_t size) +static ssize_t ds1511_nvram_write(void *priv, unsigned int pos, void *buf, + size_t size) { int i; @@ -266,7 +266,7 @@ static int ds1511_nvram_write(void *priv, unsigned int pos, void *buf, for (i = 0; i < size; i++) rtc_write(*(char *)buf++, DS1511_RAMDATA); - return 0; + return size; } static int ds1511_rtc_probe(struct platform_device *pdev) diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c index dbff5b621ef5..ac4304ec21fa 100644 --- a/drivers/rtc/rtc-ds1553.c +++ b/drivers/rtc/rtc-ds1553.c @@ -221,30 +221,32 @@ static const struct rtc_class_ops ds1553_rtc_ops = { .alarm_irq_enable = ds1553_rtc_alarm_irq_enable, }; -static int ds1553_nvram_read(void *priv, unsigned int pos, void *val, - size_t bytes) +static ssize_t ds1553_nvram_read(void *priv, unsigned int pos, void *val, + size_t bytes) { struct platform_device *pdev = priv; struct rtc_plat_data *pdata = platform_get_drvdata(pdev); void __iomem *ioaddr = pdata->ioaddr; + size_t bytes_read = bytes; u8 *buf = val; for (; bytes; bytes--) *buf++ = readb(ioaddr + pos++); - return 0; + return bytes_read; } -static int ds1553_nvram_write(void *priv, unsigned int pos, void *val, - size_t bytes) +static ssize_t ds1553_nvram_write(void *priv, unsigned int pos, void *val, + size_t bytes) { struct platform_device *pdev = priv; struct rtc_plat_data *pdata = platform_get_drvdata(pdev); void __iomem *ioaddr = pdata->ioaddr; + size_t bytes_written = bytes; u8 *buf = val; for (; bytes; bytes--) writeb(*buf++, ioaddr + pos++); - return 0; + return bytes_written; } static int ds1553_rtc_probe(struct platform_device *pdev) diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c index 04dbf35cf3b7..0f113cff4b69 100644 --- a/drivers/rtc/rtc-ds1685.c +++ b/drivers/rtc/rtc-ds1685.c @@ -837,11 +837,12 @@ ds1685_rtc_ops = { }; /* ----------------------------------------------------------------------- */ -static int ds1685_nvram_read(void *priv, unsigned int pos, void *val, - size_t size) +static ssize_t ds1685_nvram_read(void *priv, unsigned int pos, void *val, + size_t size) { struct ds1685_priv *rtc = priv; struct mutex *rtc_mutex = &rtc->dev->ops_lock; + size_t size_read = size; ssize_t count; u8 *buf = val; int err; @@ -901,14 +902,15 @@ static int ds1685_nvram_read(void *priv, unsigned int pos, void *val, #endif /* !CONFIG_RTC_DRV_DS1689 */ mutex_unlock(rtc_mutex); - return 0; + return size_read; } -static int ds1685_nvram_write(void *priv, unsigned int pos, void *val, - size_t size) +static ssize_t ds1685_nvram_write(void *priv, unsigned int pos, void *val, + size_t size) { struct ds1685_priv *rtc = priv; struct mutex *rtc_mutex = &rtc->dev->ops_lock; + size_t size_written = size; ssize_t count; u8 *buf = val; int err; @@ -968,7 +970,7 @@ static int ds1685_nvram_write(void *priv, unsigned int pos, void *val, #endif /* !CONFIG_RTC_DRV_DS1689 */ mutex_unlock(rtc_mutex); - return 0; + return size_written; } /* ----------------------------------------------------------------------- */ diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c index 6ae8b9a294fe..cdc3159dd69a 100644 --- a/drivers/rtc/rtc-ds1742.c +++ b/drivers/rtc/rtc-ds1742.c @@ -114,28 +114,30 @@ static const struct rtc_class_ops ds1742_rtc_ops = { .set_time = ds1742_rtc_set_time, }; -static int ds1742_nvram_read(void *priv, unsigned int pos, void *val, - size_t bytes) +static ssize_t ds1742_nvram_read(void *priv, unsigned int pos, void *val, + size_t bytes) { struct rtc_plat_data *pdata = priv; void __iomem *ioaddr = pdata->ioaddr_nvram; + ssize_t bytes_read = bytes; u8 *buf = val; for (; bytes; bytes--) *buf++ = readb(ioaddr + pos++); - return 0; + return bytes_read; } -static int ds1742_nvram_write(void *priv, unsigned int pos, void *val, - size_t bytes) +static ssize_t ds1742_nvram_write(void *priv, unsigned int pos, void *val, + size_t bytes) { struct rtc_plat_data *pdata = priv; void __iomem *ioaddr = pdata->ioaddr_nvram; + ssize_t bytes_written = bytes; u8 *buf = val; for (; bytes; bytes--) writeb(*buf++, ioaddr + pos++); - return 0; + return bytes_written; } static int ds1742_rtc_probe(struct platform_device *pdev) diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c index 1485a6ae51e6..0ea97da761b6 100644 --- a/drivers/rtc/rtc-ds3232.c +++ b/drivers/rtc/rtc-ds3232.c @@ -460,22 +460,28 @@ static const struct rtc_class_ops ds3232_rtc_ops = { .alarm_irq_enable = ds3232_alarm_irq_enable, }; -static int ds3232_nvmem_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t ds3232_nvmem_read(void *priv, unsigned int offset, void *val, + size_t bytes) { struct regmap *ds3232_regmap = (struct regmap *)priv; + int ret; - return regmap_bulk_read(ds3232_regmap, DS3232_REG_SRAM_START + offset, - val, bytes); + ret = regmap_bulk_read(ds3232_regmap, DS3232_REG_SRAM_START + offset, + val, bytes); + + return ret < 0 ? ret : bytes; } -static int ds3232_nvmem_write(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t ds3232_nvmem_write(void *priv, unsigned int offset, void *val, + size_t bytes) { struct regmap *ds3232_regmap = (struct regmap *)priv; + int ret; + + ret = regmap_bulk_write(ds3232_regmap, DS3232_REG_SRAM_START + offset, + val, bytes); - return regmap_bulk_write(ds3232_regmap, DS3232_REG_SRAM_START + offset, - val, bytes); + return ret < 0 ? ret : bytes; } static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq, diff --git a/drivers/rtc/rtc-isl12026.c b/drivers/rtc/rtc-isl12026.c index 2aabb9151d4c..0368cf3c95cd 100644 --- a/drivers/rtc/rtc-isl12026.c +++ b/drivers/rtc/rtc-isl12026.c @@ -274,8 +274,8 @@ static const struct rtc_class_ops isl12026_rtc_ops = { .set_time = isl12026_rtc_set_time, }; -static int isl12026_nvm_read(void *p, unsigned int offset, - void *val, size_t bytes) +static ssize_t isl12026_nvm_read(void *p, unsigned int offset, + void *val, size_t bytes) { struct isl12026 *priv = p; int ret; @@ -315,11 +315,11 @@ static int isl12026_nvm_read(void *p, unsigned int offset, return ret < 0 ? ret : -EIO; } - return 0; + return bytes; } -static int isl12026_nvm_write(void *p, unsigned int offset, - void *val, size_t bytes) +static ssize_t isl12026_nvm_write(void *p, unsigned int offset, + void *val, size_t bytes) { struct isl12026 *priv = p; int ret; @@ -372,7 +372,7 @@ static int isl12026_nvm_write(void *p, unsigned int offset, mutex_unlock(&priv->rtc->ops_lock); - return ret; + return ret < 0 ? ret : num_written; } static void isl12026_force_power_modes(struct i2c_client *client) diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index e50c23ee1646..3523c18f4034 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c @@ -770,8 +770,8 @@ static const struct attribute_group isl1219_rtc_sysfs_files = { .attrs = isl1219_rtc_attrs, }; -static int isl1208_nvmem_read(void *priv, unsigned int off, void *buf, - size_t count) +static ssize_t isl1208_nvmem_read(void *priv, unsigned int off, void *buf, + size_t count) { struct isl1208_state *isl1208 = priv; struct i2c_client *client = to_i2c_client(isl1208->rtc->dev.parent); @@ -785,8 +785,8 @@ static int isl1208_nvmem_read(void *priv, unsigned int off, void *buf, return ret == 0 ? count : ret; } -static int isl1208_nvmem_write(void *priv, unsigned int off, void *buf, - size_t count) +static ssize_t isl1208_nvmem_write(void *priv, unsigned int off, void *buf, + size_t count) { struct isl1208_state *isl1208 = priv; struct i2c_client *client = to_i2c_client(isl1208->rtc->dev.parent); diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c index f0f6b9b6daec..53e21878effc 100644 --- a/drivers/rtc/rtc-m48t59.c +++ b/drivers/rtc/rtc-m48t59.c @@ -313,8 +313,8 @@ static const struct rtc_class_ops m48t59_rtc_ops = { .alarm_irq_enable = m48t59_rtc_alarm_irq_enable, }; -static int m48t59_nvram_read(void *priv, unsigned int offset, void *val, - size_t size) +static ssize_t m48t59_nvram_read(void *priv, unsigned int offset, void *val, + size_t size) { struct platform_device *pdev = priv; struct device *dev = &pdev->dev; @@ -331,11 +331,11 @@ static int m48t59_nvram_read(void *priv, unsigned int offset, void *val, spin_unlock_irqrestore(&m48t59->lock, flags); - return 0; + return cnt; } -static int m48t59_nvram_write(void *priv, unsigned int offset, void *val, - size_t size) +static ssize_t m48t59_nvram_write(void *priv, unsigned int offset, void *val, + size_t size) { struct platform_device *pdev = priv; struct device *dev = &pdev->dev; @@ -352,7 +352,7 @@ static int m48t59_nvram_write(void *priv, unsigned int offset, void *val, spin_unlock_irqrestore(&m48t59->lock, flags); - return 0; + return cnt; } static int m48t59_rtc_probe(struct platform_device *pdev) diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c index dd4a62e2d39c..c10829617d2e 100644 --- a/drivers/rtc/rtc-m48t86.c +++ b/drivers/rtc/rtc-m48t86.c @@ -161,8 +161,8 @@ static const struct rtc_class_ops m48t86_rtc_ops = { .proc = m48t86_rtc_proc, }; -static int m48t86_nvram_read(void *priv, unsigned int off, void *buf, - size_t count) +static ssize_t m48t86_nvram_read(void *priv, unsigned int off, void *buf, + size_t count) { struct device *dev = priv; unsigned int i; @@ -170,11 +170,11 @@ static int m48t86_nvram_read(void *priv, unsigned int off, void *buf, for (i = 0; i < count; i++) ((u8 *)buf)[i] = m48t86_readb(dev, M48T86_NVRAM(off + i)); - return 0; + return count; } -static int m48t86_nvram_write(void *priv, unsigned int off, void *buf, - size_t count) +static ssize_t m48t86_nvram_write(void *priv, unsigned int off, void *buf, + size_t count) { struct device *dev = priv; unsigned int i; @@ -182,7 +182,7 @@ static int m48t86_nvram_write(void *priv, unsigned int off, void *buf, for (i = 0; i < count; i++) m48t86_writeb(dev, ((u8 *)buf)[i], M48T86_NVRAM(off + i)); - return 0; + return count; } /* diff --git a/drivers/rtc/rtc-max31335.c b/drivers/rtc/rtc-max31335.c index a2441e5c2c74..03f29ed19e58 100644 --- a/drivers/rtc/rtc-max31335.c +++ b/drivers/rtc/rtc-max31335.c @@ -496,22 +496,28 @@ static struct clk_init_data max31335_clk_init = { .ops = &max31335_clkout_ops, }; -static int max31335_nvmem_reg_read(void *priv, unsigned int offset, - void *val, size_t bytes) +static ssize_t max31335_nvmem_reg_read(void *priv, unsigned int offset, + void *val, size_t bytes) { struct max31335_data *max31335 = priv; unsigned int reg = MAX31335_TS0_SEC_1_128 + offset; + int ret; + + ret = regmap_bulk_read(max31335->regmap, reg, val, bytes); - return regmap_bulk_read(max31335->regmap, reg, val, bytes); + return ret < 0 ? ret : bytes; } -static int max31335_nvmem_reg_write(void *priv, unsigned int offset, - void *val, size_t bytes) +static ssize_t max31335_nvmem_reg_write(void *priv, unsigned int offset, + void *val, size_t bytes) { struct max31335_data *max31335 = priv; unsigned int reg = MAX31335_TS0_SEC_1_128 + offset; + int ret; + + ret = regmap_bulk_write(max31335->regmap, reg, val, bytes); - return regmap_bulk_write(max31335->regmap, reg, val, bytes); + return ret < 0 ? ret : bytes; } static struct nvmem_config max31335_nvmem_cfg = { diff --git a/drivers/rtc/rtc-meson.c b/drivers/rtc/rtc-meson.c index db1d626edca5..0e4d05a4c68d 100644 --- a/drivers/rtc/rtc-meson.c +++ b/drivers/rtc/rtc-meson.c @@ -255,28 +255,34 @@ static const struct rtc_class_ops meson_rtc_ops = { /* NVMEM interface layer functions */ -static int meson_rtc_regmem_read(void *context, unsigned int offset, - void *buf, size_t bytes) +static ssize_t meson_rtc_regmem_read(void *context, unsigned int offset, + void *buf, size_t bytes) { struct meson_rtc *rtc = context; unsigned int read_offset, read_size; + int ret; read_offset = RTC_REGMEM_0 + (offset / 4); read_size = bytes / 4; - return regmap_bulk_read(rtc->serial, read_offset, buf, read_size); + ret = regmap_bulk_read(rtc->serial, read_offset, buf, read_size); + + return ret < 0 ? ret : bytes; } -static int meson_rtc_regmem_write(void *context, unsigned int offset, - void *buf, size_t bytes) +static ssize_t meson_rtc_regmem_write(void *context, unsigned int offset, + void *buf, size_t bytes) { struct meson_rtc *rtc = context; unsigned int write_offset, write_size; + int ret; write_offset = RTC_REGMEM_0 + (offset / 4); write_size = bytes / 4; - return regmap_bulk_write(rtc->serial, write_offset, buf, write_size); + ret = regmap_bulk_write(rtc->serial, write_offset, buf, write_size); + + return ret < 0 ? ret : bytes; } static int meson_rtc_probe(struct platform_device *pdev) diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index c6155c48a4ac..81cad3c3690b 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c @@ -685,8 +685,8 @@ static struct pinctrl_desc rtc_pinctrl_desc = { .owner = THIS_MODULE, }; -static int omap_rtc_scratch_read(void *priv, unsigned int offset, void *_val, - size_t bytes) +static ssize_t omap_rtc_scratch_read(void *priv, unsigned int offset, void *_val, + size_t bytes) { struct omap_rtc *rtc = priv; u32 *val = _val; @@ -696,11 +696,11 @@ static int omap_rtc_scratch_read(void *priv, unsigned int offset, void *_val, val[i] = rtc_readl(rtc, OMAP_RTC_SCRATCH0_REG + offset + (i * 4)); - return 0; + return bytes; } -static int omap_rtc_scratch_write(void *priv, unsigned int offset, void *_val, - size_t bytes) +static ssize_t omap_rtc_scratch_write(void *priv, unsigned int offset, void *_val, + size_t bytes) { struct omap_rtc *rtc = priv; u32 *val = _val; @@ -712,7 +712,7 @@ static int omap_rtc_scratch_write(void *priv, unsigned int offset, void *_val, OMAP_RTC_SCRATCH0_REG + offset + (i * 4), val[i]); rtc->type->lock(rtc); - return 0; + return bytes; } static struct nvmem_config omap_rtc_nvmem_config = { diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c index 9c04c4e1a49c..0303cf51fb3e 100644 --- a/drivers/rtc/rtc-pcf2127.c +++ b/drivers/rtc/rtc-pcf2127.c @@ -361,8 +361,8 @@ static int pcf2127_rtc_ioctl(struct device *dev, } } -static int pcf2127_nvmem_read(void *priv, unsigned int offset, - void *val, size_t bytes) +static ssize_t pcf2127_nvmem_read(void *priv, unsigned int offset, + void *val, size_t bytes) { struct pcf2127 *pcf2127 = priv; int ret; @@ -373,12 +373,14 @@ static int pcf2127_nvmem_read(void *priv, unsigned int offset, if (ret) return ret; - return regmap_bulk_read(pcf2127->regmap, PCF2127_REG_RAM_RD_CMD, - val, bytes); + ret = regmap_bulk_read(pcf2127->regmap, PCF2127_REG_RAM_RD_CMD, + val, bytes); + + return ret < 0 ? ret : bytes; } -static int pcf2127_nvmem_write(void *priv, unsigned int offset, - void *val, size_t bytes) +static ssize_t pcf2127_nvmem_write(void *priv, unsigned int offset, + void *val, size_t bytes) { struct pcf2127 *pcf2127 = priv; int ret; @@ -389,8 +391,10 @@ static int pcf2127_nvmem_write(void *priv, unsigned int offset, if (ret) return ret; - return regmap_bulk_write(pcf2127->regmap, PCF2127_REG_RAM_WRT_CMD, - val, bytes); + ret = regmap_bulk_write(pcf2127->regmap, PCF2127_REG_RAM_WRT_CMD, + val, bytes); + + return ret < 0 ? ret : bytes; } /* watchdog driver */ diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c index fdbc07f14036..bccb55b4985c 100644 --- a/drivers/rtc/rtc-pcf85063.c +++ b/drivers/rtc/rtc-pcf85063.c @@ -319,16 +319,24 @@ static const struct rtc_class_ops pcf85063_rtc_ops = { .ioctl = pcf85063_ioctl, }; -static int pcf85063_nvmem_read(void *priv, unsigned int offset, - void *val, size_t bytes) +static ssize_t pcf85063_nvmem_read(void *priv, unsigned int offset, + void *val, size_t bytes) { - return regmap_read(priv, PCF85063_REG_RAM, val); + int ret; + + ret = regmap_read(priv, PCF85063_REG_RAM, val); + + return ret < 0 ? ret : bytes; } -static int pcf85063_nvmem_write(void *priv, unsigned int offset, - void *val, size_t bytes) +static ssize_t pcf85063_nvmem_write(void *priv, unsigned int offset, + void *val, size_t bytes) { - return regmap_write(priv, PCF85063_REG_RAM, *(u8 *)val); + int ret; + + ret = regmap_write(priv, PCF85063_REG_RAM, *(u8 *)val); + + return ret < 0 ? ret : bytes; } static int pcf85063_load_capacitance(struct pcf85063 *pcf85063, diff --git a/drivers/rtc/rtc-pcf85363.c b/drivers/rtc/rtc-pcf85363.c index 540042b9eec8..3ad91f2ee417 100644 --- a/drivers/rtc/rtc-pcf85363.c +++ b/drivers/rtc/rtc-pcf85363.c @@ -319,26 +319,32 @@ static const struct rtc_class_ops rtc_ops = { .alarm_irq_enable = pcf85363_rtc_alarm_irq_enable, }; -static int pcf85363_nvram_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t pcf85363_nvram_read(void *priv, unsigned int offset, void *val, + size_t bytes) { struct pcf85363 *pcf85363 = priv; + int ret; - return regmap_bulk_read(pcf85363->regmap, CTRL_RAM + offset, - val, bytes); + ret = regmap_bulk_read(pcf85363->regmap, CTRL_RAM + offset, + val, bytes); + + return ret < 0 ? ret : bytes; } -static int pcf85363_nvram_write(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t pcf85363_nvram_write(void *priv, unsigned int offset, void *val, + size_t bytes) { struct pcf85363 *pcf85363 = priv; + int ret; - return regmap_bulk_write(pcf85363->regmap, CTRL_RAM + offset, - val, bytes); + ret = regmap_bulk_write(pcf85363->regmap, CTRL_RAM + offset, + val, bytes); + + return ret < 0 ? ret : bytes; } -static int pcf85x63_nvram_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t pcf85x63_nvram_read(void *priv, unsigned int offset, void *val, + size_t bytes) { struct pcf85363 *pcf85363 = priv; unsigned int tmp_val; @@ -347,18 +353,21 @@ static int pcf85x63_nvram_read(void *priv, unsigned int offset, void *val, ret = regmap_read(pcf85363->regmap, CTRL_RAMBYTE, &tmp_val); (*(unsigned char *) val) = (unsigned char) tmp_val; - return ret; + return ret < 0 ? ret : bytes; } -static int pcf85x63_nvram_write(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t pcf85x63_nvram_write(void *priv, unsigned int offset, void *val, + size_t bytes) { struct pcf85363 *pcf85363 = priv; unsigned char tmp_val; + int ret; tmp_val = *((unsigned char *)val); - return regmap_write(pcf85363->regmap, CTRL_RAMBYTE, - (unsigned int)tmp_val); + ret = regmap_write(pcf85363->regmap, CTRL_RAMBYTE, + (unsigned int)tmp_val); + + return ret < 0 ? ret : bytes; } static const struct pcf85x63_config pcf_85263_config = { diff --git a/drivers/rtc/rtc-rp5c01.c b/drivers/rtc/rtc-rp5c01.c index 44afa6d996e7..156f9086caab 100644 --- a/drivers/rtc/rtc-rp5c01.c +++ b/drivers/rtc/rtc-rp5c01.c @@ -160,10 +160,11 @@ static const struct rtc_class_ops rp5c01_rtc_ops = { * byte is stored in BLOCK10, the low nibble in BLOCK11. */ -static int rp5c01_nvram_read(void *_priv, unsigned int pos, void *val, - size_t bytes) +static ssize_t rp5c01_nvram_read(void *_priv, unsigned int pos, void *val, + size_t bytes) { struct rp5c01_priv *priv = _priv; + size_t bytes_read = bytes; u8 *buf = val; spin_lock_irq(&priv->lock); @@ -185,13 +186,14 @@ static int rp5c01_nvram_read(void *_priv, unsigned int pos, void *val, } spin_unlock_irq(&priv->lock); - return 0; + return bytes_read; } -static int rp5c01_nvram_write(void *_priv, unsigned int pos, void *val, - size_t bytes) +static ssize_t rp5c01_nvram_write(void *_priv, unsigned int pos, void *val, + size_t bytes) { struct rp5c01_priv *priv = _priv; + size_t bytes_written = bytes; u8 *buf = val; spin_lock_irq(&priv->lock); @@ -212,7 +214,7 @@ static int rp5c01_nvram_write(void *_priv, unsigned int pos, void *val, } spin_unlock_irq(&priv->lock); - return 0; + return bytes_written; } static int __init rp5c01_rtc_probe(struct platform_device *dev) diff --git a/drivers/rtc/rtc-rv3028.c b/drivers/rtc/rtc-rv3028.c index 2f001c59c61d..3e2c6497f4d7 100644 --- a/drivers/rtc/rtc-rv3028.c +++ b/drivers/rtc/rtc-rv3028.c @@ -600,20 +600,28 @@ static int rv3028_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) } } -static int rv3028_nvram_write(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t rv3028_nvram_write(void *priv, unsigned int offset, void *val, + size_t bytes) { - return regmap_bulk_write(priv, RV3028_RAM1 + offset, val, bytes); + int ret; + + ret = regmap_bulk_write(priv, RV3028_RAM1 + offset, val, bytes); + + return ret < 0 ? ret : bytes; } -static int rv3028_nvram_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t rv3028_nvram_read(void *priv, unsigned int offset, void *val, + size_t bytes) { - return regmap_bulk_read(priv, RV3028_RAM1 + offset, val, bytes); + int ret; + + ret = regmap_bulk_read(priv, RV3028_RAM1 + offset, val, bytes); + + return ret < 0 ? ret : bytes; } -static int rv3028_eeprom_write(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t rv3028_eeprom_write(void *priv, unsigned int offset, void *val, + size_t bytes) { struct rv3028_data *rv3028 = priv; u32 status, eerd; @@ -655,11 +663,11 @@ static int rv3028_eeprom_write(void *priv, unsigned int offset, void *val, restore_eerd: rv3028_exit_eerd(rv3028, eerd); - return ret; + return ret < 0 ? ret : bytes; } -static int rv3028_eeprom_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t rv3028_eeprom_read(void *priv, unsigned int offset, void *val, + size_t bytes) { struct rv3028_data *rv3028 = priv; u32 status, eerd, data; @@ -700,7 +708,7 @@ static int rv3028_eeprom_read(void *priv, unsigned int offset, void *val, restore_eerd: rv3028_exit_eerd(rv3028, eerd); - return ret; + return ret < 0 ? ret : bytes; } #ifdef CONFIG_COMMON_CLK diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c index 4a81feeb00ff..63466d76eaa1 100644 --- a/drivers/rtc/rtc-rv3029c2.c +++ b/drivers/rtc/rtc-rv3029c2.c @@ -472,16 +472,24 @@ static int rv3029_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) } } -static int rv3029_nvram_write(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t rv3029_nvram_write(void *priv, unsigned int offset, void *val, + size_t bytes) { - return regmap_bulk_write(priv, RV3029_RAM_PAGE + offset, val, bytes); + int ret; + + ret = regmap_bulk_write(priv, RV3029_RAM_PAGE + offset, val, bytes); + + return ret < 0 ? ret : bytes; } -static int rv3029_nvram_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t rv3029_nvram_read(void *priv, unsigned int offset, void *val, + size_t bytes) { - return regmap_bulk_read(priv, RV3029_RAM_PAGE + offset, val, bytes); + int ret; + + ret = regmap_bulk_read(priv, RV3029_RAM_PAGE + offset, val, bytes); + + return ret < 0 ? ret : bytes; } static const struct rv3029_trickle_tab_elem { diff --git a/drivers/rtc/rtc-rv3032.c b/drivers/rtc/rtc-rv3032.c index 35b2e36b426a..179ea03725c1 100644 --- a/drivers/rtc/rtc-rv3032.c +++ b/drivers/rtc/rtc-rv3032.c @@ -484,17 +484,25 @@ static int rv3032_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) } } -static int rv3032_nvram_write(void *priv, unsigned int offset, void *val, size_t bytes) +static ssize_t rv3032_nvram_write(void *priv, unsigned int offset, void *val, size_t bytes) { - return regmap_bulk_write(priv, RV3032_RAM1 + offset, val, bytes); + int ret; + + ret = regmap_bulk_write(priv, RV3032_RAM1 + offset, val, bytes); + + return ret < 0 ? ret : bytes; } -static int rv3032_nvram_read(void *priv, unsigned int offset, void *val, size_t bytes) +static ssize_t rv3032_nvram_read(void *priv, unsigned int offset, void *val, size_t bytes) { - return regmap_bulk_read(priv, RV3032_RAM1 + offset, val, bytes); + int ret; + + ret = regmap_bulk_read(priv, RV3032_RAM1 + offset, val, bytes); + + return ret < 0 ? ret : bytes; } -static int rv3032_eeprom_write(void *priv, unsigned int offset, void *val, size_t bytes) +static ssize_t rv3032_eeprom_write(void *priv, unsigned int offset, void *val, size_t bytes) { struct rv3032_data *rv3032 = priv; u32 status, eerd; @@ -532,10 +540,10 @@ static int rv3032_eeprom_write(void *priv, unsigned int offset, void *val, size_ exit_eerd: rv3032_exit_eerd(rv3032, eerd); - return ret; + return ret < 0 ? ret : bytes; } -static int rv3032_eeprom_read(void *priv, unsigned int offset, void *val, size_t bytes) +static ssize_t rv3032_eeprom_read(void *priv, unsigned int offset, void *val, size_t bytes) { struct rv3032_data *rv3032 = priv; u32 status, eerd, data; @@ -572,7 +580,7 @@ static int rv3032_eeprom_read(void *priv, unsigned int offset, void *val, size_t exit_eerd: rv3032_exit_eerd(rv3032, eerd); - return ret; + return ret < 0 ? ret : bytes; } static int rv3032_trickle_charger_setup(struct device *dev, struct rv3032_data *rv3032) diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c index 1327251e527c..a6b02b78b0e6 100644 --- a/drivers/rtc/rtc-rv8803.c +++ b/drivers/rtc/rtc-rv8803.c @@ -536,14 +536,18 @@ static int rv8803_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) } } -static int rv8803_nvram_write(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t rv8803_nvram_write(void *priv, unsigned int offset, void *val, + size_t bytes) { - return rv8803_write_reg(priv, RV8803_RAM, *(u8 *)val); + int ret; + + ret = rv8803_write_reg(priv, RV8803_RAM, *(u8 *)val); + + return ret < 0 ? ret : bytes; } -static int rv8803_nvram_read(void *priv, unsigned int offset, - void *val, size_t bytes) +static ssize_t rv8803_nvram_read(void *priv, unsigned int offset, + void *val, size_t bytes) { int ret; @@ -553,7 +557,7 @@ static int rv8803_nvram_read(void *priv, unsigned int offset, *(u8 *)val = ret; - return 0; + return ret < 0 ? ret : bytes; } static const struct rtc_class_ops rv8803_rtc_ops = { diff --git a/drivers/rtc/rtc-rx8581.c b/drivers/rtc/rtc-rx8581.c index 48efd61a114d..e0d49c2861f2 100644 --- a/drivers/rtc/rtc-rx8581.c +++ b/drivers/rtc/rtc-rx8581.c @@ -187,26 +187,32 @@ static const struct rtc_class_ops rx8581_rtc_ops = { .set_time = rx8581_rtc_set_time, }; -static int rx8571_nvram_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t rx8571_nvram_read(void *priv, unsigned int offset, void *val, + size_t bytes) { struct rx8581 *rx8581 = priv; + int ret; - return regmap_bulk_read(rx8581->regmap, RX8571_USER_RAM + offset, - val, bytes); + ret = regmap_bulk_read(rx8581->regmap, RX8571_USER_RAM + offset, + val, bytes); + + return ret < 0 ? ret : bytes; } -static int rx8571_nvram_write(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t rx8571_nvram_write(void *priv, unsigned int offset, void *val, + size_t bytes) { struct rx8581 *rx8581 = priv; + int ret; - return regmap_bulk_write(rx8581->regmap, RX8571_USER_RAM + offset, - val, bytes); + ret = regmap_bulk_write(rx8581->regmap, RX8571_USER_RAM + offset, + val, bytes); + + return ret < 0 ? ret : bytes; } -static int rx85x1_nvram_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t rx85x1_nvram_read(void *priv, unsigned int offset, void *val, + size_t bytes) { struct rx8581 *rx8581 = priv; unsigned int tmp_val; @@ -215,18 +221,21 @@ static int rx85x1_nvram_read(void *priv, unsigned int offset, void *val, ret = regmap_read(rx8581->regmap, RX8581_REG_RAM, &tmp_val); (*(unsigned char *)val) = (unsigned char) tmp_val; - return ret; + return ret < 0 ? ret : bytes; } -static int rx85x1_nvram_write(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t rx85x1_nvram_write(void *priv, unsigned int offset, void *val, + size_t bytes) { struct rx8581 *rx8581 = priv; unsigned char tmp_val; + int ret; tmp_val = *((unsigned char *)val); - return regmap_write(rx8581->regmap, RX8581_REG_RAM, - (unsigned int)tmp_val); + ret = regmap_write(rx8581->regmap, RX8581_REG_RAM, + (unsigned int)tmp_val); + + return ret < 0 ? ret : bytes; } static const struct rx85x1_config rx8581_config = { diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c index 7cb6be1b7815..85d811b68a9b 100644 --- a/drivers/rtc/rtc-stk17ta8.c +++ b/drivers/rtc/rtc-stk17ta8.c @@ -230,28 +230,30 @@ static const struct rtc_class_ops stk17ta8_rtc_ops = { .alarm_irq_enable = stk17ta8_rtc_alarm_irq_enable, }; -static int stk17ta8_nvram_read(void *priv, unsigned int pos, void *val, - size_t bytes) +static ssize_t stk17ta8_nvram_read(void *priv, unsigned int pos, void *val, + size_t bytes) { struct rtc_plat_data *pdata = priv; void __iomem *ioaddr = pdata->ioaddr; + size_t bytes_read = bytes; u8 *buf = val; for (; bytes; bytes--) *buf++ = readb(ioaddr + pos++); - return 0; + return bytes_read; } -static int stk17ta8_nvram_write(void *priv, unsigned int pos, void *val, - size_t bytes) +static ssize_t stk17ta8_nvram_write(void *priv, unsigned int pos, void *val, + size_t bytes) { struct rtc_plat_data *pdata = priv; void __iomem *ioaddr = pdata->ioaddr; + size_t bytes_written = bytes; u8 *buf = val; for (; bytes; bytes--) writeb(*buf++, ioaddr + pos++); - return 0; + return bytes_written; } static int stk17ta8_rtc_probe(struct platform_device *pdev) diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index 8e0c66906103..62fda0f86364 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -675,7 +675,7 @@ static const struct rtc_class_ops sun6i_rtc_ops = { .alarm_irq_enable = sun6i_rtc_alarm_irq_enable }; -static int sun6i_rtc_nvmem_read(void *priv, unsigned int offset, void *_val, size_t bytes) +static ssize_t sun6i_rtc_nvmem_read(void *priv, unsigned int offset, void *_val, size_t bytes) { struct sun6i_rtc_dev *chip = priv; u32 *val = _val; @@ -684,10 +684,10 @@ static int sun6i_rtc_nvmem_read(void *priv, unsigned int offset, void *_val, siz for (i = 0; i < bytes / 4; ++i) val[i] = readl(chip->base + SUN6I_GP_DATA + offset + 4 * i); - return 0; + return bytes; } -static int sun6i_rtc_nvmem_write(void *priv, unsigned int offset, void *_val, size_t bytes) +static ssize_t sun6i_rtc_nvmem_write(void *priv, unsigned int offset, void *_val, size_t bytes) { struct sun6i_rtc_dev *chip = priv; u32 *val = _val; @@ -696,7 +696,7 @@ static int sun6i_rtc_nvmem_write(void *priv, unsigned int offset, void *_val, si for (i = 0; i < bytes / 4; ++i) writel(val[i], chip->base + SUN6I_GP_DATA + offset + 4 * i); - return 0; + return bytes; } static struct nvmem_config sun6i_rtc_nvmem_cfg = { diff --git a/drivers/rtc/rtc-ti-k3.c b/drivers/rtc/rtc-ti-k3.c index ec759d8f7023..9a1097fcdad6 100644 --- a/drivers/rtc/rtc-ti-k3.c +++ b/drivers/rtc/rtc-ti-k3.c @@ -483,16 +483,19 @@ static const struct rtc_class_ops ti_k3_rtc_ops = { .alarm_irq_enable = ti_k3_rtc_alarm_irq_enable, }; -static int ti_k3_rtc_scratch_read(void *priv_data, unsigned int offset, - void *val, size_t bytes) +static ssize_t ti_k3_rtc_scratch_read(void *priv_data, unsigned int offset, + void *val, size_t bytes) { struct ti_k3_rtc *priv = (struct ti_k3_rtc *)priv_data; + int ret; + + ret = regmap_bulk_read(priv->regmap, REG_K3RTC_SCRATCH0 + offset, val, bytes / 4); - return regmap_bulk_read(priv->regmap, REG_K3RTC_SCRATCH0 + offset, val, bytes / 4); + return ret < 0 ? ret : bytes; } -static int ti_k3_rtc_scratch_write(void *priv_data, unsigned int offset, - void *val, size_t bytes) +static ssize_t ti_k3_rtc_scratch_write(void *priv_data, unsigned int offset, + void *val, size_t bytes) { struct ti_k3_rtc *priv = (struct ti_k3_rtc *)priv_data; int ret; @@ -501,7 +504,8 @@ static int ti_k3_rtc_scratch_write(void *priv_data, unsigned int offset, if (ret) return ret; - return k3rtc_fence(priv); + ret = k3rtc_fence(priv); + return ret < 0 ? ret : bytes; } static struct nvmem_config ti_k3_rtc_nvmem_config = { diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 13f8ce08243c..b770a5cc1aad 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c @@ -487,16 +487,24 @@ static const struct rtc_class_ops twl_rtc_ops = { .alarm_irq_enable = twl_rtc_alarm_irq_enable, }; -static int twl_nvram_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t twl_nvram_read(void *priv, unsigned int offset, void *val, + size_t bytes) { - return twl_i2c_read((long)priv, val, offset, bytes); + int ret; + + ret = twl_i2c_read((long)priv, val, offset, bytes); + + return ret < 0 ? ret : bytes; } -static int twl_nvram_write(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t twl_nvram_write(void *priv, unsigned int offset, void *val, + size_t bytes) { - return twl_i2c_write((long)priv, val, offset, bytes); + int ret; + + ret = twl_i2c_write((long)priv, val, offset, bytes); + + return ret < 0 ? ret : bytes; } /*----------------------------------------------------------------------*/