[OPW,kernel,1/3] acpi: apei: Replace timespec with timespec64
diff mbox

Message ID 1414662162-10988-2-git-send-email-somyaanand214@gmail.com
State New, archived
Headers show

Commit Message

Somya Anand Oct. 30, 2014, 9:42 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.

Introducing a local variable of type 'struct timespec64' to replace
'struct timespec' in order to support new pstore_info API.

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
---
 drivers/acpi/apei/erst.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Arnd Bergmann Oct. 30, 2014, 11:41 a.m. UTC | #1
On Thursday 30 October 2014 15:12:40 Somya Anand wrote:
> index ed65e9c..a84871a 100644
> --- a/drivers/acpi/apei/erst.c
> +++ b/drivers/acpi/apei/erst.c
> @@ -999,6 +999,7 @@ static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
>         u64 record_id;
>         struct cper_pstore_record *rcd;
>         size_t rcd_len = sizeof(*rcd) + erst_info.bufsize;
> +       struct timespec64 *ts64 = time;
>  
>         if (erst_disable)
>                 return -ENODEV;

Same comment as for the powerpc patch, this breaks all 32-bit platforms.
Using timespec_to_timespec64() is probably the right approach here.

> @@ -1052,10 +1053,10 @@ skip:
>                 *type = PSTORE_TYPE_UNKNOWN;
>  
>         if (rcd->hdr.validation_bits & CPER_VALID_TIMESTAMP)
> -               time->tv_sec = rcd->hdr.timestamp;
> +               ts64->tv_sec = rcd->hdr.timestamp;
>         else
> -               time->tv_sec = 0;
> -       time->tv_nsec = 0;
> +               ts64->tv_sec = 0;
> +       ts64->tv_nsec = 0;
>  
>  out:
>         kfree(rcd);

If you do something like this patch, it's better to rename the argument
passed in so you don't have to change all references to it.

	Arnd

Patch
diff mbox

diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index ed65e9c..a84871a 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -999,6 +999,7 @@  static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
 	u64 record_id;
 	struct cper_pstore_record *rcd;
 	size_t rcd_len = sizeof(*rcd) + erst_info.bufsize;
+	struct timespec64 *ts64 = time;
 
 	if (erst_disable)
 		return -ENODEV;
@@ -1052,10 +1053,10 @@  skip:
 		*type = PSTORE_TYPE_UNKNOWN;
 
 	if (rcd->hdr.validation_bits & CPER_VALID_TIMESTAMP)
-		time->tv_sec = rcd->hdr.timestamp;
+		ts64->tv_sec = rcd->hdr.timestamp;
 	else
-		time->tv_sec = 0;
-	time->tv_nsec = 0;
+		ts64->tv_sec = 0;
+	ts64->tv_nsec = 0;
 
 out:
 	kfree(rcd);