/* * The function queue_cnt() is safe for readers to call without * holding q->lock. Readers use this function to verify that the queue * is nonempty before proceeding with a dequeue operation. The fact * that a writer might concurrently increment the tail does not * matter, since the queue remains nonempty nonetheless.
*/ staticinlineint queue_cnt(conststruct timestamp_event_queue *q)
{ /* * Paired with WRITE_ONCE() in enqueue_external_timestamp(), * ptp_read(), extts_fifo_show().
*/ int cnt = READ_ONCE(q->tail) - READ_ONCE(q->head); return cnt < 0 ? PTP_MAX_TIMESTAMPS + cnt : cnt;
}
/* Check if ptp virtual clock is in use */ staticinlinebool ptp_vclock_in_use(struct ptp_clock *ptp)
{ bool in_use = false;
/* Virtual clocks can't be stacked on top of virtual clocks. * Avoid acquiring the n_vclocks_mux on virtual clocks, to allow this * function to be called from code paths where the n_vclocks_mux of the * parent physical clock is already held. Functionally that's not an * issue, but lockdep would complain, because they have the same lock * class.
*/ if (ptp->is_virtual_clock) returnfalse;
if (mutex_lock_interruptible(&ptp->n_vclocks_mux)) returntrue;
if (ptp->n_vclocks)
in_use = true;
mutex_unlock(&ptp->n_vclocks_mux);
return in_use;
}
/* Check if ptp clock shall be free running */ staticinlinebool ptp_clock_freerun(struct ptp_clock *ptp)
{ if (ptp->has_cycles) returnfalse;
return ptp_vclock_in_use(ptp);
}
externconststructclass ptp_class;
/* * see ptp_chardev.c
*/
/* caller must hold pincfg_mux */ int ptp_set_pinfunc(struct ptp_clock *ptp, unsignedint pin, enum ptp_pin_function func, unsignedint chan);
long ptp_ioctl(struct posix_clock_context *pccontext, unsignedint cmd, unsignedlong arg);
int ptp_open(struct posix_clock_context *pccontext, fmode_t fmode);
int ptp_release(struct posix_clock_context *pccontext);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.