Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32eaf120 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'ptp-2038'



Fixed two warnings in e1000e and igb, when switching to timespec64
some printf formats started to not match.  In theses cases actually
the new type is __kernel_time_t which is __kernel_long_t which
unfortunately can be either "long" or "long long".  So to solve
this I cases the arguments to "long long".  -DaveM

Richard Cochran says:

====================
ptp: get ready for 2038

This series converts the core driver methods of the PTP Hardware Clock
(PHC) subsystem to use the 64 bit version of the timespec structure,
making the core API ready for the year 2038.

In addition, I reviewed how each driver and device represents the time
value at the hardware register level.  Most of the drivers are ready,
but a few will need some work before the year 2038, as shown:

   Patch   Driver
   ------------------------------------------------
   12      drivers/net/ethernet/intel/igb/igb_ptp.c
   15 ?    drivers/net/ethernet/sfc/ptp.c
   16      drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c

The commit log messages document how each driver is ready or why it is
not ready.  For patch 15, I could not easily find out the hardware
representation of the time value, and so the SFC maintainers will have
to review their low level code in order to resolve any remaining
issues.

* ChangeLog
** V3
   - dp83640: use timespec64 throughout per Arnd's suggestion
   - tilegx: use timespec64 throughout per Chris' suggestion
   - add Jeff's acked-bys
** V2
   - use the new methods in the posix clock code right away (patch #3)
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents d482994f ed7c6317
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -456,7 +456,7 @@ int gxio_mpipe_equeue_init(gxio_mpipe_equeue_t *equeue,
EXPORT_SYMBOL_GPL(gxio_mpipe_equeue_init);

int gxio_mpipe_set_timestamp(gxio_mpipe_context_t *context,
			     const struct timespec *ts)
			     const struct timespec64 *ts)
{
	cycles_t cycles = get_cycles();
	return gxio_mpipe_set_timestamp_aux(context, (uint64_t)ts->tv_sec,
@@ -466,7 +466,7 @@ int gxio_mpipe_set_timestamp(gxio_mpipe_context_t *context,
EXPORT_SYMBOL_GPL(gxio_mpipe_set_timestamp);

int gxio_mpipe_get_timestamp(gxio_mpipe_context_t *context,
			     struct timespec *ts)
			     struct timespec64 *ts)
{
	int ret;
	cycles_t cycles_prev, cycles_now, clock_rate;
+2 −2
Original line number Diff line number Diff line
@@ -1830,7 +1830,7 @@ extern int gxio_mpipe_link_set_attr(gxio_mpipe_link_t *link, uint32_t attr,
 *  code.
 */
extern int gxio_mpipe_get_timestamp(gxio_mpipe_context_t *context,
				    struct timespec *ts);
				    struct timespec64 *ts);

/* Set the timestamp of mPIPE.
 *
@@ -1840,7 +1840,7 @@ extern int gxio_mpipe_get_timestamp(gxio_mpipe_context_t *context,
 *  code.
 */
extern int gxio_mpipe_set_timestamp(gxio_mpipe_context_t *context,
				    const struct timespec *ts);
				    const struct timespec64 *ts);

/* Adjust the timestamp of mPIPE.
 *
+4 −4
Original line number Diff line number Diff line
@@ -983,7 +983,7 @@ static int bfin_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
	return 0;
}

static int bfin_ptp_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
static int bfin_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
{
	u64 ns;
	u32 remainder;
@@ -1003,7 +1003,7 @@ static int bfin_ptp_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
}

static int bfin_ptp_settime(struct ptp_clock_info *ptp,
			   const struct timespec *ts)
			   const struct timespec64 *ts)
{
	u64 ns;
	unsigned long flags;
@@ -1039,8 +1039,8 @@ static struct ptp_clock_info bfin_ptp_caps = {
	.pps		= 0,
	.adjfreq	= bfin_ptp_adjfreq,
	.adjtime	= bfin_ptp_adjtime,
	.gettime	= bfin_ptp_gettime,
	.settime	= bfin_ptp_settime,
	.gettime64	= bfin_ptp_gettime,
	.settime64	= bfin_ptp_settime,
	.enable		= bfin_ptp_enable,
};

+7 −6
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ static int xgbe_adjtime(struct ptp_clock_info *info, s64 delta)
	return 0;
}

static int xgbe_gettime(struct ptp_clock_info *info, struct timespec *ts)
static int xgbe_gettime(struct ptp_clock_info *info, struct timespec64 *ts)
{
	struct xgbe_prv_data *pdata = container_of(info,
						   struct xgbe_prv_data,
@@ -193,12 +193,13 @@ static int xgbe_gettime(struct ptp_clock_info *info, struct timespec *ts)

	spin_unlock_irqrestore(&pdata->tstamp_lock, flags);

	*ts = ns_to_timespec(nsec);
	*ts = ns_to_timespec64(nsec);

	return 0;
}

static int xgbe_settime(struct ptp_clock_info *info, const struct timespec *ts)
static int xgbe_settime(struct ptp_clock_info *info,
			const struct timespec64 *ts)
{
	struct xgbe_prv_data *pdata = container_of(info,
						   struct xgbe_prv_data,
@@ -206,7 +207,7 @@ static int xgbe_settime(struct ptp_clock_info *info, const struct timespec *ts)
	unsigned long flags;
	u64 nsec;

	nsec = timespec_to_ns(ts);
	nsec = timespec64_to_ns(ts);

	spin_lock_irqsave(&pdata->tstamp_lock, flags);

@@ -236,8 +237,8 @@ void xgbe_ptp_register(struct xgbe_prv_data *pdata)
	info->max_adj = pdata->ptpclk_rate;
	info->adjfreq = xgbe_adjfreq;
	info->adjtime = xgbe_adjtime;
	info->gettime = xgbe_gettime;
	info->settime = xgbe_settime;
	info->gettime64 = xgbe_gettime;
	info->settime64 = xgbe_settime;
	info->enable = xgbe_enable;

	clock = ptp_clock_register(info, pdata->dev);
+4 −4
Original line number Diff line number Diff line
@@ -13279,7 +13279,7 @@ static int bnx2x_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
	return 0;
}

static int bnx2x_ptp_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
static int bnx2x_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
{
	struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info);
	u64 ns;
@@ -13296,7 +13296,7 @@ static int bnx2x_ptp_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
}

static int bnx2x_ptp_settime(struct ptp_clock_info *ptp,
			     const struct timespec *ts)
			     const struct timespec64 *ts)
{
	struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info);
	u64 ns;
@@ -13334,8 +13334,8 @@ static void bnx2x_register_phc(struct bnx2x *bp)
	bp->ptp_clock_info.pps = 0;
	bp->ptp_clock_info.adjfreq = bnx2x_ptp_adjfreq;
	bp->ptp_clock_info.adjtime = bnx2x_ptp_adjtime;
	bp->ptp_clock_info.gettime = bnx2x_ptp_gettime;
	bp->ptp_clock_info.settime = bnx2x_ptp_settime;
	bp->ptp_clock_info.gettime64 = bnx2x_ptp_gettime;
	bp->ptp_clock_info.settime64 = bnx2x_ptp_settime;
	bp->ptp_clock_info.enable = bnx2x_ptp_enable;

	bp->ptp_clock = ptp_clock_register(&bp->ptp_clock_info, &bp->pdev->dev);
Loading