From nobody Fri Dec 19 11:35:59 2025 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 7AD342FD1B0 for ; Tue, 9 Dec 2025 11:41:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765280496; cv=none; b=JErqAzR7IzH1p52M2r+6J1eE2OHLvNNWUu/+AJvD1igOYlIm1W1KsJmaioyz+J/9KOBlkriPrQDH1vibzYBJYSdLp+HY7U2ttuXkAt/z2oJjxvKREqcTAfarDfzEmXBYcfh+XNjZ5Ze+Q6Om0tgfCIi0lbe1esySaZvw0oxX4uM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765280496; c=relaxed/simple; bh=Q+zxnfnQdryvVJp99STbQXDRvJzA78lU1qjQYV0jJ0U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FR6cmBo5e3bkn8mXPYMzcLLr5oju5pXk2B4wfqou73Oub9JmYRUFtyjEhGCE9zGiLJrVCgG4brkGKqcNrnpEXT6W2B+Fv1wR9gornAu57KSx6/CyMAvxX6uRnhuZQdGPa3vDrUHch4CsjOjrFhC798PcwGNgUS7giriDipAIEwI= 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=Ihl4IVMA; arc=none smtp.client-ip=209.85.128.52 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="Ihl4IVMA" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-47775fb6c56so47485125e9.1 for ; Tue, 09 Dec 2025 03:41:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1765280492; x=1765885292; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s02EFpzfO9VS5EuZvl9knv4EQQswePSsPBSNV1lnBQc=; b=Ihl4IVMAmTop72HVTiYjhhYcBBSnirIE74+/1DDx+DWkXkO3uUjIMIZJCBBJkWSzxX ePX86dWDLmbNGazZyhQgIlqG2vu1556ed+657tr0Z37FxDGnnMo6jf11tyS5r+L2HyK0 LmlzWJuo5Hr6zXsuXzWcGzuCtuDH0Udqa6Q8MMwvl2UX5YBtlJ4ojFjL1LvxjTPX2m2G coCJXLBgrAfzfJdVYv11KS6XM3symfxNMpXM/wZC0o9Wpmto7mFIIYcB+jdMnpCDeTHf oMPdGNt+AdvW2ei+NYPU/ZAEIZBv+8xWxu2LYxzogQWFVLdHFfheVgLVgZUC9egwL9Ed OSgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765280492; x=1765885292; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=s02EFpzfO9VS5EuZvl9knv4EQQswePSsPBSNV1lnBQc=; b=fsG/eihxBnBg0Xo51ei0o6pM5f9qMjVBNkcuAoVNADYWwfXAnQv+BgUw7a2IMk5rD6 5NJaWGL/OOgoraksQDCLB0cilYx68RG/0TX9d6fZ5dRh4UFb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m0lc+6m0JqxsCb1QwpwWXH4q8QF1xdA== X-Received: by 2002:a05:600c:37c6:b0:477:5c45:8100 with SMTP id 5b1f17b1804b1-47939e2b584mr138637135e9.24.1765280491759; Tue, 09 Dec 2025 03:41:31 -0800 (PST) Received: from localhost (p200300f65f00660846b2ba6e435ad603.dip0.t-ipconnect.de. [2003:f6:5f00:6608:46b2:ba6e:435a:d603]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-47a7d70fa07sm35685325e9.11.2025.12.09.03.41.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Dec 2025 03:41:31 -0800 (PST) From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: Eddie James Cc: Ninad Palsule , linux-fsi@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 07/13] fsi: Create bus specific probe and remove functions Date: Tue, 9 Dec 2025 12:40:31 +0100 Message-ID: <3b53adb75a5ae7894736d46cb6eb85f5ef36520e.1765279318.git.u.kleine-koenig@baylibre.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: References: 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" X-Developer-Signature: v=1; a=openpgp-sha256; l=3323; i=u.kleine-koenig@baylibre.com; h=from:subject:message-id; bh=Q+zxnfnQdryvVJp99STbQXDRvJzA78lU1qjQYV0jJ0U=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBpOArFB6UuGooggE8cKx4BVehfzmWZa+/qN32mP lIERsXcQJiJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCaTgKxQAKCRCPgPtYfRL+ TntwCAChCVz7WkZIjYLcXNPaatIOIOTHS9mAkmxtLPQCVQ6NTzN4hPyBeagR7lMcspuqTaIjIRM E9SMfmR7cvriPyDlRXYKTcwGov1CfAfqMMhfyvb3Cu1I7Di+7V8vCv/qsRc+GdUj1p23DLEOLDU yecll886YK0ENdNVls0+nfDPrcF9vHyr1zPQ5SyyJgpvxIORxwbtCzCeRT0C1j/FT7MhNX51tYz EmnmwXXmbNZMA7ho592HjOy/j+m6N0ovLcJmApbNeA5JN1EVqdVyWkgf79uJPnmsPV0J/bpmBtc Oj8XuPZf6lKQENh9IHOZApd0D/m5zYSXECSL1Eh/515ofCPq X-Developer-Key: i=u.kleine-koenig@baylibre.com; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Content-Transfer-Encoding: quoted-printable Introduce a bus specific probe and remove function. For now this only allows to get rid of a cast of the generic device to an fsi device in the drivers and changes the remove prototype to return void---a non-zero return value is ignored anyhow. The objective is to get rid of users of struct device callbacks .probe(), .remove() and .shutdown() to eventually remove these. Until all fsi drivers are converted this results in a runtime warning about the drivers needing an update because there is a bus probe function and a driver probe function. Signed-off-by: Uwe Kleine-K=C3=B6nig --- drivers/fsi/fsi-core.c | 50 ++++++++++++++++++++++++++++++++++++++++++ include/linux/fsi.h | 2 ++ 2 files changed, 52 insertions(+) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 4e60d4b17c11..83599a1c548b 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -128,9 +128,31 @@ static int fsi_bus_match(struct device *dev, const str= uct device_driver *drv) return 0; } =20 +static int fsi_probe(struct device *dev) +{ + struct fsi_device *fsidev =3D to_fsi_dev(dev); + struct fsi_driver *fsidrv =3D to_fsi_drv(dev->driver); + + if (fsidrv->probe) + return fsidrv->probe(fsidev); + else + return 0; +} + +static void fsi_remove(struct device *dev) +{ + struct fsi_device *fsidev =3D to_fsi_dev(dev); + struct fsi_driver *fsidrv =3D to_fsi_drv(dev->driver); + + if (fsidrv->remove) + fsidrv->remove(fsidev); +} + static const struct bus_type fsi_bus_type =3D { .name =3D "fsi", .match =3D fsi_bus_match, + .probe =3D fsi_probe, + .remove =3D fsi_remove, }; =20 /* @@ -1392,6 +1414,25 @@ void fsi_master_unregister(struct fsi_master *master) } EXPORT_SYMBOL_GPL(fsi_master_unregister); =20 +static int fsi_legacy_probe(struct fsi_device *fsidev) +{ + struct device *dev =3D &fsidev->dev; + struct device_driver *driver =3D dev->driver; + + return driver->probe(dev); +} + +static void fsi_legacy_remove(struct fsi_device *fsidev) +{ + struct device *dev =3D &fsidev->dev; + struct device_driver *driver =3D dev->driver; + int ret; + + ret =3D driver->remove(dev); + if (unlikely(ret)) + dev_warn(dev, "Ignoring return value of remove callback (%pe)\n", ERR_PT= R(ret)); +} + int fsi_driver_register(struct fsi_driver *fsi_drv) { if (!fsi_drv) @@ -1401,6 +1442,15 @@ int fsi_driver_register(struct fsi_driver *fsi_drv) =20 fsi_drv->drv.bus =3D &fsi_bus_type; =20 + /* + * This driver needs updating. Note that driver_register() warns about + * this, so we're not adding another warning here. + */ + if (!fsi_drv->probe && fsi_drv->drv.probe) + fsi_drv->probe =3D fsi_legacy_probe; + if (!fsi_drv->remove && fsi_drv->drv.remove) + fsi_drv->remove =3D fsi_legacy_remove; + return driver_register(&fsi_drv->drv); } EXPORT_SYMBOL_GPL(fsi_driver_register); diff --git a/include/linux/fsi.h b/include/linux/fsi.h index 3e3a8f3adac3..9c67c43f9e6c 100644 --- a/include/linux/fsi.h +++ b/include/linux/fsi.h @@ -49,6 +49,8 @@ struct fsi_device_id { .engine_type =3D (t), .version =3D (v), =20 struct fsi_driver { + int (*probe)(struct fsi_device *fsidev); + void (*remove)(struct fsi_device *fsidev); struct device_driver drv; const struct fsi_device_id *id_table; }; --=20 2.47.3