[PATCH v8 2/8] fsi: Make master device indexing and naming optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some FSI masters need different device naming, so make the indexing and naming
an optional part of FSI master registration.

Signed-off-by: Eddie James <eajames@xxxxxxxxxxxxx>
---
 drivers/fsi/fsi-core.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index d591e68afd11..3271e40702ec 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -1297,11 +1297,16 @@ int fsi_master_register(struct fsi_master *master)
 	struct device_node *np;
 
 	mutex_init(&master->scan_lock);
-	master->idx = ida_simple_get(&master_ida, 0, INT_MAX, GFP_KERNEL);
-	if (master->idx < 0)
-		return master->idx;
 
-	dev_set_name(&master->dev, "fsi%d", master->idx);
+	if (!master->idx) {
+		master->idx = ida_simple_get(&master_ida, 0, INT_MAX,
+					     GFP_KERNEL);
+		if (master->idx < 0)
+			return master->idx;
+
+		dev_set_name(&master->dev, "fsi%d", master->idx);
+	}
+
 	master->dev.class = &fsi_master_class;
 
 	rc = device_register(&master->dev);
-- 
2.31.1




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux