aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlexander Gordeev <lasaine@lvk.cs.msu.su>2011-01-12 20:00:52 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 11:03:19 -0500
commit7f7cce74105adf714bdc9357da3b6f06e019958c (patch)
tree1fcb692726c5bf91280bcac5a65584eddcd93bf6 /drivers
parent5e196d34a776420278e4117b4742cd9d3f2350ed (diff)
pps: convert printk/pr_* to dev_*
Since we now have direct pointers to struct pps_device everywhere it's easy to use dev_* functions to print messages instead of plain printks. Where dev_* cannot be used printks are converted to pr_*. Signed-off-by: Alexander Gordeev <lasaine@lvk.cs.msu.su> Acked-by: Rodolfo Giometti <giometti@linux.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pps/clients/pps-ktimer.c5
-rw-r--r--drivers/pps/clients/pps-ldisc.c2
-rw-r--r--drivers/pps/kapi.c15
-rw-r--r--drivers/pps/pps.c25
4 files changed, 26 insertions, 21 deletions
diff --git a/drivers/pps/clients/pps-ktimer.c b/drivers/pps/clients/pps-ktimer.c
index 966ead188ee2..2728469d3884 100644
--- a/drivers/pps/clients/pps-ktimer.c
+++ b/drivers/pps/clients/pps-ktimer.c
@@ -19,6 +19,7 @@
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21 21
22#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22 23
23#include <linux/kernel.h> 24#include <linux/kernel.h>
24#include <linux/module.h> 25#include <linux/module.h>
@@ -45,7 +46,7 @@ static void pps_ktimer_event(unsigned long ptr)
45 /* First of all we get the time stamp... */ 46 /* First of all we get the time stamp... */
46 pps_get_ts(&ts); 47 pps_get_ts(&ts);
47 48
48 pr_info("PPS event at %lu\n", jiffies); 49 dev_info(pps->dev, "PPS event at %lu\n", jiffies);
49 50
50 pps_event(pps, &ts, PPS_CAPTUREASSERT, NULL); 51 pps_event(pps, &ts, PPS_CAPTUREASSERT, NULL);
51 52
@@ -94,7 +95,7 @@ static int __init pps_ktimer_init(void)
94 pps = pps_register_source(&pps_ktimer_info, 95 pps = pps_register_source(&pps_ktimer_info,
95 PPS_CAPTUREASSERT | PPS_OFFSETASSERT); 96 PPS_CAPTUREASSERT | PPS_OFFSETASSERT);
96 if (pps == NULL) { 97 if (pps == NULL) {
97 printk(KERN_ERR "cannot register ktimer source\n"); 98 pr_err("cannot register PPS source\n");
98 return -ENOMEM; 99 return -ENOMEM;
99 } 100 }
100 101
diff --git a/drivers/pps/clients/pps-ldisc.c b/drivers/pps/clients/pps-ldisc.c
index 1517f5498ec0..1b3c6eda12ba 100644
--- a/drivers/pps/clients/pps-ldisc.c
+++ b/drivers/pps/clients/pps-ldisc.c
@@ -19,6 +19,8 @@
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21 21
22#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23
22#include <linux/module.h> 24#include <linux/module.h>
23#include <linux/serial_core.h> 25#include <linux/serial_core.h>
24#include <linux/tty.h> 26#include <linux/tty.h>
diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c
index 98d4012ca595..e8847c118ea3 100644
--- a/drivers/pps/kapi.c
+++ b/drivers/pps/kapi.c
@@ -19,6 +19,7 @@
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21 21
22#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22 23
23#include <linux/kernel.h> 24#include <linux/kernel.h>
24#include <linux/module.h> 25#include <linux/module.h>
@@ -80,20 +81,20 @@ struct pps_device *pps_register_source(struct pps_source_info *info,
80 81
81 /* Sanity checks */ 82 /* Sanity checks */
82 if ((info->mode & default_params) != default_params) { 83 if ((info->mode & default_params) != default_params) {
83 printk(KERN_ERR "pps: %s: unsupported default parameters\n", 84 pr_err("%s: unsupported default parameters\n",
84 info->name); 85 info->name);
85 err = -EINVAL; 86 err = -EINVAL;
86 goto pps_register_source_exit; 87 goto pps_register_source_exit;
87 } 88 }
88 if ((info->mode & (PPS_ECHOASSERT | PPS_ECHOCLEAR)) != 0 && 89 if ((info->mode & (PPS_ECHOASSERT | PPS_ECHOCLEAR)) != 0 &&
89 info->echo == NULL) { 90 info->echo == NULL) {
90 printk(KERN_ERR "pps: %s: echo function is not defined\n", 91 pr_err("%s: echo function is not defined\n",
91 info->name); 92 info->name);
92 err = -EINVAL; 93 err = -EINVAL;
93 goto pps_register_source_exit; 94 goto pps_register_source_exit;
94 } 95 }
95 if ((info->mode & (PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)) == 0) { 96 if ((info->mode & (PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)) == 0) {
96 printk(KERN_ERR "pps: %s: unspecified time format\n", 97 pr_err("%s: unspecified time format\n",
97 info->name); 98 info->name);
98 err = -EINVAL; 99 err = -EINVAL;
99 goto pps_register_source_exit; 100 goto pps_register_source_exit;
@@ -138,7 +139,7 @@ struct pps_device *pps_register_source(struct pps_source_info *info,
138 if (id >= PPS_MAX_SOURCES) { 139 if (id >= PPS_MAX_SOURCES) {
139 spin_unlock_irq(&pps_idr_lock); 140 spin_unlock_irq(&pps_idr_lock);
140 141
141 printk(KERN_ERR "pps: %s: too many PPS sources in the system\n", 142 pr_err("%s: too many PPS sources in the system\n",
142 info->name); 143 info->name);
143 err = -EBUSY; 144 err = -EBUSY;
144 goto free_idr; 145 goto free_idr;
@@ -150,12 +151,12 @@ struct pps_device *pps_register_source(struct pps_source_info *info,
150 /* Create the char device */ 151 /* Create the char device */
151 err = pps_register_cdev(pps); 152 err = pps_register_cdev(pps);
152 if (err < 0) { 153 if (err < 0) {
153 printk(KERN_ERR "pps: %s: unable to create char device\n", 154 pr_err("%s: unable to create char device\n",
154 info->name); 155 info->name);
155 goto free_idr; 156 goto free_idr;
156 } 157 }
157 158
158 pr_info("new PPS source %s at ID %d\n", info->name, id); 159 dev_info(pps->dev, "new PPS source %s\n", info->name);
159 160
160 return pps; 161 return pps;
161 162
@@ -168,7 +169,7 @@ kfree_pps:
168 kfree(pps); 169 kfree(pps);
169 170
170pps_register_source_exit: 171pps_register_source_exit:
171 printk(KERN_ERR "pps: %s: unable to register source\n", info->name); 172 pr_err("%s: unable to register source\n", info->name);
172 173
173 return NULL; 174 return NULL;
174} 175}
diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index 1922f27a52ac..9f7c2e858dd0 100644
--- a/drivers/pps/pps.c
+++ b/drivers/pps/pps.c
@@ -19,6 +19,7 @@
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21 21
22#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22 23
23#include <linux/kernel.h> 24#include <linux/kernel.h>
24#include <linux/module.h> 25#include <linux/module.h>
@@ -67,7 +68,7 @@ static long pps_cdev_ioctl(struct file *file,
67 68
68 switch (cmd) { 69 switch (cmd) {
69 case PPS_GETPARAMS: 70 case PPS_GETPARAMS:
70 pr_debug("PPS_GETPARAMS: source %d\n", pps->id); 71 dev_dbg(pps->dev, "PPS_GETPARAMS\n");
71 72
72 spin_lock_irq(&pps->lock); 73 spin_lock_irq(&pps->lock);
73 74
@@ -83,7 +84,7 @@ static long pps_cdev_ioctl(struct file *file,
83 break; 84 break;
84 85
85 case PPS_SETPARAMS: 86 case PPS_SETPARAMS:
86 pr_debug("PPS_SETPARAMS: source %d\n", pps->id); 87 dev_dbg(pps->dev, "PPS_SETPARAMS\n");
87 88
88 /* Check the capabilities */ 89 /* Check the capabilities */
89 if (!capable(CAP_SYS_TIME)) 90 if (!capable(CAP_SYS_TIME))
@@ -93,14 +94,14 @@ static long pps_cdev_ioctl(struct file *file,
93 if (err) 94 if (err)
94 return -EFAULT; 95 return -EFAULT;
95 if (!(params.mode & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR))) { 96 if (!(params.mode & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR))) {
96 pr_debug("capture mode unspecified (%x)\n", 97 dev_dbg(pps->dev, "capture mode unspecified (%x)\n",
97 params.mode); 98 params.mode);
98 return -EINVAL; 99 return -EINVAL;
99 } 100 }
100 101
101 /* Check for supported capabilities */ 102 /* Check for supported capabilities */
102 if ((params.mode & ~pps->info.mode) != 0) { 103 if ((params.mode & ~pps->info.mode) != 0) {
103 pr_debug("unsupported capabilities (%x)\n", 104 dev_dbg(pps->dev, "unsupported capabilities (%x)\n",
104 params.mode); 105 params.mode);
105 return -EINVAL; 106 return -EINVAL;
106 } 107 }
@@ -113,7 +114,7 @@ static long pps_cdev_ioctl(struct file *file,
113 /* Restore the read only parameters */ 114 /* Restore the read only parameters */
114 if ((params.mode & (PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)) == 0) { 115 if ((params.mode & (PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)) == 0) {
115 /* section 3.3 of RFC 2783 interpreted */ 116 /* section 3.3 of RFC 2783 interpreted */
116 pr_debug("time format unspecified (%x)\n", 117 dev_dbg(pps->dev, "time format unspecified (%x)\n",
117 params.mode); 118 params.mode);
118 pps->params.mode |= PPS_TSFMT_TSPEC; 119 pps->params.mode |= PPS_TSFMT_TSPEC;
119 } 120 }
@@ -126,7 +127,7 @@ static long pps_cdev_ioctl(struct file *file,
126 break; 127 break;
127 128
128 case PPS_GETCAP: 129 case PPS_GETCAP:
129 pr_debug("PPS_GETCAP: source %d\n", pps->id); 130 dev_dbg(pps->dev, "PPS_GETCAP\n");
130 131
131 err = put_user(pps->info.mode, iuarg); 132 err = put_user(pps->info.mode, iuarg);
132 if (err) 133 if (err)
@@ -138,7 +139,7 @@ static long pps_cdev_ioctl(struct file *file,
138 struct pps_fdata fdata; 139 struct pps_fdata fdata;
139 unsigned int ev; 140 unsigned int ev;
140 141
141 pr_debug("PPS_FETCH: source %d\n", pps->id); 142 dev_dbg(pps->dev, "PPS_FETCH\n");
142 143
143 err = copy_from_user(&fdata, uarg, sizeof(struct pps_fdata)); 144 err = copy_from_user(&fdata, uarg, sizeof(struct pps_fdata));
144 if (err) 145 if (err)
@@ -153,7 +154,7 @@ static long pps_cdev_ioctl(struct file *file,
153 else { 154 else {
154 unsigned long ticks; 155 unsigned long ticks;
155 156
156 pr_debug("timeout %lld.%09d\n", 157 dev_dbg(pps->dev, "timeout %lld.%09d\n",
157 (long long) fdata.timeout.sec, 158 (long long) fdata.timeout.sec,
158 fdata.timeout.nsec); 159 fdata.timeout.nsec);
159 ticks = fdata.timeout.sec * HZ; 160 ticks = fdata.timeout.sec * HZ;
@@ -171,7 +172,7 @@ static long pps_cdev_ioctl(struct file *file,
171 172
172 /* Check for pending signals */ 173 /* Check for pending signals */
173 if (err == -ERESTARTSYS) { 174 if (err == -ERESTARTSYS) {
174 pr_debug("pending signal caught\n"); 175 dev_dbg(pps->dev, "pending signal caught\n");
175 return -EINTR; 176 return -EINTR;
176 } 177 }
177 178
@@ -240,7 +241,7 @@ int pps_register_cdev(struct pps_device *pps)
240 241
241 err = cdev_add(&pps->cdev, devt, 1); 242 err = cdev_add(&pps->cdev, devt, 1);
242 if (err) { 243 if (err) {
243 printk(KERN_ERR "pps: %s: failed to add char device %d:%d\n", 244 pr_err("%s: failed to add char device %d:%d\n",
244 pps->info.name, MAJOR(pps_devt), pps->id); 245 pps->info.name, MAJOR(pps_devt), pps->id);
245 return err; 246 return err;
246 } 247 }
@@ -282,14 +283,14 @@ static int __init pps_init(void)
282 283
283 pps_class = class_create(THIS_MODULE, "pps"); 284 pps_class = class_create(THIS_MODULE, "pps");
284 if (!pps_class) { 285 if (!pps_class) {
285 printk(KERN_ERR "pps: failed to allocate class\n"); 286 pr_err("failed to allocate class\n");
286 return -ENOMEM; 287 return -ENOMEM;
287 } 288 }
288 pps_class->dev_attrs = pps_attrs; 289 pps_class->dev_attrs = pps_attrs;
289 290
290 err = alloc_chrdev_region(&pps_devt, 0, PPS_MAX_SOURCES, "pps"); 291 err = alloc_chrdev_region(&pps_devt, 0, PPS_MAX_SOURCES, "pps");
291 if (err < 0) { 292 if (err < 0) {
292 printk(KERN_ERR "pps: failed to allocate char device region\n"); 293 pr_err("failed to allocate char device region\n");
293 goto remove_class; 294 goto remove_class;
294 } 295 }
295 296