Skip to content

Commit

Permalink
ptp: sfc: convert to the 64 bit get/set time methods.
Browse files Browse the repository at this point in the history
This patch changes the driver to use the newer API.

Depending on how the hardware represents a time value, this driver may
or may not yet be ready for the year 2038.

Compile tested only.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Richard Cochran authored and David S. Miller committed Mar 31, 2015
1 parent e394b80 commit 0fcb5c7
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions drivers/net/ethernet/sfc/ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ struct efx_ptp_data {

static int efx_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta);
static int efx_phc_adjtime(struct ptp_clock_info *ptp, s64 delta);
static int efx_phc_gettime(struct ptp_clock_info *ptp, struct timespec *ts);
static int efx_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts);
static int efx_phc_settime(struct ptp_clock_info *ptp,
const struct timespec *e_ts);
const struct timespec64 *e_ts);
static int efx_phc_enable(struct ptp_clock_info *ptp,
struct ptp_clock_request *request, int on);

Expand Down Expand Up @@ -1198,8 +1198,8 @@ static const struct ptp_clock_info efx_phc_clock_info = {
.pps = 1,
.adjfreq = efx_phc_adjfreq,
.adjtime = efx_phc_adjtime,
.gettime = efx_phc_gettime,
.settime = efx_phc_settime,
.gettime64 = efx_phc_gettime,
.settime64 = efx_phc_settime,
.enable = efx_phc_enable,
};

Expand Down Expand Up @@ -1837,7 +1837,7 @@ static int efx_phc_adjtime(struct ptp_clock_info *ptp, s64 delta)
NULL, 0, NULL);
}

static int efx_phc_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
static int efx_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
{
struct efx_ptp_data *ptp_data = container_of(ptp,
struct efx_ptp_data,
Expand All @@ -1859,28 +1859,28 @@ static int efx_phc_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
kt = ptp_data->nic_to_kernel_time(
MCDI_DWORD(outbuf, PTP_OUT_READ_NIC_TIME_MAJOR),
MCDI_DWORD(outbuf, PTP_OUT_READ_NIC_TIME_MINOR), 0);
*ts = ktime_to_timespec(kt);
*ts = ktime_to_timespec64(kt);
return 0;
}

static int efx_phc_settime(struct ptp_clock_info *ptp,
const struct timespec *e_ts)
const struct timespec64 *e_ts)
{
/* Get the current NIC time, efx_phc_gettime.
* Subtract from the desired time to get the offset
* call efx_phc_adjtime with the offset
*/
int rc;
struct timespec time_now;
struct timespec delta;
struct timespec64 time_now;
struct timespec64 delta;

rc = efx_phc_gettime(ptp, &time_now);
if (rc != 0)
return rc;

delta = timespec_sub(*e_ts, time_now);
delta = timespec64_sub(*e_ts, time_now);

rc = efx_phc_adjtime(ptp, timespec_to_ns(&delta));
rc = efx_phc_adjtime(ptp, timespec64_to_ns(&delta));
if (rc != 0)
return rc;

Expand Down

0 comments on commit 0fcb5c7

Please sign in to comment.