Staging driver fixes for 3.14-rc3
Here are a number (lots, I know) of fixes for staging drivers to resolve a bunch of reported issues. The largest patches here is one revert of a patch that is in 3.14-rc1 to fix reported problems, and a sync of a usb host driver that required some ARM patches to go in before it could be accepted (which is why it missed -rc1). All of these have been in linux-next for a while with no reported issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iEYEABECAAYFAlL+h+MACgkQMUfUDdst+ymAigCeNfR2pmw6lcNLokbdUJDOBHhX tXwAoL4rzSeaRCu1hbTe0q7lXiZDM+yN =aMFY -----END PGP SIGNATURE----- Merge tag 'staging-3.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging driver fixes from Greg KH: "Here are a number (lots, I know) of fixes for staging drivers to resolve a bunch of reported issues. The largest patches here is one revert of a patch that is in 3.14-rc1 to fix reported problems, and a sync of a usb host driver that required some ARM patches to go in before it could be accepted (which is why it missed -rc1) All of these have been in linux-next for a while with no reported issues" * tag 'staging-3.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (56 commits) staging/rtl8821ae: fix build, depends on MAC80211 iio: max1363: Use devm_regulator_get_optional for optional regulator iio:accel:bma180: Use modifier instead of index in channel specification iio: adis16400: Set timestamp as the last element in chan_spec iio: ak8975: Fix calculation formula for convert micro tesla to gauss unit staging:iio:ad799x fix typo in ad799x_events[] iio: mxs-lradc: remove useless scale_available files iio: mxs-lradc: fix buffer overflow iio:magnetometer:mag3110: Fix output of decimal digits in show_int_plus_micros() iio:magnetometer:mag3110: Report busy in _read_raw() / write_raw() when buffer is enabled wlags49_h2: Fix overflow in wireless_set_essid() xlr_net: Fix missing trivial allocation check staging: r8188eu: overflow in rtw_p2p_get_go_device_address() staging: r8188eu: array overflow in rtw_mp_ioctl_hdl() staging: r8188eu: Fix typo in USB_DEVICE list usbip/userspace/libsrc/names.c: memory leak gpu: ion: dereferencing an ERR_PTR staging: comedi: usbduxsigma: fix unaligned dereferences staging: comedi: fix too early cleanup in comedi_auto_config() staging: android: ion: dummy: fix an error code ...
This commit is contained in:
commit
e2e481d66c
|
@ -447,14 +447,14 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = {
|
||||||
{ },
|
{ },
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BMA180_CHANNEL(_index) { \
|
#define BMA180_CHANNEL(_axis) { \
|
||||||
.type = IIO_ACCEL, \
|
.type = IIO_ACCEL, \
|
||||||
.indexed = 1, \
|
.modified = 1, \
|
||||||
.channel = (_index), \
|
.channel2 = IIO_MOD_##_axis, \
|
||||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
|
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
|
||||||
BIT(IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY), \
|
BIT(IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY), \
|
||||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
|
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
|
||||||
.scan_index = (_index), \
|
.scan_index = AXIS_##_axis, \
|
||||||
.scan_type = { \
|
.scan_type = { \
|
||||||
.sign = 's', \
|
.sign = 's', \
|
||||||
.realbits = 14, \
|
.realbits = 14, \
|
||||||
|
@ -465,10 +465,10 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct iio_chan_spec bma180_channels[] = {
|
static const struct iio_chan_spec bma180_channels[] = {
|
||||||
BMA180_CHANNEL(AXIS_X),
|
BMA180_CHANNEL(X),
|
||||||
BMA180_CHANNEL(AXIS_Y),
|
BMA180_CHANNEL(Y),
|
||||||
BMA180_CHANNEL(AXIS_Z),
|
BMA180_CHANNEL(Z),
|
||||||
IIO_CHAN_SOFT_TIMESTAMP(4),
|
IIO_CHAN_SOFT_TIMESTAMP(3),
|
||||||
};
|
};
|
||||||
|
|
||||||
static irqreturn_t bma180_trigger_handler(int irq, void *p)
|
static irqreturn_t bma180_trigger_handler(int irq, void *p)
|
||||||
|
|
|
@ -1560,7 +1560,7 @@ static int max1363_probe(struct i2c_client *client,
|
||||||
st->client = client;
|
st->client = client;
|
||||||
|
|
||||||
st->vref_uv = st->chip_info->int_vref_mv * 1000;
|
st->vref_uv = st->chip_info->int_vref_mv * 1000;
|
||||||
vref = devm_regulator_get(&client->dev, "vref");
|
vref = devm_regulator_get_optional(&client->dev, "vref");
|
||||||
if (!IS_ERR(vref)) {
|
if (!IS_ERR(vref)) {
|
||||||
int vref_uv;
|
int vref_uv;
|
||||||
|
|
||||||
|
|
|
@ -189,6 +189,7 @@ enum {
|
||||||
ADIS16300_SCAN_INCLI_X,
|
ADIS16300_SCAN_INCLI_X,
|
||||||
ADIS16300_SCAN_INCLI_Y,
|
ADIS16300_SCAN_INCLI_Y,
|
||||||
ADIS16400_SCAN_ADC,
|
ADIS16400_SCAN_ADC,
|
||||||
|
ADIS16400_SCAN_TIMESTAMP,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_IIO_BUFFER
|
#ifdef CONFIG_IIO_BUFFER
|
||||||
|
|
|
@ -632,7 +632,7 @@ static const struct iio_chan_spec adis16400_channels[] = {
|
||||||
ADIS16400_MAGN_CHAN(Z, ADIS16400_ZMAGN_OUT, 14),
|
ADIS16400_MAGN_CHAN(Z, ADIS16400_ZMAGN_OUT, 14),
|
||||||
ADIS16400_TEMP_CHAN(ADIS16400_TEMP_OUT, 12),
|
ADIS16400_TEMP_CHAN(ADIS16400_TEMP_OUT, 12),
|
||||||
ADIS16400_AUX_ADC_CHAN(ADIS16400_AUX_ADC, 12),
|
ADIS16400_AUX_ADC_CHAN(ADIS16400_AUX_ADC, 12),
|
||||||
IIO_CHAN_SOFT_TIMESTAMP(12)
|
IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct iio_chan_spec adis16448_channels[] = {
|
static const struct iio_chan_spec adis16448_channels[] = {
|
||||||
|
@ -659,7 +659,7 @@ static const struct iio_chan_spec adis16448_channels[] = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12),
|
ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12),
|
||||||
IIO_CHAN_SOFT_TIMESTAMP(11)
|
IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct iio_chan_spec adis16350_channels[] = {
|
static const struct iio_chan_spec adis16350_channels[] = {
|
||||||
|
@ -677,7 +677,7 @@ static const struct iio_chan_spec adis16350_channels[] = {
|
||||||
ADIS16400_MOD_TEMP_CHAN(X, ADIS16350_XTEMP_OUT, 12),
|
ADIS16400_MOD_TEMP_CHAN(X, ADIS16350_XTEMP_OUT, 12),
|
||||||
ADIS16400_MOD_TEMP_CHAN(Y, ADIS16350_YTEMP_OUT, 12),
|
ADIS16400_MOD_TEMP_CHAN(Y, ADIS16350_YTEMP_OUT, 12),
|
||||||
ADIS16400_MOD_TEMP_CHAN(Z, ADIS16350_ZTEMP_OUT, 12),
|
ADIS16400_MOD_TEMP_CHAN(Z, ADIS16350_ZTEMP_OUT, 12),
|
||||||
IIO_CHAN_SOFT_TIMESTAMP(11)
|
IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct iio_chan_spec adis16300_channels[] = {
|
static const struct iio_chan_spec adis16300_channels[] = {
|
||||||
|
@ -690,7 +690,7 @@ static const struct iio_chan_spec adis16300_channels[] = {
|
||||||
ADIS16400_AUX_ADC_CHAN(ADIS16300_AUX_ADC, 12),
|
ADIS16400_AUX_ADC_CHAN(ADIS16300_AUX_ADC, 12),
|
||||||
ADIS16400_INCLI_CHAN(X, ADIS16300_PITCH_OUT, 13),
|
ADIS16400_INCLI_CHAN(X, ADIS16300_PITCH_OUT, 13),
|
||||||
ADIS16400_INCLI_CHAN(Y, ADIS16300_ROLL_OUT, 13),
|
ADIS16400_INCLI_CHAN(Y, ADIS16300_ROLL_OUT, 13),
|
||||||
IIO_CHAN_SOFT_TIMESTAMP(14)
|
IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct iio_chan_spec adis16334_channels[] = {
|
static const struct iio_chan_spec adis16334_channels[] = {
|
||||||
|
@ -701,7 +701,7 @@ static const struct iio_chan_spec adis16334_channels[] = {
|
||||||
ADIS16400_ACCEL_CHAN(Y, ADIS16400_YACCL_OUT, 14),
|
ADIS16400_ACCEL_CHAN(Y, ADIS16400_YACCL_OUT, 14),
|
||||||
ADIS16400_ACCEL_CHAN(Z, ADIS16400_ZACCL_OUT, 14),
|
ADIS16400_ACCEL_CHAN(Z, ADIS16400_ZACCL_OUT, 14),
|
||||||
ADIS16400_TEMP_CHAN(ADIS16350_XTEMP_OUT, 12),
|
ADIS16400_TEMP_CHAN(ADIS16350_XTEMP_OUT, 12),
|
||||||
IIO_CHAN_SOFT_TIMESTAMP(8)
|
IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct attribute *adis16400_attributes[] = {
|
static struct attribute *adis16400_attributes[] = {
|
||||||
|
|
|
@ -460,10 +460,14 @@ static int tsl2563_write_raw(struct iio_dev *indio_dev,
|
||||||
{
|
{
|
||||||
struct tsl2563_chip *chip = iio_priv(indio_dev);
|
struct tsl2563_chip *chip = iio_priv(indio_dev);
|
||||||
|
|
||||||
if (chan->channel == IIO_MOD_LIGHT_BOTH)
|
if (mask != IIO_CHAN_INFO_CALIBSCALE)
|
||||||
|
return -EINVAL;
|
||||||
|
if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
|
||||||
chip->calib0 = calib_from_sysfs(val);
|
chip->calib0 = calib_from_sysfs(val);
|
||||||
else
|
else if (chan->channel2 == IIO_MOD_LIGHT_IR)
|
||||||
chip->calib1 = calib_from_sysfs(val);
|
chip->calib1 = calib_from_sysfs(val);
|
||||||
|
else
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -472,14 +476,14 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
|
||||||
struct iio_chan_spec const *chan,
|
struct iio_chan_spec const *chan,
|
||||||
int *val,
|
int *val,
|
||||||
int *val2,
|
int *val2,
|
||||||
long m)
|
long mask)
|
||||||
{
|
{
|
||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
u32 calib0, calib1;
|
u32 calib0, calib1;
|
||||||
struct tsl2563_chip *chip = iio_priv(indio_dev);
|
struct tsl2563_chip *chip = iio_priv(indio_dev);
|
||||||
|
|
||||||
mutex_lock(&chip->lock);
|
mutex_lock(&chip->lock);
|
||||||
switch (m) {
|
switch (mask) {
|
||||||
case IIO_CHAN_INFO_RAW:
|
case IIO_CHAN_INFO_RAW:
|
||||||
case IIO_CHAN_INFO_PROCESSED:
|
case IIO_CHAN_INFO_PROCESSED:
|
||||||
switch (chan->type) {
|
switch (chan->type) {
|
||||||
|
@ -498,7 +502,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
|
||||||
ret = tsl2563_get_adc(chip);
|
ret = tsl2563_get_adc(chip);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto error_ret;
|
goto error_ret;
|
||||||
if (chan->channel == 0)
|
if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
|
||||||
*val = chip->data0;
|
*val = chip->data0;
|
||||||
else
|
else
|
||||||
*val = chip->data1;
|
*val = chip->data1;
|
||||||
|
@ -510,7 +514,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IIO_CHAN_INFO_CALIBSCALE:
|
case IIO_CHAN_INFO_CALIBSCALE:
|
||||||
if (chan->channel == 0)
|
if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
|
||||||
*val = calib_to_sysfs(chip->calib0);
|
*val = calib_to_sysfs(chip->calib0);
|
||||||
else
|
else
|
||||||
*val = calib_to_sysfs(chip->calib1);
|
*val = calib_to_sysfs(chip->calib1);
|
||||||
|
|
|
@ -85,6 +85,7 @@
|
||||||
#define AK8975_MAX_CONVERSION_TIMEOUT 500
|
#define AK8975_MAX_CONVERSION_TIMEOUT 500
|
||||||
#define AK8975_CONVERSION_DONE_POLL_TIME 10
|
#define AK8975_CONVERSION_DONE_POLL_TIME 10
|
||||||
#define AK8975_DATA_READY_TIMEOUT ((100*HZ)/1000)
|
#define AK8975_DATA_READY_TIMEOUT ((100*HZ)/1000)
|
||||||
|
#define RAW_TO_GAUSS(asa) ((((asa) + 128) * 3000) / 256)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Per-instance context data for the device.
|
* Per-instance context data for the device.
|
||||||
|
@ -265,15 +266,15 @@ static int ak8975_setup(struct i2c_client *client)
|
||||||
*
|
*
|
||||||
* Since 1uT = 0.01 gauss, our final scale factor becomes:
|
* Since 1uT = 0.01 gauss, our final scale factor becomes:
|
||||||
*
|
*
|
||||||
* Hadj = H * ((ASA + 128) / 256) * 3/10 * 100
|
* Hadj = H * ((ASA + 128) / 256) * 3/10 * 1/100
|
||||||
* Hadj = H * ((ASA + 128) * 30 / 256
|
* Hadj = H * ((ASA + 128) * 0.003) / 256
|
||||||
*
|
*
|
||||||
* Since ASA doesn't change, we cache the resultant scale factor into the
|
* Since ASA doesn't change, we cache the resultant scale factor into the
|
||||||
* device context in ak8975_setup().
|
* device context in ak8975_setup().
|
||||||
*/
|
*/
|
||||||
data->raw_to_gauss[0] = ((data->asa[0] + 128) * 30) >> 8;
|
data->raw_to_gauss[0] = RAW_TO_GAUSS(data->asa[0]);
|
||||||
data->raw_to_gauss[1] = ((data->asa[1] + 128) * 30) >> 8;
|
data->raw_to_gauss[1] = RAW_TO_GAUSS(data->asa[1]);
|
||||||
data->raw_to_gauss[2] = ((data->asa[2] + 128) * 30) >> 8;
|
data->raw_to_gauss[2] = RAW_TO_GAUSS(data->asa[2]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -428,8 +429,9 @@ static int ak8975_read_raw(struct iio_dev *indio_dev,
|
||||||
case IIO_CHAN_INFO_RAW:
|
case IIO_CHAN_INFO_RAW:
|
||||||
return ak8975_read_axis(indio_dev, chan->address, val);
|
return ak8975_read_axis(indio_dev, chan->address, val);
|
||||||
case IIO_CHAN_INFO_SCALE:
|
case IIO_CHAN_INFO_SCALE:
|
||||||
*val = data->raw_to_gauss[chan->address];
|
*val = 0;
|
||||||
return IIO_VAL_INT;
|
*val2 = data->raw_to_gauss[chan->address];
|
||||||
|
return IIO_VAL_INT_PLUS_MICRO;
|
||||||
}
|
}
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ static ssize_t mag3110_show_int_plus_micros(char *buf,
|
||||||
|
|
||||||
while (n-- > 0)
|
while (n-- > 0)
|
||||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||||
"%d.%d ", vals[n][0], vals[n][1]);
|
"%d.%06d ", vals[n][0], vals[n][1]);
|
||||||
|
|
||||||
/* replace trailing space by newline */
|
/* replace trailing space by newline */
|
||||||
buf[len - 1] = '\n';
|
buf[len - 1] = '\n';
|
||||||
|
@ -154,6 +154,9 @@ static int mag3110_read_raw(struct iio_dev *indio_dev,
|
||||||
|
|
||||||
switch (mask) {
|
switch (mask) {
|
||||||
case IIO_CHAN_INFO_RAW:
|
case IIO_CHAN_INFO_RAW:
|
||||||
|
if (iio_buffer_enabled(indio_dev))
|
||||||
|
return -EBUSY;
|
||||||
|
|
||||||
switch (chan->type) {
|
switch (chan->type) {
|
||||||
case IIO_MAGN: /* in 0.1 uT / LSB */
|
case IIO_MAGN: /* in 0.1 uT / LSB */
|
||||||
ret = mag3110_read(data, buffer);
|
ret = mag3110_read(data, buffer);
|
||||||
|
@ -199,6 +202,9 @@ static int mag3110_write_raw(struct iio_dev *indio_dev,
|
||||||
struct mag3110_data *data = iio_priv(indio_dev);
|
struct mag3110_data *data = iio_priv(indio_dev);
|
||||||
int rate;
|
int rate;
|
||||||
|
|
||||||
|
if (iio_buffer_enabled(indio_dev))
|
||||||
|
return -EBUSY;
|
||||||
|
|
||||||
switch (mask) {
|
switch (mask) {
|
||||||
case IIO_CHAN_INFO_SAMP_FREQ:
|
case IIO_CHAN_INFO_SAMP_FREQ:
|
||||||
rate = mag3110_get_samp_freq_index(data, val, val2);
|
rate = mag3110_get_samp_freq_index(data, val, val2);
|
||||||
|
|
|
@ -295,21 +295,29 @@ static ssize_t ashmem_read(struct file *file, char __user *buf,
|
||||||
|
|
||||||
/* If size is not set, or set to 0, always return EOF. */
|
/* If size is not set, or set to 0, always return EOF. */
|
||||||
if (asma->size == 0)
|
if (asma->size == 0)
|
||||||
goto out;
|
goto out_unlock;
|
||||||
|
|
||||||
if (!asma->file) {
|
if (!asma->file) {
|
||||||
ret = -EBADF;
|
ret = -EBADF;
|
||||||
goto out;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mutex_unlock(&ashmem_mutex);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* asma and asma->file are used outside the lock here. We assume
|
||||||
|
* once asma->file is set it will never be changed, and will not
|
||||||
|
* be destroyed until all references to the file are dropped and
|
||||||
|
* ashmem_release is called.
|
||||||
|
*/
|
||||||
ret = asma->file->f_op->read(asma->file, buf, len, pos);
|
ret = asma->file->f_op->read(asma->file, buf, len, pos);
|
||||||
if (ret < 0)
|
if (ret >= 0) {
|
||||||
goto out;
|
/** Update backing file pos, since f_ops->read() doesn't */
|
||||||
|
asma->file->f_pos = *pos;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
|
||||||
/** Update backing file pos, since f_ops->read() doesn't */
|
out_unlock:
|
||||||
asma->file->f_pos = *pos;
|
|
||||||
|
|
||||||
out:
|
|
||||||
mutex_unlock(&ashmem_mutex);
|
mutex_unlock(&ashmem_mutex);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -498,6 +506,7 @@ out:
|
||||||
|
|
||||||
static int set_name(struct ashmem_area *asma, void __user *name)
|
static int set_name(struct ashmem_area *asma, void __user *name)
|
||||||
{
|
{
|
||||||
|
int len;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char local_name[ASHMEM_NAME_LEN];
|
char local_name[ASHMEM_NAME_LEN];
|
||||||
|
|
||||||
|
@ -510,21 +519,19 @@ static int set_name(struct ashmem_area *asma, void __user *name)
|
||||||
* variable that does not need protection and later copy the local
|
* variable that does not need protection and later copy the local
|
||||||
* variable to the structure member with lock held.
|
* variable to the structure member with lock held.
|
||||||
*/
|
*/
|
||||||
if (copy_from_user(local_name, name, ASHMEM_NAME_LEN))
|
len = strncpy_from_user(local_name, name, ASHMEM_NAME_LEN);
|
||||||
return -EFAULT;
|
if (len < 0)
|
||||||
|
return len;
|
||||||
|
if (len == ASHMEM_NAME_LEN)
|
||||||
|
local_name[ASHMEM_NAME_LEN - 1] = '\0';
|
||||||
mutex_lock(&ashmem_mutex);
|
mutex_lock(&ashmem_mutex);
|
||||||
/* cannot change an existing mapping's name */
|
/* cannot change an existing mapping's name */
|
||||||
if (unlikely(asma->file)) {
|
if (unlikely(asma->file))
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
else
|
||||||
}
|
strcpy(asma->name + ASHMEM_NAME_PREFIX_LEN, local_name);
|
||||||
memcpy(asma->name + ASHMEM_NAME_PREFIX_LEN,
|
|
||||||
local_name, ASHMEM_NAME_LEN);
|
|
||||||
asma->name[ASHMEM_FULL_NAME_LEN-1] = '\0';
|
|
||||||
out:
|
|
||||||
mutex_unlock(&ashmem_mutex);
|
|
||||||
|
|
||||||
|
mutex_unlock(&ashmem_mutex);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,14 @@ struct compat_ion_custom_data {
|
||||||
compat_ulong_t arg;
|
compat_ulong_t arg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct compat_ion_handle_data {
|
||||||
|
compat_int_t handle;
|
||||||
|
};
|
||||||
|
|
||||||
#define COMPAT_ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \
|
#define COMPAT_ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \
|
||||||
struct compat_ion_allocation_data)
|
struct compat_ion_allocation_data)
|
||||||
#define COMPAT_ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
|
#define COMPAT_ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, \
|
||||||
|
struct compat_ion_handle_data)
|
||||||
#define COMPAT_ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, \
|
#define COMPAT_ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, \
|
||||||
struct compat_ion_custom_data)
|
struct compat_ion_custom_data)
|
||||||
|
|
||||||
|
@ -64,6 +69,19 @@ static int compat_get_ion_allocation_data(
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int compat_get_ion_handle_data(
|
||||||
|
struct compat_ion_handle_data __user *data32,
|
||||||
|
struct ion_handle_data __user *data)
|
||||||
|
{
|
||||||
|
compat_int_t i;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = get_user(i, &data32->handle);
|
||||||
|
err |= put_user(i, &data->handle);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
static int compat_put_ion_allocation_data(
|
static int compat_put_ion_allocation_data(
|
||||||
struct compat_ion_allocation_data __user *data32,
|
struct compat_ion_allocation_data __user *data32,
|
||||||
struct ion_allocation_data __user *data)
|
struct ion_allocation_data __user *data)
|
||||||
|
@ -132,8 +150,8 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||||
}
|
}
|
||||||
case COMPAT_ION_IOC_FREE:
|
case COMPAT_ION_IOC_FREE:
|
||||||
{
|
{
|
||||||
struct compat_ion_allocation_data __user *data32;
|
struct compat_ion_handle_data __user *data32;
|
||||||
struct ion_allocation_data __user *data;
|
struct ion_handle_data __user *data;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
data32 = compat_ptr(arg);
|
data32 = compat_ptr(arg);
|
||||||
|
@ -141,7 +159,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
err = compat_get_ion_allocation_data(data32, data);
|
err = compat_get_ion_handle_data(data32, data);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,11 @@
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
#include <linux/init.h>
|
||||||
#include <linux/bootmem.h>
|
#include <linux/bootmem.h>
|
||||||
#include <linux/memblock.h>
|
#include <linux/memblock.h>
|
||||||
#include <linux/sizes.h>
|
#include <linux/sizes.h>
|
||||||
|
#include <linux/io.h>
|
||||||
#include "ion.h"
|
#include "ion.h"
|
||||||
#include "ion_priv.h"
|
#include "ion_priv.h"
|
||||||
|
|
||||||
|
@ -57,7 +59,7 @@ struct ion_platform_heap dummy_heaps[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ion_platform_data dummy_ion_pdata = {
|
struct ion_platform_data dummy_ion_pdata = {
|
||||||
.nr = 4,
|
.nr = ARRAY_SIZE(dummy_heaps),
|
||||||
.heaps = dummy_heaps,
|
.heaps = dummy_heaps,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -69,7 +71,7 @@ static int __init ion_dummy_init(void)
|
||||||
heaps = kzalloc(sizeof(struct ion_heap *) * dummy_ion_pdata.nr,
|
heaps = kzalloc(sizeof(struct ion_heap *) * dummy_ion_pdata.nr,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!heaps)
|
if (!heaps)
|
||||||
return PTR_ERR(heaps);
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
||||||
/* Allocate a dummy carveout heap */
|
/* Allocate a dummy carveout heap */
|
||||||
|
@ -128,6 +130,7 @@ err:
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
device_initcall(ion_dummy_init);
|
||||||
|
|
||||||
static void __exit ion_dummy_exit(void)
|
static void __exit ion_dummy_exit(void)
|
||||||
{
|
{
|
||||||
|
@ -152,7 +155,4 @@ static void __exit ion_dummy_exit(void)
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
__exitcall(ion_dummy_exit);
|
||||||
module_init(ion_dummy_init);
|
|
||||||
module_exit(ion_dummy_exit);
|
|
||||||
|
|
||||||
|
|
|
@ -243,12 +243,12 @@ int ion_heap_init_deferred_free(struct ion_heap *heap)
|
||||||
init_waitqueue_head(&heap->waitqueue);
|
init_waitqueue_head(&heap->waitqueue);
|
||||||
heap->task = kthread_run(ion_heap_deferred_free, heap,
|
heap->task = kthread_run(ion_heap_deferred_free, heap,
|
||||||
"%s", heap->name);
|
"%s", heap->name);
|
||||||
sched_setscheduler(heap->task, SCHED_IDLE, ¶m);
|
|
||||||
if (IS_ERR(heap->task)) {
|
if (IS_ERR(heap->task)) {
|
||||||
pr_err("%s: creating thread for deferred free failed\n",
|
pr_err("%s: creating thread for deferred free failed\n",
|
||||||
__func__);
|
__func__);
|
||||||
return PTR_RET(heap->task);
|
return PTR_RET(heap->task);
|
||||||
}
|
}
|
||||||
|
sched_setscheduler(heap->task, SCHED_IDLE, ¶m);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#ifndef _ION_PRIV_H
|
#ifndef _ION_PRIV_H
|
||||||
#define _ION_PRIV_H
|
#define _ION_PRIV_H
|
||||||
|
|
||||||
|
#include <linux/device.h>
|
||||||
#include <linux/dma-direction.h>
|
#include <linux/dma-direction.h>
|
||||||
#include <linux/kref.h>
|
#include <linux/kref.h>
|
||||||
#include <linux/mm_types.h>
|
#include <linux/mm_types.h>
|
||||||
|
|
|
@ -124,6 +124,7 @@ static struct page_info *alloc_largest_available(struct ion_system_heap *heap,
|
||||||
|
|
||||||
info->page = page;
|
info->page = page;
|
||||||
info->order = orders[i];
|
info->order = orders[i];
|
||||||
|
INIT_LIST_HEAD(&info->list);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
kfree(info);
|
kfree(info);
|
||||||
|
@ -145,12 +146,15 @@ static int ion_system_heap_allocate(struct ion_heap *heap,
|
||||||
struct list_head pages;
|
struct list_head pages;
|
||||||
struct page_info *info, *tmp_info;
|
struct page_info *info, *tmp_info;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
long size_remaining = PAGE_ALIGN(size);
|
unsigned long size_remaining = PAGE_ALIGN(size);
|
||||||
unsigned int max_order = orders[0];
|
unsigned int max_order = orders[0];
|
||||||
|
|
||||||
if (align > PAGE_SIZE)
|
if (align > PAGE_SIZE)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (size / PAGE_SIZE > totalram_pages / 2)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
INIT_LIST_HEAD(&pages);
|
INIT_LIST_HEAD(&pages);
|
||||||
while (size_remaining > 0) {
|
while (size_remaining > 0) {
|
||||||
info = alloc_largest_available(sys_heap, buffer, size_remaining,
|
info = alloc_largest_available(sys_heap, buffer, size_remaining,
|
||||||
|
|
|
@ -35,10 +35,27 @@ struct sw_sync_pt {
|
||||||
u32 value;
|
u32 value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if IS_ENABLED(CONFIG_SW_SYNC)
|
||||||
struct sw_sync_timeline *sw_sync_timeline_create(const char *name);
|
struct sw_sync_timeline *sw_sync_timeline_create(const char *name);
|
||||||
void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc);
|
void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc);
|
||||||
|
|
||||||
struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value);
|
struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value);
|
||||||
|
#else
|
||||||
|
static inline struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj,
|
||||||
|
u32 value)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif /* IS_ENABLED(CONFIG_SW_SYNC) */
|
||||||
|
|
||||||
#endif /* __KERNEL __ */
|
#endif /* __KERNEL __ */
|
||||||
|
|
||||||
|
|
|
@ -79,27 +79,27 @@ static void sync_timeline_free(struct kref *kref)
|
||||||
container_of(kref, struct sync_timeline, kref);
|
container_of(kref, struct sync_timeline, kref);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
if (obj->ops->release_obj)
|
|
||||||
obj->ops->release_obj(obj);
|
|
||||||
|
|
||||||
spin_lock_irqsave(&sync_timeline_list_lock, flags);
|
spin_lock_irqsave(&sync_timeline_list_lock, flags);
|
||||||
list_del(&obj->sync_timeline_list);
|
list_del(&obj->sync_timeline_list);
|
||||||
spin_unlock_irqrestore(&sync_timeline_list_lock, flags);
|
spin_unlock_irqrestore(&sync_timeline_list_lock, flags);
|
||||||
|
|
||||||
|
if (obj->ops->release_obj)
|
||||||
|
obj->ops->release_obj(obj);
|
||||||
|
|
||||||
kfree(obj);
|
kfree(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sync_timeline_destroy(struct sync_timeline *obj)
|
void sync_timeline_destroy(struct sync_timeline *obj)
|
||||||
{
|
{
|
||||||
obj->destroyed = true;
|
obj->destroyed = true;
|
||||||
|
smp_wmb();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this is not the last reference, signal any children
|
* signal any children that their parent is going away.
|
||||||
* that their parent is going away.
|
|
||||||
*/
|
*/
|
||||||
|
sync_timeline_signal(obj);
|
||||||
|
|
||||||
if (!kref_put(&obj->kref, sync_timeline_free))
|
kref_put(&obj->kref, sync_timeline_free);
|
||||||
sync_timeline_signal(obj);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(sync_timeline_destroy);
|
EXPORT_SYMBOL(sync_timeline_destroy);
|
||||||
|
|
||||||
|
|
|
@ -616,8 +616,6 @@ int comedi_auto_config(struct device *hardware_device,
|
||||||
ret = driver->auto_attach(dev, context);
|
ret = driver->auto_attach(dev, context);
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
ret = comedi_device_postconfig(dev);
|
ret = comedi_device_postconfig(dev);
|
||||||
if (ret < 0)
|
|
||||||
comedi_device_detach(dev);
|
|
||||||
mutex_unlock(&dev->mutex);
|
mutex_unlock(&dev->mutex);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
|
@ -494,6 +494,7 @@ static int pci171x_insn_write_ao(struct comedi_device *dev,
|
||||||
struct comedi_insn *insn, unsigned int *data)
|
struct comedi_insn *insn, unsigned int *data)
|
||||||
{
|
{
|
||||||
struct pci1710_private *devpriv = dev->private;
|
struct pci1710_private *devpriv = dev->private;
|
||||||
|
unsigned int val;
|
||||||
int n, chan, range, ofs;
|
int n, chan, range, ofs;
|
||||||
|
|
||||||
chan = CR_CHAN(insn->chanspec);
|
chan = CR_CHAN(insn->chanspec);
|
||||||
|
@ -509,11 +510,14 @@ static int pci171x_insn_write_ao(struct comedi_device *dev,
|
||||||
outw(devpriv->da_ranges, dev->iobase + PCI171x_DAREF);
|
outw(devpriv->da_ranges, dev->iobase + PCI171x_DAREF);
|
||||||
ofs = PCI171x_DA1;
|
ofs = PCI171x_DA1;
|
||||||
}
|
}
|
||||||
|
val = devpriv->ao_data[chan];
|
||||||
|
|
||||||
for (n = 0; n < insn->n; n++)
|
for (n = 0; n < insn->n; n++) {
|
||||||
outw(data[n], dev->iobase + ofs);
|
val = data[n];
|
||||||
|
outw(val, dev->iobase + ofs);
|
||||||
|
}
|
||||||
|
|
||||||
devpriv->ao_data[chan] = data[n];
|
devpriv->ao_data[chan] = val;
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
|
|
||||||
|
@ -679,6 +683,7 @@ static int pci1720_insn_write_ao(struct comedi_device *dev,
|
||||||
struct comedi_insn *insn, unsigned int *data)
|
struct comedi_insn *insn, unsigned int *data)
|
||||||
{
|
{
|
||||||
struct pci1710_private *devpriv = dev->private;
|
struct pci1710_private *devpriv = dev->private;
|
||||||
|
unsigned int val;
|
||||||
int n, rangereg, chan;
|
int n, rangereg, chan;
|
||||||
|
|
||||||
chan = CR_CHAN(insn->chanspec);
|
chan = CR_CHAN(insn->chanspec);
|
||||||
|
@ -688,13 +693,15 @@ static int pci1720_insn_write_ao(struct comedi_device *dev,
|
||||||
outb(rangereg, dev->iobase + PCI1720_RANGE);
|
outb(rangereg, dev->iobase + PCI1720_RANGE);
|
||||||
devpriv->da_ranges = rangereg;
|
devpriv->da_ranges = rangereg;
|
||||||
}
|
}
|
||||||
|
val = devpriv->ao_data[chan];
|
||||||
|
|
||||||
for (n = 0; n < insn->n; n++) {
|
for (n = 0; n < insn->n; n++) {
|
||||||
outw(data[n], dev->iobase + PCI1720_DA0 + (chan << 1));
|
val = data[n];
|
||||||
|
outw(val, dev->iobase + PCI1720_DA0 + (chan << 1));
|
||||||
outb(0, dev->iobase + PCI1720_SYNCOUT); /* update outputs */
|
outb(0, dev->iobase + PCI1720_SYNCOUT); /* update outputs */
|
||||||
}
|
}
|
||||||
|
|
||||||
devpriv->ao_data[chan] = data[n];
|
devpriv->ao_data[chan] = val;
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#include <linux/usb.h>
|
#include <linux/usb.h>
|
||||||
#include <linux/fcntl.h>
|
#include <linux/fcntl.h>
|
||||||
#include <linux/compiler.h>
|
#include <linux/compiler.h>
|
||||||
|
#include <asm/unaligned.h>
|
||||||
|
|
||||||
#include "comedi_fc.h"
|
#include "comedi_fc.h"
|
||||||
#include "../comedidev.h"
|
#include "../comedidev.h"
|
||||||
|
@ -792,7 +793,8 @@ static int usbduxsigma_ai_insn_read(struct comedi_device *dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 32 bits big endian from the A/D converter */
|
/* 32 bits big endian from the A/D converter */
|
||||||
val = be32_to_cpu(*((uint32_t *)((devpriv->insn_buf) + 1)));
|
val = be32_to_cpu(get_unaligned((uint32_t
|
||||||
|
*)(devpriv->insn_buf + 1)));
|
||||||
val &= 0x00ffffff; /* strip status byte */
|
val &= 0x00ffffff; /* strip status byte */
|
||||||
val ^= 0x00800000; /* convert to unsigned */
|
val ^= 0x00800000; /* convert to unsigned */
|
||||||
|
|
||||||
|
@ -1357,7 +1359,7 @@ static int usbduxsigma_getstatusinfo(struct comedi_device *dev, int chan)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* 32 bits big endian from the A/D converter */
|
/* 32 bits big endian from the A/D converter */
|
||||||
val = be32_to_cpu(*((uint32_t *)((devpriv->insn_buf)+1)));
|
val = be32_to_cpu(get_unaligned((uint32_t *)(devpriv->insn_buf + 1)));
|
||||||
val &= 0x00ffffff; /* strip status byte */
|
val &= 0x00ffffff; /* strip status byte */
|
||||||
val ^= 0x00800000; /* convert to unsigned */
|
val ^= 0x00800000; /* convert to unsigned */
|
||||||
|
|
||||||
|
|
|
@ -2232,177 +2232,6 @@ done:
|
||||||
return rtn;
|
return rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Common Packet Handling code
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void handle_data_in_packet(struct nd_struct *nd, struct ch_struct *ch,
|
|
||||||
long dlen, long plen, int n1, u8 *dbuf)
|
|
||||||
{
|
|
||||||
char *error;
|
|
||||||
long n;
|
|
||||||
long remain;
|
|
||||||
u8 *buf;
|
|
||||||
u8 *b;
|
|
||||||
|
|
||||||
remain = nd->nd_remain;
|
|
||||||
nd->nd_tx_work = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Otherwise data should appear only when we are
|
|
||||||
* in the CS_READY state.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (ch->ch_state < CS_READY) {
|
|
||||||
error = "Data received before RWIN established";
|
|
||||||
nd->nd_remain = 0;
|
|
||||||
nd->nd_state = NS_SEND_ERROR;
|
|
||||||
nd->nd_error = error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Assure that the data received is within the
|
|
||||||
* allowable window.
|
|
||||||
*/
|
|
||||||
|
|
||||||
n = (ch->ch_s_rwin - ch->ch_s_rin) & 0xffff;
|
|
||||||
|
|
||||||
if (dlen > n) {
|
|
||||||
error = "Receive data overrun";
|
|
||||||
nd->nd_remain = 0;
|
|
||||||
nd->nd_state = NS_SEND_ERROR;
|
|
||||||
nd->nd_error = error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If we received 3 or less characters,
|
|
||||||
* assume it is a human typing, and set RTIME
|
|
||||||
* to 10 milliseconds.
|
|
||||||
*
|
|
||||||
* If we receive 10 or more characters,
|
|
||||||
* assume its not a human typing, and set RTIME
|
|
||||||
* to 100 milliseconds.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (ch->ch_edelay != DGRP_RTIME) {
|
|
||||||
if (ch->ch_rtime != ch->ch_edelay) {
|
|
||||||
ch->ch_rtime = ch->ch_edelay;
|
|
||||||
ch->ch_flag |= CH_PARAM;
|
|
||||||
}
|
|
||||||
} else if (dlen <= 3) {
|
|
||||||
if (ch->ch_rtime != 10) {
|
|
||||||
ch->ch_rtime = 10;
|
|
||||||
ch->ch_flag |= CH_PARAM;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (ch->ch_rtime != DGRP_RTIME) {
|
|
||||||
ch->ch_rtime = DGRP_RTIME;
|
|
||||||
ch->ch_flag |= CH_PARAM;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If a portion of the packet is outside the
|
|
||||||
* buffer, shorten the effective length of the
|
|
||||||
* data packet to be the amount of data received.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (remain < plen)
|
|
||||||
dlen -= plen - remain;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Detect if receive flush is now complete.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ((ch->ch_flag & CH_RX_FLUSH) != 0 &&
|
|
||||||
((ch->ch_flush_seq - nd->nd_seq_out) & SEQ_MASK) >=
|
|
||||||
((nd->nd_seq_in - nd->nd_seq_out) & SEQ_MASK)) {
|
|
||||||
ch->ch_flag &= ~CH_RX_FLUSH;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If we are ready to receive, move the data into
|
|
||||||
* the receive buffer.
|
|
||||||
*/
|
|
||||||
|
|
||||||
ch->ch_s_rin = (ch->ch_s_rin + dlen) & 0xffff;
|
|
||||||
|
|
||||||
if (ch->ch_state == CS_READY &&
|
|
||||||
(ch->ch_tun.un_open_count != 0) &&
|
|
||||||
(ch->ch_tun.un_flag & UN_CLOSING) == 0 &&
|
|
||||||
(ch->ch_cflag & CF_CREAD) != 0 &&
|
|
||||||
(ch->ch_flag & (CH_BAUD0 | CH_RX_FLUSH)) == 0 &&
|
|
||||||
(ch->ch_send & RR_RX_FLUSH) == 0) {
|
|
||||||
|
|
||||||
if (ch->ch_rin + dlen >= RBUF_MAX) {
|
|
||||||
n = RBUF_MAX - ch->ch_rin;
|
|
||||||
|
|
||||||
memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, n);
|
|
||||||
|
|
||||||
ch->ch_rin = 0;
|
|
||||||
dbuf += n;
|
|
||||||
dlen -= n;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, dlen);
|
|
||||||
|
|
||||||
ch->ch_rin += dlen;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If we are not in fastcook mode, or
|
|
||||||
* if there is a fastcook thread
|
|
||||||
* waiting for data, send the data to
|
|
||||||
* the line discipline.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ((ch->ch_flag & CH_FAST_READ) == 0 ||
|
|
||||||
ch->ch_inwait != 0) {
|
|
||||||
dgrp_input(ch);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If there is a read thread waiting
|
|
||||||
* in select, and we are in fastcook
|
|
||||||
* mode, wake him up.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (waitqueue_active(&ch->ch_tun.un_tty->read_wait) &&
|
|
||||||
(ch->ch_flag & CH_FAST_READ) != 0)
|
|
||||||
wake_up_interruptible(&ch->ch_tun.un_tty->read_wait);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Wake any thread waiting in the
|
|
||||||
* fastcook loop.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ((ch->ch_flag & CH_INPUT) != 0) {
|
|
||||||
ch->ch_flag &= ~CH_INPUT;
|
|
||||||
wake_up_interruptible(&ch->ch_flag_wait);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fabricate and insert a data packet header to
|
|
||||||
* preced the remaining data when it comes in.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (remain < plen) {
|
|
||||||
dlen = plen - remain;
|
|
||||||
b = buf;
|
|
||||||
|
|
||||||
b[0] = 0x90 + n1;
|
|
||||||
put_unaligned_be16(dlen, b + 1);
|
|
||||||
|
|
||||||
remain = 3;
|
|
||||||
if (remain > 0 && b != buf)
|
|
||||||
memcpy(buf, b, remain);
|
|
||||||
|
|
||||||
nd->nd_remain = remain;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dgrp_receive() -- decode data packets received from the remote PortServer.
|
* dgrp_receive() -- decode data packets received from the remote PortServer.
|
||||||
* @nd: pointer to a node structure
|
* @nd: pointer to a node structure
|
||||||
|
@ -2477,8 +2306,7 @@ static void dgrp_receive(struct nd_struct *nd)
|
||||||
plen = dlen + 1;
|
plen = dlen + 1;
|
||||||
|
|
||||||
dbuf = b + 1;
|
dbuf = b + 1;
|
||||||
handle_data_in_packet(nd, ch, dlen, plen, n1, dbuf);
|
goto data;
|
||||||
break;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Process 2-byte header data packet.
|
* Process 2-byte header data packet.
|
||||||
|
@ -2492,8 +2320,7 @@ static void dgrp_receive(struct nd_struct *nd)
|
||||||
plen = dlen + 2;
|
plen = dlen + 2;
|
||||||
|
|
||||||
dbuf = b + 2;
|
dbuf = b + 2;
|
||||||
handle_data_in_packet(nd, ch, dlen, plen, n1, dbuf);
|
goto data;
|
||||||
break;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Process 3-byte header data packet.
|
* Process 3-byte header data packet.
|
||||||
|
@ -2508,6 +2335,159 @@ static void dgrp_receive(struct nd_struct *nd)
|
||||||
|
|
||||||
dbuf = b + 3;
|
dbuf = b + 3;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Common packet handling code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
data:
|
||||||
|
nd->nd_tx_work = 1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Otherwise data should appear only when we are
|
||||||
|
* in the CS_READY state.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (ch->ch_state < CS_READY) {
|
||||||
|
error = "Data received before RWIN established";
|
||||||
|
goto prot_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Assure that the data received is within the
|
||||||
|
* allowable window.
|
||||||
|
*/
|
||||||
|
|
||||||
|
n = (ch->ch_s_rwin - ch->ch_s_rin) & 0xffff;
|
||||||
|
|
||||||
|
if (dlen > n) {
|
||||||
|
error = "Receive data overrun";
|
||||||
|
goto prot_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we received 3 or less characters,
|
||||||
|
* assume it is a human typing, and set RTIME
|
||||||
|
* to 10 milliseconds.
|
||||||
|
*
|
||||||
|
* If we receive 10 or more characters,
|
||||||
|
* assume its not a human typing, and set RTIME
|
||||||
|
* to 100 milliseconds.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (ch->ch_edelay != DGRP_RTIME) {
|
||||||
|
if (ch->ch_rtime != ch->ch_edelay) {
|
||||||
|
ch->ch_rtime = ch->ch_edelay;
|
||||||
|
ch->ch_flag |= CH_PARAM;
|
||||||
|
}
|
||||||
|
} else if (dlen <= 3) {
|
||||||
|
if (ch->ch_rtime != 10) {
|
||||||
|
ch->ch_rtime = 10;
|
||||||
|
ch->ch_flag |= CH_PARAM;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ch->ch_rtime != DGRP_RTIME) {
|
||||||
|
ch->ch_rtime = DGRP_RTIME;
|
||||||
|
ch->ch_flag |= CH_PARAM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If a portion of the packet is outside the
|
||||||
|
* buffer, shorten the effective length of the
|
||||||
|
* data packet to be the amount of data received.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (remain < plen)
|
||||||
|
dlen -= plen - remain;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Detect if receive flush is now complete.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ((ch->ch_flag & CH_RX_FLUSH) != 0 &&
|
||||||
|
((ch->ch_flush_seq - nd->nd_seq_out) & SEQ_MASK) >=
|
||||||
|
((nd->nd_seq_in - nd->nd_seq_out) & SEQ_MASK)) {
|
||||||
|
ch->ch_flag &= ~CH_RX_FLUSH;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we are ready to receive, move the data into
|
||||||
|
* the receive buffer.
|
||||||
|
*/
|
||||||
|
|
||||||
|
ch->ch_s_rin = (ch->ch_s_rin + dlen) & 0xffff;
|
||||||
|
|
||||||
|
if (ch->ch_state == CS_READY &&
|
||||||
|
(ch->ch_tun.un_open_count != 0) &&
|
||||||
|
(ch->ch_tun.un_flag & UN_CLOSING) == 0 &&
|
||||||
|
(ch->ch_cflag & CF_CREAD) != 0 &&
|
||||||
|
(ch->ch_flag & (CH_BAUD0 | CH_RX_FLUSH)) == 0 &&
|
||||||
|
(ch->ch_send & RR_RX_FLUSH) == 0) {
|
||||||
|
|
||||||
|
if (ch->ch_rin + dlen >= RBUF_MAX) {
|
||||||
|
n = RBUF_MAX - ch->ch_rin;
|
||||||
|
|
||||||
|
memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, n);
|
||||||
|
|
||||||
|
ch->ch_rin = 0;
|
||||||
|
dbuf += n;
|
||||||
|
dlen -= n;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, dlen);
|
||||||
|
|
||||||
|
ch->ch_rin += dlen;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we are not in fastcook mode, or
|
||||||
|
* if there is a fastcook thread
|
||||||
|
* waiting for data, send the data to
|
||||||
|
* the line discipline.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ((ch->ch_flag & CH_FAST_READ) == 0 ||
|
||||||
|
ch->ch_inwait != 0) {
|
||||||
|
dgrp_input(ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If there is a read thread waiting
|
||||||
|
* in select, and we are in fastcook
|
||||||
|
* mode, wake him up.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (waitqueue_active(&ch->ch_tun.un_tty->read_wait) &&
|
||||||
|
(ch->ch_flag & CH_FAST_READ) != 0)
|
||||||
|
wake_up_interruptible(&ch->ch_tun.un_tty->read_wait);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Wake any thread waiting in the
|
||||||
|
* fastcook loop.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ((ch->ch_flag & CH_INPUT) != 0) {
|
||||||
|
ch->ch_flag &= ~CH_INPUT;
|
||||||
|
|
||||||
|
wake_up_interruptible(&ch->ch_flag_wait);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fabricate and insert a data packet header to
|
||||||
|
* preced the remaining data when it comes in.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (remain < plen) {
|
||||||
|
dlen = plen - remain;
|
||||||
|
b = buf;
|
||||||
|
|
||||||
|
b[0] = 0x90 + n1;
|
||||||
|
put_unaligned_be16(dlen, b + 1);
|
||||||
|
|
||||||
|
remain = 3;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -635,11 +635,14 @@ static int gdm_usb_probe(struct usb_interface *intf,
|
||||||
#endif /* CONFIG_WIMAX_GDM72XX_USB_PM */
|
#endif /* CONFIG_WIMAX_GDM72XX_USB_PM */
|
||||||
|
|
||||||
ret = register_wimax_device(phy_dev, &intf->dev);
|
ret = register_wimax_device(phy_dev, &intf->dev);
|
||||||
|
if (ret)
|
||||||
|
release_usb(udev);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (ret) {
|
if (ret) {
|
||||||
kfree(phy_dev);
|
kfree(phy_dev);
|
||||||
kfree(udev);
|
kfree(udev);
|
||||||
|
usb_put_dev(usbdev);
|
||||||
} else {
|
} else {
|
||||||
usb_set_intfdata(intf, phy_dev);
|
usb_set_intfdata(intf, phy_dev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,6 @@ struct iio_channel_info {
|
||||||
uint64_t mask;
|
uint64_t mask;
|
||||||
unsigned be;
|
unsigned be;
|
||||||
unsigned is_signed;
|
unsigned is_signed;
|
||||||
unsigned enabled;
|
|
||||||
unsigned location;
|
unsigned location;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -335,6 +334,7 @@ inline int build_channel_array(const char *device_dir,
|
||||||
while (ent = readdir(dp), ent != NULL) {
|
while (ent = readdir(dp), ent != NULL) {
|
||||||
if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"),
|
if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"),
|
||||||
"_en") == 0) {
|
"_en") == 0) {
|
||||||
|
int current_enabled = 0;
|
||||||
current = &(*ci_array)[count++];
|
current = &(*ci_array)[count++];
|
||||||
ret = asprintf(&filename,
|
ret = asprintf(&filename,
|
||||||
"%s/%s", scan_el_dir, ent->d_name);
|
"%s/%s", scan_el_dir, ent->d_name);
|
||||||
|
@ -350,10 +350,10 @@ inline int build_channel_array(const char *device_dir,
|
||||||
ret = -errno;
|
ret = -errno;
|
||||||
goto error_cleanup_array;
|
goto error_cleanup_array;
|
||||||
}
|
}
|
||||||
fscanf(sysfsfp, "%u", ¤t->enabled);
|
fscanf(sysfsfp, "%u", ¤t_enabled);
|
||||||
fclose(sysfsfp);
|
fclose(sysfsfp);
|
||||||
|
|
||||||
if (!current->enabled) {
|
if (!current_enabled) {
|
||||||
free(filename);
|
free(filename);
|
||||||
count--;
|
count--;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -393,7 +393,7 @@ static const struct iio_event_spec ad799x_events[] = {
|
||||||
}, {
|
}, {
|
||||||
.type = IIO_EV_TYPE_THRESH,
|
.type = IIO_EV_TYPE_THRESH,
|
||||||
.dir = IIO_EV_DIR_FALLING,
|
.dir = IIO_EV_DIR_FALLING,
|
||||||
.mask_separate = BIT(IIO_EV_INFO_VALUE),
|
.mask_separate = BIT(IIO_EV_INFO_VALUE) |
|
||||||
BIT(IIO_EV_INFO_ENABLE),
|
BIT(IIO_EV_INFO_ENABLE),
|
||||||
}, {
|
}, {
|
||||||
.type = IIO_EV_TYPE_THRESH,
|
.type = IIO_EV_TYPE_THRESH,
|
||||||
|
@ -409,7 +409,13 @@ static const struct iio_event_spec ad799x_events[] = {
|
||||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
|
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
|
||||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
|
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
|
||||||
.scan_index = (_index), \
|
.scan_index = (_index), \
|
||||||
.scan_type = IIO_ST('u', _realbits, 16, 12 - (_realbits)), \
|
.scan_type = { \
|
||||||
|
.sign = 'u', \
|
||||||
|
.realbits = (_realbits), \
|
||||||
|
.storagebits = 16, \
|
||||||
|
.shift = 12 - (_realbits), \
|
||||||
|
.endianness = IIO_BE, \
|
||||||
|
}, \
|
||||||
.event_spec = _ev_spec, \
|
.event_spec = _ev_spec, \
|
||||||
.num_event_specs = _num_ev_spec, \
|
.num_event_specs = _num_ev_spec, \
|
||||||
}
|
}
|
||||||
|
@ -588,7 +594,8 @@ static int ad799x_probe(struct i2c_client *client,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error_free_irq:
|
error_free_irq:
|
||||||
free_irq(client->irq, indio_dev);
|
if (client->irq > 0)
|
||||||
|
free_irq(client->irq, indio_dev);
|
||||||
error_cleanup_ring:
|
error_cleanup_ring:
|
||||||
ad799x_ring_cleanup(indio_dev);
|
ad799x_ring_cleanup(indio_dev);
|
||||||
error_disable_reg:
|
error_disable_reg:
|
||||||
|
|
|
@ -1035,8 +1035,6 @@ SHOW_SCALE_AVAILABLE_ATTR(4);
|
||||||
SHOW_SCALE_AVAILABLE_ATTR(5);
|
SHOW_SCALE_AVAILABLE_ATTR(5);
|
||||||
SHOW_SCALE_AVAILABLE_ATTR(6);
|
SHOW_SCALE_AVAILABLE_ATTR(6);
|
||||||
SHOW_SCALE_AVAILABLE_ATTR(7);
|
SHOW_SCALE_AVAILABLE_ATTR(7);
|
||||||
SHOW_SCALE_AVAILABLE_ATTR(8);
|
|
||||||
SHOW_SCALE_AVAILABLE_ATTR(9);
|
|
||||||
SHOW_SCALE_AVAILABLE_ATTR(10);
|
SHOW_SCALE_AVAILABLE_ATTR(10);
|
||||||
SHOW_SCALE_AVAILABLE_ATTR(11);
|
SHOW_SCALE_AVAILABLE_ATTR(11);
|
||||||
SHOW_SCALE_AVAILABLE_ATTR(12);
|
SHOW_SCALE_AVAILABLE_ATTR(12);
|
||||||
|
@ -1053,8 +1051,6 @@ static struct attribute *mxs_lradc_attributes[] = {
|
||||||
&iio_dev_attr_in_voltage5_scale_available.dev_attr.attr,
|
&iio_dev_attr_in_voltage5_scale_available.dev_attr.attr,
|
||||||
&iio_dev_attr_in_voltage6_scale_available.dev_attr.attr,
|
&iio_dev_attr_in_voltage6_scale_available.dev_attr.attr,
|
||||||
&iio_dev_attr_in_voltage7_scale_available.dev_attr.attr,
|
&iio_dev_attr_in_voltage7_scale_available.dev_attr.attr,
|
||||||
&iio_dev_attr_in_voltage8_scale_available.dev_attr.attr,
|
|
||||||
&iio_dev_attr_in_voltage9_scale_available.dev_attr.attr,
|
|
||||||
&iio_dev_attr_in_voltage10_scale_available.dev_attr.attr,
|
&iio_dev_attr_in_voltage10_scale_available.dev_attr.attr,
|
||||||
&iio_dev_attr_in_voltage11_scale_available.dev_attr.attr,
|
&iio_dev_attr_in_voltage11_scale_available.dev_attr.attr,
|
||||||
&iio_dev_attr_in_voltage12_scale_available.dev_attr.attr,
|
&iio_dev_attr_in_voltage12_scale_available.dev_attr.attr,
|
||||||
|
@ -1613,7 +1609,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
|
||||||
* of the array.
|
* of the array.
|
||||||
*/
|
*/
|
||||||
scale_uv = ((u64)lradc->vref_mv[i] * 100000000) >>
|
scale_uv = ((u64)lradc->vref_mv[i] * 100000000) >>
|
||||||
(iio->channels[i].scan_type.realbits - s);
|
(LRADC_RESOLUTION - s);
|
||||||
lradc->scale_avail[i][s].nano =
|
lradc->scale_avail[i][s].nano =
|
||||||
do_div(scale_uv, 100000000) * 10;
|
do_div(scale_uv, 100000000) * 10;
|
||||||
lradc->scale_avail[i][s].integer = scale_uv;
|
lradc->scale_avail[i][s].integer = scale_uv;
|
||||||
|
|
|
@ -629,7 +629,7 @@ static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
struct iio_buffer *buffer;
|
struct iio_buffer *buffer;
|
||||||
|
|
||||||
buffer = iio_kfifo_allocate(indio_dev);
|
buffer = iio_kfifo_allocate(indio_dev);
|
||||||
if (buffer)
|
if (!buffer)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
iio_device_attach_buffer(indio_dev, buffer);
|
iio_device_attach_buffer(indio_dev, buffer);
|
||||||
|
|
|
@ -88,9 +88,9 @@ static int imx_drm_driver_unload(struct drm_device *drm)
|
||||||
|
|
||||||
imx_drm_device_put();
|
imx_drm_device_put();
|
||||||
|
|
||||||
drm_vblank_cleanup(imxdrm->drm);
|
drm_vblank_cleanup(drm);
|
||||||
drm_kms_helper_poll_fini(imxdrm->drm);
|
drm_kms_helper_poll_fini(drm);
|
||||||
drm_mode_config_cleanup(imxdrm->drm);
|
drm_mode_config_cleanup(drm);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -142,19 +142,19 @@ EXPORT_SYMBOL_GPL(imx_drm_crtc_panel_format);
|
||||||
|
|
||||||
int imx_drm_crtc_vblank_get(struct imx_drm_crtc *imx_drm_crtc)
|
int imx_drm_crtc_vblank_get(struct imx_drm_crtc *imx_drm_crtc)
|
||||||
{
|
{
|
||||||
return drm_vblank_get(imx_drm_crtc->imxdrm->drm, imx_drm_crtc->pipe);
|
return drm_vblank_get(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(imx_drm_crtc_vblank_get);
|
EXPORT_SYMBOL_GPL(imx_drm_crtc_vblank_get);
|
||||||
|
|
||||||
void imx_drm_crtc_vblank_put(struct imx_drm_crtc *imx_drm_crtc)
|
void imx_drm_crtc_vblank_put(struct imx_drm_crtc *imx_drm_crtc)
|
||||||
{
|
{
|
||||||
drm_vblank_put(imx_drm_crtc->imxdrm->drm, imx_drm_crtc->pipe);
|
drm_vblank_put(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(imx_drm_crtc_vblank_put);
|
EXPORT_SYMBOL_GPL(imx_drm_crtc_vblank_put);
|
||||||
|
|
||||||
void imx_drm_handle_vblank(struct imx_drm_crtc *imx_drm_crtc)
|
void imx_drm_handle_vblank(struct imx_drm_crtc *imx_drm_crtc)
|
||||||
{
|
{
|
||||||
drm_handle_vblank(imx_drm_crtc->imxdrm->drm, imx_drm_crtc->pipe);
|
drm_handle_vblank(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(imx_drm_handle_vblank);
|
EXPORT_SYMBOL_GPL(imx_drm_handle_vblank);
|
||||||
|
|
||||||
|
@ -369,29 +369,6 @@ static void imx_drm_connector_unregister(
|
||||||
drm_mode_group_reinit(imxdrm->drm);
|
drm_mode_group_reinit(imxdrm->drm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* register a crtc to the drm core
|
|
||||||
*/
|
|
||||||
static int imx_drm_crtc_register(struct imx_drm_crtc *imx_drm_crtc)
|
|
||||||
{
|
|
||||||
struct imx_drm_device *imxdrm = __imx_drm_device();
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = drm_mode_crtc_set_gamma_size(imx_drm_crtc->crtc, 256);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
drm_crtc_helper_add(imx_drm_crtc->crtc,
|
|
||||||
imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs);
|
|
||||||
|
|
||||||
drm_crtc_init(imxdrm->drm, imx_drm_crtc->crtc,
|
|
||||||
imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs);
|
|
||||||
|
|
||||||
drm_mode_group_reinit(imxdrm->drm);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called by the CRTC driver when all CRTCs are registered. This
|
* Called by the CRTC driver when all CRTCs are registered. This
|
||||||
* puts all the pieces together and initializes the driver.
|
* puts all the pieces together and initializes the driver.
|
||||||
|
@ -424,15 +401,15 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
|
||||||
|
|
||||||
mutex_lock(&imxdrm->mutex);
|
mutex_lock(&imxdrm->mutex);
|
||||||
|
|
||||||
drm_kms_helper_poll_init(imxdrm->drm);
|
drm_kms_helper_poll_init(drm);
|
||||||
|
|
||||||
/* setup the grouping for the legacy output */
|
/* setup the grouping for the legacy output */
|
||||||
ret = drm_mode_group_init_legacy_group(imxdrm->drm,
|
ret = drm_mode_group_init_legacy_group(drm,
|
||||||
&imxdrm->drm->primary->mode_group);
|
&drm->primary->mode_group);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_kms;
|
goto err_kms;
|
||||||
|
|
||||||
ret = drm_vblank_init(imxdrm->drm, MAX_CRTC);
|
ret = drm_vblank_init(drm, MAX_CRTC);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_kms;
|
goto err_kms;
|
||||||
|
|
||||||
|
@ -441,7 +418,7 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
|
||||||
* by drm timer once a current process gives up ownership of
|
* by drm timer once a current process gives up ownership of
|
||||||
* vblank event.(after drm_vblank_put function is called)
|
* vblank event.(after drm_vblank_put function is called)
|
||||||
*/
|
*/
|
||||||
imxdrm->drm->vblank_disable_allowed = true;
|
drm->vblank_disable_allowed = true;
|
||||||
|
|
||||||
if (!imx_drm_device_get()) {
|
if (!imx_drm_device_get()) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
|
@ -536,10 +513,18 @@ int imx_drm_add_crtc(struct drm_crtc *crtc,
|
||||||
|
|
||||||
*new_crtc = imx_drm_crtc;
|
*new_crtc = imx_drm_crtc;
|
||||||
|
|
||||||
ret = imx_drm_crtc_register(imx_drm_crtc);
|
ret = drm_mode_crtc_set_gamma_size(imx_drm_crtc->crtc, 256);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_register;
|
goto err_register;
|
||||||
|
|
||||||
|
drm_crtc_helper_add(crtc,
|
||||||
|
imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs);
|
||||||
|
|
||||||
|
drm_crtc_init(imxdrm->drm, crtc,
|
||||||
|
imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs);
|
||||||
|
|
||||||
|
drm_mode_group_reinit(imxdrm->drm);
|
||||||
|
|
||||||
imx_drm_update_possible_crtcs();
|
imx_drm_update_possible_crtcs();
|
||||||
|
|
||||||
mutex_unlock(&imxdrm->mutex);
|
mutex_unlock(&imxdrm->mutex);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
|
#include <linux/hdmi.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/mfd/syscon.h>
|
#include <linux/mfd/syscon.h>
|
||||||
#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
|
#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
|
||||||
|
@ -52,11 +53,6 @@ enum hdmi_datamap {
|
||||||
YCbCr422_12B = 0x12,
|
YCbCr422_12B = 0x12,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum hdmi_colorimetry {
|
|
||||||
ITU601,
|
|
||||||
ITU709,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum imx_hdmi_devtype {
|
enum imx_hdmi_devtype {
|
||||||
IMX6Q_HDMI,
|
IMX6Q_HDMI,
|
||||||
IMX6DL_HDMI,
|
IMX6DL_HDMI,
|
||||||
|
@ -489,12 +485,12 @@ static void imx_hdmi_update_csc_coeffs(struct imx_hdmi *hdmi)
|
||||||
|
|
||||||
if (is_color_space_conversion(hdmi)) {
|
if (is_color_space_conversion(hdmi)) {
|
||||||
if (hdmi->hdmi_data.enc_out_format == RGB) {
|
if (hdmi->hdmi_data.enc_out_format == RGB) {
|
||||||
if (hdmi->hdmi_data.colorimetry == ITU601)
|
if (hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_601)
|
||||||
csc_coeff = &csc_coeff_rgb_out_eitu601;
|
csc_coeff = &csc_coeff_rgb_out_eitu601;
|
||||||
else
|
else
|
||||||
csc_coeff = &csc_coeff_rgb_out_eitu709;
|
csc_coeff = &csc_coeff_rgb_out_eitu709;
|
||||||
} else if (hdmi->hdmi_data.enc_in_format == RGB) {
|
} else if (hdmi->hdmi_data.enc_in_format == RGB) {
|
||||||
if (hdmi->hdmi_data.colorimetry == ITU601)
|
if (hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_601)
|
||||||
csc_coeff = &csc_coeff_rgb_in_eitu601;
|
csc_coeff = &csc_coeff_rgb_in_eitu601;
|
||||||
else
|
else
|
||||||
csc_coeff = &csc_coeff_rgb_in_eitu709;
|
csc_coeff = &csc_coeff_rgb_in_eitu709;
|
||||||
|
@ -1140,16 +1136,16 @@ static void hdmi_config_AVI(struct imx_hdmi *hdmi)
|
||||||
/* Set up colorimetry */
|
/* Set up colorimetry */
|
||||||
if (hdmi->hdmi_data.enc_out_format == XVYCC444) {
|
if (hdmi->hdmi_data.enc_out_format == XVYCC444) {
|
||||||
colorimetry = HDMI_FC_AVICONF1_COLORIMETRY_EXTENDED_INFO;
|
colorimetry = HDMI_FC_AVICONF1_COLORIMETRY_EXTENDED_INFO;
|
||||||
if (hdmi->hdmi_data.colorimetry == ITU601)
|
if (hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_601)
|
||||||
ext_colorimetry =
|
ext_colorimetry =
|
||||||
HDMI_FC_AVICONF2_EXT_COLORIMETRY_XVYCC601;
|
HDMI_FC_AVICONF2_EXT_COLORIMETRY_XVYCC601;
|
||||||
else /* hdmi->hdmi_data.colorimetry == ITU709 */
|
else /*hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_709*/
|
||||||
ext_colorimetry =
|
ext_colorimetry =
|
||||||
HDMI_FC_AVICONF2_EXT_COLORIMETRY_XVYCC709;
|
HDMI_FC_AVICONF2_EXT_COLORIMETRY_XVYCC709;
|
||||||
} else if (hdmi->hdmi_data.enc_out_format != RGB) {
|
} else if (hdmi->hdmi_data.enc_out_format != RGB) {
|
||||||
if (hdmi->hdmi_data.colorimetry == ITU601)
|
if (hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_601)
|
||||||
colorimetry = HDMI_FC_AVICONF1_COLORIMETRY_SMPTE;
|
colorimetry = HDMI_FC_AVICONF1_COLORIMETRY_SMPTE;
|
||||||
else /* hdmi->hdmi_data.colorimetry == ITU709 */
|
else /*hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_709*/
|
||||||
colorimetry = HDMI_FC_AVICONF1_COLORIMETRY_ITUR;
|
colorimetry = HDMI_FC_AVICONF1_COLORIMETRY_ITUR;
|
||||||
ext_colorimetry = HDMI_FC_AVICONF2_EXT_COLORIMETRY_XVYCC601;
|
ext_colorimetry = HDMI_FC_AVICONF2_EXT_COLORIMETRY_XVYCC601;
|
||||||
} else { /* Carries no data */
|
} else { /* Carries no data */
|
||||||
|
@ -1379,9 +1375,9 @@ static int imx_hdmi_setup(struct imx_hdmi *hdmi, struct drm_display_mode *mode)
|
||||||
(hdmi->vic == 21) || (hdmi->vic == 22) ||
|
(hdmi->vic == 21) || (hdmi->vic == 22) ||
|
||||||
(hdmi->vic == 2) || (hdmi->vic == 3) ||
|
(hdmi->vic == 2) || (hdmi->vic == 3) ||
|
||||||
(hdmi->vic == 17) || (hdmi->vic == 18))
|
(hdmi->vic == 17) || (hdmi->vic == 18))
|
||||||
hdmi->hdmi_data.colorimetry = ITU601;
|
hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_601;
|
||||||
else
|
else
|
||||||
hdmi->hdmi_data.colorimetry = ITU709;
|
hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_709;
|
||||||
|
|
||||||
if ((hdmi->vic == 10) || (hdmi->vic == 11) ||
|
if ((hdmi->vic == 10) || (hdmi->vic == 11) ||
|
||||||
(hdmi->vic == 12) || (hdmi->vic == 13) ||
|
(hdmi->vic == 12) || (hdmi->vic == 13) ||
|
||||||
|
|
|
@ -9,5 +9,6 @@
|
||||||
* Other minor misc cleanups...
|
* Other minor misc cleanups...
|
||||||
|
|
||||||
Please send any patches to Greg Kroah-Hartman <greg@kroah.com>, Andreas Dilger
|
Please send any patches to Greg Kroah-Hartman <greg@kroah.com>, Andreas Dilger
|
||||||
<andreas.dilger@intel.com> and Peng Tao <tao.peng@emc.com>. CCing
|
<andreas.dilger@intel.com>, Oleg Drokin <oleg.drokin@intel.com> and
|
||||||
hpdd-discuss <hpdd-discuss@lists.01.org> would be great too.
|
Peng Tao <tao.peng@emc.com>. CCing hpdd-discuss <hpdd-discuss@lists.01.org>
|
||||||
|
would be great too.
|
||||||
|
|
|
@ -61,6 +61,8 @@ struct kuc_hdr {
|
||||||
__u16 kuc_msglen; /* Including header */
|
__u16 kuc_msglen; /* Including header */
|
||||||
} __attribute__((aligned(sizeof(__u64))));
|
} __attribute__((aligned(sizeof(__u64))));
|
||||||
|
|
||||||
|
#define KUC_CHANGELOG_MSG_MAXSIZE (sizeof(struct kuc_hdr)+CR_MAXSIZE)
|
||||||
|
|
||||||
#define KUC_MAGIC 0x191C /*Lustre9etLinC */
|
#define KUC_MAGIC 0x191C /*Lustre9etLinC */
|
||||||
#define KUC_FL_BLOCK 0x01 /* Wait for send */
|
#define KUC_FL_BLOCK 0x01 /* Wait for send */
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ do { \
|
||||||
do { \
|
do { \
|
||||||
LASSERT(!in_interrupt() || \
|
LASSERT(!in_interrupt() || \
|
||||||
((size) <= LIBCFS_VMALLOC_SIZE && \
|
((size) <= LIBCFS_VMALLOC_SIZE && \
|
||||||
((mask) & GFP_ATOMIC)) != 0); \
|
((mask) & __GFP_WAIT) == 0)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define LIBCFS_ALLOC_POST(ptr, size) \
|
#define LIBCFS_ALLOC_POST(ptr, size) \
|
||||||
|
|
|
@ -529,7 +529,7 @@ kiblnd_kvaddr_to_page (unsigned long vaddr)
|
||||||
{
|
{
|
||||||
struct page *page;
|
struct page *page;
|
||||||
|
|
||||||
if (is_vmalloc_addr(vaddr)) {
|
if (is_vmalloc_addr((void *)vaddr)) {
|
||||||
page = vmalloc_to_page ((void *)vaddr);
|
page = vmalloc_to_page ((void *)vaddr);
|
||||||
LASSERT (page != NULL);
|
LASSERT (page != NULL);
|
||||||
return page;
|
return page;
|
||||||
|
|
|
@ -924,7 +924,7 @@ ksocknal_launch_packet (lnet_ni_t *ni, ksock_tx_t *tx, lnet_process_id_t id)
|
||||||
int
|
int
|
||||||
ksocknal_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg)
|
ksocknal_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg)
|
||||||
{
|
{
|
||||||
int mpflag = 0;
|
int mpflag = 1;
|
||||||
int type = lntmsg->msg_type;
|
int type = lntmsg->msg_type;
|
||||||
lnet_process_id_t target = lntmsg->msg_target;
|
lnet_process_id_t target = lntmsg->msg_target;
|
||||||
unsigned int payload_niov = lntmsg->msg_niov;
|
unsigned int payload_niov = lntmsg->msg_niov;
|
||||||
|
@ -993,8 +993,9 @@ ksocknal_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg)
|
||||||
|
|
||||||
/* The first fragment will be set later in pro_pack */
|
/* The first fragment will be set later in pro_pack */
|
||||||
rc = ksocknal_launch_packet(ni, tx, target);
|
rc = ksocknal_launch_packet(ni, tx, target);
|
||||||
if (lntmsg->msg_vmflush)
|
if (!mpflag)
|
||||||
cfs_memory_pressure_restore(mpflag);
|
cfs_memory_pressure_restore(mpflag);
|
||||||
|
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
|
|
|
@ -760,7 +760,8 @@ static inline void hsm_set_cl_error(int *flags, int error)
|
||||||
*flags |= (error << CLF_HSM_ERR_L);
|
*flags |= (error << CLF_HSM_ERR_L);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CR_MAXSIZE cfs_size_round(2*NAME_MAX + 1 + sizeof(struct changelog_rec))
|
#define CR_MAXSIZE cfs_size_round(2*NAME_MAX + 1 + \
|
||||||
|
sizeof(struct changelog_ext_rec))
|
||||||
|
|
||||||
struct changelog_rec {
|
struct changelog_rec {
|
||||||
__u16 cr_namelen;
|
__u16 cr_namelen;
|
||||||
|
|
|
@ -1086,7 +1086,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl)
|
||||||
break;
|
break;
|
||||||
case Q_GETQUOTA:
|
case Q_GETQUOTA:
|
||||||
if (((type == USRQUOTA &&
|
if (((type == USRQUOTA &&
|
||||||
uid_eq(current_euid(), make_kuid(&init_user_ns, id))) ||
|
!uid_eq(current_euid(), make_kuid(&init_user_ns, id))) ||
|
||||||
(type == GRPQUOTA &&
|
(type == GRPQUOTA &&
|
||||||
!in_egroup_p(make_kgid(&init_user_ns, id)))) &&
|
!in_egroup_p(make_kgid(&init_user_ns, id)))) &&
|
||||||
(!cfs_capable(CFS_CAP_SYS_ADMIN) ||
|
(!cfs_capable(CFS_CAP_SYS_ADMIN) ||
|
||||||
|
|
|
@ -1430,7 +1430,7 @@ static struct kuc_hdr *changelog_kuc_hdr(char *buf, int len, int flags)
|
||||||
{
|
{
|
||||||
struct kuc_hdr *lh = (struct kuc_hdr *)buf;
|
struct kuc_hdr *lh = (struct kuc_hdr *)buf;
|
||||||
|
|
||||||
LASSERT(len <= CR_MAXSIZE);
|
LASSERT(len <= KUC_CHANGELOG_MSG_MAXSIZE);
|
||||||
|
|
||||||
lh->kuc_magic = KUC_MAGIC;
|
lh->kuc_magic = KUC_MAGIC;
|
||||||
lh->kuc_transport = KUC_TRANSPORT_CHANGELOG;
|
lh->kuc_transport = KUC_TRANSPORT_CHANGELOG;
|
||||||
|
@ -1503,7 +1503,7 @@ static int mdc_changelog_send_thread(void *csdata)
|
||||||
CDEBUG(D_CHANGELOG, "changelog to fp=%p start "LPU64"\n",
|
CDEBUG(D_CHANGELOG, "changelog to fp=%p start "LPU64"\n",
|
||||||
cs->cs_fp, cs->cs_startrec);
|
cs->cs_fp, cs->cs_startrec);
|
||||||
|
|
||||||
OBD_ALLOC(cs->cs_buf, CR_MAXSIZE);
|
OBD_ALLOC(cs->cs_buf, KUC_CHANGELOG_MSG_MAXSIZE);
|
||||||
if (cs->cs_buf == NULL)
|
if (cs->cs_buf == NULL)
|
||||||
GOTO(out, rc = -ENOMEM);
|
GOTO(out, rc = -ENOMEM);
|
||||||
|
|
||||||
|
@ -1540,7 +1540,7 @@ out:
|
||||||
if (ctxt)
|
if (ctxt)
|
||||||
llog_ctxt_put(ctxt);
|
llog_ctxt_put(ctxt);
|
||||||
if (cs->cs_buf)
|
if (cs->cs_buf)
|
||||||
OBD_FREE(cs->cs_buf, CR_MAXSIZE);
|
OBD_FREE(cs->cs_buf, KUC_CHANGELOG_MSG_MAXSIZE);
|
||||||
OBD_FREE_PTR(cs);
|
OBD_FREE_PTR(cs);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -892,6 +892,11 @@ static int xlr_setup_mdio(struct xlr_net_priv *priv,
|
||||||
priv->mii_bus->write = xlr_mii_write;
|
priv->mii_bus->write = xlr_mii_write;
|
||||||
priv->mii_bus->parent = &pdev->dev;
|
priv->mii_bus->parent = &pdev->dev;
|
||||||
priv->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
|
priv->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
|
||||||
|
if (priv->mii_bus->irq == NULL) {
|
||||||
|
pr_err("irq alloc failed\n");
|
||||||
|
mdiobus_free(priv->mii_bus);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
priv->mii_bus->irq[priv->phy_addr] = priv->ndev->irq;
|
priv->mii_bus->irq[priv->phy_addr] = priv->ndev->irq;
|
||||||
|
|
||||||
/* Scan only the enabled address */
|
/* Scan only the enabled address */
|
||||||
|
|
|
@ -275,13 +275,6 @@ enum cvmx_usb_pipe_flags {
|
||||||
*/
|
*/
|
||||||
#define MAX_TRANSFER_PACKETS ((1<<10)-1)
|
#define MAX_TRANSFER_PACKETS ((1<<10)-1)
|
||||||
|
|
||||||
enum {
|
|
||||||
USB_CLOCK_TYPE_REF_12,
|
|
||||||
USB_CLOCK_TYPE_REF_24,
|
|
||||||
USB_CLOCK_TYPE_REF_48,
|
|
||||||
USB_CLOCK_TYPE_CRYSTAL_12,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logical transactions may take numerous low level
|
* Logical transactions may take numerous low level
|
||||||
* transactions, especially when splits are concerned. This
|
* transactions, especially when splits are concerned. This
|
||||||
|
@ -471,19 +464,6 @@ struct octeon_hcd {
|
||||||
/* Returns the IO address to push/pop stuff data from the FIFOs */
|
/* Returns the IO address to push/pop stuff data from the FIFOs */
|
||||||
#define USB_FIFO_ADDRESS(channel, usb_index) (CVMX_USBCX_GOTGCTL(usb_index) + ((channel)+1)*0x1000)
|
#define USB_FIFO_ADDRESS(channel, usb_index) (CVMX_USBCX_GOTGCTL(usb_index) + ((channel)+1)*0x1000)
|
||||||
|
|
||||||
static int octeon_usb_get_clock_type(void)
|
|
||||||
{
|
|
||||||
switch (cvmx_sysinfo_get()->board_type) {
|
|
||||||
case CVMX_BOARD_TYPE_BBGW_REF:
|
|
||||||
case CVMX_BOARD_TYPE_LANAI2_A:
|
|
||||||
case CVMX_BOARD_TYPE_LANAI2_U:
|
|
||||||
case CVMX_BOARD_TYPE_LANAI2_G:
|
|
||||||
case CVMX_BOARD_TYPE_UBNT_E100:
|
|
||||||
return USB_CLOCK_TYPE_CRYSTAL_12;
|
|
||||||
}
|
|
||||||
return USB_CLOCK_TYPE_REF_48;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a USB 32bit CSR. It performs the necessary address swizzle
|
* Read a USB 32bit CSR. It performs the necessary address swizzle
|
||||||
* for 32bit CSRs and logs the value in a readable format if
|
* for 32bit CSRs and logs the value in a readable format if
|
||||||
|
@ -582,37 +562,6 @@ static inline int __cvmx_usb_get_data_pid(struct cvmx_usb_pipe *pipe)
|
||||||
return 0; /* Data0 */
|
return 0; /* Data0 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the number of USB ports supported by this Octeon
|
|
||||||
* chip. If the chip doesn't support USB, or is not supported
|
|
||||||
* by this API, a zero will be returned. Most Octeon chips
|
|
||||||
* support one usb port, but some support two ports.
|
|
||||||
* cvmx_usb_initialize() must be called on independent
|
|
||||||
* struct cvmx_usb_state.
|
|
||||||
*
|
|
||||||
* Returns: Number of port, zero if usb isn't supported
|
|
||||||
*/
|
|
||||||
static int cvmx_usb_get_num_ports(void)
|
|
||||||
{
|
|
||||||
int arch_ports = 0;
|
|
||||||
|
|
||||||
if (OCTEON_IS_MODEL(OCTEON_CN56XX))
|
|
||||||
arch_ports = 1;
|
|
||||||
else if (OCTEON_IS_MODEL(OCTEON_CN52XX))
|
|
||||||
arch_ports = 2;
|
|
||||||
else if (OCTEON_IS_MODEL(OCTEON_CN50XX))
|
|
||||||
arch_ports = 1;
|
|
||||||
else if (OCTEON_IS_MODEL(OCTEON_CN31XX))
|
|
||||||
arch_ports = 1;
|
|
||||||
else if (OCTEON_IS_MODEL(OCTEON_CN30XX))
|
|
||||||
arch_ports = 1;
|
|
||||||
else
|
|
||||||
arch_ports = 0;
|
|
||||||
|
|
||||||
return arch_ports;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize a USB port for use. This must be called before any
|
* Initialize a USB port for use. This must be called before any
|
||||||
* other access to the Octeon USB port is made. The port starts
|
* other access to the Octeon USB port is made. The port starts
|
||||||
|
@ -628,41 +577,16 @@ static int cvmx_usb_get_num_ports(void)
|
||||||
* Returns: 0 or a negative error code.
|
* Returns: 0 or a negative error code.
|
||||||
*/
|
*/
|
||||||
static int cvmx_usb_initialize(struct cvmx_usb_state *usb,
|
static int cvmx_usb_initialize(struct cvmx_usb_state *usb,
|
||||||
int usb_port_number)
|
int usb_port_number,
|
||||||
|
enum cvmx_usb_initialize_flags flags)
|
||||||
{
|
{
|
||||||
union cvmx_usbnx_clk_ctl usbn_clk_ctl;
|
union cvmx_usbnx_clk_ctl usbn_clk_ctl;
|
||||||
union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status;
|
union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status;
|
||||||
enum cvmx_usb_initialize_flags flags = 0;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* At first allow 0-1 for the usb port number */
|
/* At first allow 0-1 for the usb port number */
|
||||||
if ((usb_port_number < 0) || (usb_port_number > 1))
|
if ((usb_port_number < 0) || (usb_port_number > 1))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
/* For all chips except 52XX there is only one port */
|
|
||||||
if (!OCTEON_IS_MODEL(OCTEON_CN52XX) && (usb_port_number > 0))
|
|
||||||
return -EINVAL;
|
|
||||||
/* Try to determine clock type automatically */
|
|
||||||
if (octeon_usb_get_clock_type() == USB_CLOCK_TYPE_CRYSTAL_12) {
|
|
||||||
/* Only 12 MHZ crystals are supported */
|
|
||||||
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI;
|
|
||||||
} else {
|
|
||||||
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND;
|
|
||||||
|
|
||||||
switch (octeon_usb_get_clock_type()) {
|
|
||||||
case USB_CLOCK_TYPE_REF_12:
|
|
||||||
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ;
|
|
||||||
break;
|
|
||||||
case USB_CLOCK_TYPE_REF_24:
|
|
||||||
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ;
|
|
||||||
break;
|
|
||||||
case USB_CLOCK_TYPE_REF_48:
|
|
||||||
flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -EINVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(usb, 0, sizeof(*usb));
|
memset(usb, 0, sizeof(*usb));
|
||||||
usb->init_flags = flags;
|
usb->init_flags = flags;
|
||||||
|
@ -3431,7 +3355,6 @@ static int octeon_usb_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const struct hc_driver octeon_hc_driver = {
|
static const struct hc_driver octeon_hc_driver = {
|
||||||
.description = "Octeon USB",
|
.description = "Octeon USB",
|
||||||
.product_desc = "Octeon Host Controller",
|
.product_desc = "Octeon Host Controller",
|
||||||
|
@ -3448,15 +3371,74 @@ static const struct hc_driver octeon_hc_driver = {
|
||||||
.hub_control = octeon_usb_hub_control,
|
.hub_control = octeon_usb_hub_control,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int octeon_usb_probe(struct platform_device *pdev)
|
||||||
static int octeon_usb_driver_probe(struct device *dev)
|
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
int usb_num = to_platform_device(dev)->id;
|
int initialize_flags;
|
||||||
int irq = platform_get_irq(to_platform_device(dev), 0);
|
int usb_num;
|
||||||
|
struct resource *res_mem;
|
||||||
|
struct device_node *usbn_node;
|
||||||
|
int irq = platform_get_irq(pdev, 0);
|
||||||
|
struct device *dev = &pdev->dev;
|
||||||
struct octeon_hcd *priv;
|
struct octeon_hcd *priv;
|
||||||
struct usb_hcd *hcd;
|
struct usb_hcd *hcd;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
u32 clock_rate = 48000000;
|
||||||
|
bool is_crystal_clock = false;
|
||||||
|
const char *clock_type;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (dev->of_node == NULL) {
|
||||||
|
dev_err(dev, "Error: empty of_node\n");
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
usbn_node = dev->of_node->parent;
|
||||||
|
|
||||||
|
i = of_property_read_u32(usbn_node,
|
||||||
|
"refclk-frequency", &clock_rate);
|
||||||
|
if (i) {
|
||||||
|
dev_err(dev, "No USBN \"refclk-frequency\"\n");
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
switch (clock_rate) {
|
||||||
|
case 12000000:
|
||||||
|
initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ;
|
||||||
|
break;
|
||||||
|
case 24000000:
|
||||||
|
initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ;
|
||||||
|
break;
|
||||||
|
case 48000000:
|
||||||
|
initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dev_err(dev, "Illebal USBN \"refclk-frequency\" %u\n", clock_rate);
|
||||||
|
return -ENXIO;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
i = of_property_read_string(usbn_node,
|
||||||
|
"refclk-type", &clock_type);
|
||||||
|
|
||||||
|
if (!i && strcmp("crystal", clock_type) == 0)
|
||||||
|
is_crystal_clock = true;
|
||||||
|
|
||||||
|
if (is_crystal_clock)
|
||||||
|
initialize_flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI;
|
||||||
|
else
|
||||||
|
initialize_flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND;
|
||||||
|
|
||||||
|
res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
|
if (res_mem == NULL) {
|
||||||
|
dev_err(dev, "found no memory resource\n");
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
usb_num = (res_mem->start >> 44) & 1;
|
||||||
|
|
||||||
|
if (irq < 0) {
|
||||||
|
/* Defective device tree, but we know how to fix it. */
|
||||||
|
irq_hw_number_t hwirq = usb_num ? (1 << 6) + 17 : 56;
|
||||||
|
irq = irq_create_mapping(NULL, hwirq);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the DMA mask to 64bits so we get buffers already translated for
|
* Set the DMA mask to 64bits so we get buffers already translated for
|
||||||
|
@ -3465,90 +3447,6 @@ static int octeon_usb_driver_probe(struct device *dev)
|
||||||
dev->coherent_dma_mask = ~0;
|
dev->coherent_dma_mask = ~0;
|
||||||
dev->dma_mask = &dev->coherent_dma_mask;
|
dev->dma_mask = &dev->coherent_dma_mask;
|
||||||
|
|
||||||
hcd = usb_create_hcd(&octeon_hc_driver, dev, dev_name(dev));
|
|
||||||
if (!hcd) {
|
|
||||||
dev_dbg(dev, "Failed to allocate memory for HCD\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
hcd->uses_new_polling = 1;
|
|
||||||
priv = (struct octeon_hcd *)hcd->hcd_priv;
|
|
||||||
|
|
||||||
spin_lock_init(&priv->lock);
|
|
||||||
|
|
||||||
tasklet_init(&priv->dequeue_tasklet, octeon_usb_urb_dequeue_work, (unsigned long)priv);
|
|
||||||
INIT_LIST_HEAD(&priv->dequeue_list);
|
|
||||||
|
|
||||||
status = cvmx_usb_initialize(&priv->usb, usb_num);
|
|
||||||
if (status) {
|
|
||||||
dev_dbg(dev, "USB initialization failed with %d\n", status);
|
|
||||||
kfree(hcd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This delay is needed for CN3010, but I don't know why... */
|
|
||||||
mdelay(10);
|
|
||||||
|
|
||||||
spin_lock_irqsave(&priv->lock, flags);
|
|
||||||
cvmx_usb_poll(&priv->usb);
|
|
||||||
spin_unlock_irqrestore(&priv->lock, flags);
|
|
||||||
|
|
||||||
status = usb_add_hcd(hcd, irq, IRQF_SHARED);
|
|
||||||
if (status) {
|
|
||||||
dev_dbg(dev, "USB add HCD failed with %d\n", status);
|
|
||||||
kfree(hcd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
device_wakeup_enable(hcd->self.controller);
|
|
||||||
|
|
||||||
dev_dbg(dev, "Registered HCD for port %d on irq %d\n", usb_num, irq);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int octeon_usb_driver_remove(struct device *dev)
|
|
||||||
{
|
|
||||||
int status;
|
|
||||||
struct usb_hcd *hcd = dev_get_drvdata(dev);
|
|
||||||
struct octeon_hcd *priv = hcd_to_octeon(hcd);
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
usb_remove_hcd(hcd);
|
|
||||||
tasklet_kill(&priv->dequeue_tasklet);
|
|
||||||
spin_lock_irqsave(&priv->lock, flags);
|
|
||||||
status = cvmx_usb_shutdown(&priv->usb);
|
|
||||||
spin_unlock_irqrestore(&priv->lock, flags);
|
|
||||||
if (status)
|
|
||||||
dev_dbg(dev, "USB shutdown failed with %d\n", status);
|
|
||||||
|
|
||||||
kfree(hcd);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct device_driver octeon_usb_driver = {
|
|
||||||
.name = "OcteonUSB",
|
|
||||||
.bus = &platform_bus_type,
|
|
||||||
.probe = octeon_usb_driver_probe,
|
|
||||||
.remove = octeon_usb_driver_remove,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#define MAX_USB_PORTS 10
|
|
||||||
static struct platform_device *pdev_glob[MAX_USB_PORTS];
|
|
||||||
static int octeon_usb_registered;
|
|
||||||
static int __init octeon_usb_module_init(void)
|
|
||||||
{
|
|
||||||
int num_devices = cvmx_usb_get_num_ports();
|
|
||||||
int device;
|
|
||||||
|
|
||||||
if (usb_disabled() || num_devices == 0)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
if (driver_register(&octeon_usb_driver))
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
octeon_usb_registered = 1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only cn52XX and cn56XX have DWC_OTG USB hardware and the
|
* Only cn52XX and cn56XX have DWC_OTG USB hardware and the
|
||||||
* IOB priority registers. Under heavy network load USB
|
* IOB priority registers. Under heavy network load USB
|
||||||
|
@ -3569,41 +3467,102 @@ static int __init octeon_usb_module_init(void)
|
||||||
cvmx_write_csr(CVMX_IOB_N2C_L2C_PRI_CNT, pri_cnt.u64);
|
cvmx_write_csr(CVMX_IOB_N2C_L2C_PRI_CNT, pri_cnt.u64);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (device = 0; device < num_devices; device++) {
|
hcd = usb_create_hcd(&octeon_hc_driver, dev, dev_name(dev));
|
||||||
struct resource irq_resource;
|
if (!hcd) {
|
||||||
struct platform_device *pdev;
|
dev_dbg(dev, "Failed to allocate memory for HCD\n");
|
||||||
memset(&irq_resource, 0, sizeof(irq_resource));
|
return -1;
|
||||||
irq_resource.start = (device == 0) ? OCTEON_IRQ_USB0 : OCTEON_IRQ_USB1;
|
|
||||||
irq_resource.end = irq_resource.start;
|
|
||||||
irq_resource.flags = IORESOURCE_IRQ;
|
|
||||||
pdev = platform_device_register_simple((char *)octeon_usb_driver. name, device, &irq_resource, 1);
|
|
||||||
if (IS_ERR(pdev)) {
|
|
||||||
driver_unregister(&octeon_usb_driver);
|
|
||||||
octeon_usb_registered = 0;
|
|
||||||
return PTR_ERR(pdev);
|
|
||||||
}
|
|
||||||
if (device < MAX_USB_PORTS)
|
|
||||||
pdev_glob[device] = pdev;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
hcd->uses_new_polling = 1;
|
||||||
|
priv = (struct octeon_hcd *)hcd->hcd_priv;
|
||||||
|
|
||||||
|
spin_lock_init(&priv->lock);
|
||||||
|
|
||||||
|
tasklet_init(&priv->dequeue_tasklet, octeon_usb_urb_dequeue_work, (unsigned long)priv);
|
||||||
|
INIT_LIST_HEAD(&priv->dequeue_list);
|
||||||
|
|
||||||
|
status = cvmx_usb_initialize(&priv->usb, usb_num, initialize_flags);
|
||||||
|
if (status) {
|
||||||
|
dev_dbg(dev, "USB initialization failed with %d\n", status);
|
||||||
|
kfree(hcd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This delay is needed for CN3010, but I don't know why... */
|
||||||
|
mdelay(10);
|
||||||
|
|
||||||
|
spin_lock_irqsave(&priv->lock, flags);
|
||||||
|
cvmx_usb_poll(&priv->usb);
|
||||||
|
spin_unlock_irqrestore(&priv->lock, flags);
|
||||||
|
|
||||||
|
status = usb_add_hcd(hcd, irq, 0);
|
||||||
|
if (status) {
|
||||||
|
dev_dbg(dev, "USB add HCD failed with %d\n", status);
|
||||||
|
kfree(hcd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
device_wakeup_enable(hcd->self.controller);
|
||||||
|
|
||||||
|
dev_info(dev, "Registered HCD for port %d on irq %d\n", usb_num, irq);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit octeon_usb_module_cleanup(void)
|
static int octeon_usb_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
int i;
|
int status;
|
||||||
|
struct device *dev = &pdev->dev;
|
||||||
|
struct usb_hcd *hcd = dev_get_drvdata(dev);
|
||||||
|
struct octeon_hcd *priv = hcd_to_octeon(hcd);
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
for (i = 0; i < MAX_USB_PORTS; i++)
|
usb_remove_hcd(hcd);
|
||||||
if (pdev_glob[i]) {
|
tasklet_kill(&priv->dequeue_tasklet);
|
||||||
platform_device_unregister(pdev_glob[i]);
|
spin_lock_irqsave(&priv->lock, flags);
|
||||||
pdev_glob[i] = NULL;
|
status = cvmx_usb_shutdown(&priv->usb);
|
||||||
}
|
spin_unlock_irqrestore(&priv->lock, flags);
|
||||||
if (octeon_usb_registered)
|
if (status)
|
||||||
driver_unregister(&octeon_usb_driver);
|
dev_dbg(dev, "USB shutdown failed with %d\n", status);
|
||||||
|
|
||||||
|
kfree(hcd);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct of_device_id octeon_usb_match[] = {
|
||||||
|
{
|
||||||
|
.compatible = "cavium,octeon-5750-usbc",
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct platform_driver octeon_usb_driver = {
|
||||||
|
.driver = {
|
||||||
|
.name = "OcteonUSB",
|
||||||
|
.owner = THIS_MODULE,
|
||||||
|
.of_match_table = octeon_usb_match,
|
||||||
|
},
|
||||||
|
.probe = octeon_usb_probe,
|
||||||
|
.remove = octeon_usb_remove,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int __init octeon_usb_driver_init(void)
|
||||||
|
{
|
||||||
|
if (usb_disabled())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return platform_driver_register(&octeon_usb_driver);
|
||||||
|
}
|
||||||
|
module_init(octeon_usb_driver_init);
|
||||||
|
|
||||||
|
static void __exit octeon_usb_driver_exit(void)
|
||||||
|
{
|
||||||
|
if (usb_disabled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
platform_driver_unregister(&octeon_usb_driver);
|
||||||
|
}
|
||||||
|
module_exit(octeon_usb_driver_exit);
|
||||||
|
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
MODULE_AUTHOR("Cavium Networks <support@caviumnetworks.com>");
|
MODULE_AUTHOR("Cavium, Inc. <support@cavium.com>");
|
||||||
MODULE_DESCRIPTION("Cavium Networks Octeon USB Host driver.");
|
MODULE_DESCRIPTION("Cavium Inc. OCTEON USB Host driver.");
|
||||||
module_init(octeon_usb_module_init);
|
|
||||||
module_exit(octeon_usb_module_cleanup);
|
|
||||||
|
|
|
@ -668,8 +668,8 @@ void oz_binding_add(const char *net_dev)
|
||||||
if (binding) {
|
if (binding) {
|
||||||
binding->ptype.type = __constant_htons(OZ_ETHERTYPE);
|
binding->ptype.type = __constant_htons(OZ_ETHERTYPE);
|
||||||
binding->ptype.func = oz_pkt_recv;
|
binding->ptype.func = oz_pkt_recv;
|
||||||
memcpy(binding->name, net_dev, OZ_MAX_BINDING_LEN);
|
|
||||||
if (net_dev && *net_dev) {
|
if (net_dev && *net_dev) {
|
||||||
|
memcpy(binding->name, net_dev, OZ_MAX_BINDING_LEN);
|
||||||
oz_dbg(ON, "Adding binding: %s\n", net_dev);
|
oz_dbg(ON, "Adding binding: %s\n", net_dev);
|
||||||
binding->ptype.dev =
|
binding->ptype.dev =
|
||||||
dev_get_by_name(&init_net, net_dev);
|
dev_get_by_name(&init_net, net_dev);
|
||||||
|
@ -680,6 +680,7 @@ void oz_binding_add(const char *net_dev)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
oz_dbg(ON, "Binding to all netcards\n");
|
oz_dbg(ON, "Binding to all netcards\n");
|
||||||
|
memset(binding->name, 0, OZ_MAX_BINDING_LEN);
|
||||||
binding->ptype.dev = NULL;
|
binding->ptype.dev = NULL;
|
||||||
}
|
}
|
||||||
if (binding) {
|
if (binding) {
|
||||||
|
|
|
@ -912,12 +912,12 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)
|
||||||
unsigned char *pbuf;
|
unsigned char *pbuf;
|
||||||
u32 wpa_ielen = 0;
|
u32 wpa_ielen = 0;
|
||||||
u8 *pbssid = GetAddr3Ptr(pframe);
|
u8 *pbssid = GetAddr3Ptr(pframe);
|
||||||
u32 hidden_ssid = 0;
|
|
||||||
struct HT_info_element *pht_info = NULL;
|
struct HT_info_element *pht_info = NULL;
|
||||||
struct rtw_ieee80211_ht_cap *pht_cap = NULL;
|
struct rtw_ieee80211_ht_cap *pht_cap = NULL;
|
||||||
u32 bcn_channel;
|
u32 bcn_channel;
|
||||||
unsigned short ht_cap_info;
|
unsigned short ht_cap_info;
|
||||||
unsigned char ht_info_infos_0;
|
unsigned char ht_info_infos_0;
|
||||||
|
int ssid_len;
|
||||||
|
|
||||||
if (is_client_associated_to_ap(Adapter) == false)
|
if (is_client_associated_to_ap(Adapter) == false)
|
||||||
return true;
|
return true;
|
||||||
|
@ -999,21 +999,15 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* checking SSID */
|
/* checking SSID */
|
||||||
|
ssid_len = 0;
|
||||||
p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SSID_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
|
p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SSID_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
|
||||||
if (p == NULL) {
|
if (p) {
|
||||||
DBG_88E("%s marc: cannot find SSID for survey event\n", __func__);
|
ssid_len = *(p + 1);
|
||||||
hidden_ssid = true;
|
if (ssid_len > NDIS_802_11_LENGTH_SSID)
|
||||||
} else {
|
ssid_len = 0;
|
||||||
hidden_ssid = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((NULL != p) && (false == hidden_ssid && (*(p + 1)))) {
|
|
||||||
memcpy(bssid->Ssid.Ssid, (p + 2), *(p + 1));
|
|
||||||
bssid->Ssid.SsidLength = *(p + 1);
|
|
||||||
} else {
|
|
||||||
bssid->Ssid.SsidLength = 0;
|
|
||||||
bssid->Ssid.Ssid[0] = '\0';
|
|
||||||
}
|
}
|
||||||
|
memcpy(bssid->Ssid.Ssid, (p + 2), ssid_len);
|
||||||
|
bssid->Ssid.SsidLength = ssid_len;
|
||||||
|
|
||||||
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("%s bssid.Ssid.Ssid:%s bssid.Ssid.SsidLength:%d "
|
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("%s bssid.Ssid.Ssid:%s bssid.Ssid.SsidLength:%d "
|
||||||
"cur_network->network.Ssid.Ssid:%s len:%d\n", __func__, bssid->Ssid.Ssid,
|
"cur_network->network.Ssid.Ssid:%s len:%d\n", __func__, bssid->Ssid.Ssid,
|
||||||
|
|
|
@ -2500,7 +2500,7 @@ static int rtw_mp_ioctl_hdl(struct net_device *dev, struct iw_request_info *info
|
||||||
("rtw_mp_ioctl_hdl: subcode [%d], len[%d], buffer_len[%d]\r\n",
|
("rtw_mp_ioctl_hdl: subcode [%d], len[%d], buffer_len[%d]\r\n",
|
||||||
poidparam->subcode, poidparam->len, len));
|
poidparam->subcode, poidparam->len, len));
|
||||||
|
|
||||||
if (poidparam->subcode >= MAX_MP_IOCTL_SUBCODE) {
|
if (poidparam->subcode >= ARRAY_SIZE(mp_ioctl_hdl)) {
|
||||||
RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, ("no matching drvext subcodes\r\n"));
|
RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, ("no matching drvext subcodes\r\n"));
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto _rtw_mp_ioctl_hdl_exit;
|
goto _rtw_mp_ioctl_hdl_exit;
|
||||||
|
@ -3164,9 +3164,7 @@ static int rtw_p2p_get_go_device_address(struct net_device *dev,
|
||||||
u8 *p2pie;
|
u8 *p2pie;
|
||||||
uint p2pielen = 0, attr_contentlen = 0;
|
uint p2pielen = 0, attr_contentlen = 0;
|
||||||
u8 attr_content[100] = {0x00};
|
u8 attr_content[100] = {0x00};
|
||||||
|
u8 go_devadd_str[17 + 12] = {};
|
||||||
u8 go_devadd_str[17 + 10] = {0x00};
|
|
||||||
/* +10 is for the str "go_devadd =", we have to clear it at wrqu->data.pointer */
|
|
||||||
|
|
||||||
/* Commented by Albert 20121209 */
|
/* Commented by Albert 20121209 */
|
||||||
/* The input data is the GO's interface address which the application wants to know its device address. */
|
/* The input data is the GO's interface address which the application wants to know its device address. */
|
||||||
|
@ -3223,12 +3221,12 @@ static int rtw_p2p_get_go_device_address(struct net_device *dev,
|
||||||
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
|
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
|
||||||
|
|
||||||
if (!blnMatch)
|
if (!blnMatch)
|
||||||
sprintf(go_devadd_str, "\n\ndev_add = NULL");
|
snprintf(go_devadd_str, sizeof(go_devadd_str), "\n\ndev_add = NULL");
|
||||||
else
|
else
|
||||||
sprintf(go_devadd_str, "\n\ndev_add =%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
|
snprintf(go_devadd_str, sizeof(go_devadd_str), "\n\ndev_add =%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
|
||||||
attr_content[0], attr_content[1], attr_content[2], attr_content[3], attr_content[4], attr_content[5]);
|
attr_content[0], attr_content[1], attr_content[2], attr_content[3], attr_content[4], attr_content[5]);
|
||||||
|
|
||||||
if (copy_to_user(wrqu->data.pointer, go_devadd_str, 10 + 17))
|
if (copy_to_user(wrqu->data.pointer, go_devadd_str, sizeof(go_devadd_str)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
|
||||||
{USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */
|
{USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */
|
||||||
/*=== Customer ID ===*/
|
/*=== Customer ID ===*/
|
||||||
/****** 8188EUS ********/
|
/****** 8188EUS ********/
|
||||||
{USB_DEVICE(0x8179, 0x07B8)}, /* Abocom - Abocom */
|
{USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */
|
||||||
{USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */
|
{USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */
|
||||||
{} /* Terminating entry */
|
{} /* Terminating entry */
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
config R8821AE
|
config R8821AE
|
||||||
tristate "RealTek RTL8821AE Wireless LAN NIC driver"
|
tristate "RealTek RTL8821AE Wireless LAN NIC driver"
|
||||||
depends on PCI && WLAN
|
depends on PCI && WLAN && MAC80211
|
||||||
depends on m
|
depends on m
|
||||||
select WIRELESS_EXT
|
select WIRELESS_EXT
|
||||||
select WEXT_PRIV
|
select WEXT_PRIV
|
||||||
|
|
|
@ -1414,7 +1414,7 @@ struct rtl_dm {
|
||||||
|
|
||||||
|
|
||||||
/*88e tx power tracking*/
|
/*88e tx power tracking*/
|
||||||
u8 bb_swing_idx_ofdm[2];
|
u8 bb_swing_idx_ofdm[MAX_RF_PATH];
|
||||||
u8 bb_swing_idx_ofdm_current;
|
u8 bb_swing_idx_ofdm_current;
|
||||||
u8 bb_swing_idx_ofdm_base[MAX_RF_PATH];
|
u8 bb_swing_idx_ofdm_base[MAX_RF_PATH];
|
||||||
bool bb_swing_flag_Ofdm;
|
bool bb_swing_flag_Ofdm;
|
||||||
|
|
|
@ -169,15 +169,15 @@ static void *my_malloc(size_t size)
|
||||||
struct pool *p;
|
struct pool *p;
|
||||||
|
|
||||||
p = calloc(1, sizeof(struct pool));
|
p = calloc(1, sizeof(struct pool));
|
||||||
if (!p) {
|
if (!p)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
p->mem = calloc(1, size);
|
||||||
|
if (!p->mem) {
|
||||||
free(p);
|
free(p);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->mem = calloc(1, size);
|
|
||||||
if (!p->mem)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
p->next = pool_head;
|
p->next = pool_head;
|
||||||
pool_head = p;
|
pool_head = p;
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,8 @@ static int valid_args(__u32 rhport, enum usb_device_speed speed)
|
||||||
case USB_SPEED_WIRELESS:
|
case USB_SPEED_WIRELESS:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pr_err("speed %d\n", speed);
|
pr_err("Failed attach request for unsupported USB speed: %s\n",
|
||||||
|
usb_speed_string(speed));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1061,7 +1061,7 @@ static int wireless_set_essid(struct net_device *dev, struct iw_request_info *in
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->flags != 0 && data->length > HCF_MAX_NAME_LEN + 1) {
|
if (data->flags != 0 && data->length > HCF_MAX_NAME_LEN) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue