[OPW,kernel,1/1] arch: powerpc: Replace timespec with timespec64
diff mbox

Message ID 1414666858-13838-1-git-send-email-somyaanand214@gmail.com
State New, archived
Headers show

Commit Message

Somya Anand Oct. 30, 2014, 11 a.m. UTC
32-bit systems using 'struct timespec' will break in the year 2038,
so we have to replace that code with more appropriate types.

'struct timespec' is replaced by 'struct timespec64'

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
---
 This patch belongs to patch-set 'Replace timespec with timespec64 in pstore_info',
 https://groups.google.com/d/msg/opw-kernel/svmWHP4wsMc/qAw_W8yh6fQJ
 
 arch/powerpc/platforms/pseries/nvram.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Arnd Bergmann Oct. 30, 2014, 11:30 a.m. UTC | #1
On Thursday 30 October 2014 16:30:58 Somya Anand wrote:
> 32-bit systems using 'struct timespec' will break in the year 2038,
> so we have to replace that code with more appropriate types.
> 
> 'struct timespec' is replaced by 'struct timespec64'
> 


But your patch doesn't actually replace 'struct timespec' here, it
just adds another use of 'struct timespec64'.
> 
> diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
> index 11a3b61..f954ff9 100644
> --- a/arch/powerpc/platforms/pseries/nvram.c
> +++ b/arch/powerpc/platforms/pseries/nvram.c
> @@ -607,6 +607,7 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
>         char *buff = NULL;
>         int sig = 0;
>         loff_t p;
> +       struct timepec64 *ts64 = time;
>  
>         read_type++;
> 

And this relies on timespec64 and timespec being the same type, otherwise you
wouldn't be able to assign one to the other.

	Arnd

Patch
diff mbox

diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 11a3b61..f954ff9 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -607,6 +607,7 @@  static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
 	char *buff = NULL;
 	int sig = 0;
 	loff_t p;
+	struct timepec64 *ts64 = time;
 
 	read_type++;
 
@@ -618,24 +619,24 @@  static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
 	case PSTORE_TYPE_PPC_RTAS:
 		part = &rtas_log_partition;
 		*type = PSTORE_TYPE_PPC_RTAS;
-		time->tv_sec = last_rtas_event;
-		time->tv_nsec = 0;
+		ts64->tv_sec = last_rtas_event;
+		ts64->tv_nsec = 0;
 		break;
 	case PSTORE_TYPE_PPC_OF:
 		sig = NVRAM_SIG_OF;
 		part = &of_config_partition;
 		*type = PSTORE_TYPE_PPC_OF;
 		*id = PSTORE_TYPE_PPC_OF;
-		time->tv_sec = 0;
-		time->tv_nsec = 0;
+		ts64->tv_sec = 0;
+		ts64->tv_nsec = 0;
 		break;
 	case PSTORE_TYPE_PPC_COMMON:
 		sig = NVRAM_SIG_SYS;
 		part = &common_partition;
 		*type = PSTORE_TYPE_PPC_COMMON;
 		*id = PSTORE_TYPE_PPC_COMMON;
-		time->tv_sec = 0;
-		time->tv_nsec = 0;
+		ts64->tv_sec = 0;
+		ts64->tv_nsec = 0;
 		break;
 	default:
 		return 0;