mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-27 06:39:51 +00:00
3a5584e0df
Adds latest 6.6 patches from the Raspberry Pi repository. These patches were generated from: https://github.com/raspberrypi/linux/commits/rpi-6.6.y/ With the following command: git format-patch -N v6.6.67..HEAD (HEAD -> 811ff707533bcd67cdcd368bbd46223082009b12) Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> (cherry picked from commit 692205305db14deeff1a2dc4a6d7f87e19fc418b)
82 lines
2.2 KiB
Diff
82 lines
2.2 KiB
Diff
From 468b525d45a726e4ba704b33c4eba53de47ac684 Mon Sep 17 00:00:00 2001
|
|
From: Phil Elwell <phil@raspberrypi.com>
|
|
Date: Thu, 5 Dec 2024 16:03:39 +0000
|
|
Subject: [PATCH] misc: rp1-pio: More logical probe sequence
|
|
|
|
Sort the probe function initialisation into a more logical order.
|
|
|
|
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
|
|
---
|
|
drivers/misc/rp1-pio.c | 31 +++++++++++++++----------------
|
|
1 file changed, 15 insertions(+), 16 deletions(-)
|
|
|
|
--- a/drivers/misc/rp1-pio.c
|
|
+++ b/drivers/misc/rp1-pio.c
|
|
@@ -1153,6 +1153,10 @@ static int rp1_pio_probe(struct platform
|
|
return -EINVAL;
|
|
}
|
|
|
|
+ pdev->id = of_alias_get_id(pdev->dev.of_node, "pio");
|
|
+ if (pdev->id < 0)
|
|
+ return dev_err_probe(dev, pdev->id, "alias is missing\n");
|
|
+
|
|
fw = devm_rp1_firmware_get(dev, dev->of_node);
|
|
if (IS_ERR(fw))
|
|
return PTR_ERR(fw);
|
|
@@ -1185,31 +1189,26 @@ static int rp1_pio_probe(struct platform
|
|
goto out_err;
|
|
}
|
|
|
|
- cdev_init(&pio->cdev, &rp1_pio_fops);
|
|
- ret = cdev_add(&pio->cdev, pio->dev_num, 1);
|
|
- if (ret) {
|
|
- dev_err(dev, "cdev_add failed (err %d)\n", ret);
|
|
- goto out_unregister;
|
|
- }
|
|
-
|
|
pio->dev_class = class_create(DRIVER_NAME);
|
|
if (IS_ERR(pio->dev_class)) {
|
|
ret = PTR_ERR(pio->dev_class);
|
|
dev_err(dev, "class_create failed (err %d)\n", ret);
|
|
- goto out_cdev_del;
|
|
+ goto out_unregister;
|
|
}
|
|
- pdev->id = of_alias_get_id(pdev->dev.of_node, "pio");
|
|
- if (pdev->id < 0) {
|
|
- dev_err(dev, "alias is missing\n");
|
|
- return -EINVAL;
|
|
+
|
|
+ cdev_init(&pio->cdev, &rp1_pio_fops);
|
|
+ ret = cdev_add(&pio->cdev, pio->dev_num, 1);
|
|
+ if (ret) {
|
|
+ dev_err(dev, "cdev_add failed (err %d)\n", ret);
|
|
goto out_class_destroy;
|
|
}
|
|
+
|
|
sprintf(dev_name, "pio%d", pdev->id);
|
|
cdev = device_create(pio->dev_class, NULL, pio->dev_num, NULL, dev_name);
|
|
if (IS_ERR(cdev)) {
|
|
ret = PTR_ERR(cdev);
|
|
dev_err(dev, "%s: device_create failed (err %d)\n", __func__, ret);
|
|
- goto out_class_destroy;
|
|
+ goto out_cdev_del;
|
|
}
|
|
|
|
g_pio = pio;
|
|
@@ -1217,12 +1216,12 @@ static int rp1_pio_probe(struct platform
|
|
dev_info(dev, "Created instance as %s\n", dev_name);
|
|
return 0;
|
|
|
|
-out_class_destroy:
|
|
- class_destroy(pio->dev_class);
|
|
-
|
|
out_cdev_del:
|
|
cdev_del(&pio->cdev);
|
|
|
|
+out_class_destroy:
|
|
+ class_destroy(pio->dev_class);
|
|
+
|
|
out_unregister:
|
|
unregister_chrdev_region(pio->dev_num, 1);
|
|
|