diff options
Diffstat (limited to 'drivers/pps/kapi.c')
| -rw-r--r-- | drivers/pps/kapi.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c index a4e8eb9fece6..f197e8ea185c 100644 --- a/drivers/pps/kapi.c +++ b/drivers/pps/kapi.c | |||
| @@ -52,6 +52,14 @@ static void pps_add_offset(struct pps_ktime *ts, struct pps_ktime *offset) | |||
| 52 | ts->sec += offset->sec; | 52 | ts->sec += offset->sec; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | static void pps_echo_client_default(struct pps_device *pps, int event, | ||
| 56 | void *data) | ||
| 57 | { | ||
| 58 | dev_info(pps->dev, "echo %s %s\n", | ||
| 59 | event & PPS_CAPTUREASSERT ? "assert" : "", | ||
| 60 | event & PPS_CAPTURECLEAR ? "clear" : ""); | ||
| 61 | } | ||
| 62 | |||
| 55 | /* | 63 | /* |
| 56 | * Exported functions | 64 | * Exported functions |
| 57 | */ | 65 | */ |
| @@ -80,13 +88,6 @@ struct pps_device *pps_register_source(struct pps_source_info *info, | |||
| 80 | err = -EINVAL; | 88 | err = -EINVAL; |
| 81 | goto pps_register_source_exit; | 89 | goto pps_register_source_exit; |
| 82 | } | 90 | } |
| 83 | if ((info->mode & (PPS_ECHOASSERT | PPS_ECHOCLEAR)) != 0 && | ||
| 84 | info->echo == NULL) { | ||
| 85 | pr_err("%s: echo function is not defined\n", | ||
| 86 | info->name); | ||
| 87 | err = -EINVAL; | ||
| 88 | goto pps_register_source_exit; | ||
| 89 | } | ||
| 90 | if ((info->mode & (PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)) == 0) { | 91 | if ((info->mode & (PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)) == 0) { |
| 91 | pr_err("%s: unspecified time format\n", | 92 | pr_err("%s: unspecified time format\n", |
| 92 | info->name); | 93 | info->name); |
| @@ -108,6 +109,11 @@ struct pps_device *pps_register_source(struct pps_source_info *info, | |||
| 108 | pps->params.mode = default_params; | 109 | pps->params.mode = default_params; |
| 109 | pps->info = *info; | 110 | pps->info = *info; |
| 110 | 111 | ||
| 112 | /* check for default echo function */ | ||
| 113 | if ((pps->info.mode & (PPS_ECHOASSERT | PPS_ECHOCLEAR)) && | ||
| 114 | pps->info.echo == NULL) | ||
| 115 | pps->info.echo = pps_echo_client_default; | ||
| 116 | |||
| 111 | init_waitqueue_head(&pps->queue); | 117 | init_waitqueue_head(&pps->queue); |
| 112 | spin_lock_init(&pps->lock); | 118 | spin_lock_init(&pps->lock); |
| 113 | 119 | ||
