Make pwm channel numbers unsigned.
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
struct pwm_channel {
|
||||
device_t dev;
|
||||
int channel;
|
||||
u_int channel;
|
||||
uint64_t period;
|
||||
uint64_t duty;
|
||||
uint32_t flags;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user