forked from Imagelibrary/rtems
timecounter: Merge FreeBSD change r279728
Add mutex support to the pps_ioctl() API in the kernel. Bump kernel version to reflect structure change. PR: 196897 MFC after: 1 week Update #3175.
This commit is contained in:
committed by
Sebastian Huber
parent
ed9a6fd8ac
commit
ea0b339bbc
@@ -133,6 +133,8 @@ struct pps_kcbind_args {
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
struct mtx;
|
||||
|
||||
struct pps_state {
|
||||
/* Capture information. */
|
||||
struct timehands *capth;
|
||||
@@ -140,6 +142,9 @@ struct pps_state {
|
||||
unsigned capgen;
|
||||
unsigned capcount;
|
||||
|
||||
/* pointer to mutex protecting this state, if any */
|
||||
struct mtx *mtx;
|
||||
|
||||
/* State information. */
|
||||
pps_params_t ppsparam;
|
||||
pps_info_t ppsinfo;
|
||||
|
||||
@@ -51,7 +51,6 @@ __FBSDID("$FreeBSD r284178 2015-06-09T11:49:56Z$");
|
||||
#include <sys/limits.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/systm.h>
|
||||
@@ -1713,17 +1712,10 @@ pps_fetch(struct pps_fetch_args *fapi, struct pps_state *pps)
|
||||
cseq = pps->ppsinfo.clear_sequence;
|
||||
while (aseq == pps->ppsinfo.assert_sequence &&
|
||||
cseq == pps->ppsinfo.clear_sequence) {
|
||||
if (abi_aware(pps, 1) && pps->driver_mtx != NULL) {
|
||||
if (pps->flags & PPSFLAG_MTX_SPIN) {
|
||||
err = msleep_spin(pps, pps->driver_mtx,
|
||||
"ppsfch", timo);
|
||||
} else {
|
||||
err = msleep(pps, pps->driver_mtx, PCATCH,
|
||||
"ppsfch", timo);
|
||||
}
|
||||
} else {
|
||||
if (pps->mtx != NULL)
|
||||
err = msleep(pps, pps->mtx, PCATCH, "ppsfch", timo);
|
||||
else
|
||||
err = tsleep(pps, PCATCH, "ppsfch", timo);
|
||||
}
|
||||
if (err == EWOULDBLOCK && fapi->timeout.tv_sec == -1) {
|
||||
continue;
|
||||
} else if (err != 0) {
|
||||
|
||||
Reference in New Issue
Block a user