On Tue, Apr 07, 2020 at 11:01:14PM +0300, Souza, Jose wrote: > [...] > > > + } while (ret == -EAGAIN); > > > > Let's protect against an endless loop. > > const ktime_t timeout = ktime_add_ms(ktime_get_raw(), 3); > int ret; > > do { > ret = sandybridge_pcode_write_timeout(i915, > ICL_PCODE_EXIT_TCCOLD, > 0, 250, 1); > } while (ret == -EAGAIN && ktime_compare(timeout, ktime_get_raw()) > 0); Why not just a simple trial = 0; while (1) { ret = pcode_write(); if (ret != -EAGAIN || ++trial == 3) break; msleep(1); } with the msleep(1), as if the PCODE run/busy flag didn't get cleared after the 1ms polling, it probably doesn't make sense to retry in a tight loop. --Imre _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx