From patchwork Wed Jun 5 17:59:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687250 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 9FB3F13C9D9 for ; Wed, 5 Jun 2024 18:00:05 +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=1717610407; cv=none; b=ZVYbm20rFwTFY29zQpJtaV757SScvKtevB466aP+av4bUjDgSZ9V8J94I/PagUU8eEizih2xoJhCUADnd/X2qYUFA2gTPCr+U+35an/zaP27WuDqkarnc2jSYPkHQMtNwJrlIy5quoacVywcPOjNo1BEoZwUeF0Bwz7uJhiA8sc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610407; c=relaxed/simple; bh=ipr39Oe7qflzshs+uqKeD5dsLOI2DywzVbGtmwc3XF4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=JUQPpxuQry8lRgbAkyZixMS8fgvYyLblUROg8WF7W1ezKR05sw12CQEKslUgthtKTQ2GW/qRIl/kF6ndpBPPAVdyH9txNcsZ0T5Tr4xTb2DDDEo8VfJx+cSxW/PdC7FuN7UQhMb6zApQnTEkZclcq8ovIY6+7lMfQBA3WHpvPFQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=J4iEbje9; arc=none smtp.client-ip=209.85.219.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="J4iEbje9" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-df78ea30f83so1550303276.1 for ; Wed, 05 Jun 2024 11:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610405; x=1718215205; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=nEr10taYCu3WGRiwn+CGqfggqJNbp7A+We0V3ygommI=; b=J4iEbje95ninWiXtqqt5T/9d9/rhCySu+uRgj5M+PAahakXxAmJMwbOM3Vl+q9ipwO cR2XMTaT3Cl6rtmhHcCzhm9ADVnFZb1p7yDmg+5o5KLMVVkrKunBBEwcfC6DifTaKXZY +22DMkjtteZbmFu3YZvAFV37gq3FnCxnNGemPsZXaxgCOZFtLwTgb/ySUoNoxgKThXqI /j358DaGUSozaVs/XrXx5gTTjXCJvJ2f3lRsZKCCy3KtAdh0gF3OvCEX+ecoMyu8HbjC QoZmOUWx+hkMmSCw6alLz9KvgAyuX7At1Lbtv2yzZUUbf2fKO7pPiVpatVP+Lflv7Hil VtlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610405; x=1718215205; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nEr10taYCu3WGRiwn+CGqfggqJNbp7A+We0V3ygommI=; b=ocBPF94azFTbTOdUGdVoVg5+RTRsLOU+82VUofIXsCzLN077E7Mdu+17jBMi5VcRjy Y5iKG6WDLEAPtcEBy8pa9ry4MbUNx/vofLiDCsntA32N3YivgDSCTIVj1s1IlASaPkRT 3jIQDLxUjQ9JhA7zAOjK4vkhpAPOfxq2EB9CvaSVVGgfpmvG+I8/gBpnC9dWKByrmrHb bINje3dXE33HCnAfWoq/LAmYYVc3InDOuyEg4WhII6HXRwTf7TCxwkUrO/JibxLxV4EC VYL/vbt9JQkNArN2MuwvNAmecPKTnMAbfDrY6N6Hq9yUD50zUEaVg9C13HXQBQRHzm81 Un6A== X-Forwarded-Encrypted: i=1; AJvYcCWzGDw3mnFwcOpkEycR8VzC4H8ppxSa6JK2o4uRQCZ4L2B93yAk/gxfD44Ua2kBDr/OmddEckMYbYpMJiNy77k5Uqw6oX1XC/TNbhE= X-Gm-Message-State: AOJu0YyE+0LystQ9s9qUiQy4C6bBQylgXnu3DlWfBRR4xSTUKhFtfw8J ITe9CIT9GWkxfiSg2HakYIFE632uGVtSpyMuksGVAwFx40cmTBgQUK2Aquhd54ycAJvSLKdor2K A9Q6KOMPirQ== X-Google-Smtp-Source: AGHT+IEFfd1XOUpmBlCQ8OC96XaGHvsQJFoGDWo7KSg31aa/FmwG5qSwwUZMqSajPkXkOc1t6VuaS9UByNrZ0g== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a25:dfd5:0:b0:df4:eb0b:8fd with SMTP id 3f1490d57ef6-dfade9e0f4dmr76066276.2.1717610404805; Wed, 05 Jun 2024 11:00:04 -0700 (PDT) Date: Wed, 5 Jun 2024 17:59:45 +0000 In-Reply-To: <20240605175953.2613260-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-2-joychakr@google.com> Subject: [PATCH v1 01/17] hwmon: pmbus: adm1266: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/hwmon/pmbus/adm1266.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/pmbus/adm1266.c b/drivers/hwmon/pmbus/adm1266.c index 2c4d94cc8729..7eaab5a7b04c 100644 --- a/drivers/hwmon/pmbus/adm1266.c +++ b/drivers/hwmon/pmbus/adm1266.c @@ -375,7 +375,7 @@ static int adm1266_nvmem_read_blackbox(struct adm1266_data *data, u8 *read_buff) return 0; } -static int adm1266_nvmem_read(void *priv, unsigned int offset, void *val, size_t bytes) +static ssize_t adm1266_nvmem_read(void *priv, unsigned int offset, void *val, size_t bytes) { struct adm1266_data *data = priv; int ret; @@ -395,7 +395,7 @@ static int adm1266_nvmem_read(void *priv, unsigned int offset, void *val, size_t memcpy(val, data->dev_mem + offset, bytes); - return 0; + return bytes; } static int adm1266_config_nvmem(struct adm1266_data *data) From patchwork Wed Jun 5 17:59:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687251 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 5332014EC5B for ; Wed, 5 Jun 2024 18:00:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610412; cv=none; b=G9HIJTTbTP1jQ4zYzR4Drd2BSQ6vEja9uCOYuE/n1gREiVv9nSYEqQz73yk+gDS4xAmsCz4Nfx4AytXBdwDgaZafX3mY7rB82VJMFVbNBT2nbRus7m6zFl08Lh/IrDPtjFh6B8W4vkUoYOL0Pqnt3Q+M78i3RrlzABe6jjrfTUg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610412; c=relaxed/simple; bh=8DJQonJqq5Z4yQRN/sDPNHSxx9pC4pBa8VVN/l35RYU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=kxc+hya6jy67u9RWDsjpQYEeLg9GcE4DFinStT5kveXg4iBDA0VhKRtNh5psYwrxNOvWzVCLF3lzBNYoqQUswaTCxnYnNofLd2SplGCjxlNI1Qa1G5QetGRgSAsVzL3K0TgoxwH7ue+Y1mEIWHdL8RZS+gwX1nLjDwaKtoHzgfs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=pfblUWIw; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pfblUWIw" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-62a08436241so312887b3.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=R9mNb0BkVek2QLU0aR1trxfxWRYRGaJFlNWZlWJb9g64iqJJSMaUWHbwp9yrFeDWTW eoQvPrMHC2VITp/mE9151PVj0AMcudkYb6rlLaG8UebNkcj1zc0QJJq/43FdcwxnMKdB cRzu93sE4UjG2omPSLfH5m9p7qyfFBEXftiVr9VlTH13B/9f5Ywjk3xuT2/v3QRs2A3e hkOQh9xE27eBQRivQsriBpoMQpEUNW/jrOYQRgx64ib6K5osMxzeP9LXpjyiQvgc8lKx y5DxwGO9bMSppbrVvJ5jQFV84SLNz2yv6t7csi3An3NyQQJpqP0Ncb6b7N4mX7wVlSFP cWew== X-Forwarded-Encrypted: i=1; AJvYcCWiPpwL1o/RI7Ja8Ih0/IyoEdQmycffd2sLkOiOe4ZLWA3Jbm+uAV89HSuLItCAp+AGGuiitqhBkwl+P6nm1WpDxtmCFLpUZxjYQRs= X-Gm-Message-State: AOJu0YykRhUdRBsGebVaF+0SWSX1lGz4hf/4QQKWz5LhYjHsxVeOi12E ejJyhAr+FUzSJKCPQJFQNdm2MpbhVAVpFrPWpUUbERBMbecd0JXsk2JvOzLNG+4P+yvC67mz2AZ m1e+19vkxwQ== 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-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-3-joychakr@google.com> Subject: [PATCH v1 02/17] media: i2c: ov2740: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/media/i2c/ov2740.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c index c48dbcde9877..0101ab55a5ef 100644 --- a/drivers/media/i2c/ov2740.c +++ b/drivers/media/i2c/ov2740.c @@ -1212,8 +1212,8 @@ static void ov2740_remove(struct i2c_client *client) pm_runtime_disable(&client->dev); } -static int ov2740_nvmem_read(void *priv, unsigned int off, void *val, - size_t count) +static ssize_t ov2740_nvmem_read(void *priv, unsigned int off, void *val, + size_t count) { struct nvm_data *nvm = priv; struct device *dev = regmap_get_device(nvm->regmap); @@ -1241,7 +1241,7 @@ static int ov2740_nvmem_read(void *priv, unsigned int off, void *val, pm_runtime_put(dev); exit: v4l2_subdev_unlock_state(sd_state); - return ret; + return ret < 0 ? ret : count; } static int ov2740_register_nvmem(struct i2c_client *client, From patchwork Wed Jun 5 17:59:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687252 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 C5821154C09 for ; Wed, 5 Jun 2024 18:00:14 +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=1717610416; cv=none; b=Qg2ru+kX+3drx2Euc3Ayycd3aASDyCngwRMxB1oBNb01QDh+Q9rPvMOGSkDVsSRKC899Mjg0C7zlRWBOp1E+zbzk3+45TvJ+Dv6l5Yumnbklze2jcFwAcVojL1akFbD4Afmh5w86vIAKasKX4Y7l9Ilaieb+XlNH+0wExuclFBI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610416; c=relaxed/simple; bh=fPdJt4Gydxsb6XLYSRdNJ8hD/W3THq9fKXubquLZs6s=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=i6pO2TMpfF9WSxmEgO2OgQMj+dJxB2O9ZPUNseanigLTQlD7BtCocaUnhG3NIxZlrSfBprkFCXYw4oXWpSwDxDW+dNjlwGkinP6gV7VE76oS46/YUkYaxsln0x6hrQ1WF8mMvYy39CpyJZZZ/x0v8Oz9aGL9L9BspHrFDVUYwuc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=yNqgUmHy; arc=none smtp.client-ip=209.85.128.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="yNqgUmHy" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-627f382fb97so232927b3.3 for ; Wed, 05 Jun 2024 11:00:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610414; x=1718215214; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=qvmsbFq1f0xb8qTUeLHIrwaOpt4YNpx3HYdX4+QrPhA=; b=yNqgUmHy2UkDE3heRRb8oMaXmLeLXyM1i27wFJS/QU6flgxbWEI6TZ7da1x1XjqPQO VlQ19oRwmx0Yd/blYB/OvER0B5Y/49RGI6us/PAl60yjXA5+o8wOy5hEfj5ZadolRbK+ XWIHPanx9sQPLs2/5sl8VyvI7v9OkxWCYCvKJqd4BWY60BaRMym9Ck/ROACMI/JPScoo WSekErhgKeJiiUPjrxf3KdbGf6pBiF0a1bGCPfBXHONpv8wSDHUMAThTTzKivKWkB3ub bbsqHW9iPJwiorjZWv1Xw6UL52JrjCEQWpvC3xexXC3j6MNOu7OViZQDgdh4MDbEtTMU WmCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610414; x=1718215214; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qvmsbFq1f0xb8qTUeLHIrwaOpt4YNpx3HYdX4+QrPhA=; b=gRgxahZai5cmOYkcZQwnG2tjy/Xki5K6BIlFJ/2GqC9OpjcAO4URHu7mK/goZzzUaE bL0DauvjfyCXKGmv1UU2p9y0EL6wWbrwYnIBa2VgiFg72QD5tG6sAtXqMqFDu/zjqa/M iwADEmPdvfguhMFMx+1MT2xeRomo7UncN90r+aN6Cz03HdcqMFdhA443KhwOWSaPPAYl Z6MDkEkXkBIAd8cnu7GTwEuBkFShs+D+T/X0WlkGqnV2sOnZMr4GVjRh94xn2fFpX6+n RLPeWnojReMttKBMTUBHKR2H+Sy1WtZnoADXn19xF8007dzo/KafmKKFltSXfFlDyLBm 2YIw== X-Forwarded-Encrypted: i=1; AJvYcCUz84q/oTTudwiFLLycCxuZKOOJdAFb7oHDxhsxAkKHz5SiS/nN6G2E9F+iQ/uB2bUP8xFLauOLbQiwJe2f3AcjHlw8Y79tRmhT5Pw= X-Gm-Message-State: AOJu0YzYYoMXlMeIO3OeLG2S0H9+8PZW7MRPHlO9OCGo5uTzQPrcZESY p+53o4O6lXzPND5xvxGYvMyA2Ff3mQGgLJI6XmQ8Y+rMYYu5SmRbivtoQNTOS+najuGa8pnagp1 YPYfsHsBxeA== X-Google-Smtp-Source: AGHT+IHixjuOYQ1InGCAjmo87JHH7BxdpNaY95UBwdRBHB8eZTSP6/tJXCeai8kdlzm5GsjEUY/q6O3hk54taA== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:690c:6688:b0:622:cd7d:fec4 with SMTP id 00721157ae682-62cbb5e6bc6mr8437267b3.9.1717610413829; Wed, 05 Jun 2024 11:00:13 -0700 (PDT) Date: Wed, 5 Jun 2024 17:59:47 +0000 In-Reply-To: <20240605175953.2613260-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-4-joychakr@google.com> Subject: [PATCH v1 03/17] media: i2c: video-i2c: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/media/i2c/video-i2c.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c index 56dbe07a1c99..2bfc221b5104 100644 --- a/drivers/media/i2c/video-i2c.c +++ b/drivers/media/i2c/video-i2c.c @@ -151,12 +151,15 @@ struct video_i2c_chip { int (*hwmon_init)(struct video_i2c_data *data); }; -static int mlx90640_nvram_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t mlx90640_nvram_read(void *priv, unsigned int offset, void *val, + size_t bytes) { struct video_i2c_data *data = priv; + int ret; + + ret = regmap_bulk_read(data->regmap, MLX90640_EEPROM_START_ADDR + offset, val, bytes); - return regmap_bulk_read(data->regmap, MLX90640_EEPROM_START_ADDR + offset, val, bytes); + return ret < 0 ? ret : bytes; } static struct nvmem_config mlx90640_nvram_config = { From patchwork Wed Jun 5 17:59:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687253 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 C587C15F408 for ; Wed, 5 Jun 2024 18:00:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610422; cv=none; b=D1oq8IZbE1phWLEtSXivFMGGJ7X0VOw9/IxUIFa8Fis5Etwt2gHZ3rgSEN7KoVs/GAWMavwwn7zSbECw5mVwpYTmCvkSPm8SVs4He0jzigXdmu93wFZ8T97v+mQPIMzayi3xlPLIq1ZuZHyj5Wcg8DfaQuFIhnenbVhRFdYnagw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610422; c=relaxed/simple; bh=DtpDZyHe3eugG9lKYAyC1ondYmKEiXhRbdfT84tszLE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=U5dXvzOpD5hcp030w2EpPrisZSytvt91l65rb8fCXt6XvnD3CoO5JXCOxk48GiIz8MzzY6BfS5ylg7BYwXBOIgz3HiwmHKUxH6vcmQ0d9WSNHQfnCO5iPXUsYpY59iNPw2IfzBNOyKl42C4Kl6g/Cti9ojZAdM9ORNbVS2Uzjis= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=U52V+hRs; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="U52V+hRs" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-df78ea30f83so1550766276.1 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=AE/iamN0cu5lajefXw4yNE1/658/ZnogZIcKgCsZvXcU9TbRyAyX6fScE5z15dHYGw H6Hxri8M/Dg4e6OnBh5FDcn2Rq8yK3qtuqxHrAcorYXyFe01nJdBLu71fKfyNFVSsrKf XkBkC10Mmahtz09Q+zlz3CinHadUGAnIwDS+DJ1Cf9a2zQQzzczPi5XmhwjTirZipKtn F8NHNaBn4SfX5d4ZgJdhfNxrVuc2dmRSmbWad0fPsCcdIEvcZo52f++EPcIcnwO9L15R kZDOWhPDjeo0lMLrF2t4A6bRRZgWGbhMXe0neLe1yC6wCE0DR/pH0hPLvtVqFVQ1yB9p gh2w== X-Forwarded-Encrypted: i=1; AJvYcCVoMdrylq3dt5xoKxgzTpAxjHiXZtSAgLmUMDGdhq4MP+Wa7KiCg4r1mmHVb8Sd+lygpFkGAHEQ3+WB8/D6a3rbnue7NFb5mhvtRKY= X-Gm-Message-State: AOJu0YylMQo32Nd0ZoDbP3KQWSbGOfa+nlwZ43GtniFzFajZST3mgfTE J12cY49ss9JHuohThN1kE0G+FB7Y/8fMktXkqTp8swSg1bUuoTQF/ib2VyFU86Tui3qY7T0ciC2 LxvWmrojpjw== 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-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-5-joychakr@google.com> Subject: [PATCH v1 04/17] iio: pressure: bmp280: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/iio/pressure/bmp280-core.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c index 09f53d987c7d..8d5aeabfa297 100644 --- a/drivers/iio/pressure/bmp280-core.c +++ b/drivers/iio/pressure/bmp280-core.c @@ -1465,10 +1465,11 @@ static const int bmp580_odr_table[][2] = { static const int bmp580_nvmem_addrs[] = { 0x20, 0x21, 0x22 }; -static int bmp580_nvmem_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t bmp580_nvmem_read(void *priv, unsigned int offset, void *val, + size_t bytes) { struct bmp280_data *data = priv; + size_t bytes_read = bytes; u16 *dst = val; int ret, addr; @@ -1518,13 +1519,14 @@ static int bmp580_nvmem_read(void *priv, unsigned int offset, void *val, mutex_unlock(&data->lock); pm_runtime_mark_last_busy(data->dev); pm_runtime_put_autosuspend(data->dev); - return ret; + return ret < 0 ? ret : bytes_read; } -static int bmp580_nvmem_write(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t bmp580_nvmem_write(void *priv, unsigned int offset, void *val, + size_t bytes) { struct bmp280_data *data = priv; + size_t bytes_written = bytes; u16 *buf = val; int ret, addr; @@ -1582,7 +1584,7 @@ static int bmp580_nvmem_write(void *priv, unsigned int offset, void *val, mutex_unlock(&data->lock); pm_runtime_mark_last_busy(data->dev); pm_runtime_put_autosuspend(data->dev); - return ret; + return ret < 0 ? ret : bytes_written; } static int bmp580_preinit(struct bmp280_data *data) From patchwork Wed Jun 5 17:59:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687254 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 977411953A4 for ; Wed, 5 Jun 2024 18:00:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610425; cv=none; b=qB5jhvW3LjfFfKqB9iZ3Kw1uP47LwXElor1H4oqRFiB5GZnKJWjWGm/vScyZ7pBew5n8nw23a4cogGRhkobnNCbLlYFGLR2i4m1ipuc2dagSv44y8pMqQ2/w+5ScuLC6OevaOJveXg+BahrhtPuvb3KWPzAYAf9R6yi8fEX2wt4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610425; c=relaxed/simple; bh=M/eENeT34qITqyMJGoLfrkcDLPx6c2gqtgSpfyqShjk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=aDDKGm5My0fYuyu5hAJ6EEIgqc4ueyZpe2JhZCLYHImWJMI3dCln5CdIOgVWdoESJ5ppO3B+9ULTEmfZjEBW8r/nkK95rNYYXCgfPeXgPo6+5S+A5aoyaBSMdGLONTbIjQ8pHBiBtT8lTTh2c3sqIrcSDGf1IPppqHLHVCM4tsQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=FJuZggmh; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="FJuZggmh" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-df7a6530373so128569276.0 for ; Wed, 05 Jun 2024 11:00:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610423; x=1718215223; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=oWEvs7lXuHPW/wbGZW3HASpAVL3QgOZ/ef+Ervw8nvw=; b=FJuZggmhFGhWp10YbseBbhbNSwZbD3YkwUxXiS6vcF3km6ch/KL4ccGCubjjUswrvs stPWi6m+aTLRC39j/3ob86S2Z6NSr8O8AxWYWzc/hE+2uMm67w4Lmz1S94v/l/H2c1hJ O+dO/BeG+dPImMkDS26dKkcAxhVypHz9QHnNm3SysGqu+1oZzO8mtV+2ZAtcfMJ6UYcp ai+ktg2KHiTPkI3n1qzSaKTw4JfArzruUWmO+bX2v6Wv+JKurz/SBGIfcsiP8wS4dc4B B6pVh21yuxtzozIJA2Lvp6iwb6u37kIgRlnXtqQ/gmB7Q0nOc3TCGGSkWeK8EtBzAwJO uA/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610423; x=1718215223; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oWEvs7lXuHPW/wbGZW3HASpAVL3QgOZ/ef+Ervw8nvw=; b=BLhEPY7GfL81AAFrYuuDO1TfpflQi+h+Rqvv4uL1jVVlp2IvqabpVvB6mMcQn+ikyw 5y0dGWUwqF7ZwNGn7Fc+uiI4lTusx2ZFEOxASbwnCWiFzvXh/pg2+BUmUg+JoUFxeS42 xLTqAJXaP6CdNc4BbbGWOsDhE5StIoTx4C3l/POmCEGR4UoXmNc956sy9MtEWj4hzsdG mdb1aJf3BGAhY7CLY+J/eTkSJz/xGfHsx8uMijVy3kbO8zMEMqbYSzRL9mSKxj4xswUT ta/fcfyvxASZm4f8GRNzLOTeOCapHQpDlXXXKYpkW4/ECIUkxtD0+BomhDsFMsakxj1p F0FQ== X-Forwarded-Encrypted: i=1; AJvYcCXkjOpHOtC2sIlA6b9Si93Hx5aKNpm64t+WR+xlM/xJEFfl1jLoYtpDTYNouhPS/0ApWm/9btEdIb9TOCxVqJO9om2LyppwJppq4aI= X-Gm-Message-State: AOJu0YztalJ8YLSz+b7avKGhEsIs9euTwncTwL2t/PQLSqpiP0rcii9y qPrbB+oDkBfe/BXUhKnQ1VL6ojyLBTJNGBTvt5XWbnsmmvEsOrwpTyrnK+4l+1sgpJ+9NSWfQ00 6N2c/8P2HfQ== X-Google-Smtp-Source: AGHT+IHzBpKnrggHmMHMkvKX90wRDGnyxC/rya4wNnolxBy/S7eZxADMs2JOhL4gs65LRvS4Cl380vcS0L4//g== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a25:9004:0:b0:de5:a44c:25af with SMTP id 3f1490d57ef6-dfadec0b255mr68771276.5.1717610422643; Wed, 05 Jun 2024 11:00:22 -0700 (PDT) Date: Wed, 5 Jun 2024 17:59:49 +0000 In-Reply-To: <20240605175953.2613260-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-6-joychakr@google.com> Subject: [PATCH v1 05/17] misc: ds1682: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/misc/ds1682.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/misc/ds1682.c b/drivers/misc/ds1682.c index 5f8dcd0e3848..953341666ddb 100644 --- a/drivers/misc/ds1682.c +++ b/drivers/misc/ds1682.c @@ -198,26 +198,22 @@ static const struct bin_attribute ds1682_eeprom_attr = { .write = ds1682_eeprom_write, }; -static int ds1682_nvmem_read(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t ds1682_nvmem_read(void *priv, unsigned int offset, void *val, + size_t bytes) { struct i2c_client *client = priv; - int ret; - ret = i2c_smbus_read_i2c_block_data(client, DS1682_REG_EEPROM + offset, + return i2c_smbus_read_i2c_block_data(client, DS1682_REG_EEPROM + offset, bytes, val); - return ret < 0 ? ret : 0; } -static int ds1682_nvmem_write(void *priv, unsigned int offset, void *val, - size_t bytes) +static ssize_t ds1682_nvmem_write(void *priv, unsigned int offset, void *val, + size_t bytes) { struct i2c_client *client = priv; - int ret; - ret = i2c_smbus_write_i2c_block_data(client, DS1682_REG_EEPROM + offset, + return i2c_smbus_write_i2c_block_data(client, DS1682_REG_EEPROM + offset, bytes, val); - return ret < 0 ? ret : 0; } /* From patchwork Wed Jun 5 17:59:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687255 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 9484B1957E9 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-62a089511f9so15304287b3.1 for ; Wed, 05 Jun 2024 11:00:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610426; x=1718215226; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Kq8gN9PC4V0/WUeYJD+ngNL2/82oznUqnDRsVCEUyhc=; b=yW9iJgkcljzKSnVxoazsYECi5fP6QNHHLJ9IlEuTsYQL+RlaWWDmJD2d4e+DNhDTlm KIfryHEvd7FtNm8eHNyqjTI1XXd9/8uhvtg7pv/6kGvV3N26EfwVy000lhOWFWeeOYca tJ5tYDQzM0o210kyrr+IgjNfC2CA3bJ/iL77N6LlXzTEq98PU3R3wL/25tRG7uPbotgU cpbVNwzhr6IKc2fqP3RBBaMQHVM8jgX0F5gRXjSonWVCOuoyDtvr1Rlg6q+Zn0PJq947 LFpzYOwiH3TGEwZZHterdbmrVBOoTZV4ppyVHdrpANxTOrfCSPzqLu+DJ+cBDsXOimAK gLiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610426; x=1718215226; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Kq8gN9PC4V0/WUeYJD+ngNL2/82oznUqnDRsVCEUyhc=; b=saGfNWIWeuZFUqgmxExzGx6BzeB18M0vXTritH4fLaUaKalQEEwMVzlF8M+n/1WPfu yQcfxBflC4/mfIZYwseVXlkkmny8fq3FEp9D1N13a6rd5Xh+uTH666Se8bJgaDeq3H5b /gPSshDJIX6WyES0L8FwP/Mr2X1lx/NKsVpAMQierFIZp9F0kAFwyiL/iyk3GuJlzrwM 90OIePRCk1rJ1r38PNKDC/rJ3gMT0rUN2y8pnuulzcTjCTWnQyBD9MV90TNxWEkn/OGt kVztk7iXi/YelJuKVnLI7kvgyxAJgk/0y6nPA+80h87Zukni9aZP/e6j0iUtXFQCZyxa VZTA== X-Forwarded-Encrypted: i=1; AJvYcCX//6NoHKkxsUcSrqe6oJOa16VuUjX0odadLDlwcIXXYbwjPfoy706lx06clDLmJQvvG0DWGW4Hs8zTYATwimrs/PMr1rWO8sajT2Q= X-Gm-Message-State: AOJu0Yy8HhETShy2Rgmpmp5OAN7XXhcVBI4B7MvzWqpCNywei/dvsrnK ViAeRZ2xcpJ/kZtZPIj+JyGouWl6qwqx/q/7p2MxU0lxFCtGPtwjCfWJKdvUO+YaQP+r/C16wuN rLGKuZaJxhw== 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-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-7-joychakr@google.com> Subject: [PATCH v1 06/17] misc: eeprom: at24: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/misc/eeprom/at24.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 4bd4f32bcdab..0e8d92d6ab1e 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -424,8 +424,9 @@ static ssize_t at24_regmap_write(struct at24_data *at24, const char *buf, return -ETIMEDOUT; } -static int at24_read(void *priv, unsigned int off, void *val, size_t count) +static ssize_t at24_read(void *priv, unsigned int off, void *val, size_t count) { + size_t bytes_read = count; struct at24_data *at24; struct device *dev; char *buf = val; @@ -465,11 +466,12 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count) if (unlikely(at24->read_post)) at24->read_post(off, buf, i); - return 0; + return bytes_read; } -static int at24_write(void *priv, unsigned int off, void *val, size_t count) +static ssize_t at24_write(void *priv, unsigned int off, void *val, size_t count) { + size_t bytes_written = count; struct at24_data *at24; struct device *dev; char *buf = val; @@ -509,7 +511,7 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count) pm_runtime_put(dev); - return 0; + return bytes_written; } static int at24_make_dummy_client(struct at24_data *at24, unsigned int index, From patchwork Wed Jun 5 17:59:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687256 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 73EFF13A87E for ; Wed, 5 Jun 2024 18:00:31 +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=1717610433; cv=none; b=pEVsg80n4ziA0A2g3kNmQfuKF6lXZjnmVSIibWkTN8UQKDSAUR7WFXXZF4e1y0Ychr5iYru8eZw2ydlEH5Zzbi31KyEiCwOVQPYDMgeoJnFcM3kxkD0zPFFzXANVLDLg1ngms1ezYwVa3kAUZR11lbaeC5aLQU0qsvFd+b65m0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610433; c=relaxed/simple; bh=7YntdTNu7aMZ5zLGGRpR3JsfAB0rBOtanC3KQe4XBYY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=gdJehf0c2kLwYEosKVvKC3M4s1Tv8/e0el3g5YIN8eAayg59qfvK2d4D8y9JvWNltMj3x6mnffS1CieHM5sS8qiQstj+pVAU6PbY5cm5xZ9LU7rVDkW3pM7tfX9zDapMPYtIMV1adAmmSRx/D1g4jit9nD3AVLF0UgZGziVsO08= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=xh8vf0dA; arc=none smtp.client-ip=209.85.128.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="xh8vf0dA" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-62a1e9807c0so743417b3.0 for ; Wed, 05 Jun 2024 11:00:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610430; x=1718215230; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=GabZAVwK9FSl0VODpa0rRnhc7Hb5WIAFsUpyNY/Jkgw=; b=xh8vf0dA+TFlUnkkazIa6Em6KzJbbntuGamI4Gn8Wj1jFYYx5ZYFkn2tA0alpWg68u 9jhNXfx2DxL9m7tqmgthqmC1rUSflk24zLEIHrstf3mW39EvFDR2FeelUhLsupY30DEi /gVZrfJA0Slzv9rEogcUVgXiY8hLFc0E46E+FUZ/X8hWU6PYTTTOsgDQPMK44rgcyi4X g7UTGxktSZ/IcwoGFDfvWXQYzCbWyLYks/FVJWCMOKozF5JwJ5koJWgZ7381pzPo2fKz JwnKZftDOTv9WkuxVVV5rBvZHglYy9BQThw/il2JbfCMaxHpHsqQPdwDUsOxRCnGKcAo B5jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610430; x=1718215230; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GabZAVwK9FSl0VODpa0rRnhc7Hb5WIAFsUpyNY/Jkgw=; b=JJvfaP34q/dZtxA/8WqDmbDISDSJIq73M50y6rc+9BstOJFBlhIVoCOgRUhxa+Fy9Z 1G0rW9c6DTR5l5bCYyE3+Jg3McDJikRaPNRp1owSq8Icip2huqv7ugZeeknbUo6tAKTC rX8mWOe3U9YbcM3SiQ+60clTQjWRbpRHALOyYFXXsim1FZMosu6zU9ddoS27E++QcHBg iJcqFhe1FA47Vnhn9rn7Hvr1IbEFVaOTZ6vvY80XkvICEWkVSxS3osiln3o6GYPeqkPH SAgqsZUU/2uVMA6wEYsu8fHtyr7i9TzrbDHGBTKQWsJX8R3CLigXSrg7sDYk1/KkmNK8 oaFQ== X-Forwarded-Encrypted: i=1; AJvYcCUUp287qfPPr0ySdiKD+5LcuBtrkMqOjvYYjRz6oE1R2oPc2zUBO/+C+SESTOOKizPkcAtjvW9Kmv2hLQclOezOnMQTJsVOO8lADaY= X-Gm-Message-State: AOJu0Yz5hN30J6oiEayxsAfrw5bZAuPj5ml9F2wnR4nBXHErgB9lz30i rPVuMaTeWTmczcWWJOookV6xvEbSTTsKrBdP+4b3zrhCglV5mDfEu5PDt7F8sYMET6/DlhSoc3A 3Nn3IivyX4A== X-Google-Smtp-Source: AGHT+IEja+GLVOpS7V2U0r8IR9Z9ZB6nAf9rPU6225JSB7wTRYk1qUU4QFIkeBtYF/8VHx1IHDowrDp0WPzcZg== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a0d:d952:0:b0:627:de82:8077 with SMTP id 00721157ae682-62cc709af05mr798057b3.2.1717610430440; Wed, 05 Jun 2024 11:00:30 -0700 (PDT) Date: Wed, 5 Jun 2024 17:59:51 +0000 In-Reply-To: <20240605175953.2613260-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-8-joychakr@google.com> Subject: [PATCH v1 07/17] misc: eeprom: at25: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/misc/eeprom/at25.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c index 595ceb9a7126..73d60f80aea8 100644 --- a/drivers/misc/eeprom/at25.c +++ b/drivers/misc/eeprom/at25.c @@ -74,8 +74,8 @@ struct at25_data { #define io_limit PAGE_SIZE /* bytes */ -static int at25_ee_read(void *priv, unsigned int offset, - void *val, size_t count) +static ssize_t at25_ee_read(void *priv, unsigned int offset, + void *val, size_t count) { struct at25_data *at25 = priv; char *buf = val; @@ -147,7 +147,7 @@ static int at25_ee_read(void *priv, unsigned int offset, dev_dbg(&at25->spi->dev, "read %zu bytes at %d\n", count, offset); - return 0; + return count; } /* Read extra registers as ID or serial number */ @@ -195,10 +195,11 @@ static struct attribute *sernum_attrs[] = { }; ATTRIBUTE_GROUPS(sernum); -static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count) +static ssize_t at25_ee_write(void *priv, unsigned int off, void *val, size_t count) { struct at25_data *at25 = priv; size_t maxsz = spi_max_transfer_size(at25->spi); + size_t bytes_written = count; const char *buf = val; int status = 0; unsigned buf_size; @@ -313,7 +314,7 @@ static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count) mutex_unlock(&at25->lock); kfree(bounce); - return status; + return status < 0 ? status : bytes_written; } /*-------------------------------------------------------------------------*/ From patchwork Wed Jun 5 17:59:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687257 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 23FC513C3F2 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=1717610437; cv=none; b=ndDR98oGSOpZ2cZdXRGnU9u49E+VQ4StuMjuIQXA6KXVTGd2xSnq3YRDXLUy56EOg4LCnZyEiyJFqtTj+wOYO0udfb3pQ2TuGgraRSGxL2NM75Kz8K6TyETlkOBMubvKEfclOPuocnNb6Weyq3hzDU3azZqN+5sMIABTpOdLOnE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610437; c=relaxed/simple; bh=1Nr1idmwpwCu952z8yg01gYhGFCoooIcYkAZZCQGY7A=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=tR42IhF4LIGnKhW71oQFiM1Lh1IJV2dj6+45iFMem65/PLnxxx1fmqaRUNVf7uLPtfGOMwsNIxLvqq0UiVyqVSsBin+aVcvwYNMiXhZx5erK9v0cAEM+uO39OXsz78rQNjfLyAayx/WV3DAWJezPQzcpBJZN1I2W35x7EUGPDCY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=c1tBtF+y; arc=none smtp.client-ip=209.85.128.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-62a2aec8521so607527b3.0 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=HhQRpBWU1IllNRU/cUz1RKbdarBxqO0jIqlK37Ab4TembeTIIk7bvEZi7058xuh7Cz Hp6Fhl8+rOzGbJD/Bn8t+fqZwFdUMnZEXrWKilTFvvadURVTg55MG8XmAOJ4JHdxBet2 P8hZAWWDcT9nMFnVzlRzCg2+wLKoRLF+4/Wm1OAXhXRQ+b9A9Fk/28FdjFz9+koRWGm3 5V4EF6Qhgv5M7CjHpk7LbHb7RHc+DDpz9QMp5Bx4F747lUKtbzEBZDp1Rtr7fQqfB6qo QE8W+mdcLv/gC/vt29XiTdt4POOobB1poleClGdHXNO6RIhbgHb6Xr9vqpN7Tn/Nx8p9 iH/g== X-Forwarded-Encrypted: i=1; AJvYcCVo1d3tIBNQPjRKSp9kqGJ8vm8M/5WZ8gNMxVIlUKNF3/piXf2aakoxFWm5IyERsPZZfLlameF8yM0NgQcY1+zclly0fpIDLmCjUug= X-Gm-Message-State: AOJu0YxkoRnCFf/ldOeaySVDZ7vn0aBjpkjlaIASASnDSeP72jDYGpRB pH1BgfMx+21+rbqEZPw4AqvIR7l9Td/9dxC76cgE1nOrGhNblKC1T43Y8AnyyFKp3vD9U3DATzj SMxgEHV62Zw== 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-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-9-joychakr@google.com> Subject: [PATCH v1 08/17] misc: eeprom: 93xx46: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- drivers/misc/eeprom/eeprom_93xx46.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c index 45c8ae0db8f9..5d618a13fe5a 100644 --- a/drivers/misc/eeprom/eeprom_93xx46.c +++ b/drivers/misc/eeprom/eeprom_93xx46.c @@ -79,10 +79,11 @@ static inline bool has_quirk_extra_read_cycle(struct eeprom_93xx46_dev *edev) return edev->pdata->quirks & EEPROM_93XX46_QUIRK_EXTRA_READ_CYCLE; } -static int eeprom_93xx46_read(void *priv, unsigned int off, - void *val, size_t count) +static ssize_t eeprom_93xx46_read(void *priv, unsigned int off, + void *val, size_t count) { struct eeprom_93xx46_dev *edev = priv; + size_t bytes_read = count; char *buf = val; int err = 0; int bits; @@ -158,7 +159,7 @@ static int eeprom_93xx46_read(void *priv, unsigned int off, mutex_unlock(&edev->lock); - return err; + return err < 0 ? err : bytes_read; } static int eeprom_93xx46_ew(struct eeprom_93xx46_dev *edev, int is_on) @@ -258,12 +259,13 @@ eeprom_93xx46_write_word(struct eeprom_93xx46_dev *edev, return ret; } -static int eeprom_93xx46_write(void *priv, unsigned int off, +static ssize_t eeprom_93xx46_write(void *priv, unsigned int off, void *val, size_t count) { struct eeprom_93xx46_dev *edev = priv; char *buf = val; int i, ret, step = 1; + size_t bytes_written = count; if (unlikely(off >= edev->size)) return -EFBIG; @@ -304,7 +306,7 @@ static int eeprom_93xx46_write(void *priv, unsigned int off, /* erase/write disable */ eeprom_93xx46_ew(edev, 0); - return ret; + return ret < 0 ? ret : bytes_written; } static int eeprom_93xx46_eral(struct eeprom_93xx46_dev *edev) From patchwork Wed Jun 5 17:59:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687258 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 8B9BB13AD2A for ; Wed, 5 Jun 2024 18:00:39 +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=1717610442; cv=none; b=BYcIT+DabenbIhP/2Ad93P6Ga6IMlCxSgXPdcefKDrSWaLQ5Qs/qvzJegVkjluzMIcCmG08CmqrwhjhxreyPRUdBycIWNH7PS7EBHYKs+c69aXaS0irXjlnBVYUQGWO1NJyi/8p4qxDSMD6Ny6FNPkZmYSi3xcx3JDyp4GRrGis= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610442; c=relaxed/simple; bh=W5M28gmX2P2bsv2kzALbrb00qFmArQmOjGRUC+k0KS4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=SW1+HTmKe/Ky0awDZp1qIW7NqdWBcDNb65Od2JYyuom0MD2I74d5OLIFrDRZoMQpIbNbqFIVin6psj+rmP+5Vk4fv6lQ53KVtl7N2iySDzlaDo2VZ/j9tBzNyOT0+t5Ru5qKRBsk6oIjY0KUR1M83KRvAP42nV16sC6CfibQMy8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=BoWahOKK; arc=none smtp.client-ip=209.85.128.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="BoWahOKK" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-62a23864df0so561027b3.0 for ; Wed, 05 Jun 2024 11:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610439; x=1718215239; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=+5/Bg969zZ0eVFu5myprHh5fQqxMXbek8nDgGOBzWoA=; b=BoWahOKKkJ1D7kfGtrnP0cUxpIrNaZ2suLddLewzR2oz4u7CWziBpzwFHQ+ftzncIs eFtpB/1H9zyQlzicoMJtoEWPK3DPjQzpefAzkEwD6qaiDFV3B0gWZlDhSKPFv0kyzLES mK3VwWf9UebiINpOs4Y5YKaafb1YFVHMwQk3QrRe8v5CIiNxI1jeF5dttXUDVWoM7CnG Marjrxai/k2CObkQx8B/L/3vNKpz1bxj4bvREXGRI3sEGkj1WJCLGHIzNySao6ORHqDb qzF5yPhaXQSrvk1jdn3p9DrUhYQfLvZ2MNZglt0siqP5RZkjDQWbJGwgpmIA/iYYcKMP XYxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610439; x=1718215239; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+5/Bg969zZ0eVFu5myprHh5fQqxMXbek8nDgGOBzWoA=; b=YYNdmKcaQy+F3N2pw1q0ZDWW9awAoS/aqimD4qgLvD23QHN1OpgfFsi/rr8pofSVbl jJeCJWZfxPuyjDiTOGUWmwwRcsEFsp99++opZazQQpj07WNqwyHWduZ3rj03u8TPrMX1 39zb/GCgn2R+mkVqjPEt5xsn9pJZTEekN7Y1IIvVWtOSG6Sur2JiW5QMXn12EA9JYV90 7l6w78K5tY/4Axex1Kh757hZKhaTq1k1ME6nWfW02lGzt+5XBZq/C+Y44ycTjaeZwpu8 3q245eIYps9ZV7altTMq6JvZxRWpcP1LDDieyx+2u9iHRiMetnrr7sK2JpY/25apLLo0 XdUQ== X-Forwarded-Encrypted: i=1; AJvYcCXrH9Q4+5I6i3l2K7XU2T+DGAPTVuu+pogFTevTkDYoSMSnN8hbYU5I+T7zNn6Az2DS+eKlDDILbw5BLQk9JJuCcdVrscHgUJeowmg= X-Gm-Message-State: AOJu0YzHdIiIpFS6IrnhZRqS7Z6niqNfFDRFEMgWBpThFK0MtVrTZkqe nquQjJzirtqDjkokbR92xZJNqCq6Cp0LNgW72tjurAN9rZCUEBLDG0t5FVv0waRnRIjgbX91EaL C4M1ZPv5TTw== X-Google-Smtp-Source: AGHT+IFfzGEzBdG0mJIzkY83NzFi7HVUzu/maRQ4zPj2TdB+TSZFtwNCtZCm0+GEQSlNaviP1mxKnEiXfVn+VQ== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:690c:d90:b0:62c:efc:38b7 with SMTP id 00721157ae682-62cbb4a22a0mr7561267b3.1.1717610438615; Wed, 05 Jun 2024 11:00:38 -0700 (PDT) Date: Wed, 5 Jun 2024 17:59:53 +0000 In-Reply-To: <20240605175953.2613260-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240605175953.2613260-1-joychakr@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605175953.2613260-10-joychakr@google.com> Subject: [PATCH v1 09/17] misc: mchp_pci1xxxx: Change nvmem reg_read/write return type From: Joy Chakraborty To: Srinivas Kandagatla , Greg Kroah-Hartman , AngeloGioacchino Del Regno , Lars-Peter Clausen , Sakari Ailus , Bingbu Cao , Zhihao Cheng , Jerome Brunet , Martin Blumenstingl Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, linux-mtd@lists.infradead.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org, manugautam@google.com, Joy Chakraborty Change nvmem read/write function definition return type to ssize_t. Signed-off-by: Joy Chakraborty --- .../misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c index 16695cb5e69c..817382c342d3 100644 --- a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c +++ b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c @@ -117,8 +117,8 @@ static bool is_eeprom_responsive(struct pci1xxxx_otp_eeprom_device *priv) return true; } -static int pci1xxxx_eeprom_read(void *priv_t, unsigned int off, - void *buf_t, size_t count) +static ssize_t pci1xxxx_eeprom_read(void *priv_t, unsigned int off, + void *buf_t, size_t count) { struct pci1xxxx_otp_eeprom_device *priv = priv_t; void __iomem *rb = priv->reg_base; @@ -159,8 +159,8 @@ static int pci1xxxx_eeprom_read(void *priv_t, unsigned int off, return ret; } -static int pci1xxxx_eeprom_write(void *priv_t, unsigned int off, - void *value_t, size_t count) +static ssize_t pci1xxxx_eeprom_write(void *priv_t, unsigned int off, + void *value_t, size_t count) { struct pci1xxxx_otp_eeprom_device *priv = priv_t; void __iomem *rb = priv->reg_base; @@ -214,8 +214,8 @@ static void otp_device_set_address(struct pci1xxxx_otp_eeprom_device *priv, writew(hi, priv->reg_base + MMAP_OTP_OFFSET(OTP_ADDR_HIGH_OFFSET)); } -static int pci1xxxx_otp_read(void *priv_t, unsigned int off, - void *buf_t, size_t count) +static ssize_t pci1xxxx_otp_read(void *priv_t, unsigned int off, + void *buf_t, size_t count) { struct pci1xxxx_otp_eeprom_device *priv = priv_t; void __iomem *rb = priv->reg_base; @@ -264,8 +264,8 @@ static int pci1xxxx_otp_read(void *priv_t, unsigned int off, return ret; } -static int pci1xxxx_otp_write(void *priv_t, unsigned int off, - void *value_t, size_t count) +static ssize_t pci1xxxx_otp_write(void *priv_t, unsigned int off, + void *value_t, size_t count) { struct pci1xxxx_otp_eeprom_device *priv = priv_t; void __iomem *rb = priv->reg_base; From patchwork Wed Jun 5 18:02:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13687303 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 0B42C144D02 for ; Wed, 5 Jun 2024 18:02:44 +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=1717610566; cv=none; b=YO9CGv+L+JL+KdWul4Ti8tJU7FHYMCXpt31OCrEC90V3qRVEdAyk23lciPoJmSmDeN1hHgdzYAL3wsHfV5FDzebufksoaIskcvGsnZtA+rh9Mp57N4Iv2Tj1JoR51t2IhsmiDPeYZCfkCmXWtMwVzyYYoYXbr3K43SD99gmvBY0= 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.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="bosRmD0V" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-627f43bec13so708257b3.0 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=HKFUn72nrJtaMwpj0tdS+KIsBwES0lrKjUS2andkbx0K2Ys1aslRJED+I2SJzkDJvx cXDTwN0AQfblk9yvOJe+xji7Wgl9LscK6RwPoo3bp/oeFB+Sxl0bf1K9jC2a0IpKcbNw iEYt19UoUdEDWAVo4kiSo8gBWpk1POQ969nh1ijLaZPLtKQsd5CHb6KKfE8YPr8MhXP1 yRZiJFWkSFIwwb2gGL2ZwrY5gHZtETTb1jyG3bgwR6zM5uiTVOEQnElh8zffGtJET9cR Qrapwjpkc0qWemSh0rNYjv8302fJ8NTACxv+guByUAsY4fMkUxeD6W0BlifprSDJREf0 NtTQ== X-Forwarded-Encrypted: i=1; AJvYcCWZPcDfYyA7O6+BeTkCdHpDIII7AQwHqP2R5jl8/zAcb6QkWm7McRF4uFeOQf7fbKQdEdDcjmg3tP/HTC9VoOsPCY2oiOkHd9TFcpI= X-Gm-Message-State: AOJu0YwvTwwn7SudhZZ9CccdjN6PrRzDtDIhiOs8Ais4ki+/43KtJ19B ZCPOQDqa8xFWY0s6/2xBayXXdeEAubcgOzVryVo7jKCf/LMISXeutlqdkp22vgIhWt2bJFE79qr zfq60kvI2xQ== 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-media@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: 13687304 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 BF9FF13C3E0 for ; Wed, 5 Jun 2024 18:02:49 +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=1717610571; cv=none; b=S18uwpW4JnorA2FpMdp/MVVKmiraCYIxUaYAKnqyQFypCLJD0RAqlB6V3Qp8NRZ9Xcxuz8U9vocG5Hf5o5Qn2G63PXdNSaLmbSZMi+8FIv7r3htJEOcMq4nj/Ad+MzjuHVboN5Uym0T1mmzFzJTW7e7YCyOBZUu3X9N9+YeLaRQ= 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.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="u2X6l/Cn" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-629638f1cb0so235907b3.3 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=GI09CCgunx4NDSJX+eWNt7+c4cCabWe2evpZtEOnhO6PPGI6mWTAb080bmv/XUIMO+ AGi8xVVVKGyGWAZ1zQx6kdFM/843ko4BKDAH4W9FzTScWmFsEwdBHYvzT1Gj/2oexZsN v9d3QD4tuB8Yl6HGfbKbmr5WNSB+W/Ip+qCSSXNnYc2Tn2AFwrMrLpVAaLWtiV4i1x/1 o+LaIYST99JBs54YQpacURbOuCVUO1eMNNsrg+BtpGZYRdt2F6DvwZEDAdB6FQmEqKCg iC11s0/oLxPk9Y5R+5A8Tq6og0/d+v5RgTmI3nNTLX4FZjHJOdhcooAP2am7TiXKreJm vJtQ== X-Forwarded-Encrypted: i=1; AJvYcCXEzLSKmFgPuznekw3JaCc1ng5CfdZHejAbGHTIsgA3TRQgv1qgHcXj+Bnjse1NoUEKmar4ATshSqXoSERqFI4ghypeQ7kTuNjqYtU= X-Gm-Message-State: AOJu0Yy56ajvOSV5/5xvexRXEbTOUV60mlhn+c5HnupIS8nuuyLeZFWw zyrrcJULXOnEKxyriGpZ8xjyZqrmEJr+uNtx3gI9hxWD/m1UxWbZKG4uUZb8Adeh6JyUQEKRaD8 PPXF2qFxY+g== 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-media@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: 13687305 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 CA72514E2E4 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=1717610575; cv=none; b=VBljVrE+z6AuzpvLiHfNFsi2+4gciBbDoeYe93T7usWKpFMpwjJ//cc7JOQ03U7Lsr8ubKJK44kLd59ZUac+5dN9+AQTlaLZe2tqaURE6598tDrhEPWkbXjxbjUhmB1a2+RjS4bpHeo2WgYKplLujY6cJXDkQWszfegpvAMO/MM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610575; c=relaxed/simple; bh=3NTGVyytdVyzcHP8txKlFB9YPPGxIJEVxCzu2cUQr1M=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=WyDd2/iVUeMEaJnpsXlxYtKOFZjOEKaANz/jEhOuK6biHnPw+LexIqfu7W/4M2D1n21gRdjxmOhhQQ5wC0CqLADZTE2HhTN4j4ZTYOsvt7ijQSbyGAiR5VSH9KJYYFu6d3YadB+wqjuTzIPRuObNGhvul1w3o/jn1jZNoaYvVGU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Zceh7r4D; arc=none smtp.client-ip=209.85.128.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-627eb3fb46cso320797b3.2 for ; Wed, 05 Jun 2024 11:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610573; x=1718215373; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=qDI8h7ZoQYy75CqD6I2McYIto2hpIA5emU6fq1I3LPI=; b=Zceh7r4DKjZxj+a9nK/QaXDX6PywKjBJO0UZV1S/xJdKXimp/nnCI0wZvsZf0UJhwK 7Q1RjJdda7ewUbgf1avKIEw/IlHVV0/kuQYnDpbGWhedQ8/BTcIzW73L2EnJUWVZdmg+ PZ9u65qivhbL3++hcgSBbL4DG4bWaaEbCO+dFoE8ACY4vUfP6RaLzkkrbcCyH5XWZISy wDGKnK9ja1EPb9k9WJHVTZJ5qM0WWQfoT1vIvHa7kLuHD+Sqbr7dPNAVmelsUyhgUAwX A2L8gG3AW7S8JXvOWrFgHP2ygYbSqPQRbESNpKB37Y6rSBH6lpRPJcUdj1DyHb9Jg1wz zX0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610573; x=1718215373; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qDI8h7ZoQYy75CqD6I2McYIto2hpIA5emU6fq1I3LPI=; b=c5FV4QdfZ/ccSWEIuUIZMY5wrXJi994hbhJi2y6XHaB3jTj/yjYLVttSpkAiF4Xce1 KBbXG9pVyhUe67BXkPPRA94UB64esyL14q7Om04sYs3pDiMkWjHA8lA9sFYpMZSFuLSr oxkBHi6O7IFcrEoRmLn7T+ZpHBNVG3rmR8GFx4l+kGwnxGXmN6/fH8x8Pp/fQQr/CA92 7SbQNe4xWsY8LHLZMJFYQkX5+t30Qdk8irTIaCw9k4FpXOjH1G4emncHLUhA5d45JxRn B/OxAp9dbSZCo+2efRfbPFnQknUcEAZOgUu1G5tXqdLofoIIuP9BhBvLJ3p3/1ykSSc1 HFZA== X-Forwarded-Encrypted: i=1; AJvYcCVNsyRG6e97ZmiQCtTSeuFQxHeO9hzdmzDKd9ERlNRoHW9pT+AMDVTwl/j4SxC4dZNIuhDdzRlWK9qnvPev1xAp/NZrfsWPeSJobtE= X-Gm-Message-State: AOJu0YxTDplAgWUxsbYZCp79ceiA/YSHMmXnV9kBk/GlQmEmZErYb4c6 xM8F37wZaqyaeeDvqwiuKJTPV9ri8zr+mxWEatAyUtK4fnMlldLeaO/hU7lmBmcpGc86m/fZSn1 HvRsok6+tNQ== 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-media@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: 13687306 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 2ADBE14EC6E 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-62a23864df0so603957b3.0 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=koxkhNMfTWldkUYPt2KbfpcEunvyXfzH3H2Wmeu2mJvrcNM+sDhyI+z+OXhA/aCUNp CcQ6EmGvia0NNiFnvM5q9Jtf3NEdU0piCHaG2XIzCJURjnJtLrhtTXafqQ9QNUlChWgV hfbOMF5Jfjiqye4EzVwDcp7Ndud35f27ZSL2VfiuLTtpmLsaGpeeNiMH5H8Hrb1vmO4T sWZscjaYCEUN+dOSzO6c7EqzjML3Hzd5DfD8CLwfjCuDwE1c8B5whkajHrN0lpcVSbZA VBw6bsoHroUWyf+kxN2YXlqOGEqHgIA1KyIigwRfc6KFmp0RIzXBJvur0NEsB/H8RTji jf7g== X-Forwarded-Encrypted: i=1; AJvYcCUAglhwV/KyiEvl2J+gT4AZmU1LLT1bMyqtLplit2E4snpgVGu5ZE3zXkqU5NYfB6/Ozrswuohv51dNXOALrD6lHZ42QkEQ3zkAVl8= X-Gm-Message-State: AOJu0YwBk2IQzuc3ZQk+Ka9c8cn5trE2JZq13X7Cid4XuWoMgq4Y9Z9L CM1Vh+KFAIgY20dQuomiWi3uzYzhgOJirU81C7JOumeM4vDgszkO6r0PqRsNsoKkjGr/InrCd1p cZjdn5SIhTQ== 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-media@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: 13687307 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 688B014F9E9 for ; Wed, 5 Jun 2024 18:03:02 +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=1717610585; cv=none; b=FjwmrBWh2NBgVrKOyhoKMl+BZALDB5YvtiGnekXu+tyUF7EC4B0QXLBew3cJj/zIPpXEfpMV3VZWZyReN2f3l/mKzPaezb1WB510K18sLPfHY9itad4wd4N3tWKS4A/j6nJozXLmWRehMKjqHTLtuzrnf5VG9dxFgCu/8rCHZXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610585; c=relaxed/simple; bh=5F0WRZAIFyT/53498dR8Vin7Zzzm6LhYVaUBgnMWhtU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=rh6lSqI8DHlJYOJiPeB3c6JqM1rI8d4YooCo6HZLBJL2aRur8vqsVmQbDoM1+/HORs57Vr+89BaC5RI89LSWISu4oLyRkVb2gANLJezof5218LFhIGF9wV7EbR8/T6KDYPjIXDla5iSgV5RdHaDbD7aoYzwiVDGgLOEY1i2V57Q= 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.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="Idku6B1W" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-62a089511f9so15353767b3.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=ZDZ+G19G0roVayPYVd0g2EsTLqevTlZi8BAK8fVJ9CRpkl28/+v8Z8CyGKuJLbsn3T B7Cj4/JTqS/UwM1MSJBy+21ndEfEGZZS2WunzIiA1BjQsr8cdTqNdJiHBp8EYlptvJGs ckmMXnu3QLOG0RWWvI1gVVI5m5c2YFXwIRCqpqPEqrfcTLQ5dk9Mi4e1LLeFmHGf5cCK z0pI6DQPM8Gmn6bX77OWQlcZ4dekTEP9mV9uPa/1Bp61wxBK9882iZ6puIu+P1siCDGF WAj59o4A3ooDH3q4TYeqe+g2ov5bTW/4tjEMczGvice4g0qwlLPJ3xArZuP6+ByyJONh 5Gug== X-Forwarded-Encrypted: i=1; AJvYcCWguErYhvoIiLQpLbn/g/JmXX+6hIwTleIatuw6KpOZdXmMmaZWvnR9z3ORAjWnsRpjZvg3uKZ3zwv4pH5EtkO7+siboDi5hvX11KQ= X-Gm-Message-State: AOJu0Yzb8PABFqZwLZGfaKUdSFw/Rsohw7R+HPfIbqeAJacIYb2MSQkd oHHH5yjc+8MPEePz8VGMGoBQcFZnHkHrzlY0R0lkeLK6TJ05CMus3n2h/mKS01Jd0GBDvr0Xgsr 9bGw5RKESXA== 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-media@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: 13687308 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 B3011152DE4 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=1717610589; cv=none; b=lincH/ucxRK7hAc67wUBDug93felFN2ckGVGjzJGHA+bBc/1nogRkTMvKqXRhCKuhSYE0fE7nZawjYC9pIQE3XDnCYTpnlrYwmBKFaMIh6oOpVVyvcG1WLUyMZqGmyzZEx7A0J04CMHeqi9Q/l9Jg/hXt8GSiIh2PdIxtkYRpK8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610589; c=relaxed/simple; bh=fQnAA6GcMGARJcapq8jrHjYduUARBDKjz1Q8WK0DSoQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=uvkVaEKwqIMCHJ567tmv69Smqom9amqEPcULM8nd6sPfzd6hs4Yn/XxBYo//jnH/i0mle5+WyM8iP7uSb2sj2q+ZIJSc9/ZGPCkAskImfop1YlLPY22UqprXM8Z+Ia8eFuG6XCWJzQZBDngnhKV6DB8uTApZzLBTk/C6XlTmNro= 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-629f8a92145so636877b3.0 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=NHo1hxE/rsIcMF0qpWXybGXtsU14vBNoFMKn9ro4OgAXg25rYErDsFCz4WwDWNUn7x uowxEoVHIRV61h2uh0LBZQZDJZU3wE1t5Fm8fJEwDzT2GEdP77BsO9hoKCZDHG0Z4Wrv S5qX7bptvUnFC0N2+OKgvJBWd7QLQwf4JyNaoPNAafwQ608Pyd39G5/4fwGEIOcT7Ud3 iJ4pfneIsZrWTQSF6Lu33xVOdrvxsZNYTa46s3vrSDE5nTSuJgHzzfy5UBIJu4GYlK7w lM07DCWBR627PAKENPI0OhH6z5Ehszex4HhjQCEp4ogbXOAAwZiUukwTyy6F9p0ltqfx bzIQ== X-Forwarded-Encrypted: i=1; AJvYcCWdYNULCyjjxciHI+T21NJ/4WA299XsUR82nuiSaGpPrHFBFJOth9GOdB2kV8aXNCpVV9iNK3dPRewwjbnrCz61ljVwvuPzGBXA1hw= X-Gm-Message-State: AOJu0YyT44HCA2b4Ew/GvcdX5EHsBx1jS0BEsoGh18H8LVVRC3bTBF+W LEzTtkLha+0y0Zq8I/recp7e1JAei+/rVagAiIKM896GkjBQMhOytrfQztnJ9iXDaqPgQBGLsfd OOliSC+MP1A== 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-media@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: 13687309 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 3E35C13C694 for ; Wed, 5 Jun 2024 18:03:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610592; cv=none; b=AXlKONFinaFp9dDT5UQvtcNspNGgVoRSOzpBftRNKygSkk2mTHtnJJELgKDy4vwaU+b+siJxjmdRhcz2qwP9XX6p5ZskQNtF+Z+D8yA66hmU2jq+XBp7axW6eB27mzS5lxoQ99GfoBieIZSgxtvk2YSJpPv2WvbV3/I8appEuLI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610592; c=relaxed/simple; bh=e26lRTuAGuJgmNX9Kn+IMmOklmBtw9bMfbnFAWkr9AI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=vFsBcjU90PAGWolMrfDHX7qNT9i7YPfFFPzm9ZunNfro4bwc1XLG+Uj6SANzd/ZtbTcX2T6+pgT/tb7DgBSr1ZAusCmjm0P2EQgDmHSXL4ihvQ7hmyVcbZ+x9av0wbpUGo/bXyY3MFkW/PK36AQIop7S8X3D/4jp0PZcqCjDGeY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=XH5mJeVg; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XH5mJeVg" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-629f8a71413so473177b3.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=C4IAKaMn+AN8CNRuwLXtSDcsWeRrWSfiVXQMvBNnpKQ6loSbBORYk3/1N0ATJ8uLfF zCw4fp5RFdASnkf3puKlt6ljP8fqz5gep1oHKlTl0PO1XmI7K1SZuwMi4QH9YiG93pOg SI37ld5RkW7EMMo0cd26flO4aUbx19QH74YUu3M6w0LtOjxsc6YplM2pkLnP1cW2Cq97 0FVBtdbmkReDV2ten7PiSkchQqn36YgKqbtAFgIXBkk65qSr5SAJDPCQ0aSRjRenlA/f GjDJCV6Bfd/JNu6SpHcjpfs/zZ173y+/SrssW2R93t+Do8hxQDrwln3S7o+EwGLazXK3 wqTA== X-Forwarded-Encrypted: i=1; AJvYcCVRsTOyPpYg6bSGMdeMeQkNaZtpbVl1YxqRJucGsoLwDTt47Po4ZIcqJe9RZKwuqUzGQ8PcZ+iqIyvRVCjq7UbGNzgdoNqMbd5KmcY= X-Gm-Message-State: AOJu0YwM9/RRMLanW8c6sN4TAdhw+nmvkDHInT4MLsuSnwp6q/+4pwqr KGwNlrJqDBvm4uGeTaIUgdzHEOMrrxhkBy5LKGU8/87Bt7/SLVZNScgemJX7CBMHRw3SzUPzqGs b/D5OExJ9MA== 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-media@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: 13687310 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 3DF6715443D 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=1717610599; cv=none; b=AFZbSTn2hrKeRtSeAe/otfB8jwUjc/3oEPoyVMZdxPqdjEgpebso4yHXflP4hBZmqJYgtVNiDOK5w5jWdcRBmMiXlaaaTqkXkSKjHg1ARCwyYaIPfnxrjtE5oiBaYuyrRkkPN/2kVEAZCs7d0PlMK20GBJ5eumm21nOW1HQ+zUI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610599; c=relaxed/simple; bh=BLTJ41wpBtcf3kU8nmI3BatBDrznlk9b0FbiRiKJMtE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=FW4107xkreokgyUTYKJIEC1Tdiy6YNNuGq5AQ8d4+TG0S2R5nNRlxPDUBUjoWdAZxn5npNnEa7LAY5LfF0pz4JHX/O/VhGu3tlvn675Zepow2jMOstdo4FmQifWhdRcR+c8jP4APUKaKdkk4EmQZenXaKVJwD9P3ZQtlNZDx5cw= 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-62a084a0571so412047b3.2 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=P8A1H7x56l5+bbGcKBm5Vy5juxzoj+L+jUvR7A3OykzJnTmOmv3wzj7qfNBWnId27U uMlMUkYTbJ9N8Yhr2ylX5qAgoHuwU0ChH0BVP4LWQJidYIkFTNHSJaeRIFj92D657rSz 8mpCfsJMabNijDwoHSFXInq8BSFNCfs5X56OJGjxd/Fe4Vj+/Mf2EM5yji/sXR1DaQbU +4cZREVvzt/vu0r0JpsFxnTlGAMPUGWvpsvKhDXw6pi14DclllESIKZsuk+JkGA0xraw APujvT1ojxMFlr3CqeG26tidQgOoh9FHHtMBhT5yosN64ExRixfMa551qKtz5YddJKZT nrNQ== X-Forwarded-Encrypted: i=1; AJvYcCVtKXthBBWsrAar1X2yPMYB97TvHsSQuptJTJp2EWJwQ8TEBgEsCTQzXvONF/zV7ogQ+STsXdVEVGv9YUVEd0l7H/77qNxVFvY+8ug= X-Gm-Message-State: AOJu0YwYVr79aVzgCj7iVz/OkER1dmEfHMxvArKd2iJEfZVHA+/lY5ZR KZdDUv8YE6hWTRSasKf3JqhumqKZygtuofLP4DpS+e17eoAt6QeX8MJISvkEW48X2xOQ+UkNoyw enwbmTWC3xg== 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-media@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; } /*----------------------------------------------------------------------*/