Unverified Commit 37209634 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!15299 ptp: Ensure info->enable callback is always set

parents d62add7a 44b93e82
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -189,6 +189,11 @@ static int ptp_getcycles64(struct ptp_clock_info *info, struct timespec64 *ts)
		return info->gettime64(info, ts);
}

static int ptp_enable(struct ptp_clock_info *ptp, struct ptp_clock_request *request, int on)
{
	return -EOPNOTSUPP;
}

static void ptp_aux_kworker(struct kthread_work *work)
{
	struct ptp_clock *ptp = container_of(work, struct ptp_clock,
@@ -251,6 +256,9 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
			ptp->info->getcrosscycles = ptp->info->getcrosststamp;
	}

	if (!ptp->info->enable)
		ptp->info->enable = ptp_enable;

	if (ptp->info->do_aux_work) {
		kthread_init_delayed_work(&ptp->aux_work, ptp_aux_kworker);
		ptp->kworker = kthread_create_worker(0, "ptp%d", ptp->index);