summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2019-05-22 09:22:33 -0400
committerIngo Molnar <mingo@kernel.org>2019-06-03 06:32:56 -0400
commit90fde663aed0a1c27e50dd1bf3f121141b2fe9f2 (patch)
treeef30f81782cdffc2127a1f68d631d0cfe6f94c9c
parent24811637dbfd07c69da7e9db586d35d17e6afca3 (diff)
locking/atomic, crypto/nx: Prepare for atomic64_read() conversion
The return type of atomic64_read() varies by architecture. It may return long (e.g. powerpc), long long (e.g. arm), or s64 (e.g. x86_64). This is somewhat painful, and mandates the use of explicit casts in some cases (e.g. when printing the return value). To ameliorate matters, subsequent patches will make the atomic64 API consistently use s64. As a preparatory step, this patch updates the nx-842 code to treat the return value of atomic64_read() as s64, using explicit casts. These casts will be removed once the s64 conversion is complete. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Will Deacon <will.deacon@arm.com> Cc: aou@eecs.berkeley.edu Cc: arnd@arndb.de Cc: bp@alien8.de Cc: catalin.marinas@arm.com Cc: davem@davemloft.net Cc: fenghua.yu@intel.com Cc: heiko.carstens@de.ibm.com Cc: ink@jurassic.park.msu.ru Cc: jhogan@kernel.org Cc: linux@armlinux.org.uk Cc: mattst88@gmail.com Cc: mpe@ellerman.id.au Cc: palmer@sifive.com Cc: paul.burton@mips.com Cc: paulus@samba.org Cc: ralf@linux-mips.org Cc: rth@twiddle.net Cc: tony.luck@intel.com Cc: vgupta@synopsys.com Link: https://lkml.kernel.org/r/20190522132250.26499-2-mark.rutland@arm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--drivers/crypto/nx/nx-842-pseries.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/crypto/nx/nx-842-pseries.c b/drivers/crypto/nx/nx-842-pseries.c
index 5c4aa606208c..938332ce3b60 100644
--- a/drivers/crypto/nx/nx-842-pseries.c
+++ b/drivers/crypto/nx/nx-842-pseries.c
@@ -856,8 +856,8 @@ static ssize_t nx842_##_name##_show(struct device *dev, \
856 rcu_read_lock(); \ 856 rcu_read_lock(); \
857 local_devdata = rcu_dereference(devdata); \ 857 local_devdata = rcu_dereference(devdata); \
858 if (local_devdata) \ 858 if (local_devdata) \
859 p = snprintf(buf, PAGE_SIZE, "%ld\n", \ 859 p = snprintf(buf, PAGE_SIZE, "%lld\n", \
860 atomic64_read(&local_devdata->counters->_name)); \ 860 (s64)atomic64_read(&local_devdata->counters->_name)); \
861 rcu_read_unlock(); \ 861 rcu_read_unlock(); \
862 return p; \ 862 return p; \
863} 863}
@@ -909,17 +909,17 @@ static ssize_t nx842_timehist_show(struct device *dev,
909 } 909 }
910 910
911 for (i = 0; i < (NX842_HIST_SLOTS - 2); i++) { 911 for (i = 0; i < (NX842_HIST_SLOTS - 2); i++) {
912 bytes = snprintf(p, bytes_remain, "%u-%uus:\t%ld\n", 912 bytes = snprintf(p, bytes_remain, "%u-%uus:\t%lld\n",
913 i ? (2<<(i-1)) : 0, (2<<i)-1, 913 i ? (2<<(i-1)) : 0, (2<<i)-1,
914 atomic64_read(&times[i])); 914 (s64)atomic64_read(&times[i]));
915 bytes_remain -= bytes; 915 bytes_remain -= bytes;
916 p += bytes; 916 p += bytes;
917 } 917 }
918 /* The last bucket holds everything over 918 /* The last bucket holds everything over
919 * 2<<(NX842_HIST_SLOTS - 2) us */ 919 * 2<<(NX842_HIST_SLOTS - 2) us */
920 bytes = snprintf(p, bytes_remain, "%uus - :\t%ld\n", 920 bytes = snprintf(p, bytes_remain, "%uus - :\t%lld\n",
921 2<<(NX842_HIST_SLOTS - 2), 921 2<<(NX842_HIST_SLOTS - 2),
922 atomic64_read(&times[(NX842_HIST_SLOTS - 1)])); 922 (s64)atomic64_read(&times[(NX842_HIST_SLOTS - 1)]));
923 p += bytes; 923 p += bytes;
924 924
925 rcu_read_unlock(); 925 rcu_read_unlock();