* [PATCH v1 1/1] scsi: lpfc: Switch to use %ptTs
@ 2025-02-06 15:58 Andy Shevchenko
2025-02-06 16:52 ` Thomas Weißschuh
2025-02-06 18:16 ` Justin Tee
0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2025-02-06 15:58 UTC (permalink / raw)
To: Martin K. Petersen, Justin Tee, linux-scsi, linux-kernel
Cc: James Smart, Dick Kennedy, James E.J. Bottomley, Andy Shevchenko
Use %ptTs instead of open-coded variant to print contents of time64_t type
in human readable form.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/scsi/lpfc/lpfc_init.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index e360fc79b028..240e92143d73 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -5643,24 +5643,11 @@ void
lpfc_cgn_update_tstamp(struct lpfc_hba *phba, struct lpfc_cgn_ts *ts)
{
struct timespec64 cur_time;
- struct tm tm_val;
ktime_get_real_ts64(&cur_time);
- time64_to_tm(cur_time.tv_sec, 0, &tm_val);
-
- ts->month = tm_val.tm_mon + 1;
- ts->day = tm_val.tm_mday;
- ts->year = tm_val.tm_year - 100;
- ts->hour = tm_val.tm_hour;
- ts->minute = tm_val.tm_min;
- ts->second = tm_val.tm_sec;
lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
- "2646 Updated CMF timestamp : "
- "%u/%u/%u %u:%u:%u\n",
- ts->day, ts->month,
- ts->year, ts->hour,
- ts->minute, ts->second);
+ "2646 Updated CMF timestamp : %ptTs\n", cur_time);
}
/**
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] scsi: lpfc: Switch to use %ptTs
2025-02-06 15:58 [PATCH v1 1/1] scsi: lpfc: Switch to use %ptTs Andy Shevchenko
@ 2025-02-06 16:52 ` Thomas Weißschuh
2025-02-06 18:57 ` Andy Shevchenko
2025-02-06 18:16 ` Justin Tee
1 sibling, 1 reply; 5+ messages in thread
From: Thomas Weißschuh @ 2025-02-06 16:52 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Martin K. Petersen, Justin Tee, linux-scsi, linux-kernel,
James Smart, Dick Kennedy, James E.J. Bottomley
On Thu, Feb 06, 2025 at 05:58:22PM +0200, Andy Shevchenko wrote:
> Use %ptTs instead of open-coded variant to print contents of time64_t type
> in human readable form.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/scsi/lpfc/lpfc_init.c | 15 +--------------
> 1 file changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
> index e360fc79b028..240e92143d73 100644
> --- a/drivers/scsi/lpfc/lpfc_init.c
> +++ b/drivers/scsi/lpfc/lpfc_init.c
> @@ -5643,24 +5643,11 @@ void
> lpfc_cgn_update_tstamp(struct lpfc_hba *phba, struct lpfc_cgn_ts *ts)
> {
> struct timespec64 cur_time;
> - struct tm tm_val;
>
> ktime_get_real_ts64(&cur_time);
> - time64_to_tm(cur_time.tv_sec, 0, &tm_val);
> -
> - ts->month = tm_val.tm_mon + 1;
> - ts->day = tm_val.tm_mday;
> - ts->year = tm_val.tm_year - 100;
> - ts->hour = tm_val.tm_hour;
> - ts->minute = tm_val.tm_min;
> - ts->second = tm_val.tm_sec;
>
> lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
> - "2646 Updated CMF timestamp : "
> - "%u/%u/%u %u:%u:%u\n",
> - ts->day, ts->month,
> - ts->year, ts->hour,
> - ts->minute, ts->second);
> + "2646 Updated CMF timestamp : %ptTs\n", cur_time);
All %p<FOO> arguments need to be addresses.
Also %ptT wants a time64_t, not a 'struct timespec64'.
It would work by chance because tv_sec is the first member and time64_t.
Correct: "&cur_time.tv_sec".
> }
>
> /**
> --
> 2.43.0.rc1.1336.g36b5255a03ac
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] scsi: lpfc: Switch to use %ptTs
2025-02-06 15:58 [PATCH v1 1/1] scsi: lpfc: Switch to use %ptTs Andy Shevchenko
2025-02-06 16:52 ` Thomas Weißschuh
@ 2025-02-06 18:16 ` Justin Tee
2025-02-06 18:57 ` Andy Shevchenko
1 sibling, 1 reply; 5+ messages in thread
From: Justin Tee @ 2025-02-06 18:16 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Martin K. Petersen, Justin Tee, linux-scsi, linux-kernel,
James Smart, Dick Kennedy, James E.J. Bottomley
Hi Andy,
The purpose of the lpfc_cgn_update_tstamp routine is more than just
printf. The *ts pointer argument is updated with cur_time, and is
typically a pointer to a global statistics struct used by the device
driver in various contexts. Sorry, but we can’t remove the lines
suggested in this patch.
Regards,
Justin Tee
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] scsi: lpfc: Switch to use %ptTs
2025-02-06 16:52 ` Thomas Weißschuh
@ 2025-02-06 18:57 ` Andy Shevchenko
0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2025-02-06 18:57 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Martin K. Petersen, Justin Tee, linux-scsi, linux-kernel,
James Smart, Dick Kennedy, James E.J. Bottomley
On Thu, Feb 06, 2025 at 05:52:16PM +0100, Thomas Weißschuh wrote:
> On Thu, Feb 06, 2025 at 05:58:22PM +0200, Andy Shevchenko wrote:
...
> > lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT,
> > - "2646 Updated CMF timestamp : "
> > - "%u/%u/%u %u:%u:%u\n",
> > - ts->day, ts->month,
> > - ts->year, ts->hour,
> > - ts->minute, ts->second);
> > + "2646 Updated CMF timestamp : %ptTs\n", cur_time);
>
> All %p<FOO> arguments need to be addresses.
> Also %ptT wants a time64_t, not a 'struct timespec64'.
> It would work by chance because tv_sec is the first member and time64_t.
>
> Correct: "&cur_time.tv_sec".
Indeed, thanks!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] scsi: lpfc: Switch to use %ptTs
2025-02-06 18:16 ` Justin Tee
@ 2025-02-06 18:57 ` Andy Shevchenko
0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2025-02-06 18:57 UTC (permalink / raw)
To: Justin Tee
Cc: Martin K. Petersen, Justin Tee, linux-scsi, linux-kernel,
James Smart, Dick Kennedy, James E.J. Bottomley
On Thu, Feb 06, 2025 at 10:16:09AM -0800, Justin Tee wrote:
> Hi Andy,
>
> The purpose of the lpfc_cgn_update_tstamp routine is more than just
> printf. The *ts pointer argument is updated with cur_time, and is
> typically a pointer to a global statistics struct used by the device
> driver in various contexts. Sorry, but we can’t remove the lines
> suggested in this patch.
Ah, you are right, the ts is used somewhere else.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-02-06 18:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-06 15:58 [PATCH v1 1/1] scsi: lpfc: Switch to use %ptTs Andy Shevchenko
2025-02-06 16:52 ` Thomas Weißschuh
2025-02-06 18:57 ` Andy Shevchenko
2025-02-06 18:16 ` Justin Tee
2025-02-06 18:57 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).