From nobody Mon Dec 1 22:34:55 2025 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.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 E145B3101DE for ; Sat, 29 Nov 2025 16:58:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764435523; cv=none; b=VpPl+oZjXvOBQGCvK7fUE1zX1ADf3v4pRR+4zmaW5tXo608DetuMHYhzkA25oBfKmLZMERgrzsLXlBb+kDZ799AhCh80CvFnSwG6mg4T78pgAPAou9Q8DxhCp1qOU6Dz5jYE6SCCbZ7kECRaAO5BNBZBkJCPpfUxxB1uSQ4RvUg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764435523; c=relaxed/simple; bh=5Ko9OFc0vr0gGtFxjBBAa/QVqxQ0ngFCXdaNCP4hmfw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SzcbvDoFwt8uizvamOzu8OnyCe8Z91sMoCENJgflSgoDS/AVuvV4faYmZOstrnE1dBdLNoDXOSPK7WVgHisONoHun9JfaOl/y++BWLQ3rb6ajUXCb/bIVRPmSvGprsIlHl8ipYJg5AzeoMli0XkwOL6bcoRgiA06NAiA6cEXRLE= 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=Aefwkf83; arc=none smtp.client-ip=209.85.218.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="Aefwkf83" Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-b735e278fa1so620163666b.0 for ; Sat, 29 Nov 2025 08:58:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1764435519; x=1765040319; 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=JLhX8tQBG7Ugjs6QPYIozvOuqN85HAlCvTON9W26PZk=; b=Aefwkf83D7tSMni+p1eUfP5ONEkQOeuJoOFRWGafuTTGuoAYpLEi/NqlO6kcvr1Fxh PMrqpD1Pe/mLt8lA+XYN/HY9XaxUj8MFVa+wj5mNSADLxZVV81EaD700SIdFT6iyAEYu 610fG4vTKw6SRdehcp/i2QnuVEG/jyyPVRi7wF1n9NvIoSozk0YO1k4YIUPdSaWD65wm HJ+jbepKxePK3iqsqPOKZWB6GS+CM0mgUXr5ngu0vPssJI/4AvISDbE5fVNlWze2ZEq1 BqzkO13zBmClGhYUxtxJlztVTbFzRwW2q4CzbFvKFazzx2NDXMSo5CRe9BUjyIxFTXnn hJTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764435519; x=1765040319; 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=JLhX8tQBG7Ugjs6QPYIozvOuqN85HAlCvTON9W26PZk=; b=DSkRY2i77ZZ3lcuIcbaNjx9hypDXEkvLp8il0XRNkK+ovZNkzNwOI7bqlLoz1fJgv4 /5LpdUelkfWRt5JFYaTJrWsbfNXXWU4qBXpLtO9KCUMcjAK30wNJzBmXi8RvsBRmaaSX UkYrxNagXSzCFD0pidTy6ncxZN0AqOB52riffTRDOPYFNj5myVPDkRc4mySNw2pbWXgG Yhm9SlZLUUoTp+8JIymDXgTryHsqHJLWE90A8vntiax4DgSkC/USB06uDDZ7M1X3Vfx9 CbEjMx65W7RZl34QFC/yVE58NcN8bXKy6pB2mrYEQJBuhs4foIf4YDHWgpcCzn1C7zg/ Rl9g== X-Forwarded-Encrypted: i=1; AJvYcCU9OzdgRuAv/T7oaKUSpZlePp49Hq1xPOK4iFE0l1e+9JU6LnRQucXuoS1+9H1pCS7NIS4XIU3b8VW9AqY=@vger.kernel.org X-Gm-Message-State: AOJu0YwB9MrGU2jqrehRp7OeqX+PWeB3ZvG0bFnCaQ/50vV2IRitZPbP zYzRmF9/IrUdXCjw6KTlzIWL8PuyNIehGN6QohhNsrJH04t+NeY5gi+WvvOMjk+8oNI= X-Gm-Gg: ASbGncsmicg7/oN26DXs0mIk8vMRKkAxBItSW5g6NN5a455JpdtQVPMVPrQIgOKKh67 RdSPPS65WJkDYQ0frPiqxOZoyzvgDDBXPOsId+j1Qi0k5mD52xAZgNKPoNqxkC0pKXfbY6snpnr /0+RcIrkdlqE9h9ufioJteCPTM2XDHPXM6r8VX8Y/BPRxbVkC7LgnCstonGP1J9RPFF7EQ4oyFR 23g+t/N7I4R2GoiAaGjbsXNIVCHSTuVNWfSQa26NbBf3TYIIWl+94UQRf7uQLh66KKOTS8pzzjx ctLbUUOUh/bxDeprJ200AvA0yE4BOBRFIhrZ7kNPX8l13D3F2pz6cIA/w+byB2OSzR0pXoC2+i4 nVfjsgbGcEL2MHLM3xCfb4tNW1/YIdp+ZJ00wkMVSnUhI+CaYMB62IOU2ZLbxopW7rbCHfe8JUN gKTr7sQCZ/P3z7WV0X X-Google-Smtp-Source: AGHT+IEOXIFzARMujXRF5ColFiNLis/8c1lSq4x61az1JeqnMHUrGdROHy7DyXPj4bpmOJpZ4qR7eA== X-Received: by 2002:a17:907:94d0:b0:b76:23df:c993 with SMTP id a640c23a62f3a-b76c5669651mr2384092166b.56.1764435519244; Sat, 29 Nov 2025 08:58:39 -0800 (PST) Received: from localhost ([2a02:8071:b783:6940:1d24:d58d:2b65:c291]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-b76f5a265d4sm735909466b.60.2025.11.29.08.58.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Nov 2025 08:58:38 -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, Greg Kroah-Hartman Subject: [PATCH 07/12] fsi: Create bus specific probe and remove functions Date: Sat, 29 Nov 2025 17:57:43 +0100 Message-ID: <20fbddeac9962e35db315a731c3a7ea360803efc.1764434226.git.ukleinek@kernel.org> 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=5Ko9OFc0vr0gGtFxjBBAa/QVqxQ0ngFCXdaNCP4hmfw=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBpKyYUGfR4dKbeiRDCoX4BBWIlXxD4dk5847maa txyAIerzciJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCaSsmFAAKCRCPgPtYfRL+ TtYaB/9p1kxndBQLB4u+g4T0UJAGjqG3U+l//JhihN7uCH1QqYN+7RgbDbp2Re25U89II+iWUwa OhtL4f7HMpYL1lwG8AevOceialWvMD5zIbxKxTjY+/Bd8ehHuK6KugzJZkASqxXC1oBfBpHULfJ hRcOEylnE/+l95XzI6O9Gej0lavlYsi6BGCbGeL61fl4VUFKtppq8XIbEXfbUzjtcQOkh1hlkDV u6kDJ9cY/ZClNyqWO4uxjut2BA7J/4I0CI6DFLzJyVUN2BNJ2zjvzflxLtrMr9ApQe3Xp50n5sK OmW+h+iplTL9Ip/oGQtayPRXVJEyBLQGg0etbxcomdLLotp9 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