LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] staging: rts5028: use msecs_to_jiffies for timeouts
@ 2015-01-19 7:25 Nicholas Mc Guire
2015-01-22 1:40 ` 敬锐
0 siblings, 1 reply; 4+ messages in thread
From: Nicholas Mc Guire @ 2015-01-19 7:25 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Surya Seetharaman, Keerthimai Janarthanan, Tina Johnson,
Sarah Sharp, Fabio Falzoi, devel, linux-kernel,
Nicholas Mc Guire
This is only an API consolidation and should make things more readable
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
Converting milliseconds to jiffies by val * HZ / 1000 is technically
not wrong but msecs_to_jiffies(val) is the cleaner solution and handles
corner cases correctly.
This patch was only compile tested with x86_64_defconfig + CONFIG_STAGING=y,
CONFIG_RTS5208=m
Patch is against 3.19.0-rc4 -next-20150116
drivers/staging/rts5208/rtsx_transport.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index 756a968..dab1995 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -271,7 +271,7 @@ int rtsx_send_cmd(struct rtsx_chip *chip, u8 card, int timeout)
/* Wait for TRANS_OK_INT */
timeleft = wait_for_completion_interruptible_timeout(
- &trans_done, timeout * HZ / 1000);
+ &trans_done, msecs_to_jiffies(timeout));
if (timeleft <= 0) {
dev_dbg(rtsx_dev(chip), "chip->int_reg = 0x%x\n",
chip->int_reg);
@@ -431,7 +431,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
spin_unlock_irq(&rtsx->reg_lock);
timeleft = wait_for_completion_interruptible_timeout(
- &trans_done, timeout * HZ / 1000);
+ &trans_done, msecs_to_jiffies(timeout));
if (timeleft <= 0) {
dev_dbg(rtsx_dev(chip), "Timeout (%s %d)\n",
__func__, __LINE__);
@@ -455,7 +455,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
init_completion(&trans_done);
spin_unlock_irq(&rtsx->reg_lock);
timeleft = wait_for_completion_interruptible_timeout(
- &trans_done, timeout * HZ / 1000);
+ &trans_done, msecs_to_jiffies(timeout));
if (timeleft <= 0) {
dev_dbg(rtsx_dev(chip), "Timeout (%s %d)\n",
__func__, __LINE__);
@@ -575,7 +575,7 @@ static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card,
spin_unlock_irq(&rtsx->reg_lock);
timeleft = wait_for_completion_interruptible_timeout(
- &trans_done, timeout * HZ / 1000);
+ &trans_done, msecs_to_jiffies(timeout));
if (timeleft <= 0) {
dev_dbg(rtsx_dev(chip), "Timeout (%s %d)\n",
__func__, __LINE__);
@@ -602,7 +602,7 @@ static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card,
init_completion(&trans_done);
spin_unlock_irq(&rtsx->reg_lock);
timeleft = wait_for_completion_interruptible_timeout(
- &trans_done, timeout * HZ / 1000);
+ &trans_done, msecs_to_jiffies(timeout));
if (timeleft <= 0) {
dev_dbg(rtsx_dev(chip), "Timeout (%s %d)\n",
__func__, __LINE__);
@@ -688,7 +688,7 @@ static int rtsx_transfer_buf(struct rtsx_chip *chip, u8 card, void *buf,
/* Wait for TRANS_OK_INT */
timeleft = wait_for_completion_interruptible_timeout(
- &trans_done, timeout * HZ / 1000);
+ &trans_done, msecs_to_jiffies(timeout));
if (timeleft <= 0) {
dev_dbg(rtsx_dev(chip), "Timeout (%s %d)\n",
__func__, __LINE__);
--
1.7.10.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: rts5028: use msecs_to_jiffies for timeouts
2015-01-19 7:25 [PATCH] staging: rts5028: use msecs_to_jiffies for timeouts Nicholas Mc Guire
@ 2015-01-22 1:40 ` 敬锐
2015-01-22 9:01 ` Nicholas Mc Guire
0 siblings, 1 reply; 4+ messages in thread
From: 敬锐 @ 2015-01-22 1:40 UTC (permalink / raw)
To: Nicholas Mc Guire, Greg Kroah-Hartman
Cc: devel, Keerthimai Janarthanan, Sarah Sharp, linux-kernel,
Fabio Falzoi, Tina Johnson, Surya Seetharaman
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 3441 bytes --]
the title should be 5208.
On 01/19/2015 03:25 PM, Nicholas Mc Guire wrote:
> This is only an API consolidation and should make things more readable
>
> Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
> ---
>
> Converting milliseconds to jiffies by val * HZ / 1000 is technically
> not wrong but msecs_to_jiffies(val) is the cleaner solution and handles
> corner cases correctly.
>
> This patch was only compile tested with x86_64_defconfig + CONFIG_STAGING=y,
> CONFIG_RTS5208=m
>
> Patch is against 3.19.0-rc4 -next-20150116
>
> drivers/staging/rts5208/rtsx_transport.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
> index 756a968..dab1995 100644
> --- a/drivers/staging/rts5208/rtsx_transport.c
> +++ b/drivers/staging/rts5208/rtsx_transport.c
> @@ -271,7 +271,7 @@ int rtsx_send_cmd(struct rtsx_chip *chip, u8 card, int timeout)
>
> /* Wait for TRANS_OK_INT */
> timeleft = wait_for_completion_interruptible_timeout(
> - &trans_done, timeout * HZ / 1000);
> + &trans_done, msecs_to_jiffies(timeout));
> if (timeleft <= 0) {
> dev_dbg(rtsx_dev(chip), "chip->int_reg = 0x%x\n",
> chip->int_reg);
> @@ -431,7 +431,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
> spin_unlock_irq(&rtsx->reg_lock);
>
> timeleft = wait_for_completion_interruptible_timeout(
> - &trans_done, timeout * HZ / 1000);
> + &trans_done, msecs_to_jiffies(timeout));
> if (timeleft <= 0) {
> dev_dbg(rtsx_dev(chip), "Timeout (%s %d)\n",
> __func__, __LINE__);
> @@ -455,7 +455,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
> init_completion(&trans_done);
> spin_unlock_irq(&rtsx->reg_lock);
> timeleft = wait_for_completion_interruptible_timeout(
> - &trans_done, timeout * HZ / 1000);
> + &trans_done, msecs_to_jiffies(timeout));
> if (timeleft <= 0) {
> dev_dbg(rtsx_dev(chip), "Timeout (%s %d)\n",
> __func__, __LINE__);
> @@ -575,7 +575,7 @@ static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card,
> spin_unlock_irq(&rtsx->reg_lock);
>
> timeleft = wait_for_completion_interruptible_timeout(
> - &trans_done, timeout * HZ / 1000);
> + &trans_done, msecs_to_jiffies(timeout));
> if (timeleft <= 0) {
> dev_dbg(rtsx_dev(chip), "Timeout (%s %d)\n",
> __func__, __LINE__);
> @@ -602,7 +602,7 @@ static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card,
> init_completion(&trans_done);
> spin_unlock_irq(&rtsx->reg_lock);
> timeleft = wait_for_completion_interruptible_timeout(
> - &trans_done, timeout * HZ / 1000);
> + &trans_done, msecs_to_jiffies(timeout));
> if (timeleft <= 0) {
> dev_dbg(rtsx_dev(chip), "Timeout (%s %d)\n",
> __func__, __LINE__);
> @@ -688,7 +688,7 @@ static int rtsx_transfer_buf(struct rtsx_chip *chip, u8 card, void *buf,
>
> /* Wait for TRANS_OK_INT */
> timeleft = wait_for_completion_interruptible_timeout(
> - &trans_done, timeout * HZ / 1000);
> + &trans_done, msecs_to_jiffies(timeout));
> if (timeleft <= 0) {
> dev_dbg(rtsx_dev(chip), "Timeout (%s %d)\n",
> __func__, __LINE__);
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: rts5028: use msecs_to_jiffies for timeouts
2015-01-22 1:40 ` 敬锐
@ 2015-01-22 9:01 ` Nicholas Mc Guire
2015-01-23 1:13 ` 敬锐
0 siblings, 1 reply; 4+ messages in thread
From: Nicholas Mc Guire @ 2015-01-22 9:01 UTC (permalink / raw)
To: ????
Cc: Greg Kroah-Hartman, devel, Keerthimai Janarthanan, Sarah Sharp,
linux-kernel, Fabio Falzoi, Tina Johnson, Surya Seetharaman
On Thu, 22 Jan 2015, ???? wrote:
> the title should be 5208.
sorry - that was a typo - should this be
resubmitted for traceability or is that not
necessary ?
>
> On 01/19/2015 03:25 PM, Nicholas Mc Guire wrote:
> > This is only an API consolidation and should make things more readable
> >
> > Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
> > ---
> >
> > Converting milliseconds to jiffies by val * HZ / 1000 is technically
> > not wrong but msecs_to_jiffies(val) is the cleaner solution and handles
> > corner cases correctly.
> >
> > This patch was only compile tested with x86_64_defconfig + CONFIG_STAGING=y,
> > CONFIG_RTS5208=m
> >
> > Patch is against 3.19.0-rc4 -next-20150116
> >
> > drivers/staging/rts5208/rtsx_transport.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
> > index 756a968..dab1995 100644
> > --- a/drivers/staging/rts5208/rtsx_transport.c
> > +++ b/drivers/staging/rts5208/rtsx_transport.c
> > @@ -271,7 +271,7 @@ int rtsx_send_cmd(struct rtsx_chip *chip, u8 card, int timeout)
> >
> > /* Wait for TRANS_OK_INT */
> > timeleft = wait_for_completion_interruptible_timeout(
> > - &trans_done, timeout * HZ / 1000);
> > + &trans_done, msecs_to_jiffies(timeout));
> > if (timeleft <= 0) {
> > dev_dbg(rtsx_dev(chip), "chip->int_reg = 0x%x\n",
> > chip->int_reg);
> > @@ -431,7 +431,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
> > spin_unlock_irq(&rtsx->reg_lock);
> >
> > timeleft = wait_for_completion_interruptible_timeout(
> > - &trans_done, timeout * HZ / 1000);
> > + &trans_done, msecs_to_jiffies(timeout));
> > if (timeleft <= 0) {
> > dev_dbg(rtsx_dev(chip), "Timeout (%s %d)\n",
> > __func__, __LINE__);
> > @@ -455,7 +455,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
> > init_completion(&trans_done);
> > spin_unlock_irq(&rtsx->reg_lock);
> > timeleft = wait_for_completion_interruptible_timeout(
> > - &trans_done, timeout * HZ / 1000);
> > + &trans_done, msecs_to_jiffies(timeout));
> > if (timeleft <= 0) {
> > dev_dbg(rtsx_dev(chip), "Timeout (%s %d)\n",
> > __func__, __LINE__);
> > @@ -575,7 +575,7 @@ static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card,
> > spin_unlock_irq(&rtsx->reg_lock);
> >
> > timeleft = wait_for_completion_interruptible_timeout(
> > - &trans_done, timeout * HZ / 1000);
> > + &trans_done, msecs_to_jiffies(timeout));
> > if (timeleft <= 0) {
> > dev_dbg(rtsx_dev(chip), "Timeout (%s %d)\n",
> > __func__, __LINE__);
> > @@ -602,7 +602,7 @@ static int rtsx_transfer_sglist_adma(struct rtsx_chip *chip, u8 card,
> > init_completion(&trans_done);
> > spin_unlock_irq(&rtsx->reg_lock);
> > timeleft = wait_for_completion_interruptible_timeout(
> > - &trans_done, timeout * HZ / 1000);
> > + &trans_done, msecs_to_jiffies(timeout));
> > if (timeleft <= 0) {
> > dev_dbg(rtsx_dev(chip), "Timeout (%s %d)\n",
> > __func__, __LINE__);
> > @@ -688,7 +688,7 @@ static int rtsx_transfer_buf(struct rtsx_chip *chip, u8 card, void *buf,
> >
> > /* Wait for TRANS_OK_INT */
> > timeleft = wait_for_completion_interruptible_timeout(
> > - &trans_done, timeout * HZ / 1000);
> > + &trans_done, msecs_to_jiffies(timeout));
> > if (timeleft <= 0) {
> > dev_dbg(rtsx_dev(chip), "Timeout (%s %d)\n",
> > __func__, __LINE__);
thx!
hofrat
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: rts5028: use msecs_to_jiffies for timeouts
2015-01-22 9:01 ` Nicholas Mc Guire
@ 2015-01-23 1:13 ` 敬锐
0 siblings, 0 replies; 4+ messages in thread
From: 敬锐 @ 2015-01-23 1:13 UTC (permalink / raw)
To: Nicholas Mc Guire
Cc: Greg Kroah-Hartman, devel, Keerthimai Janarthanan, Sarah Sharp,
linux-kernel, Fabio Falzoi, Tina Johnson, Surya Seetharaman
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 330 bytes --]
On 01/22/2015 05:01 PM, Nicholas Mc Guire wrote:
> sorry - that was a typo - should this be
> resubmitted for traceability or is that not
> necessary ?
resubmit, thanks.ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-23 1:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-19 7:25 [PATCH] staging: rts5028: use msecs_to_jiffies for timeouts Nicholas Mc Guire
2015-01-22 1:40 ` 敬锐
2015-01-22 9:01 ` Nicholas Mc Guire
2015-01-23 1:13 ` 敬锐
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).