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: 13687247 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 24019195F3D for ; Wed, 5 Jun 2024 18:00:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610438; cv=none; b=pPNtlE7TZjd9d6I86jZu5IIOsmLmx6saMwKEjoL+xDnO766sXF8Jea9oJQeQwAYMfIpcnjRg8R/cHyjI2tMDjeyG5JId5yVSz4P5NaSQztDZhcuv/eQT3BBi2BpCJ77gRgVe5SyaQbg0adkV9KPxQe16iaprirUrnoYGcWe7YsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717610438; c=relaxed/simple; bh=1Nr1idmwpwCu952z8yg01gYhGFCoooIcYkAZZCQGY7A=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=H26OaH849yRcO0xxcAaqYlUR++uNsZwuJxIpzJ9iybHVhffzP/RoF6auCc0hF8BAwe/SMgMExyEjGke1Q8wCp4PjKUk/nAY3j80mlJL25dj+LCQOmbFzz/rGneHOr4Z9SEnU1+ErxsC/b7fo7+XJdJQURKmjpGWSVSPh47RuAvM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=c1tBtF+y; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="c1tBtF+y" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-627dd6a56caso262547b3.3 for ; Wed, 05 Jun 2024 11:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717610434; x=1718215234; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=MVw14u+NFBf2FJ7HWAHlLpDDoc6dqDnKHHZFCo9Dzmo=; b=c1tBtF+yJ8uoGUqKF3NY2+DNv0U+YbN7XP5vEddV+WJ7paLKxOEOglfOFz182dQWhI TpkluWnQxtAvQfp05jLsz4zT9dm3xfsdzDHh1yzr8/nmaSz10c9q8p1TSIS4ycb9XjL4 +kZT3Co4WBmgkH8T5xB5TRVYwTeQD9Vt+Y49WRFALEILqv0lqjfHvGNKs5cdrawGsQq0 zlcEIgFN0D27pd2iV8Hc8uPpS6COn5E86LdPT12ToZhOr4ISvKhsf5WLKdzwsRexu4qm 8nydig+D2wj90/ixelEJDLBX4o3t/wkbBmdzYkGeDePYPMVOnQXT2td5EkySC3qAkgu1 qPIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717610434; x=1718215234; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MVw14u+NFBf2FJ7HWAHlLpDDoc6dqDnKHHZFCo9Dzmo=; b=Zsrwaqea7zvfibErrObz4tLrmwFPX3jKM3YxIqtEP8lgct4F8VlP+mAFR2qW22N3n9 i7/69Wq7hRzpxrsBDup9AnkXpYAcHcrv4u1x8SiilPFYc9xEs709zXEqle75Fgm9DY0I QXywbB6UKP3tixfDK4AjNJEk7tFi2HrJQh10UCimvjPo9pnLHa+CyVpTF08wni4/2W4E IBEsklpN0xQdocpUBdgtme1JWqvsveqzz0LBlgYz1K4+k5vQTTTUUFMz8rgJ/snV7dde JRM1uMStPO9kCIcry9Rn3T0tUClDuN3OuPI/9sIX6dHqek1uW6ihDggOpc620Oh72MG5 JdAg== X-Gm-Message-State: AOJu0YxTT4JDFCJ6NgC5tlR1MKdRJYdtBZDFgaE5+dLyQIk624kbIo5x 0CdoLSichfBBRkFfF9IwdIVwSao1oS6pv5L2JhOtHKZvoPziOrH1ATasx9A/iqpVX9iJMNXr9hf 3fzP3CDdS3A== 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-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-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)