]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blobdiff - drivers/opp/debugfs.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livep...
[mirror_ubuntu-eoan-kernel.git] / drivers / opp / debugfs.c
index b03c03576a624fe9c3af1ff09e75443a63fd8f5d..e6828e5f81b01a46590cada0077d1016cec2d584 100644 (file)
@@ -77,10 +77,21 @@ int opp_debug_create_one(struct dev_pm_opp *opp, struct opp_table *opp_table)
 {
        struct dentry *pdentry = opp_table->dentry;
        struct dentry *d;
+       unsigned long id;
        char name[25];  /* 20 chars for 64 bit value + 5 (opp:\0) */
 
-       /* Rate is unique to each OPP, use it to give opp-name */
-       snprintf(name, sizeof(name), "opp:%lu", opp->rate);
+       /*
+        * Get directory name for OPP.
+        *
+        * - Normally rate is unique to each OPP, use it to get unique opp-name.
+        * - For some devices rate isn't available, use index instead.
+        */
+       if (likely(opp->rate))
+               id = opp->rate;
+       else
+               id = _get_opp_count(opp_table);
+
+       snprintf(name, sizeof(name), "opp:%lu", id);
 
        /* Create per-opp directory */
        d = debugfs_create_dir(name, pdentry);