mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Phil Carmody <ext-phil.2.carmody@nokia.com>
To: gregkh@suse.de
Cc: linux-kernel@vger.kernel.org
Subject: [RFC 5/6] PM: Example of how easy it is to mark attributes const
Date: Thu, 17 Dec 2009 20:12:15 +0200	[thread overview]
Message-ID: <1261073536-27396-6-git-send-email-ext-phil.2.carmody@nokia.com> (raw)
In-Reply-To: <1261073536-27396-5-git-send-email-ext-phil.2.carmody@nokia.com>

These attributes can now be in ro sections.

Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
---
 drivers/regulator/core.c |   38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index efe568d..f2b4376 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -215,7 +215,7 @@ static ssize_t regulator_uV_show(struct device *dev,
 
 	return ret;
 }
-static DEVICE_ATTR(microvolts, 0444, regulator_uV_show, NULL);
+static DEVICE_CATTR(microvolts, 0444, regulator_uV_show, NULL);
 
 static ssize_t regulator_uA_show(struct device *dev,
 				struct device_attribute *attr, char *buf)
@@ -224,7 +224,7 @@ static ssize_t regulator_uA_show(struct device *dev,
 
 	return sprintf(buf, "%d\n", _regulator_get_current_limit(rdev));
 }
-static DEVICE_ATTR(microamps, 0444, regulator_uA_show, NULL);
+static DEVICE_CATTR(microamps, 0444, regulator_uA_show, NULL);
 
 static ssize_t regulator_name_show(struct device *dev,
 			     struct device_attribute *attr, char *buf)
@@ -264,7 +264,7 @@ static ssize_t regulator_opmode_show(struct device *dev,
 
 	return regulator_print_opmode(buf, _regulator_get_mode(rdev));
 }
-static DEVICE_ATTR(opmode, 0444, regulator_opmode_show, NULL);
+static DEVICE_CATTR(opmode, 0444, regulator_opmode_show, NULL);
 
 static ssize_t regulator_print_state(char *buf, int state)
 {
@@ -288,7 +288,7 @@ static ssize_t regulator_state_show(struct device *dev,
 
 	return ret;
 }
-static DEVICE_ATTR(state, 0444, regulator_state_show, NULL);
+static DEVICE_CATTR(state, 0444, regulator_state_show, NULL);
 
 static ssize_t regulator_status_show(struct device *dev,
 				   struct device_attribute *attr, char *buf)
@@ -329,7 +329,7 @@ static ssize_t regulator_status_show(struct device *dev,
 
 	return sprintf(buf, "%s\n", label);
 }
-static DEVICE_ATTR(status, 0444, regulator_status_show, NULL);
+static DEVICE_CATTR(status, 0444, regulator_status_show, NULL);
 
 static ssize_t regulator_min_uA_show(struct device *dev,
 				    struct device_attribute *attr, char *buf)
@@ -341,7 +341,7 @@ static ssize_t regulator_min_uA_show(struct device *dev,
 
 	return sprintf(buf, "%d\n", rdev->constraints->min_uA);
 }
-static DEVICE_ATTR(min_microamps, 0444, regulator_min_uA_show, NULL);
+static DEVICE_CATTR(min_microamps, 0444, regulator_min_uA_show, NULL);
 
 static ssize_t regulator_max_uA_show(struct device *dev,
 				    struct device_attribute *attr, char *buf)
@@ -353,7 +353,7 @@ static ssize_t regulator_max_uA_show(struct device *dev,
 
 	return sprintf(buf, "%d\n", rdev->constraints->max_uA);
 }
-static DEVICE_ATTR(max_microamps, 0444, regulator_max_uA_show, NULL);
+static DEVICE_CATTR(max_microamps, 0444, regulator_max_uA_show, NULL);
 
 static ssize_t regulator_min_uV_show(struct device *dev,
 				    struct device_attribute *attr, char *buf)
@@ -365,7 +365,7 @@ static ssize_t regulator_min_uV_show(struct device *dev,
 
 	return sprintf(buf, "%d\n", rdev->constraints->min_uV);
 }
-static DEVICE_ATTR(min_microvolts, 0444, regulator_min_uV_show, NULL);
+static DEVICE_CATTR(min_microvolts, 0444, regulator_min_uV_show, NULL);
 
 static ssize_t regulator_max_uV_show(struct device *dev,
 				    struct device_attribute *attr, char *buf)
@@ -377,7 +377,7 @@ static ssize_t regulator_max_uV_show(struct device *dev,
 
 	return sprintf(buf, "%d\n", rdev->constraints->max_uV);
 }
-static DEVICE_ATTR(max_microvolts, 0444, regulator_max_uV_show, NULL);
+static DEVICE_CATTR(max_microvolts, 0444, regulator_max_uV_show, NULL);
 
 static ssize_t regulator_total_uA_show(struct device *dev,
 				      struct device_attribute *attr, char *buf)
@@ -392,7 +392,7 @@ static ssize_t regulator_total_uA_show(struct device *dev,
 	mutex_unlock(&rdev->mutex);
 	return sprintf(buf, "%d\n", uA);
 }
-static DEVICE_ATTR(requested_microamps, 0444, regulator_total_uA_show, NULL);
+static DEVICE_CATTR(requested_microamps, 0444, regulator_total_uA_show, NULL);
 
 static ssize_t regulator_num_users_show(struct device *dev,
 				      struct device_attribute *attr, char *buf)
@@ -422,7 +422,7 @@ static ssize_t regulator_suspend_mem_uV_show(struct device *dev,
 
 	return sprintf(buf, "%d\n", rdev->constraints->state_mem.uV);
 }
-static DEVICE_ATTR(suspend_mem_microvolts, 0444,
+static DEVICE_CATTR(suspend_mem_microvolts, 0444,
 		regulator_suspend_mem_uV_show, NULL);
 
 static ssize_t regulator_suspend_disk_uV_show(struct device *dev,
@@ -432,7 +432,7 @@ static ssize_t regulator_suspend_disk_uV_show(struct device *dev,
 
 	return sprintf(buf, "%d\n", rdev->constraints->state_disk.uV);
 }
-static DEVICE_ATTR(suspend_disk_microvolts, 0444,
+static DEVICE_CATTR(suspend_disk_microvolts, 0444,
 		regulator_suspend_disk_uV_show, NULL);
 
 static ssize_t regulator_suspend_standby_uV_show(struct device *dev,
@@ -442,7 +442,7 @@ static ssize_t regulator_suspend_standby_uV_show(struct device *dev,
 
 	return sprintf(buf, "%d\n", rdev->constraints->state_standby.uV);
 }
-static DEVICE_ATTR(suspend_standby_microvolts, 0444,
+static DEVICE_CATTR(suspend_standby_microvolts, 0444,
 		regulator_suspend_standby_uV_show, NULL);
 
 static ssize_t regulator_suspend_mem_mode_show(struct device *dev,
@@ -453,7 +453,7 @@ static ssize_t regulator_suspend_mem_mode_show(struct device *dev,
 	return regulator_print_opmode(buf,
 		rdev->constraints->state_mem.mode);
 }
-static DEVICE_ATTR(suspend_mem_mode, 0444,
+static DEVICE_CATTR(suspend_mem_mode, 0444,
 		regulator_suspend_mem_mode_show, NULL);
 
 static ssize_t regulator_suspend_disk_mode_show(struct device *dev,
@@ -464,7 +464,7 @@ static ssize_t regulator_suspend_disk_mode_show(struct device *dev,
 	return regulator_print_opmode(buf,
 		rdev->constraints->state_disk.mode);
 }
-static DEVICE_ATTR(suspend_disk_mode, 0444,
+static DEVICE_CATTR(suspend_disk_mode, 0444,
 		regulator_suspend_disk_mode_show, NULL);
 
 static ssize_t regulator_suspend_standby_mode_show(struct device *dev,
@@ -475,7 +475,7 @@ static ssize_t regulator_suspend_standby_mode_show(struct device *dev,
 	return regulator_print_opmode(buf,
 		rdev->constraints->state_standby.mode);
 }
-static DEVICE_ATTR(suspend_standby_mode, 0444,
+static DEVICE_CATTR(suspend_standby_mode, 0444,
 		regulator_suspend_standby_mode_show, NULL);
 
 static ssize_t regulator_suspend_mem_state_show(struct device *dev,
@@ -486,7 +486,7 @@ static ssize_t regulator_suspend_mem_state_show(struct device *dev,
 	return regulator_print_state(buf,
 			rdev->constraints->state_mem.enabled);
 }
-static DEVICE_ATTR(suspend_mem_state, 0444,
+static DEVICE_CATTR(suspend_mem_state, 0444,
 		regulator_suspend_mem_state_show, NULL);
 
 static ssize_t regulator_suspend_disk_state_show(struct device *dev,
@@ -497,7 +497,7 @@ static ssize_t regulator_suspend_disk_state_show(struct device *dev,
 	return regulator_print_state(buf,
 			rdev->constraints->state_disk.enabled);
 }
-static DEVICE_ATTR(suspend_disk_state, 0444,
+static DEVICE_CATTR(suspend_disk_state, 0444,
 		regulator_suspend_disk_state_show, NULL);
 
 static ssize_t regulator_suspend_standby_state_show(struct device *dev,
@@ -508,7 +508,7 @@ static ssize_t regulator_suspend_standby_state_show(struct device *dev,
 	return regulator_print_state(buf,
 			rdev->constraints->state_standby.enabled);
 }
-static DEVICE_ATTR(suspend_standby_state, 0444,
+static DEVICE_CATTR(suspend_standby_state, 0444,
 		regulator_suspend_standby_state_show, NULL);
 
 
-- 
1.6.0.4


  reply	other threads:[~2009-12-17 18:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-17 18:12 [RFC 0/6] Driver core: Encourage use of const attributes Phil Carmody
2009-12-17 18:12 ` [RFC 1/6] Driver core: device_attribute parameters can often be const* Phil Carmody
2009-12-17 18:12   ` [RFC 2/6] Driver core: bin_attribute " Phil Carmody
2009-12-17 18:12     ` [RFC 3/6] Driver core: driver_attribute " Phil Carmody
2009-12-17 18:12       ` [RFC 4/6] Driver core: Easy macros to encourage const attributes Phil Carmody
2009-12-17 18:12         ` Phil Carmody [this message]
2009-12-17 18:12           ` [RFC 6/6] gpio: Example of how easy it is to mark attributes const Phil Carmody
2009-12-17 23:16 ` [RFC 0/6] Driver core: Encourage use of const attributes Greg KH
2009-12-18  0:42   ` Stephen Rothwell
2009-12-18  4:20     ` Greg KH
2009-12-18 13:34       ` [PATCH 0/3] " Phil Carmody
2009-12-18 13:34         ` [PATCH 1/3] Driver core: device_attribute parameters can often be const* Phil Carmody
2009-12-18 13:34           ` [PATCH 2/3] Driver core: bin_attribute " Phil Carmody
2009-12-18 13:34             ` [PATCH 3/3] Driver core: driver_attribute " Phil Carmody
2009-12-18  8:52   ` [RFC 0/6] Driver core: Encourage use of const attributes Phil Carmody
2009-12-18 16:10     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1261073536-27396-6-git-send-email-ext-phil.2.carmody@nokia.com \
    --to=ext-phil.2.carmody@nokia.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®