pm: EDP: bug fixes
Sivaram Nair [Thu, 13 Sep 2012 14:06:14 +0000 (17:06 +0300)]
This patch includes several minor bug fixes:
(1) fixing example documentation
(2) fixing minor errors in sysfs
(3) fixing governor initcalls to postcore
(4) adding missing include

Change-Id: I3c1115cc23e6e887c083801a59143c5a06e75d12
Signed-off-by: Sivaram Nair <sivaramn@nvidia.com>
Reviewed-on: http://git-master/r/132525
Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>

Documentation/edp/howto
drivers/edp/edp_overage.c
drivers/edp/edp_priority.c
drivers/edp/sysfs.c
include/linux/edp.h

index da83848..8433529 100644 (file)
@@ -147,10 +147,13 @@ examples show how the usual operations are performed.
 
        Example 2:
 
+       static unsigned int modem_states[] = { ... }
+
        /* modem client */
        struct edp_client modem_edp_client = {
                .name = "modem",
-               .states = { 2500, 1500, 1000, 500, 0 },
+               .states = modem_states,
+               .num_states = ARRAY_SIZE(num_states),
                .e0_index = MODEM_EDP_E0,
                .priority = EDP_MAX_PRIO - 3,
                .max_borrowers = 1,
index fd7f841..8f379aa 100644 (file)
@@ -239,6 +239,4 @@ static int __init overage_init(void)
 {
        return edp_register_governor(&overage_governor);
 }
-
-MODULE_LICENSE("GPL");
-module_init(overage_init);
+postcore_initcall(overage_init);
index bb78e7e..b2396e3 100644 (file)
@@ -163,13 +163,4 @@ static int __init prio_init(void)
 {
        return edp_register_governor(&prio_governor);
 }
-
-static void __exit prio_exit(void)
-{
-       int r = edp_unregister_governor(&prio_governor);
-       WARN_ON(r);
-}
-
-MODULE_LICENSE("GPL");
-module_init(prio_init);
-module_exit(prio_exit);
+postcore_initcall(prio_init);
index e22fccf..d23996b 100644 (file)
@@ -221,7 +221,8 @@ static ssize_t current_show(struct edp_client *c, char *s)
 
 static ssize_t threshold_show(struct edp_client *c, char *s)
 {
-       return scnprintf(s, PAGE_SIZE, "%u\n", c->ithreshold);
+       return scnprintf(s, PAGE_SIZE, "%u\n",
+                       c->num_loans ? c->ithreshold : 0);
 }
 
 static ssize_t borrowers_show(struct edp_client *c, char *s)
@@ -240,10 +241,13 @@ struct client_attr attr_e0 = __ATTR_RO(e0);
 struct client_attr attr_max_borrowers = __ATTR_RO(max_borrowers);
 struct client_attr attr_priority = __ATTR_RO(priority);
 struct client_attr attr_request = __ATTR_RO(request);
-struct client_attr attr_current = __ATTR_RO(current);
 struct client_attr attr_threshold = __ATTR_RO(threshold);
 struct client_attr attr_borrowers = __ATTR_RO(borrowers);
 struct client_attr attr_loans = __ATTR_RO(loans);
+struct client_attr attr_current = {
+       .attr = { .name = "current", .mode = 0444 },
+       .show = current_show
+};
 
 static struct attribute *client_attrs[] = {
        &attr_states.attr,
@@ -383,6 +387,4 @@ static int __init edp_sysfs_init(void)
 
        return kobject_init_and_add(&edp_kobj, &ktype_edp, parent, "edp");
 }
-
-MODULE_LICENSE("GPL");
-module_init(edp_sysfs_init);
+postcore_initcall(edp_sysfs_init);
index ef114e7..fe11c8a 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <linux/kernel.h>
 #include <linux/errno.h>
+#include <linux/workqueue.h>
 
 #define EDP_NAME_LEN   16
 #define EDP_MIN_PRIO   0