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: 13687243 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 E5CE314EC5B for ; Wed, 5 Jun 2024 18:00:18 +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=1717610420; cv=none; b=jtISd9J5YZi1sRZaeYOu7CBAO0kAgyebSw7aW5xlfRxdqa6Y7PJGAY+GvGJGKl30+3RbCKN+lC78/uyJQQA6QsFLm9bwtJiI4gSt6pRVOn7vxuryOn29BUGzqzlDKj9tbdMDtJGRtcmOzr/qnIgpKDaxbtaqhYSI6uuhxTDQD0k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610420; c=relaxed/simple; bh=DtpDZyHe3eugG9lKYAyC1ondYmKEiXhRbdfT84tszLE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=C8RTv7ndPyW28AaxEoqDNSTPoLwojNzDvi6pGcyFewRJWyAuRdsBN9jEnOhCGDmYe4kYupEbIHt7Vh5Sx8DarGy0EzTGSaMyTkbbvYs1cmTQ6OmKrigSzbIMor2069HQk0boTWN9aWMRpRthYpwxXkgUaVCh6z6Y3nqqc3pGlDM= 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.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="U52V+hRs" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc691f1f83aso23575276.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=Uj01CqnTlMLi91Sccwj5o+/p8+Zoi/0S0qBX7nZIaof8lnN0ARmQCaGYI/lP9nu38d 1npEiOioWZu+6jKhSrEEolCuBbND2BsL1rgimY6QIrY7kQNVQd8qk7UNBjw/UI7Kp3VZ 9ji8ohDpqJ2OibVLfN86f78l2XWTyVMYRfIaQ6B/4RItJUt3CLaJPxKGk25A8eyo8PaQ w8JAEvpFhM6fbxCoDzAGrUtx/mq1Z5cIjYy1wfX/Xkijp8mZHD/cMpliCsJglOG+qJgk vxkzMRlj0+Ne8QMTMs2rNExuSy13pXkbOT7XBdwLZmVk+EZCH8CcHy1t59yvBpH/SaI0 jrxg== X-Gm-Message-State: AOJu0Yy4xdSBxRZH74WR/CIuFifqc+zcApjTVkMKWWaH56XNlDyQQ2Sg Dbv6MzMIkVGHyFoJ1Jf3iTY77W9QcoAfxeThCsJoUXRpIicHf70gKGEmE9bJHpuLLkGjABsA0y9 9UAuGEynuEg== 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-hwmon@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)