Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp951919rdb; Fri, 16 Feb 2024 00:02:22 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV28e3aGWak9sWbpBY15Nkh0Fe7ikrKIJN3OewLNawnAn+8QZkVbjGwu355kHgIbwsZreNuh1Lgqhkj2MRA/Gsps/5dOUCw1HydocxxDw== X-Google-Smtp-Source: AGHT+IFUeE/iXeA2dFr30sc7b+OODXfrC6vYP4h26RSWnxSWOQ26DZVNQdHP2tbWkbrufKeyg6pe X-Received: by 2002:a17:906:185b:b0:a3d:b660:c824 with SMTP id w27-20020a170906185b00b00a3db660c824mr1654614eje.69.1708070541997; Fri, 16 Feb 2024 00:02:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708070541; cv=pass; d=google.com; s=arc-20160816; b=n3tIeHywwsQ/sqFg5LeoOuIB/mLBmRohERI6Sxg5aP/U8zpQUMJp+NbO3Fxz4pzCGq +HJD7HeRiZ83GMeb+SH5ViKIPzFUzzZW/aVhzXD41lqicXL+DQKA2k0xasecJR8kzqMP ZuGdZ1zGH8Vn8jGTpvVyCFgmbm/xYrzlljpUCg2plaPkOQXB6b+MREnlh3BgDvULIPU/ QGHeOiAxKD5d0t/1i6A99pV6APFjub1Vo62XqV1qO8luT627H7bb/od5evmGqkLzkA8D AZGDLkChxRONjzcC1qg1ktOpYilD6/gVleJzcCVI6ZqT2B4eKPjDHcZHhYoQzjdFvb+3 tChg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id:dkim-signature; bh=VVeiECxEmwSLffzbtwy2YG4CyEm4W66/wRiP637DW7E=; fh=nXs/zBkC1fyGT1Fbmmp5YZLdzFQCtlsfnl+UZiYevqg=; b=nNd4pQrMwYFl+JZXnfgEyGqmEmu7Y2EVEKh1XvefARfLgDnVDVR/LNCZ3ADwyG4SNh Y+mcbVO7yVJgbEs+51+fqnBlXzbxBd9m7NsqZUR+sqh1IrdPINVeD0QEoCOxNS5r3Iom 1uS1bYW300s7wiCfVrjnWL/csaxIbfqtBO9lXwzzpSvXZLYUleSnR+jygO3nb0b0FuJo Y01jZbX/NCbBEj0rsrQU62th5llN/6htKwxlrEZIGAxXKBBKtO6UWCDRYNj5oU5NMh7V wDQcrFXBsd7V5vend0Fpr3w3SfrS82SpAF46iCDBNiUblh1lNpz2rsOg5+yGr8yNisZ2 Ycmw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=psvjRJ16; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-68190-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68190-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gs18-20020a1709072d1200b00a3dac7c827bsi1052462ejc.155.2024.02.16.00.02.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 00:02:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68190-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=psvjRJ16; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-68190-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68190-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 2C3241F25737 for ; Fri, 16 Feb 2024 07:52:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BB2F17756; Fri, 16 Feb 2024 07:52:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="psvjRJ16" Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (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 529A514AA7; Fri, 16 Feb 2024 07:52:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708069947; cv=none; b=EWWBYoO03aSTFW5eGQl/t1bPV7dLn3ua0RgAaUjD0xca3Q5UDOnnGShvOA/C0WVLUMYQVvdg+PkGhlAyr/HYS+PbkiSRK3YCQcw8y/lPmyRZBrqK7uDjTzqA1luJVyxV61ZwVHWsQHmlh7vWYHOKgZGy/gp5wHCQt3187hjj5cI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708069947; c=relaxed/simple; bh=Vynf5DoweuXHHLSE4lGddXqNt/Xoy7UcJ0TOB9VRc/E=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CzOS56j0mTVZbS5Fas+NbBIaKHFFXv5XOzMqxWoE75vLho3eX/tZnLoGlFog4nUw/w9tVdIiiVslLcX5wrvZeh452YXxl3D6nNYxx3JLIrVzXb/YxwzGk5xtx6upoV+4z41d7XsEmsWAiK0P3kos9d75EO1ZBCEtR5iijHcMXNs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=psvjRJ16; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 6DA131C0005; Fri, 16 Feb 2024 07:52:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708069942; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VVeiECxEmwSLffzbtwy2YG4CyEm4W66/wRiP637DW7E=; b=psvjRJ16HrEu/GqFLLL7wMMfKBPT08MCl4ar0FAhJ0EKI6MP0fdlU9/TMRf2aJcPbYuHTT Y/XaWJ5OWcn2Ggc41n+8jK67j9PIuW99NYEcgM6cqWyWbdDssXoZ47Z7/Z2Iy53x05h9Eb B3p8wByuOej2VhFVfrmVTvV/uJNYxSvZtxPhi08Uq7ysqNY/mn4KsAxzwT0Vnpk33SKyAH 9YgXPL9T+KdVxh3hEjjdo9kwWrADnu9szuZSYl+ofMyLx2D0BOytKOrgIrdNHN1q9n9t2b +MsYZsZV4HOyhZnFWK6rQfV+wPw8aelkKg/RHraSCGZQOpQOZcJmL1zXzqpfMA== Message-ID: Date: Fri, 16 Feb 2024 08:52:17 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 05/18] mux: add mux_chip_resume() function To: Andy Shevchenko Cc: Linus Walleij , Bartosz Golaszewski , Tony Lindgren , Haojian Zhuang , Vignesh R , Aaro Koskinen , Janusz Krzysztofik , Andi Shyti , Peter Rosin , Vinod Koul , Kishon Vijay Abraham I , Philipp Zabel , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org, linux-phy@lists.infradead.org, linux-pci@vger.kernel.org, gregory.clement@bootlin.com, theo.lebrun@bootlin.com, thomas.petazzoni@bootlin.com, u-kumar1@ti.com References: <20240102-j7200-pcie-s2r-v3-0-5c2e4a3fac1f@bootlin.com> <20240102-j7200-pcie-s2r-v3-5-5c2e4a3fac1f@bootlin.com> From: Thomas Richard In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-GND-Sasl: thomas.richard@bootlin.com On 2/15/24 16:29, Andy Shevchenko wrote: > On Thu, Feb 15, 2024 at 04:17:50PM +0100, Thomas Richard wrote: >> The mux_chip_resume() function restores a mux_chip using the cached state >> of each mux. > > ... > >> +int mux_chip_resume(struct mux_chip *mux_chip) >> +{ >> + int global_ret = 0; >> + int ret, i; >> + >> + for (i = 0; i < mux_chip->controllers; ++i) { >> + struct mux_control *mux = &mux_chip->mux[i]; >> + >> + if (mux->cached_state == MUX_CACHE_UNKNOWN) >> + continue; >> + >> + ret = mux_control_set(mux, mux->cached_state); >> + if (ret < 0) { >> + dev_err(&mux_chip->dev, "unable to restore state\n"); >> + if (!global_ret) >> + global_ret = ret; > > Hmm... This will record the first error and continue. In the v2 we talked about this with Peter Rosin. In fact, in the v1 (mux_chip_resume() didn't exists yet, everything was done in the mmio driver) I had the same behavior: try to restore all muxes and in case of error restore the first one. I don't know what is the right solution. I just restored the behavior I had in v1. > >> + } >> + } >> + return global_ret; > > So here, we actually will get stale data in case there are > 1 failures. Yes, indeed. But we will have an error message for each failure. > >> +} > -- Thomas Richard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com