xref: /openbmc/linux/drivers/pps/pps.c (revision 2a5cd6e2fb1984cc83f08b3645bf394830ac7825)
1eae9d2baSRodolfo Giometti /*
2eae9d2baSRodolfo Giometti  * PPS core file
3eae9d2baSRodolfo Giometti  *
4eae9d2baSRodolfo Giometti  *
5eae9d2baSRodolfo Giometti  * Copyright (C) 2005-2009   Rodolfo Giometti <giometti@linux.it>
6eae9d2baSRodolfo Giometti  *
7eae9d2baSRodolfo Giometti  *   This program is free software; you can redistribute it and/or modify
8eae9d2baSRodolfo Giometti  *   it under the terms of the GNU General Public License as published by
9eae9d2baSRodolfo Giometti  *   the Free Software Foundation; either version 2 of the License, or
10eae9d2baSRodolfo Giometti  *   (at your option) any later version.
11eae9d2baSRodolfo Giometti  *
12eae9d2baSRodolfo Giometti  *   This program is distributed in the hope that it will be useful,
13eae9d2baSRodolfo Giometti  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14eae9d2baSRodolfo Giometti  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15eae9d2baSRodolfo Giometti  *   GNU General Public License for more details.
16eae9d2baSRodolfo Giometti  *
17eae9d2baSRodolfo Giometti  *   You should have received a copy of the GNU General Public License
18eae9d2baSRodolfo Giometti  *   along with this program; if not, write to the Free Software
19eae9d2baSRodolfo Giometti  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20eae9d2baSRodolfo Giometti  */
21eae9d2baSRodolfo Giometti 
227f7cce74SAlexander Gordeev #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23eae9d2baSRodolfo Giometti 
24eae9d2baSRodolfo Giometti #include <linux/kernel.h>
25eae9d2baSRodolfo Giometti #include <linux/module.h>
26eae9d2baSRodolfo Giometti #include <linux/init.h>
27eae9d2baSRodolfo Giometti #include <linux/sched.h>
28eae9d2baSRodolfo Giometti #include <linux/uaccess.h>
29eae9d2baSRodolfo Giometti #include <linux/idr.h>
30*2a5cd6e2SAlexander Gordeev #include <linux/mutex.h>
31eae9d2baSRodolfo Giometti #include <linux/cdev.h>
32eae9d2baSRodolfo Giometti #include <linux/poll.h>
33eae9d2baSRodolfo Giometti #include <linux/pps_kernel.h>
34083e5866SAlexander Gordeev #include <linux/slab.h>
35eae9d2baSRodolfo Giometti 
36eae9d2baSRodolfo Giometti /*
37eae9d2baSRodolfo Giometti  * Local variables
38eae9d2baSRodolfo Giometti  */
39eae9d2baSRodolfo Giometti 
40eae9d2baSRodolfo Giometti static dev_t pps_devt;
41eae9d2baSRodolfo Giometti static struct class *pps_class;
42eae9d2baSRodolfo Giometti 
43*2a5cd6e2SAlexander Gordeev static DEFINE_MUTEX(pps_idr_lock);
44083e5866SAlexander Gordeev static DEFINE_IDR(pps_idr);
45083e5866SAlexander Gordeev 
46eae9d2baSRodolfo Giometti /*
47eae9d2baSRodolfo Giometti  * Char device methods
48eae9d2baSRodolfo Giometti  */
49eae9d2baSRodolfo Giometti 
50eae9d2baSRodolfo Giometti static unsigned int pps_cdev_poll(struct file *file, poll_table *wait)
51eae9d2baSRodolfo Giometti {
52eae9d2baSRodolfo Giometti 	struct pps_device *pps = file->private_data;
53eae9d2baSRodolfo Giometti 
54eae9d2baSRodolfo Giometti 	poll_wait(file, &pps->queue, wait);
55eae9d2baSRodolfo Giometti 
56eae9d2baSRodolfo Giometti 	return POLLIN | POLLRDNORM;
57eae9d2baSRodolfo Giometti }
58eae9d2baSRodolfo Giometti 
59eae9d2baSRodolfo Giometti static int pps_cdev_fasync(int fd, struct file *file, int on)
60eae9d2baSRodolfo Giometti {
61eae9d2baSRodolfo Giometti 	struct pps_device *pps = file->private_data;
62eae9d2baSRodolfo Giometti 	return fasync_helper(fd, file, on, &pps->async_queue);
63eae9d2baSRodolfo Giometti }
64eae9d2baSRodolfo Giometti 
65eae9d2baSRodolfo Giometti static long pps_cdev_ioctl(struct file *file,
66eae9d2baSRodolfo Giometti 		unsigned int cmd, unsigned long arg)
67eae9d2baSRodolfo Giometti {
68eae9d2baSRodolfo Giometti 	struct pps_device *pps = file->private_data;
69eae9d2baSRodolfo Giometti 	struct pps_kparams params;
70eae9d2baSRodolfo Giometti 	void __user *uarg = (void __user *) arg;
71eae9d2baSRodolfo Giometti 	int __user *iuarg = (int __user *) arg;
72eae9d2baSRodolfo Giometti 	int err;
73eae9d2baSRodolfo Giometti 
74eae9d2baSRodolfo Giometti 	switch (cmd) {
75eae9d2baSRodolfo Giometti 	case PPS_GETPARAMS:
767f7cce74SAlexander Gordeev 		dev_dbg(pps->dev, "PPS_GETPARAMS\n");
77eae9d2baSRodolfo Giometti 
78cbf83cc5SRodolfo Giometti 		spin_lock_irq(&pps->lock);
79cbf83cc5SRodolfo Giometti 
80cbf83cc5SRodolfo Giometti 		/* Get the current parameters */
81cbf83cc5SRodolfo Giometti 		params = pps->params;
82cbf83cc5SRodolfo Giometti 
83cbf83cc5SRodolfo Giometti 		spin_unlock_irq(&pps->lock);
84cbf83cc5SRodolfo Giometti 
85cbf83cc5SRodolfo Giometti 		err = copy_to_user(uarg, &params, sizeof(struct pps_kparams));
86eae9d2baSRodolfo Giometti 		if (err)
87eae9d2baSRodolfo Giometti 			return -EFAULT;
88eae9d2baSRodolfo Giometti 
89eae9d2baSRodolfo Giometti 		break;
90eae9d2baSRodolfo Giometti 
91eae9d2baSRodolfo Giometti 	case PPS_SETPARAMS:
927f7cce74SAlexander Gordeev 		dev_dbg(pps->dev, "PPS_SETPARAMS\n");
93eae9d2baSRodolfo Giometti 
94eae9d2baSRodolfo Giometti 		/* Check the capabilities */
95eae9d2baSRodolfo Giometti 		if (!capable(CAP_SYS_TIME))
96eae9d2baSRodolfo Giometti 			return -EPERM;
97eae9d2baSRodolfo Giometti 
98eae9d2baSRodolfo Giometti 		err = copy_from_user(&params, uarg, sizeof(struct pps_kparams));
99eae9d2baSRodolfo Giometti 		if (err)
100eae9d2baSRodolfo Giometti 			return -EFAULT;
101eae9d2baSRodolfo Giometti 		if (!(params.mode & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR))) {
1027f7cce74SAlexander Gordeev 			dev_dbg(pps->dev, "capture mode unspecified (%x)\n",
103eae9d2baSRodolfo Giometti 								params.mode);
104eae9d2baSRodolfo Giometti 			return -EINVAL;
105eae9d2baSRodolfo Giometti 		}
106eae9d2baSRodolfo Giometti 
107eae9d2baSRodolfo Giometti 		/* Check for supported capabilities */
108eae9d2baSRodolfo Giometti 		if ((params.mode & ~pps->info.mode) != 0) {
1097f7cce74SAlexander Gordeev 			dev_dbg(pps->dev, "unsupported capabilities (%x)\n",
110eae9d2baSRodolfo Giometti 								params.mode);
111eae9d2baSRodolfo Giometti 			return -EINVAL;
112eae9d2baSRodolfo Giometti 		}
113eae9d2baSRodolfo Giometti 
114eae9d2baSRodolfo Giometti 		spin_lock_irq(&pps->lock);
115eae9d2baSRodolfo Giometti 
116eae9d2baSRodolfo Giometti 		/* Save the new parameters */
117eae9d2baSRodolfo Giometti 		pps->params = params;
118eae9d2baSRodolfo Giometti 
119eae9d2baSRodolfo Giometti 		/* Restore the read only parameters */
120eae9d2baSRodolfo Giometti 		if ((params.mode & (PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)) == 0) {
121eae9d2baSRodolfo Giometti 			/* section 3.3 of RFC 2783 interpreted */
1227f7cce74SAlexander Gordeev 			dev_dbg(pps->dev, "time format unspecified (%x)\n",
123eae9d2baSRodolfo Giometti 								params.mode);
124eae9d2baSRodolfo Giometti 			pps->params.mode |= PPS_TSFMT_TSPEC;
125eae9d2baSRodolfo Giometti 		}
126eae9d2baSRodolfo Giometti 		if (pps->info.mode & PPS_CANWAIT)
127eae9d2baSRodolfo Giometti 			pps->params.mode |= PPS_CANWAIT;
128eae9d2baSRodolfo Giometti 		pps->params.api_version = PPS_API_VERS;
129eae9d2baSRodolfo Giometti 
130eae9d2baSRodolfo Giometti 		spin_unlock_irq(&pps->lock);
131eae9d2baSRodolfo Giometti 
132eae9d2baSRodolfo Giometti 		break;
133eae9d2baSRodolfo Giometti 
134eae9d2baSRodolfo Giometti 	case PPS_GETCAP:
1357f7cce74SAlexander Gordeev 		dev_dbg(pps->dev, "PPS_GETCAP\n");
136eae9d2baSRodolfo Giometti 
137eae9d2baSRodolfo Giometti 		err = put_user(pps->info.mode, iuarg);
138eae9d2baSRodolfo Giometti 		if (err)
139eae9d2baSRodolfo Giometti 			return -EFAULT;
140eae9d2baSRodolfo Giometti 
141eae9d2baSRodolfo Giometti 		break;
142eae9d2baSRodolfo Giometti 
14386d921f9SAlexander Gordeev 	case PPS_FETCH: {
14486d921f9SAlexander Gordeev 		struct pps_fdata fdata;
1453003d55bSAlexander Gordeev 		unsigned int ev;
14686d921f9SAlexander Gordeev 
1477f7cce74SAlexander Gordeev 		dev_dbg(pps->dev, "PPS_FETCH\n");
148eae9d2baSRodolfo Giometti 
149eae9d2baSRodolfo Giometti 		err = copy_from_user(&fdata, uarg, sizeof(struct pps_fdata));
150eae9d2baSRodolfo Giometti 		if (err)
151eae9d2baSRodolfo Giometti 			return -EFAULT;
152eae9d2baSRodolfo Giometti 
1533003d55bSAlexander Gordeev 		ev = pps->last_ev;
154eae9d2baSRodolfo Giometti 
155eae9d2baSRodolfo Giometti 		/* Manage the timeout */
156eae9d2baSRodolfo Giometti 		if (fdata.timeout.flags & PPS_TIME_INVALID)
1573003d55bSAlexander Gordeev 			err = wait_event_interruptible(pps->queue,
1583003d55bSAlexander Gordeev 					ev != pps->last_ev);
159eae9d2baSRodolfo Giometti 		else {
16086d921f9SAlexander Gordeev 			unsigned long ticks;
16186d921f9SAlexander Gordeev 
1627f7cce74SAlexander Gordeev 			dev_dbg(pps->dev, "timeout %lld.%09d\n",
163eae9d2baSRodolfo Giometti 					(long long) fdata.timeout.sec,
164eae9d2baSRodolfo Giometti 					fdata.timeout.nsec);
165eae9d2baSRodolfo Giometti 			ticks = fdata.timeout.sec * HZ;
166eae9d2baSRodolfo Giometti 			ticks += fdata.timeout.nsec / (NSEC_PER_SEC / HZ);
167eae9d2baSRodolfo Giometti 
168eae9d2baSRodolfo Giometti 			if (ticks != 0) {
169eae9d2baSRodolfo Giometti 				err = wait_event_interruptible_timeout(
1703003d55bSAlexander Gordeev 						pps->queue,
1713003d55bSAlexander Gordeev 						ev != pps->last_ev,
1723003d55bSAlexander Gordeev 						ticks);
173eae9d2baSRodolfo Giometti 				if (err == 0)
174eae9d2baSRodolfo Giometti 					return -ETIMEDOUT;
175eae9d2baSRodolfo Giometti 			}
176eae9d2baSRodolfo Giometti 		}
177eae9d2baSRodolfo Giometti 
178eae9d2baSRodolfo Giometti 		/* Check for pending signals */
179eae9d2baSRodolfo Giometti 		if (err == -ERESTARTSYS) {
1807f7cce74SAlexander Gordeev 			dev_dbg(pps->dev, "pending signal caught\n");
181eae9d2baSRodolfo Giometti 			return -EINTR;
182eae9d2baSRodolfo Giometti 		}
183eae9d2baSRodolfo Giometti 
184eae9d2baSRodolfo Giometti 		/* Return the fetched timestamp */
185eae9d2baSRodolfo Giometti 		spin_lock_irq(&pps->lock);
186eae9d2baSRodolfo Giometti 
187eae9d2baSRodolfo Giometti 		fdata.info.assert_sequence = pps->assert_sequence;
188eae9d2baSRodolfo Giometti 		fdata.info.clear_sequence = pps->clear_sequence;
189eae9d2baSRodolfo Giometti 		fdata.info.assert_tu = pps->assert_tu;
190eae9d2baSRodolfo Giometti 		fdata.info.clear_tu = pps->clear_tu;
191eae9d2baSRodolfo Giometti 		fdata.info.current_mode = pps->current_mode;
192eae9d2baSRodolfo Giometti 
193eae9d2baSRodolfo Giometti 		spin_unlock_irq(&pps->lock);
194eae9d2baSRodolfo Giometti 
195eae9d2baSRodolfo Giometti 		err = copy_to_user(uarg, &fdata, sizeof(struct pps_fdata));
196eae9d2baSRodolfo Giometti 		if (err)
197eae9d2baSRodolfo Giometti 			return -EFAULT;
198eae9d2baSRodolfo Giometti 
199eae9d2baSRodolfo Giometti 		break;
20086d921f9SAlexander Gordeev 	}
201eae9d2baSRodolfo Giometti 	default:
202eae9d2baSRodolfo Giometti 		return -ENOTTY;
203eae9d2baSRodolfo Giometti 		break;
204eae9d2baSRodolfo Giometti 	}
205eae9d2baSRodolfo Giometti 
206eae9d2baSRodolfo Giometti 	return 0;
207eae9d2baSRodolfo Giometti }
208eae9d2baSRodolfo Giometti 
209eae9d2baSRodolfo Giometti static int pps_cdev_open(struct inode *inode, struct file *file)
210eae9d2baSRodolfo Giometti {
211eae9d2baSRodolfo Giometti 	struct pps_device *pps = container_of(inode->i_cdev,
212eae9d2baSRodolfo Giometti 						struct pps_device, cdev);
213eae9d2baSRodolfo Giometti 	file->private_data = pps;
214eae9d2baSRodolfo Giometti 
215eae9d2baSRodolfo Giometti 	return 0;
216eae9d2baSRodolfo Giometti }
217eae9d2baSRodolfo Giometti 
218eae9d2baSRodolfo Giometti static int pps_cdev_release(struct inode *inode, struct file *file)
219eae9d2baSRodolfo Giometti {
220eae9d2baSRodolfo Giometti 	return 0;
221eae9d2baSRodolfo Giometti }
222eae9d2baSRodolfo Giometti 
223eae9d2baSRodolfo Giometti /*
224eae9d2baSRodolfo Giometti  * Char device stuff
225eae9d2baSRodolfo Giometti  */
226eae9d2baSRodolfo Giometti 
227eae9d2baSRodolfo Giometti static const struct file_operations pps_cdev_fops = {
228eae9d2baSRodolfo Giometti 	.owner		= THIS_MODULE,
229eae9d2baSRodolfo Giometti 	.llseek		= no_llseek,
230eae9d2baSRodolfo Giometti 	.poll		= pps_cdev_poll,
231eae9d2baSRodolfo Giometti 	.fasync		= pps_cdev_fasync,
232eae9d2baSRodolfo Giometti 	.unlocked_ioctl	= pps_cdev_ioctl,
233eae9d2baSRodolfo Giometti 	.open		= pps_cdev_open,
234eae9d2baSRodolfo Giometti 	.release	= pps_cdev_release,
235eae9d2baSRodolfo Giometti };
236eae9d2baSRodolfo Giometti 
237083e5866SAlexander Gordeev static void pps_device_destruct(struct device *dev)
238083e5866SAlexander Gordeev {
239083e5866SAlexander Gordeev 	struct pps_device *pps = dev_get_drvdata(dev);
240083e5866SAlexander Gordeev 
241083e5866SAlexander Gordeev 	/* release id here to protect others from using it while it's
242083e5866SAlexander Gordeev 	 * still in use */
243*2a5cd6e2SAlexander Gordeev 	mutex_lock(&pps_idr_lock);
244083e5866SAlexander Gordeev 	idr_remove(&pps_idr, pps->id);
245*2a5cd6e2SAlexander Gordeev 	mutex_unlock(&pps_idr_lock);
246083e5866SAlexander Gordeev 
247083e5866SAlexander Gordeev 	kfree(dev);
248083e5866SAlexander Gordeev 	kfree(pps);
249083e5866SAlexander Gordeev }
250083e5866SAlexander Gordeev 
251eae9d2baSRodolfo Giometti int pps_register_cdev(struct pps_device *pps)
252eae9d2baSRodolfo Giometti {
253eae9d2baSRodolfo Giometti 	int err;
2545e196d34SAlexander Gordeev 	dev_t devt;
255eae9d2baSRodolfo Giometti 
256*2a5cd6e2SAlexander Gordeev 	mutex_lock(&pps_idr_lock);
257083e5866SAlexander Gordeev 	/* Get new ID for the new PPS source */
258*2a5cd6e2SAlexander Gordeev 	if (idr_pre_get(&pps_idr, GFP_KERNEL) == 0) {
259*2a5cd6e2SAlexander Gordeev 		mutex_unlock(&pps_idr_lock);
260083e5866SAlexander Gordeev 		return -ENOMEM;
261*2a5cd6e2SAlexander Gordeev 	}
262083e5866SAlexander Gordeev 
263083e5866SAlexander Gordeev 	/* Now really allocate the PPS source.
264083e5866SAlexander Gordeev 	 * After idr_get_new() calling the new source will be freely available
265083e5866SAlexander Gordeev 	 * into the kernel.
266083e5866SAlexander Gordeev 	 */
267083e5866SAlexander Gordeev 	err = idr_get_new(&pps_idr, pps, &pps->id);
268*2a5cd6e2SAlexander Gordeev 	mutex_unlock(&pps_idr_lock);
269083e5866SAlexander Gordeev 
270083e5866SAlexander Gordeev 	if (err < 0)
271083e5866SAlexander Gordeev 		return err;
272083e5866SAlexander Gordeev 
273083e5866SAlexander Gordeev 	pps->id &= MAX_ID_MASK;
274083e5866SAlexander Gordeev 	if (pps->id >= PPS_MAX_SOURCES) {
275083e5866SAlexander Gordeev 		pr_err("%s: too many PPS sources in the system\n",
276083e5866SAlexander Gordeev 					pps->info.name);
277083e5866SAlexander Gordeev 		err = -EBUSY;
278083e5866SAlexander Gordeev 		goto free_idr;
279083e5866SAlexander Gordeev 	}
280083e5866SAlexander Gordeev 
2815e196d34SAlexander Gordeev 	devt = MKDEV(MAJOR(pps_devt), pps->id);
2825e196d34SAlexander Gordeev 
283eae9d2baSRodolfo Giometti 	cdev_init(&pps->cdev, &pps_cdev_fops);
284eae9d2baSRodolfo Giometti 	pps->cdev.owner = pps->info.owner;
285eae9d2baSRodolfo Giometti 
2865e196d34SAlexander Gordeev 	err = cdev_add(&pps->cdev, devt, 1);
287eae9d2baSRodolfo Giometti 	if (err) {
2887f7cce74SAlexander Gordeev 		pr_err("%s: failed to add char device %d:%d\n",
289eae9d2baSRodolfo Giometti 				pps->info.name, MAJOR(pps_devt), pps->id);
290083e5866SAlexander Gordeev 		goto free_idr;
291eae9d2baSRodolfo Giometti 	}
2925e196d34SAlexander Gordeev 	pps->dev = device_create(pps_class, pps->info.dev, devt, pps,
293eae9d2baSRodolfo Giometti 							"pps%d", pps->id);
294054b2b13SJoonwoo Park 	if (IS_ERR(pps->dev))
295eae9d2baSRodolfo Giometti 		goto del_cdev;
296eae9d2baSRodolfo Giometti 
297083e5866SAlexander Gordeev 	pps->dev->release = pps_device_destruct;
298083e5866SAlexander Gordeev 
299eae9d2baSRodolfo Giometti 	pr_debug("source %s got cdev (%d:%d)\n", pps->info.name,
300eae9d2baSRodolfo Giometti 			MAJOR(pps_devt), pps->id);
301eae9d2baSRodolfo Giometti 
302eae9d2baSRodolfo Giometti 	return 0;
303eae9d2baSRodolfo Giometti 
304eae9d2baSRodolfo Giometti del_cdev:
305eae9d2baSRodolfo Giometti 	cdev_del(&pps->cdev);
306eae9d2baSRodolfo Giometti 
307083e5866SAlexander Gordeev free_idr:
308*2a5cd6e2SAlexander Gordeev 	mutex_lock(&pps_idr_lock);
309083e5866SAlexander Gordeev 	idr_remove(&pps_idr, pps->id);
310*2a5cd6e2SAlexander Gordeev 	mutex_unlock(&pps_idr_lock);
311083e5866SAlexander Gordeev 
312eae9d2baSRodolfo Giometti 	return err;
313eae9d2baSRodolfo Giometti }
314eae9d2baSRodolfo Giometti 
315eae9d2baSRodolfo Giometti void pps_unregister_cdev(struct pps_device *pps)
316eae9d2baSRodolfo Giometti {
3175e196d34SAlexander Gordeev 	device_destroy(pps_class, pps->dev->devt);
318eae9d2baSRodolfo Giometti 	cdev_del(&pps->cdev);
319eae9d2baSRodolfo Giometti }
320eae9d2baSRodolfo Giometti 
321eae9d2baSRodolfo Giometti /*
322eae9d2baSRodolfo Giometti  * Module stuff
323eae9d2baSRodolfo Giometti  */
324eae9d2baSRodolfo Giometti 
325eae9d2baSRodolfo Giometti static void __exit pps_exit(void)
326eae9d2baSRodolfo Giometti {
327eae9d2baSRodolfo Giometti 	class_destroy(pps_class);
328eae9d2baSRodolfo Giometti 	unregister_chrdev_region(pps_devt, PPS_MAX_SOURCES);
329eae9d2baSRodolfo Giometti }
330eae9d2baSRodolfo Giometti 
331eae9d2baSRodolfo Giometti static int __init pps_init(void)
332eae9d2baSRodolfo Giometti {
333eae9d2baSRodolfo Giometti 	int err;
334eae9d2baSRodolfo Giometti 
335eae9d2baSRodolfo Giometti 	pps_class = class_create(THIS_MODULE, "pps");
336eae9d2baSRodolfo Giometti 	if (!pps_class) {
3377f7cce74SAlexander Gordeev 		pr_err("failed to allocate class\n");
338eae9d2baSRodolfo Giometti 		return -ENOMEM;
339eae9d2baSRodolfo Giometti 	}
340eae9d2baSRodolfo Giometti 	pps_class->dev_attrs = pps_attrs;
341eae9d2baSRodolfo Giometti 
342eae9d2baSRodolfo Giometti 	err = alloc_chrdev_region(&pps_devt, 0, PPS_MAX_SOURCES, "pps");
343eae9d2baSRodolfo Giometti 	if (err < 0) {
3447f7cce74SAlexander Gordeev 		pr_err("failed to allocate char device region\n");
345eae9d2baSRodolfo Giometti 		goto remove_class;
346eae9d2baSRodolfo Giometti 	}
347eae9d2baSRodolfo Giometti 
348eae9d2baSRodolfo Giometti 	pr_info("LinuxPPS API ver. %d registered\n", PPS_API_VERS);
349eae9d2baSRodolfo Giometti 	pr_info("Software ver. %s - Copyright 2005-2007 Rodolfo Giometti "
350eae9d2baSRodolfo Giometti 		"<giometti@linux.it>\n", PPS_VERSION);
351eae9d2baSRodolfo Giometti 
352eae9d2baSRodolfo Giometti 	return 0;
353eae9d2baSRodolfo Giometti 
354eae9d2baSRodolfo Giometti remove_class:
355eae9d2baSRodolfo Giometti 	class_destroy(pps_class);
356eae9d2baSRodolfo Giometti 
357eae9d2baSRodolfo Giometti 	return err;
358eae9d2baSRodolfo Giometti }
359eae9d2baSRodolfo Giometti 
360eae9d2baSRodolfo Giometti subsys_initcall(pps_init);
361eae9d2baSRodolfo Giometti module_exit(pps_exit);
362eae9d2baSRodolfo Giometti 
363eae9d2baSRodolfo Giometti MODULE_AUTHOR("Rodolfo Giometti <giometti@linux.it>");
364eae9d2baSRodolfo Giometti MODULE_DESCRIPTION("LinuxPPS support (RFC 2783) - ver. " PPS_VERSION);
365eae9d2baSRodolfo Giometti MODULE_LICENSE("GPL");
366