All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: remove get_monotonic_boottime()
@ 2018-06-18 15:06 Arnd Bergmann
  2018-06-19  7:18 ` Quytelda Kahja
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2018-06-18 15:06 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: y2038, Bastien Nocera, Hans de Goede, Larry Finger,
	Arnd Bergmann, Quytelda Kahja, Arushi Singhal, devel,
	linux-kernel

get_monotonic_boottime() is deprecated because it uses the
old 'timespec' structure. This replaces one of the last callers
with a call to ktime_get_boottime, which also simplifies it
a bit by avoiding a double conversion.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 02178e25fbb8..73fc3a742f74 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -233,13 +233,6 @@ static int rtw_ieee80211_channel_to_frequency(int chan, int band)
 	return 0; /* not supported */
 }
 
-static u64 rtw_get_systime_us(void)
-{
-	struct timespec ts;
-	get_monotonic_boottime(&ts);
-	return ((u64)ts.tv_sec*1000000) + ts.tv_nsec / 1000;
-}
-
 #define MAX_BSSINFO_LEN 1000
 struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wlan_network *pnetwork)
 {
@@ -331,7 +324,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl
 
 	notify_channel = ieee80211_get_channel(wiphy, freq);
 
-	notify_timestamp = rtw_get_systime_us();
+	notify_timestamp = ktime_to_us(ktime_get_boottime());
 
 	notify_interval = le16_to_cpu(*(__le16 *)rtw_get_beacon_interval_from_ie(pnetwork->network.IEs));
 	notify_capability = le16_to_cpu(*(__le16 *)rtw_get_capability_from_ie(pnetwork->network.IEs));
-- 
2.9.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: rtl8723bs: remove get_monotonic_boottime()
  2018-06-18 15:06 [PATCH] staging: rtl8723bs: remove get_monotonic_boottime() Arnd Bergmann
@ 2018-06-19  7:18 ` Quytelda Kahja
  2018-06-19  8:09   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Quytelda Kahja @ 2018-06-19  7:18 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Greg Kroah-Hartman, y2038, Bastien Nocera, Hans de Goede,
	Larry Finger, Quytelda Kahja, Arushi Singhal, devel,
	linux-kernel

I'm fairly sure this doesn't matter functionally (yet), but perhaps
'notify_timestamp' should be updated to an 's64' type since ktime_to_us()
returns a signed type?

That note aside, I think this is good.

On Mon, Jun 18, 2018 at 05:06:50PM +0200, Arnd Bergmann wrote:
> get_monotonic_boottime() is deprecated because it uses the
> old 'timespec' structure. This replaces one of the last callers
> with a call to ktime_get_boottime, which also simplifies it
> a bit by avoiding a double conversion.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Quytelda Kahja <quytelda@tamalin.org>
> ---
>  drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> index 02178e25fbb8..73fc3a742f74 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> @@ -233,13 +233,6 @@ static int rtw_ieee80211_channel_to_frequency(int chan, int band)
>  	return 0; /* not supported */
>  }
>
> -static u64 rtw_get_systime_us(void)
> -{
> -	struct timespec ts;
> -	get_monotonic_boottime(&ts);
> -	return ((u64)ts.tv_sec*1000000) + ts.tv_nsec / 1000;
> -}
> -
>  #define MAX_BSSINFO_LEN 1000
>  struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wlan_network *pnetwork)
>  {
> @@ -331,7 +324,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl
>
>  	notify_channel = ieee80211_get_channel(wiphy, freq);
>
> -	notify_timestamp = rtw_get_systime_us();
> +	notify_timestamp = ktime_to_us(ktime_get_boottime());
>
>  	notify_interval = le16_to_cpu(*(__le16 *)rtw_get_beacon_interval_from_ie(pnetwork->network.IEs));
>  	notify_capability = le16_to_cpu(*(__le16 *)rtw_get_capability_from_ie(pnetwork->network.IEs));
> --
> 2.9.0
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: rtl8723bs: remove get_monotonic_boottime()
  2018-06-19  7:18 ` Quytelda Kahja
@ 2018-06-19  8:09   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2018-06-19  8:09 UTC (permalink / raw)
  To: Quytelda Kahja
  Cc: Greg Kroah-Hartman, y2038 Mailman List, Bastien Nocera,
	Hans de Goede, Larry Finger, Quytelda Kahja, Arushi Singhal,
	driverdevel, Linux Kernel Mailing List

On Tue, Jun 19, 2018 at 9:18 AM, Quytelda Kahja <quytelda@gmail.com> wrote:
> I'm fairly sure this doesn't matter functionally (yet), but perhaps
> 'notify_timestamp' should be updated to an 's64' type since ktime_to_us()
> returns a signed type?

I think it's fine either way, ktime_t is only signed to deal with
differences between
times and the theoretical case of running with local time set to a
date before 1970
(which I'm sure fails for a number of other reasons), but boottime is guaranteed
to be positive as well as monotonically increasing, so an unsigned
type is fine here.

> That note aside, I think this is good.

> Reviewed-by: Quytelda Kahja <quytelda@tamalin.org>

Thanks for taking a look!

     Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-19  8:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-18 15:06 [PATCH] staging: rtl8723bs: remove get_monotonic_boottime() Arnd Bergmann
2018-06-19  7:18 ` Quytelda Kahja
2018-06-19  8:09   ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.