All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 5/7] drivers: watchdog: sb_wdog: Fix 32bit linking problems
@ 2013-06-18 14:00 ` Markos Chandras
  0 siblings, 0 replies; 8+ messages in thread
From: Markos Chandras @ 2013-06-18 14:00 UTC (permalink / raw)
  To: linux-mips; +Cc: Markos Chandras, sibyte-users, Wim Van Sebroeck

Fixes the following linking problem:
drivers/watchdog/sb_wdog.c:211: undefined reference to `__udivdi3'

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Acked-by: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: sibyte-users@bitmover.com
Cc: Wim Van Sebroeck <wim@iguana.be>
---
This patch is for the upstream-sfr/mips-for-linux-next tree
---
 drivers/watchdog/sb_wdog.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c
index 25c7a3f..35b96738 100644
--- a/drivers/watchdog/sb_wdog.c
+++ b/drivers/watchdog/sb_wdog.c
@@ -170,6 +170,7 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,
 						unsigned long arg)
 {
 	int ret = -ENOTTY;
+	u64 tmp_user_dog;
 	unsigned long time;
 	void __user *argp = (void __user *)arg;
 	int __user *p = argp;
@@ -208,7 +209,9 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,
 		 * get the remaining count from the ... count register
 		 * which is 1*8 before the config register
 		 */
-		ret = put_user(__raw_readq(user_dog - 8) / 1000000, p);
+		tmp_user_dog = __raw_readq(user_dog - 8);
+		do_div(tmp_user_dog, 1000000);
+		ret = put_user(tmp_user_dog, p);
 		break;
 	}
 	return ret;
-- 
1.8.2.1

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

* [PATCH v2 5/7] drivers: watchdog: sb_wdog: Fix 32bit linking problems
@ 2013-06-18 14:00 ` Markos Chandras
  0 siblings, 0 replies; 8+ messages in thread
From: Markos Chandras @ 2013-06-18 14:00 UTC (permalink / raw)
  To: linux-mips; +Cc: Markos Chandras, sibyte-users, Wim Van Sebroeck

Fixes the following linking problem:
drivers/watchdog/sb_wdog.c:211: undefined reference to `__udivdi3'

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Acked-by: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: sibyte-users@bitmover.com
Cc: Wim Van Sebroeck <wim@iguana.be>
---
This patch is for the upstream-sfr/mips-for-linux-next tree
---
 drivers/watchdog/sb_wdog.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c
index 25c7a3f..35b96738 100644
--- a/drivers/watchdog/sb_wdog.c
+++ b/drivers/watchdog/sb_wdog.c
@@ -170,6 +170,7 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,
 						unsigned long arg)
 {
 	int ret = -ENOTTY;
+	u64 tmp_user_dog;
 	unsigned long time;
 	void __user *argp = (void __user *)arg;
 	int __user *p = argp;
@@ -208,7 +209,9 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,
 		 * get the remaining count from the ... count register
 		 * which is 1*8 before the config register
 		 */
-		ret = put_user(__raw_readq(user_dog - 8) / 1000000, p);
+		tmp_user_dog = __raw_readq(user_dog - 8);
+		do_div(tmp_user_dog, 1000000);
+		ret = put_user(tmp_user_dog, p);
 		break;
 	}
 	return ret;
-- 
1.8.2.1

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

* Re: [PATCH v2 5/7] drivers: watchdog: sb_wdog: Fix 32bit linking problems
  2013-06-18 14:00 ` Markos Chandras
  (?)
@ 2013-06-18 14:14 ` Ralf Baechle
  2013-06-19  7:45   ` Yousong Zhou
                     ` (2 more replies)
  -1 siblings, 3 replies; 8+ messages in thread
From: Ralf Baechle @ 2013-06-18 14:14 UTC (permalink / raw)
  To: Markos Chandras; +Cc: linux-mips, sibyte-users, Wim Van Sebroeck

On Tue, Jun 18, 2013 at 03:00:06PM +0100, Markos Chandras wrote:

> Fixes the following linking problem:
> drivers/watchdog/sb_wdog.c:211: undefined reference to `__udivdi3'
> 
> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
> Acked-by: Steven J. Hill <Steven.Hill@imgtec.com>
> Cc: sibyte-users@bitmover.com
> Cc: Wim Van Sebroeck <wim@iguana.be>
> ---
> This patch is for the upstream-sfr/mips-for-linux-next tree

That looks ok.

Wim, are going to merge this or shall I carry it?  If you take it,
feel free to add my Acked-by.

Thanks,

  Ralf

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

* Re: [PATCH v2 5/7] drivers: watchdog: sb_wdog: Fix 32bit linking problems
  2013-06-18 14:14 ` Ralf Baechle
@ 2013-06-19  7:45   ` Yousong Zhou
  2013-06-19  7:48     ` Yousong Zhou
  2013-06-19  8:55     ` Ralf Baechle
  2013-06-27 19:59   ` Wim Van Sebroeck
  2013-06-27 20:09   ` Wim Van Sebroeck
  2 siblings, 2 replies; 8+ messages in thread
From: Yousong Zhou @ 2013-06-19  7:45 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Markos Chandras, linux-mips, sibyte-users, Wim Van Sebroeck

I am not quite sure on this. I just digged this[1] out and thought that Linus
 may not be happy about the operation `tmp_user_dog/1000000`.

Correct me if I am wrong, please.

[1] http://lwn.net/Articles/456241/

On 18 June 2013 22:14, Ralf Baechle <ralf@linux-mips.org> wrote:
> On Tue, Jun 18, 2013 at 03:00:06PM +0100, Markos Chandras wrote:
>
>> Fixes the following linking problem:
>> drivers/watchdog/sb_wdog.c:211: undefined reference to `__udivdi3'
>>
>> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
>> Acked-by: Steven J. Hill <Steven.Hill@imgtec.com>
>> Cc: sibyte-users@bitmover.com
>> Cc: Wim Van Sebroeck <wim@iguana.be>
>> ---
>> This patch is for the upstream-sfr/mips-for-linux-next tree
>
> That looks ok.
>
> Wim, are going to merge this or shall I carry it?  If you take it,
> feel free to add my Acked-by.
>
> Thanks,
>
>   Ralf
>

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

* Re: [PATCH v2 5/7] drivers: watchdog: sb_wdog: Fix 32bit linking problems
  2013-06-19  7:45   ` Yousong Zhou
@ 2013-06-19  7:48     ` Yousong Zhou
  2013-06-19  8:55     ` Ralf Baechle
  1 sibling, 0 replies; 8+ messages in thread
From: Yousong Zhou @ 2013-06-19  7:48 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Markos Chandras, linux-mips, sibyte-users, Wim Van Sebroeck

On 19 June 2013 15:45, Yousong Zhou <yszhou4tech@gmail.com> wrote:
> I am not quite sure on this. I just digged this[1] out and thought that Linus
>  may not be happy about the operation `tmp_user_dog/1000000`.

Only realized that it's a decimal integer after I clicked the Send button.
Sorry for the noise...

>
> Correct me if I am wrong, please.
>
> [1] http://lwn.net/Articles/456241/
>

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

* Re: [PATCH v2 5/7] drivers: watchdog: sb_wdog: Fix 32bit linking problems
  2013-06-19  7:45   ` Yousong Zhou
  2013-06-19  7:48     ` Yousong Zhou
@ 2013-06-19  8:55     ` Ralf Baechle
  1 sibling, 0 replies; 8+ messages in thread
From: Ralf Baechle @ 2013-06-19  8:55 UTC (permalink / raw)
  To: Yousong Zhou; +Cc: Markos Chandras, linux-mips, sibyte-users, Wim Van Sebroeck

On Wed, Jun 19, 2013 at 03:45:07PM +0800, Yousong Zhou wrote:

> I am not quite sure on this. I just digged this[1] out and thought that Linus
>  may not be happy about the operation `tmp_user_dog/1000000`.
> 
> Correct me if I am wrong, please.
> 
> [1] http://lwn.net/Articles/456241/

Well, Linus' posting is about a division by a power of two.  Doing that
by do_div() is not terribly smart.  Now, reading some manuals it turned
out that the register (like most registers on Sibyte SOCs) is 64 bit
but only the lower 23 bits are being used; bits 23..64 always read as
zero.

So the best fix is to truncate the value down to 32 bit then use the plain
old `/' division.

  Ralf

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

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

diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c
index 25c7a3f..ea5d84a 100644
--- a/drivers/watchdog/sb_wdog.c
+++ b/drivers/watchdog/sb_wdog.c
@@ -208,7 +208,7 @@ static long sbwdog_ioctl(struct file *file, unsigned int cmd,
 		 * get the remaining count from the ... count register
 		 * which is 1*8 before the config register
 		 */
-		ret = put_user(__raw_readq(user_dog - 8) / 1000000, p);
+		ret = put_user((u32)__raw_readq(user_dog - 8) / 1000000, p);
 		break;
 	}
 	return ret;

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

* Re: [PATCH v2 5/7] drivers: watchdog: sb_wdog: Fix 32bit linking problems
  2013-06-18 14:14 ` Ralf Baechle
  2013-06-19  7:45   ` Yousong Zhou
@ 2013-06-27 19:59   ` Wim Van Sebroeck
  2013-06-27 20:09   ` Wim Van Sebroeck
  2 siblings, 0 replies; 8+ messages in thread
From: Wim Van Sebroeck @ 2013-06-27 19:59 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Markos Chandras, linux-mips, sibyte-users

Hi Ralf,

> > Fixes the following linking problem:
> > drivers/watchdog/sb_wdog.c:211: undefined reference to `__udivdi3'
> > 
> > Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
> > Acked-by: Steven J. Hill <Steven.Hill@imgtec.com>
> > Cc: sibyte-users@bitmover.com
> > Cc: Wim Van Sebroeck <wim@iguana.be>
> > ---
> > This patch is for the upstream-sfr/mips-for-linux-next tree
> 
> That looks ok.
> 
> Wim, are going to merge this or shall I carry it?  If you take it,
> feel free to add my Acked-by.

I'll take it and add your Acked-by.

Kind regards,
Wim.

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

* Re: [PATCH v2 5/7] drivers: watchdog: sb_wdog: Fix 32bit linking problems
  2013-06-18 14:14 ` Ralf Baechle
  2013-06-19  7:45   ` Yousong Zhou
  2013-06-27 19:59   ` Wim Van Sebroeck
@ 2013-06-27 20:09   ` Wim Van Sebroeck
  2 siblings, 0 replies; 8+ messages in thread
From: Wim Van Sebroeck @ 2013-06-27 20:09 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Markos Chandras, linux-mips, sibyte-users

Hi All,

> > Fixes the following linking problem:
> > drivers/watchdog/sb_wdog.c:211: undefined reference to `__udivdi3'
> > 
> > Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
> > Acked-by: Steven J. Hill <Steven.Hill@imgtec.com>
> > Cc: sibyte-users@bitmover.com
> > Cc: Wim Van Sebroeck <wim@iguana.be>
> > ---
> > This patch is for the upstream-sfr/mips-for-linux-next tree
> 
> That looks ok.
> 
> Wim, are going to merge this or shall I carry it?  If you take it,
> feel free to add my Acked-by.

Forget my previous e-mail. I saw that Ralf allready took it in his tree.

Kind regards,
Wim.

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

end of thread, other threads:[~2013-06-27 20:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-18 14:00 [PATCH v2 5/7] drivers: watchdog: sb_wdog: Fix 32bit linking problems Markos Chandras
2013-06-18 14:00 ` Markos Chandras
2013-06-18 14:14 ` Ralf Baechle
2013-06-19  7:45   ` Yousong Zhou
2013-06-19  7:48     ` Yousong Zhou
2013-06-19  8:55     ` Ralf Baechle
2013-06-27 19:59   ` Wim Van Sebroeck
2013-06-27 20:09   ` Wim Van Sebroeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.