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: 801822 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 57E4B13D62E for ; Wed, 5 Jun 2024 18:00:10 +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=1717610413; cv=none; b=ZkBcDjBHW+BgpIHoP9fGSfh84scHve8UG+SQT5duPzmHF6hYXvEDJ903rmoJOapiknT9TDehk1b2bTXpnO2gptozmqOmpS49mmlgWcuIOOqRjVTEP1Fe0JwRh8eS2Pj1YCo1jpUSPx/ta6gNn+fEUZHV9xM7ijdErr1PAUkHcSM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610413; c=relaxed/simple; bh=8DJQonJqq5Z4yQRN/sDPNHSxx9pC4pBa8VVN/l35RYU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=uNxNt6YYV/beYB2nqXk2sS5Re9tuNjZ2h1k7S17Lnmp0HvSdJkmQwtu1IQf1RH3sV013EBMS92YUeu/yw+lnwD9QcB49hH6XtmOKKtO4VQmvSQUPbSarodIbrSnRxuMw37TlOluXQ9fJwtfEbmqnHdkYqIoSoWun+fnIiK5GDHI= 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.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="pfblUWIw" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-62a08436241so312877b3.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=VXZCFCTJX0QedZOQfYcnnhcMVI8iQbnM5O6PUOy0sxonl7dZFtpR+jlLpdXJk9Tel0 EA6iL9rCWmpiC91zVRlBcVnI7MIMuUqhcHAak63vid+YBZf2Hw0Y1FnFsyRevPIasUL7 Z5VcLMn9QPnoFxLLPlN+/qAYc5R3oihCmYhAYqvzeS/x6f30t4V7Da8V8WeGtGMmvtJi UsfPvpf3UG1RlWl5RoyU6O7CF46mTM5yl1I5jP8kih+7t3wm8FUThUevoBSonuDGRKVA eVxavkxemvzfyXs9V7VV1YVavxykcYbnUgGkhju3jJHx9RFGSy/e6NE7hbMBipaUKAZu gBDw== X-Forwarded-Encrypted: i=1; AJvYcCWB6N4zJISHGjr8bzGfAkTpGkzhQ4SoplKzbiYX6aeu8K+GcBWI9iyAoxtQRXvl+qoA6/cbvgt3XZ1NAPtZBMR943kt992orln2 X-Gm-Message-State: AOJu0YyZWi+J4YGW5QkgjIDn4oY+h+zIURDaX7nru+HY7RTwxqXBUDY9 yw9HhuEXd8/rNmxvMuuVjHd3xK/M7vebIDbzhNIS0Yzjo5rt7UqCFkoDSU7iXgmkdXQSnnMRybc aYwO54cChxw== 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-i2c@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: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: 801821 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 C57F315F407 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=1717610421; cv=none; b=OVsKkbAxD8p1DQlyV6FR52g9SrThhOhA+rBuQ9op0xLkjFidI1fvcdKbCgbvOpagufdsZfT7wv0m1wJtN7OUG0d34B0V7OFP74EHr+EEikQM+9HdHnXYpp8mlC92NiuDMOEzs5IzHl7ydgssqAK1zJM0GtIyNNe7b1y3EMdu+ig= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610421; c=relaxed/simple; bh=DtpDZyHe3eugG9lKYAyC1ondYmKEiXhRbdfT84tszLE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=rUQlNx2v2HsY6NnkOeMRuWz6PMQuqLkka2w9WKrkRBR2HBqcdh7ICFEBgAFORE9TZy7H89VD4rgbJ/5Cusx5fAH2c3aGXX3wFl13WNcCEs65mpo5A2RpcZmw+4zWIk0VWCcO718XIwVT+AxeJBblAZTZTYP4h5e/064FKQYyFAw= 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-df7a6530373so128330276.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=F3u+SYY5fAgAtWeKlO576U1/V2/m7poRyHPfAWBCAQm8IMUV90AGe72zLyjB+xq0aP YHGNS6vxfnNwoSZrStK7wKvE+SPkkUegTWE1xmcYLjOOGqC9Wy6DDlg+PJKTPqBAWOeO raISNSzyqIGFbezSKvfaidQ0tL1i1ZCYxkCYWomm06xfc60Xc662L45LWov5NlTEMRbo XFEPa8l1Dg/JxUxVd2NW/mb4KsaDmHklpcRjwt5a702woxM25/mSl6erzvdX48O7pRRd xpytKDJE0p+gRYgZR9rVeLs9BBRkmKN4be7t5Y+niBS0ubNiEd8O6LTQjnNgMDbgrP9v gSQw== X-Forwarded-Encrypted: i=1; AJvYcCW2DQp0A27frqlqXLIuEQlINnAByzY+RBdWF6hek5kUjeud80D5D1g8ojXg3uUazIqS88JNO0jSBa8eP4GJC1iviD364LzgKY/w X-Gm-Message-State: AOJu0YwL1A5M0knaJADv8bEVkYbg4EsIjwnp604ZW5DfnifqEtb6y3MV oV5THn8r2cmkCExBdyP+pgnbCDU9ib9ymHrCx5W8zLNxQpf0LwIiljeMBvsMR0Dm3zxDIHZ4UsD 0ltdbtdeG1g== 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-i2c@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: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: 801820 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 70C6C19598E for ; Wed, 5 Jun 2024 18:00:27 +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=1717610429; cv=none; b=OjdpVaV3XWDlN0fhLHNz3ISUkLEKH8KJQmnUijz/bqH9+U0ZS13cnrEGxTgz8QqOw9jf7PA7k97tSKuQzs0gk0hB8RSPp0lOSJMGM8rI4PyY5i77grYGdYw6e3jUBuGtabdDsV2X/XSSGDQdoO1OcnxGuDy22dMTziReWBb8rlQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610429; c=relaxed/simple; bh=7s5ualCvDc0GEz4419Gj42eDU6iSkCy4DM1JO8Cp5kE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=jWCmCwUDkhczltxNvHBb2DeKZ/YdtWamGJitVPZyhWw0WTvOuQTsn1yuUKNzQmEJr1by9i6Op9sdXbu2pmkYe33D9gKUvlTqzkcK7GY53qMkummcp7qdIo5/YOkwl12wPFucPM5Pm9POI9O+8/X0HjShYoIzDXYNYiL8MXL8mhw= 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.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="yW9iJgkc" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-62a1e9807c0so741927b3.0 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=aI+wzqHENJXDN3hzjjl5f6pB9TGnnzOgA2uhgnH93jP9K8hlyIp2h6TSS2oWCF4OxY NDrNDFc6dys19+jyv+8Zcd/Wl9QtkYUJv0zRpb8Pe3ate4T0ujwL/dJw7jBaO44jgm6Z 8xZq7XxwMlsCTOplbSq2jXhuBpO8Q5237/likr96JPfaASuvbpsWkcRku4vAMdIvaprH R2d1xv/L7k1F352PLrUlhlZMZe7Mq+Fu66pHYyb3Yn0D1+JqpEX4SUBtK4XLc1pLpacr f27sA+lXnEP+t2AgNnJTg9aEIeLhVhEhtYgD+H0mGzrhltMz7DDhTGVoksezydBeDFX9 494Q== X-Forwarded-Encrypted: i=1; AJvYcCVqMuRd+r2q5uon6IAMpCuxseGiybQe2eZ5GNhgctbgZNqLPEXPdFaXI/pRko+bCcFa2NJmrjioz9M8amYBiUbM2L+Uz+QdPOPR X-Gm-Message-State: AOJu0Ywh+ucqi9qGoHiinv53wUW5201/YYo/V3biC6F8A7vdPLkMzNJP LlQRnW4jRM6JQzLIhPPnfUyS7RUoJ4TauTzIGEHgowXloy4KlOHbjhx3ym3U8wmCF1Zlmkdl0LP /tZEsVtOLjw== 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-i2c@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: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: 801819 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 27527195FC1 for ; Wed, 5 Jun 2024 18:00:35 +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=1717610436; cv=none; b=rOvU4qxEtoa4gXoe1uJfAfvAyts+DRmzNVTT4EIGHVNlI9AGRbgqTczhLQePLHqNI1uNTHKkacenHhXZic7razcopINTDb7saXbCgw/mP+zOADzffD6zaDyl1+tE4oNMPhX9H14CHjVRe3bbEi+4dDm9lLqZBFR4iKbjR+e6vmY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610436; c=relaxed/simple; bh=1Nr1idmwpwCu952z8yg01gYhGFCoooIcYkAZZCQGY7A=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=qTHrQ6eZCH+HoJiJWujLhiR5cHzE9qdIaFH2ffTKAIE2B4Uh39mBaiUhS4ucubYsOkydis2o/M10S1u/b7KtGRA0Q74bpDtxiaos21rCd+zlrrHC5dtmlaCUqoJm3Ugs5aq6naokz4rWw4xj+WUn6t/RMdU1f+I2wPotTtqw7mA= 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.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="c1tBtF+y" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-627dd6a56caso262557b3.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=Qvic2UgznRMfSV0AZtBZYr3mybNTXT/8tglqHRVVdmeztsqugsbhcLNrMA55CLVJHK OrptvjL4Qx0koJXHbobSZ6gwsWju2WiDg9uMuXbytvU5cch3yR1CbpyOPfNaS3nkOvuw g82uN6bW/c4n/Jji4Njh9TkSVpGUhmK3z2GdYPvCzOIbgDs2q47tc4u1ix0qiAnn9OTc K5UGGSSsEQbuFgSkVdMEBveztj4a0nQvsH65+jFmi1q2ABdgicjs/ITbYTiGGquGTqd1 dhwoMnhJhTmTr61qCW2QDlusPaYuR5Mpi4osHcntYTikHEk3gWaTRIqvdKTCz013l7Hu 4Zxw== X-Forwarded-Encrypted: i=1; AJvYcCWksTz9rb0a1QX7XwhQ6XNr9FvI4uKPydZnyyjcYIOPo8dvg9+8398lFoMTeA6j+dTr52hljqNtAX1jeyZrgjayn16L00R+IxmM X-Gm-Message-State: AOJu0Yy3a1e6gEUeaf5etX/Bbmy/wt3eQm34GtlG1awzO73AcoNIeDVv PaPkxKSDC6DtDL/wqXPzMgqH7W3mVxF9/oOdHmsSJL74To3pq8qFNf9DLNUWpCBW7Qql9q+ZFLd rSHeZG3HN5g== 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-i2c@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 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: 801818 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 0AB1B1442FE 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=1717610566; cv=none; b=lWiHoFZHYI0bz7A9f0IWMbEIsSGR8KoIOYwFytLbx0dMTZ/j0coIh8P0qN6TDvXlzhW16cmOdFTtDfnr1PHn1uLIlc1jB8Tlk0ltOJPs2uzSqfxObDdcWNLn9qLc8YJhrCn4ccgUVgxV9AtRHo3xzqSu15hN+0iTOWdoQKfIQfA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610566; c=relaxed/simple; bh=eF30gjQEDuHJ/IYGm6d82rKPYlogi0y1Le1+CTBv8es=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=qhCs5vzand8k//vsUV316OCCgLE3lgHN3tC0d3PRIJFqjE0rYgrwY7tzUbtRSqm9mo3tBbfR5yC4Q9GLsIRDrbSqwjttdgmA64VYrvAPUy6P2Ajnthe0QgQfW8G0M9EMCYXpgHdOejoHs5ztxbAfKy8UQQaJMzvtlBda959Jcro= 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-627ec18b115so496177b3.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=PCap2dSHeV+PxMlRu3FYsH2n7RwwAMpowvH6W8DGRJbYSwnOn10fXo5z4gdEa+XZHs mnpz7Rdfxy9o15IwUOuyuqV8OPeEW1vBermZbwMUFQjXRtxKwNGDk0gCGFz4Q3D/DAGz GrRQc95QaTMfokoT6ju3X+jFJjZ4UheQZKWtWaOx7iUHC7crJTxVcTQHW0Y8S8DbrIHD LkW9Fu/Kt2ly+0Ij4wDgQpsW8p7FVKBtswasXMVyrHufeRfItr5ACGLEdr0F3YRH6f2z H9XHrNTRZHeAnPEnIIT+vIqLXC27uwQ8JOJrO0Pa+3O8vPItxsm3NbagowSrBjjGYTbk cI2Q== X-Forwarded-Encrypted: i=1; AJvYcCVXGEo8SYWYdr3MEwBk8/ESbRbwT0WwMr5+bx6VtxxWGHoYF9Bz9tNRv8vSctspTalGiKSVyBHdQYQllx5NBTXt/wG9Bag1X4gC X-Gm-Message-State: AOJu0YzZxgtssqaSM0sI7zrplc7CN+A7ir23BI1cIhBNBYshMtvV/C2I xRur0o/yazs/XM+RkoG8VeBOEdJ0Y90NmtoDltUbh2qhkNLqoONma4IqqrLm51yp0FupytQ2BIY 4XY8OcESlMw== 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-i2c@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: 802164 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 D2D211494B6 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=1717610571; cv=none; b=JhlH6k/Y7rzgruOotba2FVccTQT74g8+fe5AqDTvJpeIaA2W870WWZnlr7muLQ2leeDE4QCdyIB9hIgZzqcFap1RCX05099ihFjbSsEALXbVkwAtS6R3XtAOtPoIt4rhK4YlY1eQDsToFby0Byi4qhm7oh1K3+2idcRvNQKcp0A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610571; 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=gerZw+tV+pyDVUhP8FnahWSkndWs7h2ZL97XMSCoYTJ7w99MZ6ZPJXZRGneec6DsCSMchkJoDoy7mEGJMTx0sFnfsSqGusuBcWcoyjUzR3Fa3T9KmZbpOphKRhzHfC3S6cDPlE28lEGsfmt7WoM+7V8Gj1M6ShKjwcvokRp9OAQ= 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-629f8a92145so631687b3.0 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=nh+6zv8+TXMM2KK8U7aGsRUKpLf1SJDKEaGgojA6MSD4y+qYb17ipvA6jP3wtuGyru wRF9VW9zoOGM2NJXyBqBYUwtI+9ciVU6PkP4Q24ySVkPVRCIBDKL6m8j+3iVEy7InRr+ oLtc9jvqTCWriJ887OqmJkaeY0T+kvmDvTIb9LaTm7vRU3pTJvSJNIVUa6emnQsq31K8 vDEZJX+hVPN6KHEAGWGZWs5usISw61KzH+R/J2qdADXDlOgAUwPRsG766Qo3Pibkv/DG HfWw5vs2mmJyHeWdOfqB9WXcwe7FF/RHvOEtKsVNOgMilfp8XaAIEFQLPrqpPo3OOhxw scpQ== X-Forwarded-Encrypted: i=1; AJvYcCV15+KQLsrEMGocrOi+eZH7Up9X2DwwJvG3YZRpJYo55Cizsl24wQjx96nBdRgbL6AtcMHvb5HT2n4PUhuetgDSyFq0kCD4iUzj X-Gm-Message-State: AOJu0YyMq3Zd16OTJsSqeNqv3XKbWZtOGTCpypm3Ri0BKSK1n9o+NpcL sPJoKLxAPvM/dH5JUK9b0cofvq+rpFkIACTC8Y07ovrZaZw6alO89rPi9xOg6sI+kC6ykHuGFIA RBhq/DP//Qg== 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-i2c@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: 801817 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 1D11D14E2FF for ; Wed, 5 Jun 2024 18:02:53 +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=1717610576; cv=none; b=hjYRACedGcpRJgmGRmpcW6kYVWL7Uv7HZH2zFHMGL+XKx0XQ+axovQ5lTV9QkJbf/egvOLi2qiyDFQPnHw258crEAalwd1CPMA77zuP8R4usSgIa0jiwYYmQ8fliwPksKPPliD4rrsgWD2LmSd5/KL4iTiKEma3cZwchNGyUeRw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610576; c=relaxed/simple; bh=3NTGVyytdVyzcHP8txKlFB9YPPGxIJEVxCzu2cUQr1M=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Dag2uR8H+wdjd0vwMIkPD0rqYnhw+abwUeh1s+0/uFnnyIYN6cd/n36NLEJxI812JobDJodPJZETsdPCxd6AB7kfYAmKA2DZCSx0EytbvrZM1jocAO5uyWZ9yl9xN03CYrmNaOmkJKYMJfcDv8017y2h7RrklKPyW5W+hKLT1vM= 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.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="Zceh7r4D" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-62a2aec8521so655557b3.0 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=dmNvDTLfCOriN8HYZrpkGpWYSlAWdL3oL4u6Fd90aOU266kH1FLnwIDD3niVH7ttIY sr7CGaLNbBv1nC3uOhyNpjzYLjnJ8ahP/E5RkrP7xzTLieMjfhFZZ6JR2Vd+JxmG8lAp wswt8z/vHb25oKVmD7ltAqO6GDRiWmkA/4DOa2hDi4TOi/BIvK+aS6RWUPZeKerhGK2B JalLOjcYgdlrNv3fCeqlaPMW4jk/Pirr/q9MbAA1OQ0K4xHW9gXzDKP9+2hu8BdyUbrw 4TuxSHM7NzJLh3t+XSrcrXuOAZKkyaO5BWC8npoFMaCioNy0XjTsfsqidR9M097x6Jea qrVA== X-Forwarded-Encrypted: i=1; AJvYcCVXbJkrXpC6O/pVBtEsZtOlDY4HHB/TZrUSX6pY29cuXEgjiqgT1wcJJlNotiSTzkiEaSykGuPHO7ztBvku8bF4jZUEE1nRwU6u X-Gm-Message-State: AOJu0YxWBDbfaMxMRLKZEFxLHGjSDcuITrkqNiL2U3ZwANCeJyURhked +XDClz5fP/PAv/BCeHZQStUyUyBuZlTbqKzVgwukwrFyd51DgIkzvgTJBbmpvq4wBPedQ5QFGuJ c1zYUU8buVw== 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-i2c@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: 802163 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 2AE6214F122 for ; Wed, 5 Jun 2024 18:02:58 +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=1717610580; cv=none; b=rIiUnnB+kqZpidFKxtkKzVHO5j44uan58wZaGiXxhAy1Xz0vJY7ZbSt5/yryiw8eOhDcaB8m2cMqMbAUx9QLYP9g/ERm0+v31uJCrQOVSu0O8lx+mehK/Gh+yEM9Q+OCrbs+JWNuVZ0zWRs14QNuTx9hYe0f6/xkvMFufa22yNk= 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.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="kNi4DOsm" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-627e4afa326so301187b3.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=Ln8mGDWkLcFnJ9T5ByBy3Hze+1g7vfDJGx71KeW+yx7zah1WI3j+uQLCSVT7hTWyM1 DdF1izXy3PzCytl48lstdShWQmBndNPJTtevBiH3yh7KaCtOfRKezziOlweQx5NBSOlb fLJm///PDdt3wKtQko7Z/rG+0tVcU0zZ7rOZ+8lZq9WV/pkOeZvyHneVJgaXWZPmqVie ehaE4Ctar2e199S6sAk60IaZ+X0+15MCaoUioT+6RQi9pX+vYcwZwlqP9jUD540Ci6Rs 5ipf3lf/vQg77qI/G6drTUjLQ6OMQhhgXtkMyQrB9mI8rWhHn7X5CY4ld55gPsGvocla i5kA== X-Forwarded-Encrypted: i=1; AJvYcCUeE/jYE4xGHikJQUSJ43Ekjgq32kAjzqc0Njdc1GS7kVc0AlUrht74v0OR8Bpxu5Kq84fLlMvSLXAVYMW8H3Ban3cCW2VmLjZ9 X-Gm-Message-State: AOJu0Yx3WFQRvzbiFWSBR0QofX70I+5iowtxAQWiIk242cx0lLNoxSAw oYeDGCKfpI1S7N65KbEtYev4LC6VA8JPuQO3ipslcMw9ww9mtEAH5fkjdhWnJMkAc2EsPP1VwMI tNulKc/+/Xg== 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-i2c@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: 801816 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 9D9C91509BF for ; Wed, 5 Jun 2024 18:03:02 +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=1717610584; cv=none; b=i/lVfBxAYpCNC14AxiSYFMUKenA6Ky6lxli3AFmRjWEF7b4Fwpdv2JaIRQOnde81xlb+ez6vccG66j5nkWI6uYvBQSXcWjJi8uSg7vXVOiqAXWM3GPpPln28+FUSuJZHno99lzHxPKdoIRGNyleS3E7UVNQ24V3ugQTYNbmRe1c= 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=Idku6B1W; 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="Idku6B1W" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-df78ea30f83so1555590276.1 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=1717610581; x=1718215381; 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=Idku6B1WbjWlNIoVZa3HVC6dG1gQ0a7HXAXah4JvpCOQTPgCUCAELnQUNb9/wosw+t yhTRct0vZJQ8OSqH5KPEIubSLF5rVAj1uqISQrHjuRVlM6HT/ZYbuFASEfFsS2JqabVf ydM9kdda7TDVtg7RPmBgAe58t94ZiU4P7gdrZ/zvLuxwAh3KNoNY9XqgkYxgn9siwYU2 r03213d0SDy/RCqasY/K9TwS/wg4MMfe8NIvc7lWlB6pgbv/jYWasckvgYwd34B3CNQZ XCOK5SIFmd+94r3xNhyeW9vWwGp6HMd4Id7m+C4bZ+xuvE3VkAS8EC7zJQXikJRsPbTc NE2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610581; x=1718215381; 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=tAijNSprhY0h3jL85ZBPpIKSc6IiaQRwGx5H3DTcxDTfUBNHM2gmzrRTo4290Vi7DJ gAIkc2g1szpyLSnMcbcGevNFJqau9bIGz3AhIagF4XKGW++jwx4BurQCjme9EJTupeyP /gV9R2268GtKJMSoqozscdZkraxQMVELhkFRCAa1bGqB1CY9PnsHUH/68TIPqlmOtVf+ Z4V5Scaiamr2/HEQX4scSVAvqQb6Dpbs+QfGQ5aN2479Cn6BZICHQO18LK28sbeEzqru qZG1JnuHyysFEK4bkp7mZnIeUHWBNVTVzZdhNwGl94u9ttxz5GfgpRlVNbaiQTDAcgZO DHzA== X-Forwarded-Encrypted: i=1; AJvYcCVcfY0dtxlHZe5Vshjx5aayOjgqepH21eNE9MQCXb0yzbq4fYlj4PuCCGgb1axsSZgR4wzcMGeKNPfDlOrEi7BmlQz7Qg/J5kbk X-Gm-Message-State: AOJu0YwpzlF76c/sYarKTJDdw5TkLH1jaSancruiwssc9ehrO5lkZysT WXHx7Xewe5lgdtk0LgEqr6YqZuONzgrP9fjzjtniYaw5lLdrnb6HlziR3u954F3mhPg8GLuTP3N roayDcbZprQ== 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-i2c@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: 802162 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 B2ECE1527BB 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-62a0841402aso270807b3.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=GJRYbzPvQoe9tUqK/BoMzKqVaz/YoECLrAB/fbDEx/POWlMDjaHIN2HOF29ATl7z/I ln+1D7N78dMmipoqGVlWXeGwZAzr+RYOVLoRHFtBO/EPWCXVTE5vcs7wPt52hRr3nxkl 4dyMeI3/7SAcEr+4vQRqDQxh6eNMHTXcdDjzexi9uPPU5g9jSN2k4ioltuNLXauWzW64 Hz33YQeSrkooYdai0AXP0s//n5yfCbS/yt53lSYc/7AuxnoQ2GutWDb1ysEKZMfSlwbx PmEhBD0khaDgBJJBW+y6gkSn4+rPgedXYy1XCXuQJPk8gdEMJ6HS7QRzu6CGuAuMlJJZ xa0w== X-Forwarded-Encrypted: i=1; AJvYcCWbyiKcLKa9xY66UwEAUizan/0TwmFL/02cgUb6onA8UajUYZ5H59i0XIYg63aaBeo5oQ7QMN+Kp2QGUziLGm2cPBzx/BjuKCfW X-Gm-Message-State: AOJu0YyZX++dtcoHztPpduZXwhKvtBbOB3zQtoCSF/nu+2zR7bnlGWzA 6W1M0HkDUK4CjXYHZDKagcKKVpHHulYNZvoQydCbF+UynabDug4ShgpWgntHHABHzMEk7jlmwNH O0bCsgNngWA== 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-i2c@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: 801815 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 63C20153810 for ; Wed, 5 Jun 2024 18:03:11 +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=1717610593; cv=none; b=G/nje13WrJgrYSXGq7wEJeSXAvP+ChZJsiF7hfntMXR0p3mR2L7lerGwUJY/uTzirHBT72YHSb1s1SueRIJbIjd8kc6pNmaqcVngXKlT7zEmNG+Roc2ubNJ9Ar0FqwhRgME1JpGy9jvSP2VW31L35ihjUYkLdhfEDcT2O9amO6Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610593; c=relaxed/simple; bh=e26lRTuAGuJgmNX9Kn+IMmOklmBtw9bMfbnFAWkr9AI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=nel2HyZryX2pW7XoUAmJEtGeQjaH4qLzlcrPBs+6N1OY/64IAP04vV14/JMHv6Tz+esjDFHjAWZ5khRXsD0COSzW6OS7QQh9pYjAB3mqHo3DnHh5c4oSberHjC8qGDQtc1YrCekHQ2ku/fepa1m6lUJE9qeGBZ6fggLdSi4b/K4= 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.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="XH5mJeVg" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-df4da3446beso231545276.1 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=d3rUnynfYcj13BbfkH5r3EZS/MSxhNXV8M6/msCOEVVLYfpMQ5bmV7LFCADYKYJDD/ OEsBZUC0QbAi3NJ4boPHu2tdB0kjhcvsu3R9hIho1+9v0v4pgSY2m8vtnLdKnlrSMUIQ +nJxluQ04X56RSgSRrmVdemqBYnLumW/jrufzN4lQ5KSGuiOnGcmMBt/9wrIgjnavF4S DZSGylNqJ6Dgn6+Ja7Ta+WeW0b1SF97hDpgrLIWTC7toTtNRV0rprykM8fClIcK0T06D h69peZj4So8/sErcmFghfez8Xmnks+6gQMg6V3KjrsDxGs1X/MF3UJUMf4sL2YnzUuNK 5PuA== X-Forwarded-Encrypted: i=1; AJvYcCWryakjoRboUhC0cOuwmUSAph/DDYsaYuE1lZAENnowEpbL9d23EQWqIuSmdiebmbLoOos9wuOw8HxUtMR/GyIk9AQIY37xkMSE X-Gm-Message-State: AOJu0Yz8uX0qQBsY7N7xVwjQ5KPG6sJb4cAIByyDjaoHGnAuWpRS9LvF yK8sv1l/jmyTelqrrxAbFa3hoDrYLtoAdWwbbebR6DGPridxC/AgDBkMUVnA78/+5SUXeiF6taD 6hh4q+IknSQ== 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-i2c@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: 802161 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 4D9BB154444 for ; Wed, 5 Jun 2024 18:03:16 +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=1717610600; cv=none; b=crGooK32hwjf+dYkMjQe7Y+qzO3v/3Oj9JHfGMJjm3mak/frgj1jdhz0Xpe+ug60smB8Cn1iX8PNhERvnD51t8Edk4h+H/DmSCx1B69BAVrIqTkCNiqEokNBSUdBS1861e1oKoun4BIVc9X4B99Qht5qk6Vbo4lR8x9yiPf+5cA= 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.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="ZhJ47nUi" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-627f20cff42so607147b3.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=CCOUav2S7MYJ/T3QZPIRSyuT9zRLTizmj8CW4KFtciMOYIDKAQ5VAMNfZ1cWH8868Q q3bGuRHbgVjj3A1d3sMCfY2XG3XRCHQJWWyaiWDOgs9+tYsLQ9Yn7hJTKDvqqchbHVFw D21fUQ5tLdgrG2cJDALjrWuxdUtusP5zAylby1J3Pw4toY9bfMgYftdZPXqQMVFhb/zD HW3BkiZ6rb9+ubDIh/fQJ7E5ihTUsUUW3bIlfWA+ZzI/SYZdla3zd81EqxfnJeSjCWmW 5ARRyTX4WjYD1V+CCYv/B8EVOul05sNCHfrHtA00pDW+uDJtF99OlJjgSvhKJV9v4TDq f15g== X-Forwarded-Encrypted: i=1; AJvYcCV9hNBxa/FGaAD8aScGGw7p/Uo0YYH22A8xnJb5ya8kmapm9gd/dHxOD2XxEYGX0PcUnjQJu43UIqM1nX1nd5TXHi/FfC/Or1jx X-Gm-Message-State: AOJu0YxaWGVUTpUWXPEjYV2txNWmxhsBsI33DjL1LW44wq/qZT2HsP7q F4ZUeVv+bcLE7VyNOkpVHB8TJAXX2//jHclJr/8IVE+KDXgoS4dYa14QQl4sxBBE/rlydTVexSD JOYSRgLH0sA== 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-i2c@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; } /*----------------------------------------------------------------------*/