diff --git a/sys/arm/allwinner/aw_pwm.c b/sys/arm/allwinner/aw_pwm.c index 6a042e8b2cd6..aef28ac0e43f 100644 --- a/sys/arm/allwinner/aw_pwm.c +++ b/sys/arm/allwinner/aw_pwm.c @@ -226,7 +226,7 @@ aw_pwm_detach(device_t dev) } static int -aw_pwm_channel_count(device_t dev, int *nchannel) +aw_pwm_channel_count(device_t dev, u_int *nchannel) { *nchannel = 1; @@ -235,7 +235,7 @@ aw_pwm_channel_count(device_t dev, int *nchannel) } static int -aw_pwm_channel_config(device_t dev, int channel, unsigned int period, unsigned int duty) +aw_pwm_channel_config(device_t dev, u_int channel, u_int period, u_int duty) { struct aw_pwm_softc *sc; uint64_t period_freq, duty_freq; @@ -298,7 +298,7 @@ aw_pwm_channel_config(device_t dev, int channel, unsigned int period, unsigned i } static int -aw_pwm_channel_get_config(device_t dev, int channel, unsigned int *period, unsigned int *duty) +aw_pwm_channel_get_config(device_t dev, u_int channel, u_int *period, u_int *duty) { struct aw_pwm_softc *sc; @@ -311,7 +311,7 @@ aw_pwm_channel_get_config(device_t dev, int channel, unsigned int *period, unsig } static int -aw_pwm_channel_enable(device_t dev, int channel, bool enable) +aw_pwm_channel_enable(device_t dev, u_int channel, bool enable) { struct aw_pwm_softc *sc; uint32_t reg; @@ -335,7 +335,7 @@ aw_pwm_channel_enable(device_t dev, int channel, bool enable) } static int -aw_pwm_channel_is_enabled(device_t dev, int channel, bool *enabled) +aw_pwm_channel_is_enabled(device_t dev, u_int channel, bool *enabled) { struct aw_pwm_softc *sc; diff --git a/sys/dev/pwm/pwmbus.c b/sys/dev/pwm/pwmbus.c index c9ffdddb645b..e97a119f7359 100644 --- a/sys/dev/pwm/pwmbus.c +++ b/sys/dev/pwm/pwmbus.c @@ -57,7 +57,7 @@ struct pwmbus_softc { device_t dev; device_t parent; - int nchannels; + u_int nchannels; }; static int @@ -103,43 +103,43 @@ pwmbus_detach(device_t dev) } static int -pwmbus_channel_config(device_t dev, int chan, u_int period, u_int duty) +pwmbus_channel_config(device_t dev, u_int chan, u_int period, u_int duty) { return (PWMBUS_CHANNEL_CONFIG(device_get_parent(dev), chan, period, duty)); } static int -pwmbus_channel_get_config(device_t dev, int chan, u_int *period, u_int *duty) +pwmbus_channel_get_config(device_t dev, u_int chan, u_int *period, u_int *duty) { return (PWMBUS_CHANNEL_GET_CONFIG(device_get_parent(dev), chan, period, duty)); } static int -pwmbus_channel_get_flags(device_t dev, int chan, uint32_t *flags) +pwmbus_channel_get_flags(device_t dev, u_int chan, uint32_t *flags) { return (PWMBUS_CHANNEL_GET_FLAGS(device_get_parent(dev), chan, flags)); } static int -pwmbus_channel_enable(device_t dev, int chan, bool enable) +pwmbus_channel_enable(device_t dev, u_int chan, bool enable) { return (PWMBUS_CHANNEL_ENABLE(device_get_parent(dev), chan, enable)); } static int -pwmbus_channel_set_flags(device_t dev, int chan, uint32_t flags) +pwmbus_channel_set_flags(device_t dev, u_int chan, uint32_t flags) { return (PWMBUS_CHANNEL_SET_FLAGS(device_get_parent(dev), chan, flags)); } static int -pwmbus_channel_is_enabled(device_t dev, int chan, bool *enable) +pwmbus_channel_is_enabled(device_t dev, u_int chan, bool *enable) { return (PWMBUS_CHANNEL_IS_ENABLED(device_get_parent(dev), chan, enable)); } static int -pwmbus_channel_count(device_t dev, int *nchannel) +pwmbus_channel_count(device_t dev, u_int *nchannel) { return (PWMBUS_CHANNEL_COUNT(device_get_parent(dev), nchannel)); } diff --git a/sys/dev/pwm/pwmbus.h b/sys/dev/pwm/pwmbus.h index 7251b9fc79a1..fbecce531424 100644 --- a/sys/dev/pwm/pwmbus.h +++ b/sys/dev/pwm/pwmbus.h @@ -34,7 +34,7 @@ struct pwm_channel { device_t dev; - int channel; + u_int channel; uint64_t period; uint64_t duty; uint32_t flags; diff --git a/sys/dev/pwm/pwmbus_if.m b/sys/dev/pwm/pwmbus_if.m index b156d110969e..4e7b49bf405c 100644 --- a/sys/dev/pwm/pwmbus_if.m +++ b/sys/dev/pwm/pwmbus_if.m @@ -33,14 +33,14 @@ INTERFACE pwmbus; CODE { static int - pwm_default_set_flags(device_t dev, int channel, uint32_t flags) + pwm_default_set_flags(device_t dev, u_int channel, uint32_t flags) { return (EOPNOTSUPP); } static int - pwm_default_get_flags(device_t dev, int channel, uint32_t *flags) + pwm_default_get_flags(device_t dev, u_int channel, uint32_t *flags) { *flags = 0; @@ -54,7 +54,7 @@ CODE { # METHOD int channel_config { device_t bus; - int channel; + u_int channel; unsigned int period; unsigned int duty; }; @@ -65,7 +65,7 @@ METHOD int channel_config { # METHOD int channel_get_config { device_t bus; - int channel; + u_int channel; unsigned int *period; unsigned int *duty; }; @@ -75,7 +75,7 @@ METHOD int channel_get_config { # METHOD int channel_set_flags { device_t bus; - int channel; + u_int channel; uint32_t flags; } DEFAULT pwm_default_set_flags; @@ -84,7 +84,7 @@ METHOD int channel_set_flags { # METHOD int channel_get_flags { device_t dev; - int channel; + u_int channel; uint32_t *flags; } DEFAULT pwm_default_get_flags; @@ -93,7 +93,7 @@ METHOD int channel_get_flags { # METHOD int channel_enable { device_t bus; - int channel; + u_int channel; bool enable; }; @@ -102,7 +102,7 @@ METHOD int channel_enable { # METHOD int channel_is_enabled { device_t bus; - int channel; + u_int channel; bool *enabled; }; @@ -111,5 +111,5 @@ METHOD int channel_is_enabled { # METHOD int channel_count { device_t bus; - int *nchannel; + u_int *nchannel; }; diff --git a/sys/dev/pwm/pwmc.c b/sys/dev/pwm/pwmc.c index 2317b52981ca..18b60388a7bc 100644 --- a/sys/dev/pwm/pwmc.c +++ b/sys/dev/pwm/pwmc.c @@ -54,7 +54,7 @@ pwm_ioctl(struct cdev *dev, u_long cmd, caddr_t data, struct pwmc_softc *sc; struct pwm_state state; device_t bus; - int nchannel; + u_int nchannel; int rv = 0; sc = dev->si_drv1; @@ -62,7 +62,7 @@ pwm_ioctl(struct cdev *dev, u_long cmd, caddr_t data, switch (cmd) { case PWMMAXCHANNEL: - nchannel = -1; + nchannel = 0; rv = PWMBUS_CHANNEL_COUNT(bus, &nchannel); bcopy(&nchannel, data, sizeof(nchannel)); break; diff --git a/usr.sbin/pwm/pwm.c b/usr.sbin/pwm/pwm.c index 9a53e37b836d..52ea1b79e6ac 100644 --- a/usr.sbin/pwm/pwm.c +++ b/usr.sbin/pwm/pwm.c @@ -66,7 +66,7 @@ main(int argc, char *argv[]) { struct pwm_state state; int fd; - int channel, nchannels; + u_int channel, nchannels; int period, duty; int action, ch; cap_rights_t right_ioctl; @@ -75,7 +75,7 @@ main(int argc, char *argv[]) action = 0; fd = -1; - channel = -1; + channel = -1u; period = duty = -1; while ((ch = getopt(argc, argv, "f:c:EDCp:d:")) != -1) { @@ -110,9 +110,9 @@ main(int argc, char *argv[]) usage(); break; case 'c': - if (channel != -1) + if (channel != -1u) usage(); - channel = strtol(optarg, NULL, 10); + channel = strtoul(optarg, NULL, 10); break; case 'f': if ((fd = open(optarg, O_RDWR)) < 0) {