[OPW,kernel,v2,1/4] acpi: apei: Add timespec to timespec64 conversion
diff mbox

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

Commit Message

Somya Anand Oct. 31, 2014, 12:22 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 1:
  * Use timespec_to_timespec64 conversion.
  * Reword commit message.
  
 drivers/acpi/apei/erst.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Arnd Bergmann Oct. 31, 2014, 4:19 p.m. UTC | #1
On Friday 31 October 2014 17:52:23 Somya Anand wrote:
> diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
> index ed65e9c..de8394c 100644
> --- a/drivers/acpi/apei/erst.c
> +++ b/drivers/acpi/apei/erst.c
> @@ -991,7 +991,7 @@ static int erst_close_pstore(struct pstore_info *psi)
>  }
>  
>  static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
> -                          struct timespec *time, char **buf,
> +                          struct timespec *ts, char **buf,
>                            bool *compressed, struct pstore_info *psi)
>  {
>         int rc;

This part is correct, you 

> @@ -999,6 +999,8 @@ 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 = timespec_to_timespec64(*ts);
> +       struct timespec64 *time = &ts64;
>  
>         if (erst_disable)
>                 return -ENODEV;

This looked correct when I first looked at it, but I now see that you have
made the same mistake as in all the other driver backends, by treating
the time argument as an input instead of an output.

	Arnd

Patch
diff mbox

diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index ed65e9c..de8394c 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -991,7 +991,7 @@  static int erst_close_pstore(struct pstore_info *psi)
 }
 
 static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
-			   struct timespec *time, char **buf,
+			   struct timespec *ts, char **buf,
 			   bool *compressed, struct pstore_info *psi)
 {
 	int rc;
@@ -999,6 +999,8 @@  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 = timespec_to_timespec64(*ts);
+	struct timespec64 *time = &ts64;
 
 	if (erst_disable)
 		return -ENODEV;