From nobody Wed Nov 27 16:52:42 2024 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 6C92764A8F for ; Tue, 8 Oct 2024 16:07:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728403667; cv=none; b=RfHBrzXS83mB7LiUeqygDic1z1M5VNFphXTo6dVS2QYI77+QyKiBOIgR/UcQIpyFORW9jBLWwVJYBtWXC3IdA0F1jdLFQ5YDEfwcRwzro+F29oRXDKWoJB74/0sD+yHRsxbCmlMiBKKOvTNIw/64Oz6G+3uVHnSFGnannTdK5IA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728403667; c=relaxed/simple; bh=Q02JvgZpEw0CKuh5bAD1hiL/2cF0mICLfBLjEWGs5gQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C79+PzYl7UfOS2PpLNVyAI5l9l+E3xn3zApi7KuFC0DLuRokHwYKukEMqA/6EP/7qCJo0ibZgx5311aZFZlgkaULOWWcEtL09PN5oKjCxUPfEfjAmgdSddIyLm3Y/MWXNbiDj4PdMLy784mnW+CG9p6U5+pYZsHBd7CvKvj1DWs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=h56sa1Ts; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="h56sa1Ts" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-5398e7dda5fso5866575e87.0 for ; Tue, 08 Oct 2024 09:07:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1728403663; x=1729008463; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=7iY6njGfqCiqj2LmxQwsaHq5nfhgm8YldXS56w+mUoc=; b=h56sa1Tskxg5I3S6Fy4HQpTHJg8yN4Yqhr8yhawzctt+Hou7joCBgiZOH9midx0iNB zgFLVNYTjw7oqZjK+14lflFyFruv1UlXaOW7CAjGEkvNqmCsC27ijWCjgqEO7D2WN+Ra bkVIRzyGmh9tZxIVtaU3g59W79ZDez0Pz0VbJS2eion4QHbEWrzPxBoKeBo/glfTO05N c3ilkThHcUJwId6rF6PLglnR2TiZjzqM6eLcuQTM3Vd7WPjFZpIO1hTMqqPM9n2f/TFB D/pFrsfhxZZcDRFwVXYpbXWB4+odKTjASdKaREk0ciGDVYj+Filmb+8ThdAcm7L/w0sh pqKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728403663; x=1729008463; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7iY6njGfqCiqj2LmxQwsaHq5nfhgm8YldXS56w+mUoc=; b=KjDhkWK1MkfZjNkKWNH2FgXFWtpN0xpf9xax3tWmVR0NOQvNdicyqhG0fR72NUctI2 G6TTk0TSFY9uwFtUF8KwAJ+ZhY908YhnkkwONKcVuSLXqHeQwp3NtxWhPax5eVapyrh5 cr1GJrkOsGjciClBQCMzFOu6ZeY63Mvaole4AGsM66smkzOrM//tZlxhyG1Oa2zUgaTG nQXK0mF0EtOv+b6D2c/nfUO9KQ8vTd9Vyfc0QNFf9wYfRS3TQ7aVnWtmzvMTrsLm+ON1 ljmmVJyOy33foq/03tIE4WaI1nsEBxhdZBREzWsog3ykuJhFXDvpfbLjMHRYMAGCRma/ 3ppA== X-Gm-Message-State: AOJu0Yw0jDlMLlZKwIztrDe1QFb8mJY7wFeI5zhK16qoXF6rWL6AfuqG aVf87rEF19dAVXgHC54kcNkypuBOghg+fb2vpmFEJBp2VfiCsrdU+rinsRrjAYg= X-Google-Smtp-Source: AGHT+IEK+i7AarbSnC/AqQomD1+MfurzcjNVvb8QbEYHSrEJIyP77gYrO3OXePZiXZs9A7BSH5Dh0Q== X-Received: by 2002:a05:6512:6c6:b0:539:94e2:a0ce with SMTP id 2adb3069b0e04-539ab9e7f85mr9040976e87.59.1728403663364; Tue, 08 Oct 2024 09:07:43 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:41f2:4244:ce34:c273]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42f86a20537sm131509375e9.15.2024.10.08.09.07.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 09:07:42 -0700 (PDT) From: Jerome Brunet Date: Tue, 08 Oct 2024 18:07:01 +0200 Subject: [PATCH v2 1/3] regulator: core: do not silently ignore provided init_data 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-Transfer-Encoding: quoted-printable Message-Id: <20241008-regulator-ignored-data-v2-1-d1251e0ee507@baylibre.com> References: <20241008-regulator-ignored-data-v2-0-d1251e0ee507@baylibre.com> In-Reply-To: <20241008-regulator-ignored-data-v2-0-d1251e0ee507@baylibre.com> To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Guenter Roeck , Jerome Brunet X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3322; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=Q02JvgZpEw0CKuh5bAD1hiL/2cF0mICLfBLjEWGs5gQ=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBnBVjKhV/lugejOqzcQ69eCAtrcHGHIGd7GNR+b wGYCNiHpVeJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZwVYygAKCRDm/A8cN/La hdFoEACGy2v2KWidDFR5bxRYY2ju/lOgqS22utl6spsvCDY5CrhC7/lm4z5giUf/r+0o/5qN+uT DbggD8QDO9/qnYHTvDHAQ76dDkqlOC0EbCeeRLmvuOQ9qrKKGs8GNoXxVrAmIV+85essvqUut+m eaQUdn10DaixWmxe7uSdmOmLCyY/rzHI3vamJg5BQnp+gIm+9tT8rTU3YrxJuvodMeUahE1hN+L sjutF/KdIL+4PjdkIC7vqw27hFydjHSOYikmQWPhmPBkhUxf74jzsiFjn+d3xuPqRwQKDYJFBH6 xxjS683z1VYcXgJrE5EVwOcZF6KbLxP9+3BTmD3zzSrwTkoM1H2AdrVDk0s9TplK/ey8TwH1fEj pVJGMg0Cf6p6dNkz8NLYRot5cQJxklh+vkf8ZE4V44nXmayla7Ckn/xxv4+ABzkVi3VkdNiRp+i udqTqeiBdxjmpU1hdrcVAgzYcaLChhJAoek6LdVuHRJfNN9tDjzj5tWMeO0BNF3pMKgtT4e0AoK h7Zh8+jXcwQd0x8DiR67UKxj1i/7v9ip60fJPtloQcxsZayNGX1Ya9PIS6deEqnA5/Ljsd3f51c ehhVyD6RUu17IbclnppLbAKopZv0itYgNNVf9p4NGTcsNKVOSMevwrH3wK81w8u4B42oZdjZmW+ zhIZUnVtDVuUMSw== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 On DT platforms, if a regulator init_data is provided in config, it is silently ignored in favor of the DT parsing done by the framework, if of_match is set. of_match is an indication that init_data is expected to be set based on DT and the parsing should be done by the regulator framework. If the regulator provider passed init_data it must be because it is useful somehow, in such case of_match should be clear. If the driver expects the framework to initialize this data on its own, it should leave init_data clear. Warn if both init_data and of_match are set, then default to the provided init_data. Signed-off-by: Jerome Brunet --- drivers/regulator/core.c | 57 +++++++++++++++++++++++++++++---------------= ---- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index d0b3879f2746..a58a9db3d9c7 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -5681,32 +5681,43 @@ regulator_register(struct device *dev, goto clean; } =20 - init_data =3D regulator_of_get_init_data(dev, regulator_desc, config, - &rdev->dev.of_node); - - /* - * Sometimes not all resources are probed already so we need to take - * that into account. This happens most the time if the ena_gpiod comes - * from a gpio extender or something else. - */ - if (PTR_ERR(init_data) =3D=3D -EPROBE_DEFER) { - ret =3D -EPROBE_DEFER; - goto clean; - } + if (config->init_data) { + /* + * Providing of_match means the framework is expected to parse + * DT to get the init_data. This would conflict with provided + * init_data, if set. Warn if it happens. + */ + if (regulator_desc->of_match) + dev_warn(dev, "Using provided init data - OF match ignored\n"); =20 - /* - * We need to keep track of any GPIO descriptor coming from the - * device tree until we have handled it over to the core. If the - * config that was passed in to this function DOES NOT contain - * a descriptor, and the config after this call DOES contain - * a descriptor, we definitely got one from parsing the device - * tree. - */ - if (!cfg->ena_gpiod && config->ena_gpiod) - dangling_of_gpiod =3D true; - if (!init_data) { init_data =3D config->init_data; rdev->dev.of_node =3D of_node_get(config->of_node); + + } else { + init_data =3D regulator_of_get_init_data(dev, regulator_desc, + config, + &rdev->dev.of_node); + + /* + * Sometimes not all resources are probed already so we need to + * take that into account. This happens most the time if the + * ena_gpiod comes from a gpio extender or something else. + */ + if (PTR_ERR(init_data) =3D=3D -EPROBE_DEFER) { + ret =3D -EPROBE_DEFER; + goto clean; + } + + /* + * We need to keep track of any GPIO descriptor coming from the + * device tree until we have handled it over to the core. If the + * config that was passed in to this function DOES NOT contain a + * descriptor, and the config after this call DOES contain a + * descriptor, we definitely got one from parsing the device + * tree. + */ + if (!cfg->ena_gpiod && config->ena_gpiod) + dangling_of_gpiod =3D true; } =20 ww_mutex_init(&rdev->mutex, ®ulator_ww_class); --=20 2.45.2 From nobody Wed Nov 27 16:52:42 2024 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.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 3967284A35 for ; Tue, 8 Oct 2024 16:07:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728403668; cv=none; b=C59qPCZDToMU4ksgXWnWesMvB88M3bDQRhaq/GJTGKr4jmYo4wrXUEGYdtDGbbgbODqgrZVKMpRmqNYm0RVIgjLBmjoHZrCMKFfW8hvnkNS6W45D4jTT1+ZCPgcV5eeLgTjbLnxzQxmOqdpEH49robSJvCbM0TgzjVsBsO87IkE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728403668; c=relaxed/simple; bh=SLpYYIhwuRweVEWtXaaExUucJuJAaFTutEyzIFc19Ys=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CDbgtvHG/v94o2UmwC3w/gFTaaNkZue3IzJwbe8VuLO1ArVysQbNO/yFLr9bZU1oPpql3gGU/lTtOE8SAETHyumKM6beLw3PeLX81S06zlO+kpBILUpO2P+ET00PRIq18bikoGr/D1ov5IPW3kjePVwpmQF/+7RqNuUy8NiilLM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=QqXhyUKv; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="QqXhyUKv" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-42cb2191107so52396345e9.1 for ; Tue, 08 Oct 2024 09:07:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1728403664; x=1729008464; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=xDbgGqNHBzRgP8skRhDRSOpGwGytoSrr7Q6T0y3qesI=; b=QqXhyUKvmcZ6S6JtErEvLORzY+4WmK1uRkocfnFV/qQjMZDG/LkmbJPL0wGgSsquX+ UMSMaBlzb3bpfdfhDMsS/UzNGiwq02iZGn0c8bcwaScoMI6F1wGfaPI13GsRP3lbgWe6 DFDxJExcTawlfOp3z8Oso2/aXE1qByI1p/fXtWCTufZ4qNP6LNNPzC+rBDATCxxfUZbn S4BTg+f6f30qXz/rTJMcijaLulROfN+vH94L8IKN3fL79r2WmwL3Pflvtf5Ah/G75M/M 2nFpWWhlcM3f52pa3BmH7Xyt5m+pHyDTzInefCfh3fB5Q3ejcBq005qHkTGm9t29selF zpaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728403664; x=1729008464; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xDbgGqNHBzRgP8skRhDRSOpGwGytoSrr7Q6T0y3qesI=; b=wpQ9u2XUdymbYFyZ6CDoPB2NewrGC7Su1fGwGdy72m+SJBJgTBbRlQjrz6v7u0fBCA Qtn2LdGw+FYw2k/FwiEafBbb3EZqXbR9d7sugNO8zIByPwGFONnkZ25pr76z2YcrO2Ls o4H1bcNt5zCsH1yzNLT/CHhcwr/TTlWg7OzEI1gpAREKKWAa4vzPjRLK1CErXegzdfRt 4ZdHN8GN6nfvyzlKh2Zk5vwkPi4jrU3DxqAxHXOrUUdc7wj9MyeJyDuTRs0IxFPyiQl+ 9Neju2KqpvRuaXT0Ze2VX5UbUpOlhiHvRq4jd/+MvPmO5q2VBXAYMTfDiqIOqiSwVbSQ hwCg== X-Gm-Message-State: AOJu0YzE2d+4i785bFNGZlI0h+gVFBgrzYEzUL8q4iO1GjahRuiRnsJD lZgcFQ3tEoE2Q9tReZJdmdC8qbC9xf6Y5gAdaC3vclHio8khNL428rRVjZFB0z8= X-Google-Smtp-Source: AGHT+IGXf5QLoPw16k9d991f5pOjDzBf+dRdwCs0K8OQU+2mi8LSHFPyk3LIsmXp9D0e6YZQzkEVNw== X-Received: by 2002:a05:600c:4f15:b0:426:554a:e0bf with SMTP id 5b1f17b1804b1-42f85ac0af7mr128799175e9.16.1728403664475; Tue, 08 Oct 2024 09:07:44 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:41f2:4244:ce34:c273]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42f86a20537sm131509375e9.15.2024.10.08.09.07.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 09:07:43 -0700 (PDT) From: Jerome Brunet Date: Tue, 08 Oct 2024 18:07:02 +0200 Subject: [PATCH v2 2/3] regulator: core: add callback to perform runtime init 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-Transfer-Encoding: quoted-printable Message-Id: <20241008-regulator-ignored-data-v2-2-d1251e0ee507@baylibre.com> References: <20241008-regulator-ignored-data-v2-0-d1251e0ee507@baylibre.com> In-Reply-To: <20241008-regulator-ignored-data-v2-0-d1251e0ee507@baylibre.com> To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Guenter Roeck , Jerome Brunet X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1560; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=SLpYYIhwuRweVEWtXaaExUucJuJAaFTutEyzIFc19Ys=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBnBVjLCQGgCHGjYMW07hkUpd8/1wsZMwG2DyQqm 9ahPocghOSJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZwVYywAKCRDm/A8cN/La hakcD/9MpkrwSCOdq50efCzV2yjgLNTwlu4tEX+4aJGvg+62GIfQ24VWjNB/+eCiDcbkoHOhPtJ RrMfm692x+OXYXwmlcKigsFiGYjVakMSzwaesI/WyP7F+JSY8BYY6310gfM6oVaS4fIolkrkQtj CyVcGIs4OF5Mt9IajLJ14vPLp5AtMggjR3GTK6kk8sYQtLudud5kQUYlqrymoHU7467IxAMBY4c wuzCkbkA1+f4gihDoQ3oDHJlTMXHgXVc3paNI0/jKopbDp3cAfmP/F1ZKu0qphI+pLyBCZWeN9z sEYLTAeIp0QupbZ+rAWOHbSdqTrF5mDhC/qhoZwveVz5PKNxXacks1RnJ3gkoCP1vBHseKTlsYj 4gdaKOusA5mnKkSanHQjJiu5zw53Aw4UvytHlKiNrr+6OzH+VjOYkZUtStUxTzkW2x5kdgNuGpj JWzqkWj0gHwZukq4b2o/PNUl2Pi4vtyH5OFbXueRRu3o3LwCOc3VY0EGZ2HjRjw29NsYuTh6PhV FdT4EIihqmcZaMwB426loSAfM2JMqNJkA3bIJAh9GAQTEB1xiNViOOoSFbFMmHhvFTNWn6rjnds pnH48R+jeObUnC9jEpYB9W4Rq7FshcxfOIZbanSzHhWUJkY/zCt6CULRfQcDMunTE+L3YuW37Ve j5qzStF/TsAmV0Q== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 Provide an initialisation callback to handle runtime parameters. The idea is similar to the regulator_init() callback, but it provides regulator specific structures, instead of just the driver specific data. As an example, this allows the driver to amend the regulator constraints based on runtime parameters if necessary. Signed-off-by: Jerome Brunet --- drivers/regulator/core.c | 6 ++++++ include/linux/regulator/driver.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index a58a9db3d9c7..f8b5d596f59d 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -5758,6 +5758,12 @@ regulator_register(struct device *dev, goto wash; } =20 + if (regulator_desc->init_cb) { + ret =3D regulator_desc->init_cb(rdev, config); + if (ret < 0) + goto wash; + } + if ((rdev->supply_name && !rdev->supply) && (rdev->constraints->always_on || rdev->constraints->boot_on)) { diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/dri= ver.h index f230a472ccd3..d2f4427504f0 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -365,6 +365,8 @@ struct regulator_desc { int (*of_parse_cb)(struct device_node *, const struct regulator_desc *, struct regulator_config *); + int (*init_cb)(struct regulator_dev *, + struct regulator_config *); int id; unsigned int continuous_voltage_range:1; unsigned n_voltages; --=20 2.45.2 From nobody Wed Nov 27 16:52:42 2024 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 B45B41E04A9 for ; Tue, 8 Oct 2024 16:07:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728403669; cv=none; b=eX8j44NCCxctlzU28Jhy6F1wqq8FfEv2gOF3oGB5X4YVKh3sOwFogH7U5LFHY6Cma2owpsMknOagD6Iv2rOzQ8oDYUHzOPOpZRbzYsIOxKRzshmjlqthA5rqUBAiot6OuP/EznnNzCxwhKvOsHrW8qkWwNUWDAV+41kzrsXxBiY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728403669; c=relaxed/simple; bh=lhQuXcRpY2zHnZo6m9Qxj7Tw4rIjXk5y2hUFVH+Dy1o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mAdMJpQjdhs1xmSAlPdD1cKIYOvomXeY/Yi+7Zas69oaujGSHSKI5jPb4MmxTn8mejmLkIpuGWkQxwv5hsSWwxwmLwqNNtKYow3UrQzimaGud/9goMpgzqxZyJJHngb5rpo7a91nUpXxRUV2d5CtkxR+8QNhVY1lbrSCWQmFH/8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=U2G5rSeu; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="U2G5rSeu" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-42cacabd2e0so54534925e9.3 for ; Tue, 08 Oct 2024 09:07:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1728403666; x=1729008466; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=lC1VrxWqIvFqRnkCBrcDqdtLVemDPB60EJSOvaq1Zpc=; b=U2G5rSeut+uj2qcUz0jKI7/PO9e+SnvQNh4q85gtxvCYL8ojwsDfm4CUZHrComWYU4 OykMnSwe0KFev6bX6jlm08Nq5iYwQeS5ExraBxDfQw/wzBWnu1pTJ5jENGWRaJJD4tQp ryL5hyRzaWawo14WqAv4iH+xPrGymxbLAJFG7xOICXf+4lLyTXfy8RoHcLZjQNQhi+xb 077lfhJDMAgIuSd8kwWumDr6aJZPBxOCojVeClh1BmyxJCW5Mk0mrzy3ykti+fEtbaMd RLwvUajemkllvG9rX64duecI9f0UvTV9RjzL5g3IeVVNVg43i8aGfHZNglm65O3fqJQK FqYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728403666; x=1729008466; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lC1VrxWqIvFqRnkCBrcDqdtLVemDPB60EJSOvaq1Zpc=; b=et0DZ8glV1LEssNsvCXpYkZTJ/E6lgpiZTl1W+bqATRw+XSkpld4LGTLpTaS73cjKy SjM7ZFcUD1u2oj29wg0B0gu8ZkXnG+cLUv3PV4RbJqugYH9ZcCvrLvZr5qQ+tQ4EYdg7 F4PYwqT627q0stL40yUC+tl8k7r/bjoi0J5FAn6d89LAFMCVF0Xg8GHDr5k1ISGeAfm2 VpBO6o7Wil/FbpoBCG1tvaRlJIlAe1UFdqnuzTE3qfhr2OFqZ/yNrNhSW+tXRZgxtbmC WybE3BO7atT8XrngeH1aCq0aT2DVMAqPeODyVCjZctvLgp79xov6uYKNKpuZg48GtHPb GG3g== X-Gm-Message-State: AOJu0YxOXBWjvCVF1l6/wPITqJ02kL56PA8RPZmUONmdFW0PjH34upaU Gtx6/dFn/CF2SEuetaQn4tKDGjYSuHzu7FfhuPWgbEFtoGkVLWOySLSYrMonXQIw5PdW4N16f57 19ks= X-Google-Smtp-Source: AGHT+IFXn9rIZ7Zyl5lyazE5zgUqEmf9anBv84CvL08pKjCuiZVMxUzf/36RMadg3qcFPXnGSeKGIA== X-Received: by 2002:a05:600c:1e1d:b0:42c:b950:680a with SMTP id 5b1f17b1804b1-42f93d5f286mr43325985e9.20.1728403665924; Tue, 08 Oct 2024 09:07:45 -0700 (PDT) Received: from toaster.baylibre.com ([2a01:e0a:3c5:5fb1:41f2:4244:ce34:c273]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-42f86a20537sm131509375e9.15.2024.10.08.09.07.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 09:07:44 -0700 (PDT) From: Jerome Brunet Date: Tue, 08 Oct 2024 18:07:03 +0200 Subject: [PATCH v2 3/3] regulator: core: remove machine init callback from config 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-Transfer-Encoding: quoted-printable Message-Id: <20241008-regulator-ignored-data-v2-3-d1251e0ee507@baylibre.com> References: <20241008-regulator-ignored-data-v2-0-d1251e0ee507@baylibre.com> In-Reply-To: <20241008-regulator-ignored-data-v2-0-d1251e0ee507@baylibre.com> To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Guenter Roeck , Jerome Brunet X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1660; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=lhQuXcRpY2zHnZo6m9Qxj7Tw4rIjXk5y2hUFVH+Dy1o=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBnBVjMeuDhe5M14Gpc1xxDstYhvTFU2hM3oHNQ2 8Rl9NHrNAyJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZwVYzAAKCRDm/A8cN/La hbiWD/9x32PlqF7Bk9HQ6byyM6fvBKt/e0o5VrmJ+u+fWaXKUsqqDrk/0KHkhqCWEfoAkFMREiw sllDQ4NM1uAm1NDDgjSAAunGyMjtDCxAiigW7HdS1fyEizfN2u9r2VUbxZIxNLPMBr1qrvZQkRY wXod9iHgJl/lyZgjZ/1dzQwCXvvQAQqAv6oBEFzWXMGCBZAHFzZ4/gjunwaE8Y/nY1lnBkPTxMo OPjUCeyhfa+0v3p4Wyz1sdDoMgT/IYiV1vnKyDPjtNOXPaJ+FAYe+mofbaaUfMOzhQaYmNCHuf5 cBPnkQX5lkP1i5baqhMWP6irevJXqKEnqwnLHb7SaGPyqKO4Ht9nbnApGfgHXW2P+G0q7JJX5hv l3IhchPu5hbudqvnrCyhyU/PF6V1ni0IEPg/CF7pUD1ST8MqWuFIVsy3vN/SuVQ6y+eJ4UEtCZj EN5vVZEzqszvZhAOMykPbMfbZyLpqrPXTd1A/Z2YEZaZK1JMhG/GBOFpnSNxlcIBLdu0XjJWpT9 0+mCda/HChZVaQSnNjSpD/Rch1XGpdu33/Eq5uP8sgU7tTSah7QhJLCfpBU3AMSov8gFxw5kaln cKkIVQmw62IUzp/ZT3AWanMQbZUjs1Fio4LbHogmU9v7T54HQni8x7HkiGpz8BNu6yQmjQxCAJt AoBZneUbsKWAfqw== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 The machine specific regulator_init() appears to be unused. It does not allow a lot of interaction with the regulator framework, since nothing from the framework is passed along (desc, config, etc ...) Machine specific init may also be done with the added init_cb() in the regulator description, so remove regulator_init(). Signed-off-by: Jerome Brunet --- drivers/regulator/core.c | 7 ------- include/linux/regulator/machine.h | 3 +-- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index f8b5d596f59d..e830230c3f39 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -5775,13 +5775,6 @@ regulator_register(struct device *dev, resolved_early =3D true; } =20 - /* perform any regulator specific init */ - if (init_data && init_data->regulator_init) { - ret =3D init_data->regulator_init(rdev->reg_data); - if (ret < 0) - goto wash; - } - if (config->ena_gpiod) { ret =3D regulator_ena_gpio_request(rdev, config); if (ret !=3D 0) { diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/ma= chine.h index 0cd76d264727..d0d700ff337a 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h @@ -285,8 +285,7 @@ struct regulator_init_data { int num_consumer_supplies; struct regulator_consumer_supply *consumer_supplies; =20 - /* optional regulator machine specific init */ - int (*regulator_init)(void *driver_data); + /* optional regulator machine specific data */ void *driver_data; /* core does not touch this */ }; =20 --=20 2.45.2