[OPW,kernel,v3,4/4] arch: powerpc: Add timespec to timespec64 conversion
diff mbox

Message ID 1415123521-4564-5-git-send-email-somyaanand214@gmail.com
State New, archived
Headers show

Commit Message

Somya Anand Nov. 4, 2014, 5:52 p.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.

Introducing a local variable of type 'struct timespec64' to update
interface of pstore_info.read in order to support
new pstore_info API.

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
---
Changes since version 2:
  * Use timespec64_to_timespec conversion for output function.
  * Reword commit message.
 arch/powerpc/platforms/pseries/nvram.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Arnd Bergmann Nov. 4, 2014, 9:44 p.m. UTC | #1
On Tuesday 04 November 2014 23:22:01 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.
> 
> Introducing a local variable of type 'struct timespec64' to update
> interface of pstore_info.read in order to support
> new pstore_info API.
> 
> Signed-off-by: Somya Anand <somyaanand214@gmail.com>
> 

Same bug as in the other three patches. Also, it doesn't seem
worthwhile to do this patch and patch 1, when the follow-up to
change the interface will mostly undo the change.

	Arnd

Patch
diff mbox

diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 11a3b61..082915e 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -598,9 +598,11 @@  static int nvram_pstore_write(enum pstore_type_id type,
  * Returns 0 if we've been called before.
  */
 static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
-				int *count, struct timespec *time, char **buf,
+				int *count, struct timespec *ts, char **buf,
 				bool *compressed, struct pstore_info *psi)
 {
+	struct timespec64 *time;
+	struct timespec ts_temp;
 	struct oops_log_info *oops_hdr;
 	unsigned int err_type, id_no, size = 0;
 	struct nvram_os_partition *part = NULL;
@@ -696,6 +698,8 @@  static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
 		return length;
 	}
 
+	ts_temp = timespec64_to_timespec(*time);
+	ts = &ts_temp;
 	*buf = buff;
 	return part->size;
 }