Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Dec 2018 18:37:26 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r342087 - in head: sys/arm/allwinner sys/dev/pwm sys/sys usr.sbin/pwm
Message-ID:  <201812141837.wBEIbQh7023117@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Fri Dec 14 18:37:26 2018
New Revision: 342087
URL: https://svnweb.freebsd.org/changeset/base/342087

Log:
  pwm: Convert period and duty to unsigned int
  
  We don't need a 64 bits value to store nanoseconds
  
  Discused with:	ian, jhibbits

Modified:
  head/sys/arm/allwinner/aw_pwm.c
  head/sys/dev/pwm/pwm_if.m
  head/sys/dev/pwm/pwmbus.c
  head/sys/dev/pwm/pwmbus_if.m
  head/sys/sys/pwm.h
  head/usr.sbin/pwm/pwm.c

Modified: head/sys/arm/allwinner/aw_pwm.c
==============================================================================
--- head/sys/arm/allwinner/aw_pwm.c	Fri Dec 14 18:16:35 2018	(r342086)
+++ head/sys/arm/allwinner/aw_pwm.c	Fri Dec 14 18:37:26 2018	(r342087)
@@ -87,8 +87,8 @@ struct aw_pwm_softc {
 	struct resource	*res;
 
 	uint64_t	clk_freq;
-	uint64_t	period;
-	uint64_t	duty;
+	unsigned int	period;
+	unsigned int	duty;
 	uint32_t	flags;
 	bool		enabled;
 };
@@ -191,7 +191,7 @@ aw_pwm_channel_max(device_t dev, int *nchannel)
 }
 
 static int
-aw_pwm_channel_config(device_t dev, int channel, uint64_t period, uint64_t duty)
+aw_pwm_channel_config(device_t dev, int channel, unsigned int period, unsigned int duty)
 {
 	struct aw_pwm_softc *sc;
 	uint64_t period_freq, duty_freq;
@@ -254,7 +254,7 @@ aw_pwm_channel_config(device_t dev, int channel, uint6
 }
 
 static int
-aw_pwm_channel_get_config(device_t dev, int channel, uint64_t *period, uint64_t *duty)
+aw_pwm_channel_get_config(device_t dev, int channel, unsigned int *period, unsigned int *duty)
 {
 	struct aw_pwm_softc *sc;
 

Modified: head/sys/dev/pwm/pwm_if.m
==============================================================================
--- head/sys/dev/pwm/pwm_if.m	Fri Dec 14 18:16:35 2018	(r342086)
+++ head/sys/dev/pwm/pwm_if.m	Fri Dec 14 18:37:26 2018	(r342087)
@@ -46,8 +46,8 @@ METHOD device_t get_bus {
 METHOD int channel_config {
 	device_t dev;
 	int channel;
-	uint64_t period;
-	uint64_t duty;
+	unsigned int period;
+	unsigned duty;
 };
 
 #
@@ -57,8 +57,8 @@ METHOD int channel_config {
 METHOD int channel_get_config {
 	device_t dev;
 	int channel;
-	uint64_t *period;
-	uint64_t *duty;
+	unsigned int *period;
+	unsigned int *duty;
 };
 
 #

Modified: head/sys/dev/pwm/pwmbus.c
==============================================================================
--- head/sys/dev/pwm/pwmbus.c	Fri Dec 14 18:16:35 2018	(r342086)
+++ head/sys/dev/pwm/pwmbus.c	Fri Dec 14 18:37:26 2018	(r342087)
@@ -138,7 +138,7 @@ pwmbus_detach(device_t dev)
 }
 
 static int
-pwmbus_channel_config(device_t bus, int channel, uint64_t period, uint64_t duty)
+pwmbus_channel_config(device_t bus, int channel, unsigned int period, unsigned int duty)
 {
 	struct pwmbus_softc *sc;
 
@@ -151,7 +151,7 @@ pwmbus_channel_config(device_t bus, int channel, uint6
 }
 
 static int
-pwmbus_channel_get_config(device_t bus, int channel, uint64_t *period, uint64_t *duty)
+pwmbus_channel_get_config(device_t bus, int channel, unsigned int *period, unsigned int *duty)
 {
 	struct pwmbus_softc *sc;
 

Modified: head/sys/dev/pwm/pwmbus_if.m
==============================================================================
--- head/sys/dev/pwm/pwmbus_if.m	Fri Dec 14 18:16:35 2018	(r342086)
+++ head/sys/dev/pwm/pwmbus_if.m	Fri Dec 14 18:37:26 2018	(r342087)
@@ -59,8 +59,8 @@ HEADER {
 METHOD int channel_config {
 	device_t bus;
 	int channel;
-	uint64_t period;
-	uint64_t duty;
+	unsigned int period;
+	unsigned int duty;
 };
 
 #
@@ -70,8 +70,8 @@ METHOD int channel_config {
 METHOD int channel_get_config {
 	device_t bus;
 	int channel;
-	uint64_t *period;
-	uint64_t *duty;
+	unsigned int *period;
+	unsigned int *duty;
 };
 
 #

Modified: head/sys/sys/pwm.h
==============================================================================
--- head/sys/sys/pwm.h	Fri Dec 14 18:16:35 2018	(r342086)
+++ head/sys/sys/pwm.h	Fri Dec 14 18:37:26 2018	(r342087)
@@ -35,8 +35,8 @@
 
 struct pwm_state {
 	int		channel;
-	uint64_t	period;
-	uint64_t	duty;
+	unsigned int	period;
+	unsigned int	duty;
 	uint32_t	flags;
 	bool		enable;
 };

Modified: head/usr.sbin/pwm/pwm.c
==============================================================================
--- head/usr.sbin/pwm/pwm.c	Fri Dec 14 18:16:35 2018	(r342086)
+++ head/usr.sbin/pwm/pwm.c	Fri Dec 14 18:37:26 2018	(r342087)
@@ -190,9 +190,9 @@ main(int argc, char *argv[])
 		}
 		break;
 	case PWM_SHOW_CONFIG:
-		printf("period: %ju\nduty: %ju\nenabled:%d\n",
-		    (uintmax_t) state.period,
-		    (uintmax_t) state.duty,
+		printf("period: %u\nduty: %u\nenabled:%d\n",
+		    state.period,
+		    state.duty,
 		    state.enable);
 		break;
 	case PWM_PERIOD:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812141837.wBEIbQh7023117>