Commit Graph

6 Commits

Author SHA1 Message Date
Will Deacon 807607f79b openrisc: delay: fix handling of counter overflow
If the counter overflows during a __delay operation, we will exit the
loop prematurely. For example, calling __delay(0x100) with the counter
at 0xffffff00 gives us a target of 0x0. The unsigned comparison in the
while loop will likely be false on the first iteration (if the counter
is now anything other than 0) and we will return early.

This patch fixes the problem by comparing deltas in the loop rather than
absolute values.

Cc: Jon Masters <jcm@redhat.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jonas Bonn <jonas@southpole.se>
2012-09-01 16:36:14 +02:00
Will Deacon 439164663e openrisc: delay: fix loops calculation for __const_udelay
The openrisc implementation of __const_udelay casts the result of a
32-bit multiplication to 64 bits and passes the top 32 bits to __delay.
Since there are no casts on the arguments, this results in a __delay of
zero, regardless of the xloops parameter.

This patch fixes the problem by casting xloops to (unsigned long long),
ensuring that the multiplication is not truncated.

Cc: Jon Masters <jcm@redhat.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jonas Bonn <jonas@southpole.se>
2012-09-01 16:36:03 +02:00
Jonas Bonn b48b2c3e50 openrisc: use generic strnlen_user() function
The generic version is both easier to support and more correct.

Signed-off-by: Jonas Bonn <jonas@southpole.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-27 21:00:32 -07:00
Jonas Bonn 603d6637ae openrisc: use generic strncpy_from_user
As per commits 2922585b93 ("lib: Sparc's strncpy_from_user is generic
enough, move under lib/") and 92ae03f2ef ("x86: merge 32/64-bit
versions of 'strncpy_from_user()' and speed it up"), and corresponding
discussion on linux-arch.

Signed-off-by: Jonas Bonn <jonas@southpole.se>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-25 08:17:43 -07:00
Jonas Bonn 224cd129fd OpenRISC: Library routines
Signed-off-by: Jonas Bonn <jonas@southpole.se>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
2011-07-22 18:46:40 +02:00
Jonas Bonn f8c4a270d9 OpenRISC: Build infrastructure
Signed-off-by: Jonas Bonn <jonas@southpole.se>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
2011-07-22 18:46:30 +02:00