]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powerpc/eeh: Stop using do_gettimeofday()
authorArnd Bergmann <arnd@arndb.de>
Sat, 4 Nov 2017 21:26:52 +0000 (22:26 +0100)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 6 Nov 2017 06:40:00 +0000 (17:40 +1100)
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: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Acked-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/eeh.h
arch/powerpc/kernel/eeh_driver.c
arch/powerpc/kernel/eeh_pe.c

index cd1df96335e54edc92e8d3a64b213240c65a75be..5161c37dd039bd29f034fdd1375c174d3d198707 100644 (file)
@@ -93,7 +93,7 @@ struct eeh_pe {
        struct pci_bus *bus;            /* Top PCI bus for bus PE       */
        int check_count;                /* Times of ignored error       */
        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      */
        atomic_t pass_dev_cnt;          /* Count of passed through devs */
        struct eeh_pe *parent;          /* Parent PE                    */
index 8b840191df59680b7030f3202d1b83571c7d8f6a..57d54163bf940b73ba8cdc730aad667d1872e300 100644 (file)
@@ -623,7 +623,7 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus,
                                struct eeh_rmv_data *rmv_data)
 {
        struct pci_bus *frozen_bus = eeh_pe_bus_get(pe);
-       struct timeval tstamp;
+       time64_t tstamp;
        int cnt, rc;
        struct eeh_dev *edev;
 
index 2e8d1b2b5af4571132c38593ef1ca160347efecf..2d4956e97aa9812fd93863322e1a1808e5a54cd7 100644 (file)
@@ -526,16 +526,16 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev)
  */
 void eeh_pe_update_time_stamp(struct eeh_pe *pe)
 {
-       struct timeval tstamp;
+       time64_t tstamp;
 
        if (!pe) return;
 
        if (pe->freeze_count <= 0) {
                pe->freeze_count = 0;
-               do_gettimeofday(&pe->tstamp);
+               pe->tstamp = ktime_get_seconds();
        } else {
-               do_gettimeofday(&tstamp);
-               if (tstamp.tv_sec - pe->tstamp.tv_sec > 3600) {
+               tstamp = ktime_get_seconds();
+               if (tstamp - pe->tstamp > 3600) {
                        pe->tstamp = tstamp;
                        pe->freeze_count = 0;
                }