RE: [PATCH v2] ufs: change the way to complete fDeviceInit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +       ktime_t start;
> +       s64 time;
Can this be done with less variables?  e.g is this working?
ktime_t timeout;

> 
>         err = ufshcd_query_flag_retry(hba, UPIU_QUERY_OPCODE_SET_FLAG,
>                 QUERY_FLAG_IDN_FDEVICEINIT, 0, NULL);
> @@ -4161,20 +4165,27 @@ static int ufshcd_complete_dev_init(struct ufs_hba
> *hba)
>                 goto out;
>         }
> 
> -       /* poll for max. 1000 iterations for fDeviceInit flag to clear */
> -       for (i = 0; i < 1000 && !err && flag_res; i++)
> -               err = ufshcd_query_flag_retry(hba,
> UPIU_QUERY_OPCODE_READ_FLAG,
> -                       QUERY_FLAG_IDN_FDEVICEINIT, 0, &flag_res);
> +       /* Poll fDeviceInit flag to be cleared */
> +       start = ktime_get();
timeout = ktime_add_ms(ktime_get(), FDEVICEINIT_COMPL_TIMEOUT);

> +       do {
> +               err = ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_READ_FLAG,
> +                                       QUERY_FLAG_IDN_FDEVICEINIT, 0, &flag_res);
> +               if (!flag_res)
> +                       break;
> +               usleep_range(5000, 10000);
> +               time = ktime_to_ms(ktime_sub(ktime_get(), start));
> +       } while (time < FDEVICEINIT_COMPL_TIMEOUT);
while (ktime_before(ktime_get(), timeout));



Thanks,
Avri




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux