Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1763303rbb; Mon, 26 Feb 2024 23:32:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVgzVmx/f+5cHy1CBJUefI7fjRh8vf140OZ0/9E3TSi/704N+LyAe0GoYf+IRAmUeXeRPE7hcbylGYGJBCr3EnKsrYOkUoFZG0/3cbe9g== X-Google-Smtp-Source: AGHT+IF41pnK5COqIC05GcbRlVfgZXaJDeYrPDwJm/at6mgqVW779A3E2NJTW2JyRyH0ZaeDkxH4 X-Received: by 2002:a05:622a:178f:b0:42e:68b5:da8f with SMTP id s15-20020a05622a178f00b0042e68b5da8fmr12179033qtk.1.1709019132300; Mon, 26 Feb 2024 23:32:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709019132; cv=pass; d=google.com; s=arc-20160816; b=PoN2dF9WfFpOqFRfsCVOtsu7Odf4tdrLVkqbxZ3AzsU/UIz3e2uqig9P8nwJ0voonc zSkjY7YVb4eQtLE3/vwW0QoUJV0BiNjIuBiHSUv8qjk9JCT6TlX+5Reo9pr3s84S0O7i 2HUQ2D4KqeYF84EGvwm+gzRINL6lJJXrUXBz7wPf9yn2uuNkJ1k3wqhr3ALZHNYNS6dP V2rPQrVgC/BcTvFx64al2DYkLN4CcMcoKCrvq813k1GoUN/FTvxaAmgSoT/+jruOAIh3 SAo+SN675Xd7CvRTRBj6Qgtw/lriTESsF9T1PusLmWL4BsR0Ss2BGTvk2V6NZog/pXnz uCgw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jSUIYWEH5Qtv1CeIMfCj1C5pzJnJI8ZZiuth+dpAzss=; fh=LOF4YfWnN5I7wfhD3pgGlpXPtTjPQtpelyEXfN+d1dI=; b=K3RV3SFK0vxnRvqB1Dm86AtK4H20I7igo1wf9/8VZIPRYTSQxVMxoo8C+ymNDQdeh9 vE3bY6EPFi23tlwW85fJu5lwTU8NE9CoZzXnn3DZBx/6iXphcKX2SIKAl2emRuiSGqkm AYuLZ/EZkIaO+x08RJhAqSprk2X9gNHbud7v+YRZHIDBKYb9vfXEC1gEmnUFOUxWzBKg ctN4tJRW34n6PXHPWi2WDWWvxJRTloaJLBXw8VVGGwsVVuGksd3Opmbh6bJ5iA4DnLaH ELkWtENp72b7FaaDuvplHJ9/7ZDbOTONpqv/DA1xYQ4XWSrc6ZzQvEwc7Z3PUcdUy9B3 FNqQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F85mb3rg; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-82804-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82804-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q18-20020a05622a04d200b0042e5c03cc5csi7248935qtx.807.2024.02.26.23.32.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 23:32:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82804-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F85mb3rg; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-82804-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82804-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org 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 137261C21E34 for ; Tue, 27 Feb 2024 07:32:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9847F54BD8; Tue, 27 Feb 2024 07:32:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="F85mb3rg" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A59F356441; Tue, 27 Feb 2024 07:32:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709019126; cv=none; b=flNbCo2J926HDPQAJ83vzU9gqg5ltPcnCO3npa/qNQzsIqIvO/F1ePbRIjmE7c8K4x2VyR1siTIbK1hxwCfkkOCTVXIGQSEJ9EFN3AUYAyum4pjQoAyyr+S5ahF8p2ClaeXCGM5C/8cZeMWsPRraNYWu01TRlznYJFXmWqsaCak= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709019126; c=relaxed/simple; bh=J+BCSTM2zIQiZtu5XInAU+A2j7tVeZ+gnZ2UGP99oBA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lcZNBx14dbzASPmWq95T3sRsTO5QIbuLL7g13bfT8dJ2LKsFmRiqKne5VCsH5CKVYOGcc9lUSJv0mP9tz/trgdQapw3fU81dmJe0iK6uHWB0i7rk3uWupNGCBHNgArCtkKKG1QtO3uMraDf+mtxuvmM3Trm1shd6jm786w6P8B8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=F85mb3rg; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7962C433C7; Tue, 27 Feb 2024 07:32:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709019126; bh=J+BCSTM2zIQiZtu5XInAU+A2j7tVeZ+gnZ2UGP99oBA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F85mb3rgIOL4NXCzALfSEiicT5N7lqtOMgIyQueWrmmd184uBe3KqcksNPr2+upHj O0+sOt8MuSjAp/8Oj3CavrSk9YU4ALImUEGoL1KsjJgP39m/znczmGzz/vTrcZtgYW 2ll6LFjJecyGs8W7GBqPcqxqQ9mibnGjGLEF1oUU= Date: Tue, 27 Feb 2024 08:32:00 +0100 From: Greg Kroah-Hartman To: Joy Chakraborty Cc: Srinivas Kandagatla , Rob Herring , Nicolas Saenz Julienne , linux-kernel@vger.kernel.org, manugautam@google.com, stable@vger.kernel.org Subject: Re: [PATCH v2] nvmem: rmem: Fix return value of rmem_read() Message-ID: <2024022737-haiku-rental-5e7b@gregkh> References: <20240206042408.224138-1-joychakr@google.com> <2024020647-submarine-lucid-ea7b@gregkh> <2024020637-handpick-pamphlet-bacb@gregkh> <2024020734-curliness-licking-44c1@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Feb 27, 2024 at 12:27:09PM +0530, Joy Chakraborty wrote: > On Wed, Feb 7, 2024 at 8:33 PM Joy Chakraborty wrote: > > > > On Wed, Feb 7, 2024 at 3:04 PM Greg Kroah-Hartman > > wrote: > > > > > > On Tue, Feb 06, 2024 at 05:22:15PM +0530, Joy Chakraborty wrote: > > > > > > Userspace will see a false error with nvmem cell reads from > > > > > > nvmem_cell_attr_read() in current code, which should be fixed on > > > > > > returning 0 for success. > > > > > > > > > > So maybe fix this all up to allow the read to return the actual amount > > > > > read? That feels more "correct" to me. > > > > > > > > > > > > > If I change the behavior of the nvmem_reg_read_t callback to negative > > > > for error and number of bytes actually read for success then, other > > > > than the core driver I would also have to change all the > > > > nvmem-provider drivers. > > > > Is it okay to do so ? > > > > > > Sure, why not? That seems like the correct fix to me, right? > > > > Sure, I can do that. > > > > Is it okay to change the if checks on the return code to "if (rc < 0)" > > instead of "if (rc)" as a fix for the immediate issue with how return > > value from rmem is handled which can be applied to older kernels. > > In a separate patch I can change the definition of nvmem_reg_read_t() > > to return ssize_t instead of int and make corresponding changes to > > nvmem-provider drivers. > > > > Does that sound okay ? > > Hi Greg, > > Sent a patch https://lore.kernel.org/all/20240219113149.2437990-2-joychakr@google.com/ > to change the return type for read/write callbacks. > Do I mark that with the "Fixes:" tag as well ? Is it actually fixing a bug? Or just evolving the api to be more correct over time? I think the latter. > It affects a lot of files so might not be able to easily pick to an > older kernel when needed. What is it fixing that older kernels need? And do not worry about stable kernels while doing development, only take that into consideration after your changes are accepted. thanks, greg k-h