[PATCH v2 11/13] fsi: scom: Convert to fsi bus probe mechanism

Uwe Kleine-König posted 13 patches 2 months ago
[PATCH v2 11/13] fsi: scom: Convert to fsi bus probe mechanism
Posted by Uwe Kleine-König 2 months ago
The fsi bus got a dedicated probe function. Make use of that. This fixes
a runtime warning about the driver needing to be converted to the bus
probe method.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
 drivers/fsi/fsi-scom.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
index 2eda44451cc1..67cd45605fe4 100644
--- a/drivers/fsi/fsi-scom.c
+++ b/drivers/fsi/fsi-scom.c
@@ -527,16 +527,16 @@ static void scom_free(struct device *dev)
 	kfree(scom);
 }
 
-static int scom_probe(struct device *dev)
+static int scom_probe(struct fsi_device *fsi_dev)
 {
-	struct fsi_device *fsi_dev = to_fsi_dev(dev);
+	struct device *dev = &fsi_dev->dev;
 	struct scom_device *scom;
 	int rc, didx;
 
 	scom = kzalloc(sizeof(*scom), GFP_KERNEL);
 	if (!scom)
 		return -ENOMEM;
-	dev_set_drvdata(dev, scom);
+	fsi_set_drvdata(fsi_dev, scom);
 	mutex_init(&scom->lock);
 
 	/* Grab a reference to the device (parent of our cdev), we'll drop it later */
@@ -574,9 +574,9 @@ static int scom_probe(struct device *dev)
 	return rc;
 }
 
-static int scom_remove(struct device *dev)
+static void scom_remove(struct fsi_device *fsi_dev)
 {
-	struct scom_device *scom = dev_get_drvdata(dev);
+	struct scom_device *scom = fsi_get_drvdata(fsi_dev);
 
 	mutex_lock(&scom->lock);
 	scom->dead = true;
@@ -584,8 +584,6 @@ static int scom_remove(struct device *dev)
 	cdev_device_del(&scom->cdev, &scom->dev);
 	fsi_free_minor(scom->dev.devt);
 	put_device(&scom->dev);
-
-	return 0;
 }
 
 static const struct of_device_id scom_of_ids[] = {
@@ -604,11 +602,11 @@ static const struct fsi_device_id scom_ids[] = {
 
 static struct fsi_driver scom_drv = {
 	.id_table = scom_ids,
+	.probe = scom_probe,
+	.remove = scom_remove,
 	.drv = {
 		.name = "scom",
 		.of_match_table = scom_of_ids,
-		.probe = scom_probe,
-		.remove = scom_remove,
 	}
 };
 
-- 
2.47.3

Re: [PATCH v2 11/13] fsi: scom: Convert to fsi bus probe mechanism
Posted by Eddie James 1 week, 5 days ago
On 12/9/25 5:40 AM, Uwe Kleine-König wrote:
> The fsi bus got a dedicated probe function. Make use of that. This fixes
> a runtime warning about the driver needing to be converted to the bus
> probe method.


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


>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
>   drivers/fsi/fsi-scom.c | 16 +++++++---------
>   1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
> index 2eda44451cc1..67cd45605fe4 100644
> --- a/drivers/fsi/fsi-scom.c
> +++ b/drivers/fsi/fsi-scom.c
> @@ -527,16 +527,16 @@ static void scom_free(struct device *dev)
>   	kfree(scom);
>   }
>   
> -static int scom_probe(struct device *dev)
> +static int scom_probe(struct fsi_device *fsi_dev)
>   {
> -	struct fsi_device *fsi_dev = to_fsi_dev(dev);
> +	struct device *dev = &fsi_dev->dev;
>   	struct scom_device *scom;
>   	int rc, didx;
>   
>   	scom = kzalloc(sizeof(*scom), GFP_KERNEL);
>   	if (!scom)
>   		return -ENOMEM;
> -	dev_set_drvdata(dev, scom);
> +	fsi_set_drvdata(fsi_dev, scom);
>   	mutex_init(&scom->lock);
>   
>   	/* Grab a reference to the device (parent of our cdev), we'll drop it later */
> @@ -574,9 +574,9 @@ static int scom_probe(struct device *dev)
>   	return rc;
>   }
>   
> -static int scom_remove(struct device *dev)
> +static void scom_remove(struct fsi_device *fsi_dev)
>   {
> -	struct scom_device *scom = dev_get_drvdata(dev);
> +	struct scom_device *scom = fsi_get_drvdata(fsi_dev);
>   
>   	mutex_lock(&scom->lock);
>   	scom->dead = true;
> @@ -584,8 +584,6 @@ static int scom_remove(struct device *dev)
>   	cdev_device_del(&scom->cdev, &scom->dev);
>   	fsi_free_minor(scom->dev.devt);
>   	put_device(&scom->dev);
> -
> -	return 0;
>   }
>   
>   static const struct of_device_id scom_of_ids[] = {
> @@ -604,11 +602,11 @@ static const struct fsi_device_id scom_ids[] = {
>   
>   static struct fsi_driver scom_drv = {
>   	.id_table = scom_ids,
> +	.probe = scom_probe,
> +	.remove = scom_remove,
>   	.drv = {
>   		.name = "scom",
>   		.of_match_table = scom_of_ids,
> -		.probe = scom_probe,
> -		.remove = scom_remove,
>   	}
>   };
>