public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: dln2: use msecs_to_jiffies for time conversion
@ 2015-03-16 15:20 Nicholas Mc Guire
  2015-03-23 12:28 ` Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Mc Guire @ 2015-03-16 15:20 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: Lee Jones, linux-kernel, Nicholas Mc Guire

Converting milliseconds to jiffies by "val * HZ / 1000" is technically
OK but msecs_to_jiffies(val) is the cleaner solution and handles all
corner cases correctly. This is a minor API consolidation only and
should make things more readable.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

Patch was compile tested with x86_64_defconfig + CONFIG_MFD_DLN2=m

Patch is agianst 4.0-rc3 (localversion-next is -next-20150316)

 drivers/mfd/dln2.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
index 1be9bd1..704e189 100644
--- a/drivers/mfd/dln2.c
+++ b/drivers/mfd/dln2.c
@@ -435,7 +435,7 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd,
 	struct dln2_response *rsp;
 	struct dln2_rx_context *rxc;
 	struct device *dev = &dln2->interface->dev;
-	const unsigned long timeout = DLN2_USB_TIMEOUT * HZ / 1000;
+	const unsigned long timeout = msecs_to_jiffies(DLN2_USB_TIMEOUT);
 	struct dln2_mod_rx_slots *rxs = &dln2->mod_rx_slots[handle];
 	int size;
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mfd: dln2: use msecs_to_jiffies for time conversion
  2015-03-16 15:20 [PATCH] mfd: dln2: use msecs_to_jiffies for time conversion Nicholas Mc Guire
@ 2015-03-23 12:28 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2015-03-23 12:28 UTC (permalink / raw)
  To: Nicholas Mc Guire; +Cc: Samuel Ortiz, linux-kernel

On Mon, 16 Mar 2015, Nicholas Mc Guire wrote:

> Converting milliseconds to jiffies by "val * HZ / 1000" is technically
> OK but msecs_to_jiffies(val) is the cleaner solution and handles all
> corner cases correctly. This is a minor API consolidation only and
> should make things more readable.
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> ---
> 
> Patch was compile tested with x86_64_defconfig + CONFIG_MFD_DLN2=m
> 
> Patch is agianst 4.0-rc3 (localversion-next is -next-20150316)
> 
>  drivers/mfd/dln2.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

> diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
> index 1be9bd1..704e189 100644
> --- a/drivers/mfd/dln2.c
> +++ b/drivers/mfd/dln2.c
> @@ -435,7 +435,7 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd,
>  	struct dln2_response *rsp;
>  	struct dln2_rx_context *rxc;
>  	struct device *dev = &dln2->interface->dev;
> -	const unsigned long timeout = DLN2_USB_TIMEOUT * HZ / 1000;
> +	const unsigned long timeout = msecs_to_jiffies(DLN2_USB_TIMEOUT);
>  	struct dln2_mod_rx_slots *rxs = &dln2->mod_rx_slots[handle];
>  	int size;
>  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-23 12:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-16 15:20 [PATCH] mfd: dln2: use msecs_to_jiffies for time conversion Nicholas Mc Guire
2015-03-23 12:28 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox