mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eddie James <eajames@linux.ibm.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: Ninad Palsule <ninad@linux.ibm.com>,
	linux-fsi@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 07/13] fsi: Create bus specific probe and remove functions
Date: Tue, 27 Jan 2026 09:27:17 -0600	[thread overview]
Message-ID: <e2413f79-53eb-40f2-8c20-75e181c3c486@linux.ibm.com> (raw)
In-Reply-To: <3b53adb75a5ae7894736d46cb6eb85f5ef36520e.1765279318.git.u.kleine-koenig@baylibre.com>


On 12/9/25 5:40 AM, Uwe Kleine-König wrote:
> 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.


Acked-by: Eddie James <eajames@linux.ibm.com>


>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
>   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 struct device_driver *drv)
>   	return 0;
>   }
>   
> +static int fsi_probe(struct device *dev)
> +{
> +	struct fsi_device *fsidev = to_fsi_dev(dev);
> +	struct fsi_driver *fsidrv = 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 = to_fsi_dev(dev);
> +	struct fsi_driver *fsidrv = to_fsi_drv(dev->driver);
> +
> +	if (fsidrv->remove)
> +		fsidrv->remove(fsidev);
> +}
> +
>   static const struct bus_type fsi_bus_type = {
>   	.name = "fsi",
>   	.match = fsi_bus_match,
> +	.probe = fsi_probe,
> +	.remove = fsi_remove,
>   };
>   
>   /*
> @@ -1392,6 +1414,25 @@ void fsi_master_unregister(struct fsi_master *master)
>   }
>   EXPORT_SYMBOL_GPL(fsi_master_unregister);
>   
> +static int fsi_legacy_probe(struct fsi_device *fsidev)
> +{
> +	struct device *dev = &fsidev->dev;
> +	struct device_driver *driver = dev->driver;
> +
> +	return driver->probe(dev);
> +}
> +
> +static void fsi_legacy_remove(struct fsi_device *fsidev)
> +{
> +	struct device *dev = &fsidev->dev;
> +	struct device_driver *driver = dev->driver;
> +	int ret;
> +
> +	ret = driver->remove(dev);
> +	if (unlikely(ret))
> +		dev_warn(dev, "Ignoring return value of remove callback (%pe)\n", ERR_PTR(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)
>   
>   	fsi_drv->drv.bus = &fsi_bus_type;
>   
> +	/*
> +	 * 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 = fsi_legacy_probe;
> +	if (!fsi_drv->remove && fsi_drv->drv.remove)
> +		fsi_drv->remove = 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 = (t), .version = (v),
>   
>   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;
>   };

  reply	other threads:[~2026-01-27 15:27 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-09 11:39 [PATCH v2 00/13] fsi: Convert to bus probe mechanism Uwe Kleine-König
2025-12-09 11:40 ` [PATCH v2 01/13] fsi: Make use of module_fsi_driver() Uwe Kleine-König
2026-01-27 15:25   ` Eddie James
2025-12-09 11:40 ` [PATCH v2 02/13] fsi: Assign driver's bus in fsi_driver_register() Uwe Kleine-König
2026-01-27 15:25   ` Eddie James
2025-12-09 11:40 ` [PATCH v2 03/13] fsi: Provide thin wrappers around dev_[gs]et_data() for fsi devices Uwe Kleine-König
2026-01-27 15:25   ` Eddie James
2025-12-09 11:40 ` [PATCH v2 04/13] i2c: fsi: Drop assigning fsi bus Uwe Kleine-König
2026-01-27 15:26   ` Eddie James
2025-12-09 11:40 ` [PATCH v2 05/13] spi: " Uwe Kleine-König
2026-01-27 15:26   ` Eddie James
2025-12-09 11:40 ` [PATCH v2 06/13] fsi: Make fsi_bus_type a private variable to the core Uwe Kleine-König
2026-01-27 15:26   ` Eddie James
2025-12-09 11:40 ` [PATCH v2 07/13] fsi: Create bus specific probe and remove functions Uwe Kleine-König
2026-01-27 15:27   ` Eddie James [this message]
2025-12-09 11:40 ` [PATCH v2 08/13] fsi: i2cr-scom: Convert to fsi bus probe mechanism Uwe Kleine-König
2026-01-27 15:27   ` Eddie James
2025-12-09 11:40 ` [PATCH v2 09/13] fsi: master: " Uwe Kleine-König
2026-01-27 15:27   ` Eddie James
2025-12-09 11:40 ` [PATCH v2 10/13] fsi: sbefifo: " Uwe Kleine-König
2026-01-27 15:28   ` Eddie James
2025-12-09 11:40 ` [PATCH v2 11/13] fsi: scom: " Uwe Kleine-König
2026-01-27 15:28   ` Eddie James
2025-12-09 11:40 ` [PATCH v2 12/13] i2c: fsi: " Uwe Kleine-König
2026-01-27 15:29   ` Eddie James
2025-12-09 11:40 ` [PATCH v2 13/13] spi: " Uwe Kleine-König
2026-01-27 15:29   ` Eddie James
2026-01-12  9:47 ` [PATCH v2 00/13] fsi: Convert to " Uwe Kleine-König
2026-01-27 15:31   ` Eddie James

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e2413f79-53eb-40f2-8c20-75e181c3c486@linux.ibm.com \
    --to=eajames@linux.ibm.com \
    --cc=linux-fsi@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ninad@linux.ibm.com \
    --cc=u.kleine-koenig@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®