[PATCH v2 08/13] fsi: i2cr-scom: Convert to fsi bus probe mechanism

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

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

diff --git a/drivers/fsi/i2cr-scom.c b/drivers/fsi/i2cr-scom.c
index dfdb16afd205..3efca2e944bb 100644
--- a/drivers/fsi/i2cr-scom.c
+++ b/drivers/fsi/i2cr-scom.c
@@ -81,9 +81,9 @@ static const struct file_operations i2cr_scom_fops = {
 	.write		= i2cr_scom_write,
 };
 
-static int i2cr_scom_probe(struct device *dev)
+static int i2cr_scom_probe(struct fsi_device *fsi_dev)
 {
-	struct fsi_device *fsi_dev = to_fsi_dev(dev);
+	struct device *dev = &fsi_dev->dev;
 	struct i2cr_scom *scom;
 	int didx;
 	int ret;
@@ -115,14 +115,12 @@ static int i2cr_scom_probe(struct device *dev)
 	return ret;
 }
 
-static int i2cr_scom_remove(struct device *dev)
+static void i2cr_scom_remove(struct fsi_device *fsi_dev)
 {
-	struct i2cr_scom *scom = dev_get_drvdata(dev);
+	struct i2cr_scom *scom = dev_get_drvdata(&fsi_dev->dev);
 
 	cdev_device_del(&scom->cdev, &scom->dev);
 	fsi_free_minor(scom->dev.devt);
-
-	return 0;
 }
 
 static const struct of_device_id i2cr_scom_of_ids[] = {
@@ -137,12 +135,12 @@ static const struct fsi_device_id i2cr_scom_ids[] = {
 };
 
 static struct fsi_driver i2cr_scom_driver = {
+	.probe = i2cr_scom_probe,
+	.remove = i2cr_scom_remove,
 	.id_table = i2cr_scom_ids,
 	.drv = {
 		.name = "i2cr_scom",
 		.of_match_table = i2cr_scom_of_ids,
-		.probe = i2cr_scom_probe,
-		.remove = i2cr_scom_remove,
 	}
 };
 
-- 
2.47.3

Re: [PATCH v2 08/13] fsi: i2cr-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 and remove callback. Make use of them.
> This fixes a runtime warning about the driver needing to be converted to
> the bus methods.


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


>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
>   drivers/fsi/i2cr-scom.c | 14 ++++++--------
>   1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/fsi/i2cr-scom.c b/drivers/fsi/i2cr-scom.c
> index dfdb16afd205..3efca2e944bb 100644
> --- a/drivers/fsi/i2cr-scom.c
> +++ b/drivers/fsi/i2cr-scom.c
> @@ -81,9 +81,9 @@ static const struct file_operations i2cr_scom_fops = {
>   	.write		= i2cr_scom_write,
>   };
>   
> -static int i2cr_scom_probe(struct device *dev)
> +static int i2cr_scom_probe(struct fsi_device *fsi_dev)
>   {
> -	struct fsi_device *fsi_dev = to_fsi_dev(dev);
> +	struct device *dev = &fsi_dev->dev;
>   	struct i2cr_scom *scom;
>   	int didx;
>   	int ret;
> @@ -115,14 +115,12 @@ static int i2cr_scom_probe(struct device *dev)
>   	return ret;
>   }
>   
> -static int i2cr_scom_remove(struct device *dev)
> +static void i2cr_scom_remove(struct fsi_device *fsi_dev)
>   {
> -	struct i2cr_scom *scom = dev_get_drvdata(dev);
> +	struct i2cr_scom *scom = dev_get_drvdata(&fsi_dev->dev);
>   
>   	cdev_device_del(&scom->cdev, &scom->dev);
>   	fsi_free_minor(scom->dev.devt);
> -
> -	return 0;
>   }
>   
>   static const struct of_device_id i2cr_scom_of_ids[] = {
> @@ -137,12 +135,12 @@ static const struct fsi_device_id i2cr_scom_ids[] = {
>   };
>   
>   static struct fsi_driver i2cr_scom_driver = {
> +	.probe = i2cr_scom_probe,
> +	.remove = i2cr_scom_remove,
>   	.id_table = i2cr_scom_ids,
>   	.drv = {
>   		.name = "i2cr_scom",
>   		.of_match_table = i2cr_scom_of_ids,
> -		.probe = i2cr_scom_probe,
> -		.remove = i2cr_scom_remove,
>   	}
>   };
>