diff mbox series

[v1] phy: qcom-ufs: Use iopoll.h readl_poll_timeout macro

Message ID 88cd3a2e-2acc-02ff-9f27-284d3b679d10@free.fr (mailing list archive)
State Mainlined
Headers show
Series [v1] phy: qcom-ufs: Use iopoll.h readl_poll_timeout macro | expand

Commit Message

Marc Gonzalez Dec. 21, 2018, 10:13 a.m. UTC
The private copy of readl_poll_timeout is no longer needed.
Use the implementation in iopoll.h instead.

Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
---
 drivers/phy/qualcomm/phy-qcom-ufs-i.h | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

Comments

Bjorn Andersson Dec. 27, 2018, 4:03 a.m. UTC | #1
On Fri 21 Dec 02:13 PST 2018, Marc Gonzalez wrote:

> The private copy of readl_poll_timeout is no longer needed.
> Use the implementation in iopoll.h instead.
> 
> Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> ---
>  drivers/phy/qualcomm/phy-qcom-ufs-i.h | 19 +------------------
>  1 file changed, 1 insertion(+), 18 deletions(-)
> 
> diff --git a/drivers/phy/qualcomm/phy-qcom-ufs-i.h b/drivers/phy/qualcomm/phy-qcom-ufs-i.h
> index 681644e43248..f798fb64de94 100644
> --- a/drivers/phy/qualcomm/phy-qcom-ufs-i.h
> +++ b/drivers/phy/qualcomm/phy-qcom-ufs-i.h
> @@ -23,24 +23,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/io.h>
>  #include <linux/delay.h>
> -
> -#define readl_poll_timeout(addr, val, cond, sleep_us, timeout_us) \
> -({ \
> -	ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \
> -	might_sleep_if(timeout_us); \
> -	for (;;) { \
> -		(val) = readl(addr); \
> -		if (cond) \
> -			break; \
> -		if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \
> -			(val) = readl(addr); \
> -			break; \
> -		} \
> -		if (sleep_us) \
> -			usleep_range(DIV_ROUND_UP(sleep_us, 4), sleep_us); \
> -	} \
> -	(cond) ? 0 : -ETIMEDOUT; \
> -})
> +#include <linux/iopoll.h>
>  
>  #define UFS_QCOM_PHY_CAL_ENTRY(reg, val)	\
>  	{				\
> -- 
> 2.17.1
Andy Gross Dec. 28, 2018, 4:05 p.m. UTC | #2
On Fri, Dec 21, 2018 at 11:13:18AM +0100, Marc Gonzalez wrote:
> The private copy of readl_poll_timeout is no longer needed.
> Use the implementation in iopoll.h instead.
> 
> Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>

Reviewed-by: Andy Gross <andy.gross@linaro.org>
Vivek Gautam Jan. 2, 2019, 6:53 a.m. UTC | #3
On Fri, Dec 21, 2018 at 9:43 PM Marc Gonzalez <marc.w.gonzalez@free.fr> wrote:
>
> The private copy of readl_poll_timeout is no longer needed.
> Use the implementation in iopoll.h instead.
>
> Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
> ---
>  drivers/phy/qualcomm/phy-qcom-ufs-i.h | 19 +------------------
>  1 file changed, 1 insertion(+), 18 deletions(-)
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-ufs-i.h b/drivers/phy/qualcomm/phy-qcom-ufs-i.h
> index 681644e43248..f798fb64de94 100644
> --- a/drivers/phy/qualcomm/phy-qcom-ufs-i.h
> +++ b/drivers/phy/qualcomm/phy-qcom-ufs-i.h
> @@ -23,24 +23,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/io.h>
>  #include <linux/delay.h>
> -
> -#define readl_poll_timeout(addr, val, cond, sleep_us, timeout_us) \
> -({ \
> -       ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \
> -       might_sleep_if(timeout_us); \
> -       for (;;) { \
> -               (val) = readl(addr); \
> -               if (cond) \
> -                       break; \
> -               if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \
> -                       (val) = readl(addr); \
> -                       break; \
> -               } \
> -               if (sleep_us) \
> -                       usleep_range(DIV_ROUND_UP(sleep_us, 4), sleep_us); \
> -       } \
> -       (cond) ? 0 : -ETIMEDOUT; \
> -})
> +#include <linux/iopoll.h>
>
>  #define UFS_QCOM_PHY_CAL_ENTRY(reg, val)       \
>         {                               \
> --
> 2.17.1

Thanks for the patch. LGTM.
Reviewed-by: Vivek Gautam <vivek.gautam@codeaurora.org>

Best regards
Vivek
Marc Gonzalez Jan. 16, 2019, 9:10 a.m. UTC | #4
On 28/12/2018 17:05, Andy Gross wrote:

> On Fri, Dec 21, 2018 at 11:13:18AM +0100, Marc Gonzalez wrote:
>
>> The private copy of readl_poll_timeout is no longer needed.
>> Use the implementation in iopoll.h instead.
>>
>> Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
> 
> Reviewed-by: Andy Gross <andy.gross@linaro.org>

Would this patch go through your tree or Kishon's tree?

Regards.
Kishon Vijay Abraham I Jan. 16, 2019, 9:24 a.m. UTC | #5
Hi,

On 16/01/19 2:40 PM, Marc Gonzalez wrote:
> On 28/12/2018 17:05, Andy Gross wrote:
> 
>> On Fri, Dec 21, 2018 at 11:13:18AM +0100, Marc Gonzalez wrote:
>>
>>> The private copy of readl_poll_timeout is no longer needed.
>>> Use the implementation in iopoll.h instead.
>>>
>>> Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
>>
>> Reviewed-by: Andy Gross <andy.gross@linaro.org>
> 
> Would this patch go through your tree or Kishon's tree?

I've merged this in phy -next.

Thanks
Kishon
Marc Gonzalez Jan. 16, 2019, 10:30 a.m. UTC | #6
On 16/01/2019 10:24, Kishon Vijay Abraham I wrote:

> On 16/01/19 2:40 PM, Marc Gonzalez wrote:
>
>> Would this patch go through your tree or Kishon's tree?
> 
> I've merged this in phy -next.

Thanks Kishon.

Do you mean here?

https://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git/log/?h=next

Regards.
Kishon Vijay Abraham I Jan. 16, 2019, 11:50 a.m. UTC | #7
Hi,

On 16/01/19 4:00 PM, Marc Gonzalez wrote:
> On 16/01/2019 10:24, Kishon Vijay Abraham I wrote:
> 
>> On 16/01/19 2:40 PM, Marc Gonzalez wrote:
>>
>>> Would this patch go through your tree or Kishon's tree?
>>
>> I've merged this in phy -next.
> 
> Thanks Kishon.
> 
> Do you mean here?
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git/log/?h=next

yes.

Thanks
Kishon
diff mbox series

Patch

diff --git a/drivers/phy/qualcomm/phy-qcom-ufs-i.h b/drivers/phy/qualcomm/phy-qcom-ufs-i.h
index 681644e43248..f798fb64de94 100644
--- a/drivers/phy/qualcomm/phy-qcom-ufs-i.h
+++ b/drivers/phy/qualcomm/phy-qcom-ufs-i.h
@@ -23,24 +23,7 @@ 
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/delay.h>
-
-#define readl_poll_timeout(addr, val, cond, sleep_us, timeout_us) \
-({ \
-	ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); \
-	might_sleep_if(timeout_us); \
-	for (;;) { \
-		(val) = readl(addr); \
-		if (cond) \
-			break; \
-		if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { \
-			(val) = readl(addr); \
-			break; \
-		} \
-		if (sleep_us) \
-			usleep_range(DIV_ROUND_UP(sleep_us, 4), sleep_us); \
-	} \
-	(cond) ? 0 : -ETIMEDOUT; \
-})
+#include <linux/iopoll.h>
 
 #define UFS_QCOM_PHY_CAL_ENTRY(reg, val)	\
 	{				\