Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2068906lqt; Sun, 21 Apr 2024 23:38:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUo0Qt8xa/sIY+7Cnal2DH8jwEeHTzeZS9jaGD2aSLZxZjRN+oIjvQmGtauk7BBVU6HHwWAqhX2tfYJ/yK2FT85Fvc3ppNkoSE91HNAhw== X-Google-Smtp-Source: AGHT+IE9PkUfVQz38vjfDATJXjIgz+nphIJpHxjs086bAvYqFj73inQXRePF+kyyQPGgQKkLKx5b X-Received: by 2002:a05:620a:12ee:b0:78e:d214:59c4 with SMTP id f14-20020a05620a12ee00b0078ed21459c4mr10412296qkl.0.1713767936895; Sun, 21 Apr 2024 23:38:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713767936; cv=pass; d=google.com; s=arc-20160816; b=Pnvu/Cjc3xXUaDMIKnje1oLplOzsl6dEzurMo0Cuw+zkEi2D1wE02ypkIkd0wr2U/F jSLfmN9VDHsq1ppDXxp4zzvuNH1w/h/xd+L3or1y1sxN3XMg2FEL+02KD8zDaVfLBamh qX9Ot3b0BmRWtMbQiZFT5Zen68NARunG1FE7Du+L30zwiRbNVI/f9XLPc4fDLioBpS2F e2+HPmjmTyroHomW1t7rRVq0epKksetE5ggU5iI+bc8p9PSIO1969DhgA9kHAwPI65gl dvVn6Q8Z4yi4DkteAYZzLTpSirkLUfyBag/j68oWkfmE7TwTJiJAJYB2UCg0m6nLe2hM uSzw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=mdXybib/rsP3+c4KKXP0fc5K/LdPF+bB0Lufl7Ur8Eg=; fh=JPEuKYHaZk/VgCvGGEZNGzGL8Zrbi7iJkCnZ53c36Js=; b=QeLLO0ASl4LrJ+Kl1FDWGCI+DOhZb8HESjdAjZCIcAuc49eoL5T0Hu1MWR7Su9XYTq g2GSzyNF6HxkILECoAhmSCA3jArdhFcsByLNqSWkq6llbuQGogxBDi+rg/y+yqHcEMg1 MqX5LILHz+LhJXHtwqaytxZLRvs8wo+Rdy5bs+wxBsD62rPsBbwUq/o2eeSL4uQFgdwB 6vVayONnB3rRyDMxOyDr0q3aKna06IGUqzyl3FfFnX3G6jVyegn2p8GeSt6NT/g7Km8T Sdsw86JhuP+S+dYoE0JbKZ4MNQbv6W7OCvUgPJ4Y+HSpLOYgatZptm+rBLSxZwu+aZot TMgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kBQKCjb0; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-152793-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152793-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id oq38-20020a05620a612600b0078ede0d1ecdsi9445103qkn.529.2024.04.21.23.38.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 23:38:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152793-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=@gmail.com header.s=20230601 header.b=kBQKCjb0; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-152793-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152793-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 8E7231C21C94 for ; Mon, 22 Apr 2024 06:38:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C7391481BA; Mon, 22 Apr 2024 06:38:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kBQKCjb0" Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (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 48AF11391 for ; Mon, 22 Apr 2024 06:38:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713767929; cv=none; b=kfzbyq6ga7jzrZ2sFc/ngMlk/h7iMYSXP5nYQWWzIylkXgVFNBg0mhF39jbgs/1r0YeML3Cpw+T5JGJbkqu0spOJbE9F8IJCKI2UJZluImPBjvgqyFTM20qoNlkvA0SJ7MWBYeHccDzEgUOhR9psQ1O+MFH/Jgd1a0jq3VF6BcY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713767929; c=relaxed/simple; bh=3eQW+JNpbvFE+5C8YsW1ZzfW2vusQDIloy15dafy2jw=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=pBZF4Mu6VpZY4MXQ7SarxttYbxkmdUML76BLQOMWOD724rW6vXEfLNBcDYIw4Es2bUd+orUBs+KJv2hMJab0GHs+vEhm1R1Mnq/xfOBcb9/sg5kXruL6DbvnmWHXMfBg+Jtz/s/cYY/G3dU/rk2k/HcSwkcBWh1Y6admlJCO0gI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kBQKCjb0; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-51b2f105829so817094e87.3 for ; Sun, 21 Apr 2024 23:38:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713767926; x=1714372726; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=mdXybib/rsP3+c4KKXP0fc5K/LdPF+bB0Lufl7Ur8Eg=; b=kBQKCjb0++sViXNz73TF4huQDPJ5nxeom9DCOcvIVQzZO37QR4NcomvaDPaZ4wKX0E pH4vU5BqhNxUdvY4ewKyoq2K5w/tJ55M2JFAWVKxV3TPwYrGOHdTknrKcOwzaJ9txk7d qBvBhZ6+RmtsC7T8fA6CT1O9WLWRJ4Q4UGFT9hbiQ6zmdldngM/jbmoxHylkkU4nbvwD 7P8Ozxc+1NTNdDgl8Ueb+qxwynLgDvuX0m3wzTZ/xciMU+AYRSiadIsmIBYYQc3Me35o ioNDLF711iDGEfDjA3w229gryR5E8d+i1BRTowiwx0VeHohFI7DODDM0bu/QH6pEQfDK 3Www== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713767926; x=1714372726; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mdXybib/rsP3+c4KKXP0fc5K/LdPF+bB0Lufl7Ur8Eg=; b=ZrjjqKmv2JqmCNcbSEOyM15Nw94w4FP5tOWLtUAi/QPpFiju2mzWS2iyBKX28dhoNY zQZHaHWWaX4UfmFJrx55ZC2a/ppTi1zSH3ltgN1T+4DJYUU1wBI6cNIDr6STgGnrXiiA GKK8DrvGEC0RkoRXAgDSDFzVYx7I3twGCKlK9wrSXLT2LnYB2p+kIdkmU6Wr66HRRNrU Unn6HRCWvQzuMI08lRz6QSWAOM5ohC1gR5zAuCEMpqlvR9MCtH61l+d5ochfuoHL9PTr uqKq3n0RtdcqMWabyn+65gDO1Q/rAuZW3nZGKXx4tlaOU45C477NoQjODw0MgpjvMPgM ZzFg== X-Forwarded-Encrypted: i=1; AJvYcCVET132U9vYyiITww8s9m2vSgKSNO8YZIDXOxGSCjA+oANdzLzci79lpvKmbVuOWJQa3qMq9+kDxI4G90GVrHfF3Am8Aq1Uk4J9KQm3 X-Gm-Message-State: AOJu0YzLL0IpOnqCQJWYK3wz0MIo3jOfrsX9ZIywfzVmt+pFkhnFvFAm B+ucuByn0rnc+KtS0KwqhXQd7pJ5R0x50Tj+Nqi1xltIuhVMDYt3 X-Received: by 2002:a05:6512:159:b0:518:b283:1078 with SMTP id m25-20020a056512015900b00518b2831078mr7445735lfo.26.1713767926068; Sun, 21 Apr 2024 23:38:46 -0700 (PDT) Received: from drtxq0yyyyyyyyyyyyyby-3.rev.dnainternet.fi (drtxq0yyyyyyyyyyyyyby-3.rev.dnainternet.fi. [2001:14ba:7426:df00::2]) by smtp.gmail.com with ESMTPSA id g11-20020ac24d8b000000b0051b5efe5985sm73646lfe.255.2024.04.21.23.38.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 23:38:45 -0700 (PDT) Date: Mon, 22 Apr 2024 09:38:33 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Liam Girdwood , Mark Brown , Matti Vaittinen , linux-kernel@vger.kernel.org, Aleksander Mazur , Guenter Roeck Subject: [PATCH] regulator: change stubbed devm_regulator_get_enable to return Ok Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Rg411aW/xVskvZh1" Content-Disposition: inline --Rg411aW/xVskvZh1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable The devm_regulator_get_enable() should be a 'call and forget' API, meaning, when it is used to enable the regulators, the API does not provide a handle to do any further control of the regulators. It gives no real benefit to return an error from the stub if CONFIG_REGULATOR is not set. On the contrary, returning and error is causing problems to drivers when hardware is such it works out just fine with no regulator control. Returning an error forces drivers to specifically handle the case where CONFIG_REGULATOR is not set, making the mere existence of the stub questionalble. Furthermore, the stub of the regulator_enable() seems to be returning Ok. Change the stub implementation for the devm_regulator_get_enable() to return Ok so drivers do not separately handle the case where the CONFIG_REGULATOR is not set. Signed-off-by: Matti Vaittinen Reported-by: Aleksander Mazur Suggested-by: Guenter Roeck Fixes: da279e6965b3 ("regulator: Add devm helpers for get and enable") --- Please find the report by Aleksander from: https://lore.kernel.org/all/20240420183427.0d3fda27@mocarz/ This patch has not received testing. It'd be great to hear if this solves the issue. I see the regulator_get_exclusive() and devm_regulator_get_optional() returning errors. I thus leave the devm_regulator_get_enable_[optional/exclusive]() to do the same while wondering if this is the right thing to do, and why... --- include/linux/regulator/consumer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/c= onsumer.h index 4660582a3302..71232fb7dda3 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -320,7 +320,7 @@ devm_regulator_get_exclusive(struct device *dev, const = char *id) =20 static inline int devm_regulator_get_enable(struct device *dev, const char= *id) { - return -ENODEV; + return 0; } =20 static inline int devm_regulator_get_enable_optional(struct device *dev, base-commit: 68adb581a39ae63a0ed082c47f01fbbe515efa0e --=20 2.43.2 --=20 Matti Vaittinen, Linux device drivers ROHM Semiconductors, Finland SWDC Kiviharjunlenkki 1E 90220 OULU FINLAND ~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~ Simon says - in Latin please. ~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~ Thanks to Simon Glass for the translation =3D]=20 --Rg411aW/xVskvZh1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmYmBd8ACgkQeFA3/03a ocUbigf+Or1olindwWniGUvsvKbD2+e/Py0Q8NabGsgw+6C8v9v52h3ljswHSNpD mUcbz8n3TOYj84NHuj/AF85fERwLZS11KpCZirE8uKEPP4lyegQ9WcS/0ELuku8j lmT2RyFWQr5Y81fMRiO7/tllHSIWgluBfHDIpEYYkClTyXku4eQgAy6UV0EnMHDR wo9fL2SX7Okf45y0+XW4CdOHFQpo1BVTXu4SKaotPEcvBQMNArjmWpZzG7lOCnmz iA9oZxqYGPPVf3p9OFKWFMDJaJ2wZpOIZmJEz0jGGPQU+wwwceTmszI+hhZCF2N1 8kZ6IF0mnNCn7InzsWOdvhxm0P60gw== =bXwe -----END PGP SIGNATURE----- --Rg411aW/xVskvZh1--