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: 1944036 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=U52V+hRs; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-gpio+bounces-7186-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VvZzQ2r0vz20WK for ; Thu, 6 Jun 2024 04:01:54 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 72BCC1C243A1 for ; Wed, 5 Jun 2024 18:01:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C9F515FA73; Wed, 5 Jun 2024 18:00:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="U52V+hRs" X-Original-To: linux-gpio@vger.kernel.org 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 DAAB215FA68 for ; Wed, 5 Jun 2024 18:00:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610421; cv=none; b=OVsKkbAxD8p1DQlyV6FR52g9SrThhOhA+rBuQ9op0xLkjFidI1fvcdKbCgbvOpagufdsZfT7wv0m1wJtN7OUG0d34B0V7OFP74EHr+EEikQM+9HdHnXYpp8mlC92NiuDMOEzs5IzHl7ydgssqAK1zJM0GtIyNNe7b1y3EMdu+ig= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610421; c=relaxed/simple; bh=DtpDZyHe3eugG9lKYAyC1ondYmKEiXhRbdfT84tszLE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=rUQlNx2v2HsY6NnkOeMRuWz6PMQuqLkka2w9WKrkRBR2HBqcdh7ICFEBgAFORE9TZy7H89VD4rgbJ/5Cusx5fAH2c3aGXX3wFl13WNcCEs65mpo5A2RpcZmw+4zWIk0VWCcO718XIwVT+AxeJBblAZTZTYP4h5e/064FKQYyFAw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=U52V+hRs; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-df7721f2e70so1661630276.0 for ; Wed, 05 Jun 2024 11:00:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610418; x=1718215218; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=AwIs39A3C8kh3vVRuRyRYkps3QbjGarBaeH82L3DU0g=; b=U52V+hRsiJQjSRnjvYDtZ8nO3ttKXkTxiHrLjNmADwfjQ8plad8HEMYMkkxmvtoFIs QEZHHMmsbHs8oE4DsgfG7xV73VdpniuxJWGD1uX+sexyHuIPqMEjjQbpiFRleB333mzK cskQ8g8ioMRy6iE5yXCZP8fi72tXA3aLXSn2e//1mmOhKE3l2iZpjrsErUj6Nw8rXBT/ Ls5L9CJrzLx+rKGRzdTKorUXDwYGdNhd3A3/5vELUbwt6as3QITS3EdKaGbEVRNWJanK trjloEE6aIqij88o+jESh2lYoT7HqoWLxLTSIiCFGrQSEuGXKrYAGwKb/WUU8YLm9SV8 ouoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610418; x=1718215218; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AwIs39A3C8kh3vVRuRyRYkps3QbjGarBaeH82L3DU0g=; b=KTKpsTGRj26mcvdXuURdngr3Gju18Nej/nsCVNqK8bGhm7FY5sBftq7y41Y5q6Gz5i NoJxSHCZ/uyCURthErEoVDjkqQaiqbDvnK7sFjCCpoiHPKGCuozf4262N29HOUjxltuJ 8TiPWCW9IAhWSNtYyKwJAjHZcCTC0qjzdUl4m7SxgoiZGnnA7r8gBOhl0AYcLjVjbZuj 3FgAHj/Wrhb5/5SLGmXluuXm7n4j6AL72D+o0RG3LLv7/jfhGZ8IhJYTWXkAeX63H4oa 2duu1Oa/P7bi2gMLlTBX+SErHJDG0HIQUJDZ/bwnvjshu7omLRUaitu/LciZTqTOouQr iJNw== X-Forwarded-Encrypted: i=1; AJvYcCVJr+6UgmPNezn2dR/TMgAYa3KnY0+0VJTyhKbm6/Z1a/u7BTZh0gi/EXNMIXUtyEiFheuvF6d9h6X4vybI6RGaF2NYBawCP57aJw== X-Gm-Message-State: AOJu0YwgidnY/CA+q77c0MjVrY2sSZOMmHQadkFNG76+xonzmctKgOMl 21OzqOEIIKn3IKQQ/n0d52GoVjH5UsXXbTcH/d5MOPV8cDUuw650FonxGw2P40cDg8W2Bq/c4ZU RuGnBd2papg== 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-gpio@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)