Commit edfd17ff authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Michael Ellerman

powerpc/eeh: Stop using do_gettimeofday()

This interface is inefficient and deprecated because of the y2038
overflow.

ktime_get_seconds() is an appropriate replacement here, since it
has sufficient granularity but is more efficient and uses monotonic
time.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
Acked-by: default avatarRussell Currey <ruscur@russell.cc>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent cbb55eeb
...@@ -93,7 +93,7 @@ struct eeh_pe { ...@@ -93,7 +93,7 @@ struct eeh_pe {
struct pci_bus *bus; /* Top PCI bus for bus PE */ struct pci_bus *bus; /* Top PCI bus for bus PE */
int check_count; /* Times of ignored error */ int check_count; /* Times of ignored error */
int freeze_count; /* Times of froze up */ int freeze_count; /* Times of froze up */
struct timeval tstamp; /* Time on first-time freeze */ time64_t tstamp; /* Time on first-time freeze */
int false_positives; /* Times of reported #ff's */ int false_positives; /* Times of reported #ff's */
atomic_t pass_dev_cnt; /* Count of passed through devs */ atomic_t pass_dev_cnt; /* Count of passed through devs */
struct eeh_pe *parent; /* Parent PE */ struct eeh_pe *parent; /* Parent PE */
......
...@@ -623,7 +623,7 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus, ...@@ -623,7 +623,7 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus,
struct eeh_rmv_data *rmv_data) struct eeh_rmv_data *rmv_data)
{ {
struct pci_bus *frozen_bus = eeh_pe_bus_get(pe); struct pci_bus *frozen_bus = eeh_pe_bus_get(pe);
struct timeval tstamp; time64_t tstamp;
int cnt, rc; int cnt, rc;
struct eeh_dev *edev; struct eeh_dev *edev;
......
...@@ -526,16 +526,16 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev) ...@@ -526,16 +526,16 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev)
*/ */
void eeh_pe_update_time_stamp(struct eeh_pe *pe) void eeh_pe_update_time_stamp(struct eeh_pe *pe)
{ {
struct timeval tstamp; time64_t tstamp;
if (!pe) return; if (!pe) return;
if (pe->freeze_count <= 0) { if (pe->freeze_count <= 0) {
pe->freeze_count = 0; pe->freeze_count = 0;
do_gettimeofday(&pe->tstamp); pe->tstamp = ktime_get_seconds();
} else { } else {
do_gettimeofday(&tstamp); tstamp = ktime_get_seconds();
if (tstamp.tv_sec - pe->tstamp.tv_sec > 3600) { if (tstamp - pe->tstamp > 3600) {
pe->tstamp = tstamp; pe->tstamp = tstamp;
pe->freeze_count = 0; pe->freeze_count = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment