diff options
Diffstat (limited to 'drivers/pps/pps.c')
-rw-r--r-- | drivers/pps/pps.c | 25 |
1 files changed, 13 insertions, 12 deletions
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 | ||