diff options
45 files changed, 506 insertions, 509 deletions
diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index 3bec9220df04..bfec313492b3 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c | |||
| @@ -447,14 +447,14 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = { | |||
| 447 | { }, | 447 | { }, |
| 448 | }; | 448 | }; |
| 449 | 449 | ||
| 450 | #define BMA180_CHANNEL(_index) { \ | 450 | #define BMA180_CHANNEL(_axis) { \ |
| 451 | .type = IIO_ACCEL, \ | 451 | .type = IIO_ACCEL, \ |
| 452 | .indexed = 1, \ | 452 | .modified = 1, \ |
| 453 | .channel = (_index), \ | 453 | .channel2 = IIO_MOD_##_axis, \ |
| 454 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ | 454 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ |
| 455 | BIT(IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY), \ | 455 | BIT(IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY), \ |
| 456 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ | 456 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ |
| 457 | .scan_index = (_index), \ | 457 | .scan_index = AXIS_##_axis, \ |
| 458 | .scan_type = { \ | 458 | .scan_type = { \ |
| 459 | .sign = 's', \ | 459 | .sign = 's', \ |
| 460 | .realbits = 14, \ | 460 | .realbits = 14, \ |
| @@ -465,10 +465,10 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = { | |||
| 465 | } | 465 | } |
| 466 | 466 | ||
| 467 | static const struct iio_chan_spec bma180_channels[] = { | 467 | static const struct iio_chan_spec bma180_channels[] = { |
| 468 | BMA180_CHANNEL(AXIS_X), | 468 | BMA180_CHANNEL(X), |
| 469 | BMA180_CHANNEL(AXIS_Y), | 469 | BMA180_CHANNEL(Y), |
| 470 | BMA180_CHANNEL(AXIS_Z), | 470 | BMA180_CHANNEL(Z), |
| 471 | IIO_CHAN_SOFT_TIMESTAMP(4), | 471 | IIO_CHAN_SOFT_TIMESTAMP(3), |
| 472 | }; | 472 | }; |
| 473 | 473 | ||
| 474 | static irqreturn_t bma180_trigger_handler(int irq, void *p) | 474 | static irqreturn_t bma180_trigger_handler(int irq, void *p) |
diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c index e283f2f2ee2f..360259266d4f 100644 --- a/drivers/iio/adc/max1363.c +++ b/drivers/iio/adc/max1363.c | |||
| @@ -1560,7 +1560,7 @@ static int max1363_probe(struct i2c_client *client, | |||
| 1560 | st->client = client; | 1560 | st->client = client; |
| 1561 | 1561 | ||
| 1562 | st->vref_uv = st->chip_info->int_vref_mv * 1000; | 1562 | st->vref_uv = st->chip_info->int_vref_mv * 1000; |
| 1563 | vref = devm_regulator_get(&client->dev, "vref"); | 1563 | vref = devm_regulator_get_optional(&client->dev, "vref"); |
| 1564 | if (!IS_ERR(vref)) { | 1564 | if (!IS_ERR(vref)) { |
| 1565 | int vref_uv; | 1565 | int vref_uv; |
| 1566 | 1566 | ||
diff --git a/drivers/iio/imu/adis16400.h b/drivers/iio/imu/adis16400.h index 2f8f9d632386..0916bf6b6c31 100644 --- a/drivers/iio/imu/adis16400.h +++ b/drivers/iio/imu/adis16400.h | |||
| @@ -189,6 +189,7 @@ enum { | |||
| 189 | ADIS16300_SCAN_INCLI_X, | 189 | ADIS16300_SCAN_INCLI_X, |
| 190 | ADIS16300_SCAN_INCLI_Y, | 190 | ADIS16300_SCAN_INCLI_Y, |
| 191 | ADIS16400_SCAN_ADC, | 191 | ADIS16400_SCAN_ADC, |
| 192 | ADIS16400_SCAN_TIMESTAMP, | ||
| 192 | }; | 193 | }; |
| 193 | 194 | ||
| 194 | #ifdef CONFIG_IIO_BUFFER | 195 | #ifdef CONFIG_IIO_BUFFER |
diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c index 368660dfe135..7c582f7ae34e 100644 --- a/drivers/iio/imu/adis16400_core.c +++ b/drivers/iio/imu/adis16400_core.c | |||
| @@ -632,7 +632,7 @@ static const struct iio_chan_spec adis16400_channels[] = { | |||
| 632 | ADIS16400_MAGN_CHAN(Z, ADIS16400_ZMAGN_OUT, 14), | 632 | ADIS16400_MAGN_CHAN(Z, ADIS16400_ZMAGN_OUT, 14), |
| 633 | ADIS16400_TEMP_CHAN(ADIS16400_TEMP_OUT, 12), | 633 | ADIS16400_TEMP_CHAN(ADIS16400_TEMP_OUT, 12), |
| 634 | ADIS16400_AUX_ADC_CHAN(ADIS16400_AUX_ADC, 12), | 634 | ADIS16400_AUX_ADC_CHAN(ADIS16400_AUX_ADC, 12), |
| 635 | IIO_CHAN_SOFT_TIMESTAMP(12) | 635 | IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP), |
| 636 | }; | 636 | }; |
| 637 | 637 | ||
| 638 | static const struct iio_chan_spec adis16448_channels[] = { | 638 | static const struct iio_chan_spec adis16448_channels[] = { |
| @@ -659,7 +659,7 @@ static const struct iio_chan_spec adis16448_channels[] = { | |||
| 659 | }, | 659 | }, |
| 660 | }, | 660 | }, |
| 661 | ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12), | 661 | ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12), |
| 662 | IIO_CHAN_SOFT_TIMESTAMP(11) | 662 | IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP), |
| 663 | }; | 663 | }; |
| 664 | 664 | ||
| 665 | static const struct iio_chan_spec adis16350_channels[] = { | 665 | static const struct iio_chan_spec adis16350_channels[] = { |
| @@ -677,7 +677,7 @@ static const struct iio_chan_spec adis16350_channels[] = { | |||
| 677 | ADIS16400_MOD_TEMP_CHAN(X, ADIS16350_XTEMP_OUT, 12), | 677 | ADIS16400_MOD_TEMP_CHAN(X, ADIS16350_XTEMP_OUT, 12), |
| 678 | ADIS16400_MOD_TEMP_CHAN(Y, ADIS16350_YTEMP_OUT, 12), | 678 | ADIS16400_MOD_TEMP_CHAN(Y, ADIS16350_YTEMP_OUT, 12), |
| 679 | ADIS16400_MOD_TEMP_CHAN(Z, ADIS16350_ZTEMP_OUT, 12), | 679 | ADIS16400_MOD_TEMP_CHAN(Z, ADIS16350_ZTEMP_OUT, 12), |
| 680 | IIO_CHAN_SOFT_TIMESTAMP(11) | 680 | IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP), |
| 681 | }; | 681 | }; |
| 682 | 682 | ||
| 683 | static const struct iio_chan_spec adis16300_channels[] = { | 683 | static const struct iio_chan_spec adis16300_channels[] = { |
| @@ -690,7 +690,7 @@ static const struct iio_chan_spec adis16300_channels[] = { | |||
| 690 | ADIS16400_AUX_ADC_CHAN(ADIS16300_AUX_ADC, 12), | 690 | ADIS16400_AUX_ADC_CHAN(ADIS16300_AUX_ADC, 12), |
| 691 | ADIS16400_INCLI_CHAN(X, ADIS16300_PITCH_OUT, 13), | 691 | ADIS16400_INCLI_CHAN(X, ADIS16300_PITCH_OUT, 13), |
| 692 | ADIS16400_INCLI_CHAN(Y, ADIS16300_ROLL_OUT, 13), | 692 | ADIS16400_INCLI_CHAN(Y, ADIS16300_ROLL_OUT, 13), |
| 693 | IIO_CHAN_SOFT_TIMESTAMP(14) | 693 | IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP), |
| 694 | }; | 694 | }; |
| 695 | 695 | ||
| 696 | static const struct iio_chan_spec adis16334_channels[] = { | 696 | static const struct iio_chan_spec adis16334_channels[] = { |
| @@ -701,7 +701,7 @@ static const struct iio_chan_spec adis16334_channels[] = { | |||
| 701 | ADIS16400_ACCEL_CHAN(Y, ADIS16400_YACCL_OUT, 14), | 701 | ADIS16400_ACCEL_CHAN(Y, ADIS16400_YACCL_OUT, 14), |
| 702 | ADIS16400_ACCEL_CHAN(Z, ADIS16400_ZACCL_OUT, 14), | 702 | ADIS16400_ACCEL_CHAN(Z, ADIS16400_ZACCL_OUT, 14), |
| 703 | ADIS16400_TEMP_CHAN(ADIS16350_XTEMP_OUT, 12), | 703 | ADIS16400_TEMP_CHAN(ADIS16350_XTEMP_OUT, 12), |
| 704 | IIO_CHAN_SOFT_TIMESTAMP(8) | 704 | IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP), |
| 705 | }; | 705 | }; |
| 706 | 706 | ||
| 707 | static struct attribute *adis16400_attributes[] = { | 707 | static struct attribute *adis16400_attributes[] = { |
diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c index 3d8110157f2d..94daa9fc1247 100644 --- a/drivers/iio/light/tsl2563.c +++ b/drivers/iio/light/tsl2563.c | |||
| @@ -460,10 +460,14 @@ static int tsl2563_write_raw(struct iio_dev *indio_dev, | |||
| 460 | { | 460 | { |
| 461 | struct tsl2563_chip *chip = iio_priv(indio_dev); | 461 | struct tsl2563_chip *chip = iio_priv(indio_dev); |
| 462 | 462 | ||
| 463 | if (chan->channel == IIO_MOD_LIGHT_BOTH) | 463 | if (mask != IIO_CHAN_INFO_CALIBSCALE) |
| 464 | return -EINVAL; | ||
| 465 | if (chan->channel2 == IIO_MOD_LIGHT_BOTH) | ||
| 464 | chip->calib0 = calib_from_sysfs(val); | 466 | chip->calib0 = calib_from_sysfs(val); |
| 465 | else | 467 | else if (chan->channel2 == IIO_MOD_LIGHT_IR) |
| 466 | chip->calib1 = calib_from_sysfs(val); | 468 | chip->calib1 = calib_from_sysfs(val); |
| 469 | else | ||
| 470 | return -EINVAL; | ||
| 467 | 471 | ||
| 468 | return 0; | 472 | return 0; |
| 469 | } | 473 | } |
| @@ -472,14 +476,14 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev, | |||
| 472 | struct iio_chan_spec const *chan, | 476 | struct iio_chan_spec const *chan, |
| 473 | int *val, | 477 | int *val, |
| 474 | int *val2, | 478 | int *val2, |
| 475 | long m) | 479 | long mask) |
| 476 | { | 480 | { |
| 477 | int ret = -EINVAL; | 481 | int ret = -EINVAL; |
| 478 | u32 calib0, calib1; | 482 | u32 calib0, calib1; |
| 479 | struct tsl2563_chip *chip = iio_priv(indio_dev); | 483 | struct tsl2563_chip *chip = iio_priv(indio_dev); |
| 480 | 484 | ||
| 481 | mutex_lock(&chip->lock); | 485 | mutex_lock(&chip->lock); |
| 482 | switch (m) { | 486 | switch (mask) { |
| 483 | case IIO_CHAN_INFO_RAW: | 487 | case IIO_CHAN_INFO_RAW: |
| 484 | case IIO_CHAN_INFO_PROCESSED: | 488 | case IIO_CHAN_INFO_PROCESSED: |
| 485 | switch (chan->type) { | 489 | switch (chan->type) { |
| @@ -498,7 +502,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev, | |||
| 498 | ret = tsl2563_get_adc(chip); | 502 | ret = tsl2563_get_adc(chip); |
| 499 | if (ret) | 503 | if (ret) |
| 500 | goto error_ret; | 504 | goto error_ret; |
| 501 | if (chan->channel == 0) | 505 | if (chan->channel2 == IIO_MOD_LIGHT_BOTH) |
| 502 | *val = chip->data0; | 506 | *val = chip->data0; |
| 503 | else | 507 | else |
| 504 | *val = chip->data1; | 508 | *val = chip->data1; |
| @@ -510,7 +514,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev, | |||
| 510 | break; | 514 | break; |
| 511 | 515 | ||
| 512 | case IIO_CHAN_INFO_CALIBSCALE: | 516 | case IIO_CHAN_INFO_CALIBSCALE: |
| 513 | if (chan->channel == 0) | 517 | if (chan->channel2 == IIO_MOD_LIGHT_BOTH) |
| 514 | *val = calib_to_sysfs(chip->calib0); | 518 | *val = calib_to_sysfs(chip->calib0); |
| 515 | else | 519 | else |
| 516 | *val = calib_to_sysfs(chip->calib1); | 520 | *val = calib_to_sysfs(chip->calib1); |
diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index ff284e5afd95..05423543f89d 100644 --- a/drivers/iio/magnetometer/ak8975.c +++ b/drivers/iio/magnetometer/ak8975.c | |||
| @@ -85,6 +85,7 @@ | |||
| 85 | #define AK8975_MAX_CONVERSION_TIMEOUT 500 | 85 | #define AK8975_MAX_CONVERSION_TIMEOUT 500 |
| 86 | #define AK8975_CONVERSION_DONE_POLL_TIME 10 | 86 | #define AK8975_CONVERSION_DONE_POLL_TIME 10 |
| 87 | #define AK8975_DATA_READY_TIMEOUT ((100*HZ)/1000) | 87 | #define AK8975_DATA_READY_TIMEOUT ((100*HZ)/1000) |
| 88 | #define RAW_TO_GAUSS(asa) ((((asa) + 128) * 3000) / 256) | ||
| 88 | 89 | ||
| 89 | /* | 90 | /* |
| 90 | * Per-instance context data for the device. | 91 | * Per-instance context data for the device. |
| @@ -265,15 +266,15 @@ static int ak8975_setup(struct i2c_client *client) | |||
| 265 | * | 266 | * |
| 266 | * Since 1uT = 0.01 gauss, our final scale factor becomes: | 267 | * Since 1uT = 0.01 gauss, our final scale factor becomes: |
| 267 | * | 268 | * |
| 268 | * Hadj = H * ((ASA + 128) / 256) * 3/10 * 100 | 269 | * Hadj = H * ((ASA + 128) / 256) * 3/10 * 1/100 |
| 269 | * Hadj = H * ((ASA + 128) * 30 / 256 | 270 | * Hadj = H * ((ASA + 128) * 0.003) / 256 |
| 270 | * | 271 | * |
| 271 | * Since ASA doesn't change, we cache the resultant scale factor into the | 272 | * Since ASA doesn't change, we cache the resultant scale factor into the |
| 272 | * device context in ak8975_setup(). | 273 | * device context in ak8975_setup(). |
| 273 | */ | 274 | */ |
| 274 | data->raw_to_gauss[0] = ((data->asa[0] + 128) * 30) >> 8; | 275 | data->raw_to_gauss[0] = RAW_TO_GAUSS(data->asa[0]); |
| 275 | data->raw_to_gauss[1] = ((data->asa[1] + 128) * 30) >> 8; | 276 | data->raw_to_gauss[1] = RAW_TO_GAUSS(data->asa[1]); |
| 276 | data->raw_to_gauss[2] = ((data->asa[2] + 128) * 30) >> 8; | 277 | data->raw_to_gauss[2] = RAW_TO_GAUSS(data->asa[2]); |
| 277 | 278 | ||
| 278 | return 0; | 279 | return 0; |
| 279 | } | 280 | } |
| @@ -428,8 +429,9 @@ static int ak8975_read_raw(struct iio_dev *indio_dev, | |||
| 428 | case IIO_CHAN_INFO_RAW: | 429 | case IIO_CHAN_INFO_RAW: |
| 429 | return ak8975_read_axis(indio_dev, chan->address, val); | 430 | return ak8975_read_axis(indio_dev, chan->address, val); |
| 430 | case IIO_CHAN_INFO_SCALE: | 431 | case IIO_CHAN_INFO_SCALE: |
| 431 | *val = data->raw_to_gauss[chan->address]; | 432 | *val = 0; |
| 432 | return IIO_VAL_INT; | 433 | *val2 = data->raw_to_gauss[chan->address]; |
| 434 | return IIO_VAL_INT_PLUS_MICRO; | ||
| 433 | } | 435 | } |
| 434 | return -EINVAL; | 436 | return -EINVAL; |
| 435 | } | 437 | } |
diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c index 4b65b6d3bdb1..f66955fb3509 100644 --- a/drivers/iio/magnetometer/mag3110.c +++ b/drivers/iio/magnetometer/mag3110.c | |||
| @@ -106,7 +106,7 @@ static ssize_t mag3110_show_int_plus_micros(char *buf, | |||
| 106 | 106 | ||
| 107 | while (n-- > 0) | 107 | while (n-- > 0) |
| 108 | len += scnprintf(buf + len, PAGE_SIZE - len, | 108 | len += scnprintf(buf + len, PAGE_SIZE - len, |
| 109 | "%d.%d ", vals[n][0], vals[n][1]); | 109 | "%d.%06d ", vals[n][0], vals[n][1]); |
| 110 | 110 | ||
| 111 | /* replace trailing space by newline */ | 111 | /* replace trailing space by newline */ |
| 112 | buf[len - 1] = '\n'; | 112 | buf[len - 1] = '\n'; |
| @@ -154,6 +154,9 @@ static int mag3110_read_raw(struct iio_dev *indio_dev, | |||
| 154 | 154 | ||
| 155 | switch (mask) { | 155 | switch (mask) { |
| 156 | case IIO_CHAN_INFO_RAW: | 156 | case IIO_CHAN_INFO_RAW: |
| 157 | if (iio_buffer_enabled(indio_dev)) | ||
| 158 | return -EBUSY; | ||
| 159 | |||
| 157 | switch (chan->type) { | 160 | switch (chan->type) { |
| 158 | case IIO_MAGN: /* in 0.1 uT / LSB */ | 161 | case IIO_MAGN: /* in 0.1 uT / LSB */ |
| 159 | ret = mag3110_read(data, buffer); | 162 | ret = mag3110_read(data, buffer); |
| @@ -199,6 +202,9 @@ static int mag3110_write_raw(struct iio_dev *indio_dev, | |||
| 199 | struct mag3110_data *data = iio_priv(indio_dev); | 202 | struct mag3110_data *data = iio_priv(indio_dev); |
| 200 | int rate; | 203 | int rate; |
| 201 | 204 | ||
| 205 | if (iio_buffer_enabled(indio_dev)) | ||
| 206 | return -EBUSY; | ||
| 207 | |||
| 202 | switch (mask) { | 208 | switch (mask) { |
| 203 | case IIO_CHAN_INFO_SAMP_FREQ: | 209 | case IIO_CHAN_INFO_SAMP_FREQ: |
| 204 | rate = mag3110_get_samp_freq_index(data, val, val2); | 210 | rate = mag3110_get_samp_freq_index(data, val, val2); |
diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 23948f167012..713a97226787 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c | |||
| @@ -295,21 +295,29 @@ static ssize_t ashmem_read(struct file *file, char __user *buf, | |||
| 295 | 295 | ||
| 296 | /* If size is not set, or set to 0, always return EOF. */ | 296 | /* If size is not set, or set to 0, always return EOF. */ |
| 297 | if (asma->size == 0) | 297 | if (asma->size == 0) |
| 298 | goto out; | 298 | goto out_unlock; |
| 299 | 299 | ||
| 300 | if (!asma->file) { | 300 | if (!asma->file) { |
| 301 | ret = -EBADF; | 301 | ret = -EBADF; |
| 302 | goto out; | 302 | goto out_unlock; |
| 303 | } | 303 | } |
| 304 | 304 | ||
| 305 | ret = asma->file->f_op->read(asma->file, buf, len, pos); | 305 | mutex_unlock(&ashmem_mutex); |
| 306 | if (ret < 0) | ||
| 307 | goto out; | ||
| 308 | 306 | ||
| 309 | /** Update backing file pos, since f_ops->read() doesn't */ | 307 | /* |
| 310 | asma->file->f_pos = *pos; | 308 | * asma and asma->file are used outside the lock here. We assume |
| 309 | * once asma->file is set it will never be changed, and will not | ||
| 310 | * be destroyed until all references to the file are dropped and | ||
| 311 | * ashmem_release is called. | ||
| 312 | */ | ||
| 313 | ret = asma->file->f_op->read(asma->file, buf, len, pos); | ||
| 314 | if (ret >= 0) { | ||
| 315 | /** Update backing file pos, since f_ops->read() doesn't */ | ||
| 316 | asma->file->f_pos = *pos; | ||
| 317 | } | ||
| 318 | return ret; | ||
| 311 | 319 | ||
| 312 | out: | 320 | out_unlock: |
| 313 | mutex_unlock(&ashmem_mutex); | 321 | mutex_unlock(&ashmem_mutex); |
| 314 | return ret; | 322 | return ret; |
| 315 | } | 323 | } |
| @@ -498,6 +506,7 @@ out: | |||
| 498 | 506 | ||
| 499 | static int set_name(struct ashmem_area *asma, void __user *name) | 507 | static int set_name(struct ashmem_area *asma, void __user *name) |
| 500 | { | 508 | { |
| 509 | int len; | ||
| 501 | int ret = 0; | 510 | int ret = 0; |
| 502 | char local_name[ASHMEM_NAME_LEN]; | 511 | char local_name[ASHMEM_NAME_LEN]; |
| 503 | 512 | ||
| @@ -510,21 +519,19 @@ static int set_name(struct ashmem_area *asma, void __user *name) | |||
| 510 | * variable that does not need protection and later copy the local | 519 | * variable that does not need protection and later copy the local |
| 511 | * variable to the structure member with lock held. | 520 | * variable to the structure member with lock held. |
| 512 | */ | 521 | */ |
| 513 | if (copy_from_user(local_name, name, ASHMEM_NAME_LEN)) | 522 | len = strncpy_from_user(local_name, name, ASHMEM_NAME_LEN); |
| 514 | return -EFAULT; | 523 | if (len < 0) |
| 515 | 524 | return len; | |
| 525 | if (len == ASHMEM_NAME_LEN) | ||
| 526 | local_name[ASHMEM_NAME_LEN - 1] = '\0'; | ||
| 516 | mutex_lock(&ashmem_mutex); | 527 | mutex_lock(&ashmem_mutex); |
| 517 | /* cannot change an existing mapping's name */ | 528 | /* cannot change an existing mapping's name */ |
| 518 | if (unlikely(asma->file)) { | 529 | if (unlikely(asma->file)) |
| 519 | ret = -EINVAL; | 530 | ret = -EINVAL; |
| 520 | goto out; | 531 | else |
| 521 | } | 532 | strcpy(asma->name + ASHMEM_NAME_PREFIX_LEN, local_name); |
| 522 | memcpy(asma->name + ASHMEM_NAME_PREFIX_LEN, | ||
| 523 | local_name, ASHMEM_NAME_LEN); | ||
| 524 | asma->name[ASHMEM_FULL_NAME_LEN-1] = '\0'; | ||
| 525 | out: | ||
| 526 | mutex_unlock(&ashmem_mutex); | ||
| 527 | 533 | ||
| 534 | mutex_unlock(&ashmem_mutex); | ||
| 528 | return ret; | 535 | return ret; |
| 529 | } | 536 | } |
| 530 | 537 | ||
diff --git a/drivers/staging/android/ion/compat_ion.c b/drivers/staging/android/ion/compat_ion.c index af6cd370b30f..ee3a7380e53b 100644 --- a/drivers/staging/android/ion/compat_ion.c +++ b/drivers/staging/android/ion/compat_ion.c | |||
| @@ -35,9 +35,14 @@ struct compat_ion_custom_data { | |||
| 35 | compat_ulong_t arg; | 35 | compat_ulong_t arg; |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | struct compat_ion_handle_data { | ||
| 39 | compat_int_t handle; | ||
| 40 | }; | ||
| 41 | |||
| 38 | #define COMPAT_ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \ | 42 | #define COMPAT_ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \ |
| 39 | struct compat_ion_allocation_data) | 43 | struct compat_ion_allocation_data) |
| 40 | #define COMPAT_ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data) | 44 | #define COMPAT_ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, \ |
| 45 | struct compat_ion_handle_data) | ||
| 41 | #define COMPAT_ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, \ | 46 | #define COMPAT_ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, \ |
| 42 | struct compat_ion_custom_data) | 47 | struct compat_ion_custom_data) |
| 43 | 48 | ||
| @@ -64,6 +69,19 @@ static int compat_get_ion_allocation_data( | |||
| 64 | return err; | 69 | return err; |
| 65 | } | 70 | } |
| 66 | 71 | ||
| 72 | static int compat_get_ion_handle_data( | ||
| 73 | struct compat_ion_handle_data __user *data32, | ||
| 74 | struct ion_handle_data __user *data) | ||
| 75 | { | ||
| 76 | compat_int_t i; | ||
| 77 | int err; | ||
| 78 | |||
| 79 | err = get_user(i, &data32->handle); | ||
| 80 | err |= put_user(i, &data->handle); | ||
| 81 | |||
| 82 | return err; | ||
| 83 | } | ||
| 84 | |||
| 67 | static int compat_put_ion_allocation_data( | 85 | static int compat_put_ion_allocation_data( |
| 68 | struct compat_ion_allocation_data __user *data32, | 86 | struct compat_ion_allocation_data __user *data32, |
| 69 | struct ion_allocation_data __user *data) | 87 | struct ion_allocation_data __user *data) |
| @@ -132,8 +150,8 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
| 132 | } | 150 | } |
| 133 | case COMPAT_ION_IOC_FREE: | 151 | case COMPAT_ION_IOC_FREE: |
| 134 | { | 152 | { |
| 135 | struct compat_ion_allocation_data __user *data32; | 153 | struct compat_ion_handle_data __user *data32; |
| 136 | struct ion_allocation_data __user *data; | 154 | struct ion_handle_data __user *data; |
| 137 | int err; | 155 | int err; |
| 138 | 156 | ||
| 139 | data32 = compat_ptr(arg); | 157 | data32 = compat_ptr(arg); |
| @@ -141,7 +159,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
| 141 | if (data == NULL) | 159 | if (data == NULL) |
| 142 | return -EFAULT; | 160 | return -EFAULT; |
| 143 | 161 | ||
| 144 | err = compat_get_ion_allocation_data(data32, data); | 162 | err = compat_get_ion_handle_data(data32, data); |
| 145 | if (err) | 163 | if (err) |
| 146 | return err; | 164 | return err; |
| 147 | 165 | ||
diff --git a/drivers/staging/android/ion/ion_dummy_driver.c b/drivers/staging/android/ion/ion_dummy_driver.c index 55b2002753f2..01cdc8aee898 100644 --- a/drivers/staging/android/ion/ion_dummy_driver.c +++ b/drivers/staging/android/ion/ion_dummy_driver.c | |||
| @@ -17,9 +17,11 @@ | |||
| 17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
| 18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
| 19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
| 20 | #include <linux/init.h> | ||
| 20 | #include <linux/bootmem.h> | 21 | #include <linux/bootmem.h> |
| 21 | #include <linux/memblock.h> | 22 | #include <linux/memblock.h> |
| 22 | #include <linux/sizes.h> | 23 | #include <linux/sizes.h> |
| 24 | #include <linux/io.h> | ||
| 23 | #include "ion.h" | 25 | #include "ion.h" |
| 24 | #include "ion_priv.h" | 26 | #include "ion_priv.h" |
| 25 | 27 | ||
| @@ -57,7 +59,7 @@ struct ion_platform_heap dummy_heaps[] = { | |||
| 57 | }; | 59 | }; |
| 58 | 60 | ||
| 59 | struct ion_platform_data dummy_ion_pdata = { | 61 | struct ion_platform_data dummy_ion_pdata = { |
| 60 | .nr = 4, | 62 | .nr = ARRAY_SIZE(dummy_heaps), |
| 61 | .heaps = dummy_heaps, | 63 | .heaps = dummy_heaps, |
| 62 | }; | 64 | }; |
| 63 | 65 | ||
| @@ -69,7 +71,7 @@ static int __init ion_dummy_init(void) | |||
| 69 | heaps = kzalloc(sizeof(struct ion_heap *) * dummy_ion_pdata.nr, | 71 | heaps = kzalloc(sizeof(struct ion_heap *) * dummy_ion_pdata.nr, |
| 70 | GFP_KERNEL); | 72 | GFP_KERNEL); |
| 71 | if (!heaps) | 73 | if (!heaps) |
| 72 | return PTR_ERR(heaps); | 74 | return -ENOMEM; |
| 73 | 75 | ||
| 74 | 76 | ||
| 75 | /* Allocate a dummy carveout heap */ | 77 | /* Allocate a dummy carveout heap */ |
| @@ -128,6 +130,7 @@ err: | |||
| 128 | } | 130 | } |
| 129 | return err; | 131 | return err; |
| 130 | } | 132 | } |
| 133 | device_initcall(ion_dummy_init); | ||
| 131 | 134 | ||
| 132 | static void __exit ion_dummy_exit(void) | 135 | static void __exit ion_dummy_exit(void) |
| 133 | { | 136 | { |
| @@ -152,7 +155,4 @@ static void __exit ion_dummy_exit(void) | |||
| 152 | 155 | ||
| 153 | return; | 156 | return; |
| 154 | } | 157 | } |
| 155 | 158 | __exitcall(ion_dummy_exit); | |
| 156 | module_init(ion_dummy_init); | ||
| 157 | module_exit(ion_dummy_exit); | ||
| 158 | |||
diff --git a/drivers/staging/android/ion/ion_heap.c b/drivers/staging/android/ion/ion_heap.c index 296c74f98dc0..37e64d51394c 100644 --- a/drivers/staging/android/ion/ion_heap.c +++ b/drivers/staging/android/ion/ion_heap.c | |||
| @@ -243,12 +243,12 @@ int ion_heap_init_deferred_free(struct ion_heap *heap) | |||
| 243 | init_waitqueue_head(&heap->waitqueue); | 243 | init_waitqueue_head(&heap->waitqueue); |
| 244 | heap->task = kthread_run(ion_heap_deferred_free, heap, | 244 | heap->task = kthread_run(ion_heap_deferred_free, heap, |
| 245 | "%s", heap->name); | 245 | "%s", heap->name); |
| 246 | sched_setscheduler(heap->task, SCHED_IDLE, ¶m); | ||
| 247 | if (IS_ERR(heap->task)) { | 246 | if (IS_ERR(heap->task)) { |
| 248 | pr_err("%s: creating thread for deferred free failed\n", | 247 | pr_err("%s: creating thread for deferred free failed\n", |
| 249 | __func__); | 248 | __func__); |
| 250 | return PTR_RET(heap->task); | 249 | return PTR_RET(heap->task); |
| 251 | } | 250 | } |
| 251 | sched_setscheduler(heap->task, SCHED_IDLE, ¶m); | ||
| 252 | return 0; | 252 | return 0; |
| 253 | } | 253 | } |
| 254 | 254 | ||
diff --git a/drivers/staging/android/ion/ion_priv.h b/drivers/staging/android/ion/ion_priv.h index d98673981cc4..fc2e4fccf69d 100644 --- a/drivers/staging/android/ion/ion_priv.h +++ b/drivers/staging/android/ion/ion_priv.h | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #ifndef _ION_PRIV_H | 17 | #ifndef _ION_PRIV_H |
| 18 | #define _ION_PRIV_H | 18 | #define _ION_PRIV_H |
| 19 | 19 | ||
| 20 | #include <linux/device.h> | ||
| 20 | #include <linux/dma-direction.h> | 21 | #include <linux/dma-direction.h> |
| 21 | #include <linux/kref.h> | 22 | #include <linux/kref.h> |
| 22 | #include <linux/mm_types.h> | 23 | #include <linux/mm_types.h> |
diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index 7f0729130d65..9849f3963e75 100644 --- a/drivers/staging/android/ion/ion_system_heap.c +++ b/drivers/staging/android/ion/ion_system_heap.c | |||
| @@ -124,6 +124,7 @@ static struct page_info *alloc_largest_available(struct ion_system_heap *heap, | |||
| 124 | 124 | ||
| 125 | info->page = page; | 125 | info->page = page; |
| 126 | info->order = orders[i]; | 126 | info->order = orders[i]; |
| 127 | INIT_LIST_HEAD(&info->list); | ||
| 127 | return info; | 128 | return info; |
| 128 | } | 129 | } |
| 129 | kfree(info); | 130 | kfree(info); |
| @@ -145,12 +146,15 @@ static int ion_system_heap_allocate(struct ion_heap *heap, | |||
| 145 | struct list_head pages; | 146 | struct list_head pages; |
| 146 | struct page_info *info, *tmp_info; | 147 | struct page_info *info, *tmp_info; |
| 147 | int i = 0; | 148 | int i = 0; |
| 148 | long size_remaining = PAGE_ALIGN(size); | 149 | unsigned long size_remaining = PAGE_ALIGN(size); |
| 149 | unsigned int max_order = orders[0]; | 150 | unsigned int max_order = orders[0]; |
| 150 | 151 | ||
| 151 | if (align > PAGE_SIZE) | 152 | if (align > PAGE_SIZE) |
| 152 | return -EINVAL; | 153 | return -EINVAL; |
| 153 | 154 | ||
| 155 | if (size / PAGE_SIZE > totalram_pages / 2) | ||
| 156 | return -ENOMEM; | ||
| 157 | |||
| 154 | INIT_LIST_HEAD(&pages); | 158 | INIT_LIST_HEAD(&pages); |
| 155 | while (size_remaining > 0) { | 159 | while (size_remaining > 0) { |
| 156 | info = alloc_largest_available(sys_heap, buffer, size_remaining, | 160 | info = alloc_largest_available(sys_heap, buffer, size_remaining, |
diff --git a/drivers/staging/android/sw_sync.h b/drivers/staging/android/sw_sync.h index 585040be5f18..5aaf71d6974b 100644 --- a/drivers/staging/android/sw_sync.h +++ b/drivers/staging/android/sw_sync.h | |||
| @@ -35,10 +35,27 @@ struct sw_sync_pt { | |||
| 35 | u32 value; | 35 | u32 value; |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | #if IS_ENABLED(CONFIG_SW_SYNC) | ||
| 38 | struct sw_sync_timeline *sw_sync_timeline_create(const char *name); | 39 | struct sw_sync_timeline *sw_sync_timeline_create(const char *name); |
| 39 | void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc); | 40 | void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc); |
| 40 | 41 | ||
| 41 | struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value); | 42 | struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value); |
| 43 | #else | ||
| 44 | static inline struct sw_sync_timeline *sw_sync_timeline_create(const char *name) | ||
| 45 | { | ||
| 46 | return NULL; | ||
| 47 | } | ||
| 48 | |||
| 49 | static inline void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc) | ||
| 50 | { | ||
| 51 | } | ||
| 52 | |||
| 53 | static inline struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, | ||
| 54 | u32 value) | ||
| 55 | { | ||
| 56 | return NULL; | ||
| 57 | } | ||
| 58 | #endif /* IS_ENABLED(CONFIG_SW_SYNC) */ | ||
| 42 | 59 | ||
| 43 | #endif /* __KERNEL __ */ | 60 | #endif /* __KERNEL __ */ |
| 44 | 61 | ||
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index 38e5d3b5ed9b..3d05f662110b 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c | |||
| @@ -79,27 +79,27 @@ static void sync_timeline_free(struct kref *kref) | |||
| 79 | container_of(kref, struct sync_timeline, kref); | 79 | container_of(kref, struct sync_timeline, kref); |
| 80 | unsigned long flags; | 80 | unsigned long flags; |
| 81 | 81 | ||
| 82 | if (obj->ops->release_obj) | ||
| 83 | obj->ops->release_obj(obj); | ||
| 84 | |||
| 85 | spin_lock_irqsave(&sync_timeline_list_lock, flags); | 82 | spin_lock_irqsave(&sync_timeline_list_lock, flags); |
| 86 | list_del(&obj->sync_timeline_list); | 83 | list_del(&obj->sync_timeline_list); |
| 87 | spin_unlock_irqrestore(&sync_timeline_list_lock, flags); | 84 | spin_unlock_irqrestore(&sync_timeline_list_lock, flags); |
| 88 | 85 | ||
| 86 | if (obj->ops->release_obj) | ||
| 87 | obj->ops->release_obj(obj); | ||
| 88 | |||
| 89 | kfree(obj); | 89 | kfree(obj); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | void sync_timeline_destroy(struct sync_timeline *obj) | 92 | void sync_timeline_destroy(struct sync_timeline *obj) |
| 93 | { | 93 | { |
| 94 | obj->destroyed = true; | 94 | obj->destroyed = true; |
| 95 | smp_wmb(); | ||
| 95 | 96 | ||
| 96 | /* | 97 | /* |
| 97 | * If this is not the last reference, signal any children | 98 | * signal any children that their parent is going away. |
| 98 | * that their parent is going away. | ||
| 99 | */ | 99 | */ |
| 100 | sync_timeline_signal(obj); | ||
| 100 | 101 | ||
| 101 | if (!kref_put(&obj->kref, sync_timeline_free)) | 102 | kref_put(&obj->kref, sync_timeline_free); |
| 102 | sync_timeline_signal(obj); | ||
| 103 | } | 103 | } |
| 104 | EXPORT_SYMBOL(sync_timeline_destroy); | 104 | EXPORT_SYMBOL(sync_timeline_destroy); |
| 105 | 105 | ||
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 246080316c90..5b15033a94bf 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c | |||
| @@ -616,8 +616,6 @@ int comedi_auto_config(struct device *hardware_device, | |||
| 616 | ret = driver->auto_attach(dev, context); | 616 | ret = driver->auto_attach(dev, context); |
| 617 | if (ret >= 0) | 617 | if (ret >= 0) |
| 618 | ret = comedi_device_postconfig(dev); | 618 | ret = comedi_device_postconfig(dev); |
| 619 | if (ret < 0) | ||
| 620 | comedi_device_detach(dev); | ||
| 621 | mutex_unlock(&dev->mutex); | 619 | mutex_unlock(&dev->mutex); |
| 622 | 620 | ||
| 623 | if (ret < 0) { | 621 | if (ret < 0) { |
diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 593676cf706a..d9ad2c0fdda2 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c | |||
| @@ -494,6 +494,7 @@ static int pci171x_insn_write_ao(struct comedi_device *dev, | |||
| 494 | struct comedi_insn *insn, unsigned int *data) | 494 | struct comedi_insn *insn, unsigned int *data) |
| 495 | { | 495 | { |
| 496 | struct pci1710_private *devpriv = dev->private; | 496 | struct pci1710_private *devpriv = dev->private; |
| 497 | unsigned int val; | ||
| 497 | int n, chan, range, ofs; | 498 | int n, chan, range, ofs; |
| 498 | 499 | ||
| 499 | chan = CR_CHAN(insn->chanspec); | 500 | chan = CR_CHAN(insn->chanspec); |
| @@ -509,11 +510,14 @@ static int pci171x_insn_write_ao(struct comedi_device *dev, | |||
| 509 | outw(devpriv->da_ranges, dev->iobase + PCI171x_DAREF); | 510 | outw(devpriv->da_ranges, dev->iobase + PCI171x_DAREF); |
| 510 | ofs = PCI171x_DA1; | 511 | ofs = PCI171x_DA1; |
| 511 | } | 512 | } |
| 513 | val = devpriv->ao_data[chan]; | ||
| 512 | 514 | ||
| 513 | for (n = 0; n < insn->n; n++) | 515 | for (n = 0; n < insn->n; n++) { |
| 514 | outw(data[n], dev->iobase + ofs); | 516 | val = data[n]; |
| 517 | outw(val, dev->iobase + ofs); | ||
| 518 | } | ||
| 515 | 519 | ||
| 516 | devpriv->ao_data[chan] = data[n]; | 520 | devpriv->ao_data[chan] = val; |
| 517 | 521 | ||
| 518 | return n; | 522 | return n; |
| 519 | 523 | ||
| @@ -679,6 +683,7 @@ static int pci1720_insn_write_ao(struct comedi_device *dev, | |||
| 679 | struct comedi_insn *insn, unsigned int *data) | 683 | struct comedi_insn *insn, unsigned int *data) |
| 680 | { | 684 | { |
| 681 | struct pci1710_private *devpriv = dev->private; | 685 | struct pci1710_private *devpriv = dev->private; |
| 686 | unsigned int val; | ||
| 682 | int n, rangereg, chan; | 687 | int n, rangereg, chan; |
| 683 | 688 | ||
| 684 | chan = CR_CHAN(insn->chanspec); | 689 | chan = CR_CHAN(insn->chanspec); |
| @@ -688,13 +693,15 @@ static int pci1720_insn_write_ao(struct comedi_device *dev, | |||
| 688 | outb(rangereg, dev->iobase + PCI1720_RANGE); | 693 | outb(rangereg, dev->iobase + PCI1720_RANGE); |
| 689 | devpriv->da_ranges = rangereg; | 694 | devpriv->da_ranges = rangereg; |
| 690 | } | 695 | } |
| 696 | val = devpriv->ao_data[chan]; | ||
| 691 | 697 | ||
| 692 | for (n = 0; n < insn->n; n++) { | 698 | for (n = 0; n < insn->n; n++) { |
| 693 | outw(data[n], dev->iobase + PCI1720_DA0 + (chan << 1)); | 699 | val = data[n]; |
| 700 | outw(val, dev->iobase + PCI1720_DA0 + (chan << 1)); | ||
| 694 | outb(0, dev->iobase + PCI1720_SYNCOUT); /* update outputs */ | 701 | outb(0, dev->iobase + PCI1720_SYNCOUT); /* update outputs */ |
| 695 | } | 702 | } |
| 696 | 703 | ||
| 697 | devpriv->ao_data[chan] = data[n]; | 704 | devpriv->ao_data[chan] = val; |
| 698 | 705 | ||
| 699 | return n; | 706 | return n; |
| 700 | } | 707 | } |
diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 3beeb1254152..88c60b6020c4 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c | |||
| @@ -48,6 +48,7 @@ | |||
| 48 | #include <linux/usb.h> | 48 | #include <linux/usb.h> |
| 49 | #include <linux/fcntl.h> | 49 | #include <linux/fcntl.h> |
| 50 | #include <linux/compiler.h> | 50 | #include <linux/compiler.h> |
| 51 | #include <asm/unaligned.h> | ||
| 51 | 52 | ||
| 52 | #include "comedi_fc.h" | 53 | #include "comedi_fc.h" |
| 53 | #include "../comedidev.h" | 54 | #include "../comedidev.h" |
| @@ -792,7 +793,8 @@ static int usbduxsigma_ai_insn_read(struct comedi_device *dev, | |||
| 792 | } | 793 | } |
| 793 | 794 | ||
| 794 | /* 32 bits big endian from the A/D converter */ | 795 | /* 32 bits big endian from the A/D converter */ |
| 795 | val = be32_to_cpu(*((uint32_t *)((devpriv->insn_buf) + 1))); | 796 | val = be32_to_cpu(get_unaligned((uint32_t |
| 797 | *)(devpriv->insn_buf + 1))); | ||
| 796 | val &= 0x00ffffff; /* strip status byte */ | 798 | val &= 0x00ffffff; /* strip status byte */ |
| 797 | val ^= 0x00800000; /* convert to unsigned */ | 799 | val ^= 0x00800000; /* convert to unsigned */ |
| 798 | 800 | ||
| @@ -1357,7 +1359,7 @@ static int usbduxsigma_getstatusinfo(struct comedi_device *dev, int chan) | |||
| 1357 | return ret; | 1359 | return ret; |
| 1358 | 1360 | ||
| 1359 | /* 32 bits big endian from the A/D converter */ | 1361 | /* 32 bits big endian from the A/D converter */ |
| 1360 | val = be32_to_cpu(*((uint32_t *)((devpriv->insn_buf)+1))); | 1362 | val = be32_to_cpu(get_unaligned((uint32_t *)(devpriv->insn_buf + 1))); |
| 1361 | val &= 0x00ffffff; /* strip status byte */ | 1363 | val &= 0x00ffffff; /* strip status byte */ |
| 1362 | val ^= 0x00800000; /* convert to unsigned */ | 1364 | val ^= 0x00800000; /* convert to unsigned */ |
| 1363 | 1365 | ||
diff --git a/drivers/staging/dgrp/dgrp_net_ops.c b/drivers/staging/dgrp/dgrp_net_ops.c index 1f61b89eca44..33ac7fb88cbd 100644 --- a/drivers/staging/dgrp/dgrp_net_ops.c +++ b/drivers/staging/dgrp/dgrp_net_ops.c | |||
| @@ -2232,177 +2232,6 @@ done: | |||
| 2232 | return rtn; | 2232 | return rtn; |
| 2233 | } | 2233 | } |
| 2234 | 2234 | ||
| 2235 | /* | ||
| 2236 | * Common Packet Handling code | ||
| 2237 | */ | ||
| 2238 | |||
| 2239 | static void handle_data_in_packet(struct nd_struct *nd, struct ch_struct *ch, | ||
| 2240 | long dlen, long plen, int n1, u8 *dbuf) | ||
| 2241 | { | ||
| 2242 | char *error; | ||
| 2243 | long n; | ||
| 2244 | long remain; | ||
| 2245 | u8 *buf; | ||
| 2246 | u8 *b; | ||
| 2247 | |||
| 2248 | remain = nd->nd_remain; | ||
| 2249 | nd->nd_tx_work = 1; | ||
| 2250 | |||
| 2251 | /* | ||
| 2252 | * Otherwise data should appear only when we are | ||
| 2253 | * in the CS_READY state. | ||
| 2254 | */ | ||
| 2255 | |||
| 2256 | if (ch->ch_state < CS_READY) { | ||
| 2257 | error = "Data received before RWIN established"; | ||
| 2258 | nd->nd_remain = 0; | ||
| 2259 | nd->nd_state = NS_SEND_ERROR; | ||
| 2260 | nd->nd_error = error; | ||
| 2261 | } | ||
| 2262 | |||
| 2263 | /* | ||
| 2264 | * Assure that the data received is within the | ||
| 2265 | * allowable window. | ||
| 2266 | */ | ||
| 2267 | |||
| 2268 | n = (ch->ch_s_rwin - ch->ch_s_rin) & 0xffff; | ||
| 2269 | |||
| 2270 | if (dlen > n) { | ||
| 2271 | error = "Receive data overrun"; | ||
| 2272 | nd->nd_remain = 0; | ||
| 2273 | nd->nd_state = NS_SEND_ERROR; | ||
| 2274 | nd->nd_error = error; | ||
| 2275 | } | ||
| 2276 | |||
| 2277 | /* | ||
| 2278 | * If we received 3 or less characters, | ||
| 2279 | * assume it is a human typing, and set RTIME | ||
| 2280 | * to 10 milliseconds. | ||
| 2281 | * | ||
| 2282 | * If we receive 10 or more characters, | ||
| 2283 | * assume its not a human typing, and set RTIME | ||
| 2284 | * to 100 milliseconds. | ||
| 2285 | */ | ||
| 2286 | |||
| 2287 | if (ch->ch_edelay != DGRP_RTIME) { | ||
| 2288 | if (ch->ch_rtime != ch->ch_edelay) { | ||
| 2289 | ch->ch_rtime = ch->ch_edelay; | ||
| 2290 | ch->ch_flag |= CH_PARAM; | ||
| 2291 | } | ||
| 2292 | } else if (dlen <= 3) { | ||
| 2293 | if (ch->ch_rtime != 10) { | ||
| 2294 | ch->ch_rtime = 10; | ||
| 2295 | ch->ch_flag |= CH_PARAM; | ||
| 2296 | } | ||
| 2297 | } else { | ||
| 2298 | if (ch->ch_rtime != DGRP_RTIME) { | ||
| 2299 | ch->ch_rtime = DGRP_RTIME; | ||
| 2300 | ch->ch_flag |= CH_PARAM; | ||
| 2301 | } | ||
| 2302 | } | ||
| 2303 | |||
| 2304 | /* | ||
| 2305 | * If a portion of the packet is outside the | ||
| 2306 | * buffer, shorten the effective length of the | ||
| 2307 | * data packet to be the amount of data received. | ||
| 2308 | */ | ||
| 2309 | |||
| 2310 | if (remain < plen) | ||
| 2311 | dlen -= plen - remain; | ||
| 2312 | |||
| 2313 | /* | ||
| 2314 | * Detect if receive flush is now complete. | ||
| 2315 | */ | ||
| 2316 | |||
| 2317 | if ((ch->ch_flag & CH_RX_FLUSH) != 0 && | ||
| 2318 | ((ch->ch_flush_seq - nd->nd_seq_out) & SEQ_MASK) >= | ||
| 2319 | ((nd->nd_seq_in - nd->nd_seq_out) & SEQ_MASK)) { | ||
| 2320 | ch->ch_flag &= ~CH_RX_FLUSH; | ||
| 2321 | } | ||
| 2322 | |||
| 2323 | /* | ||
| 2324 | * If we are ready to receive, move the data into | ||
| 2325 | * the receive buffer. | ||
| 2326 | */ | ||
| 2327 | |||
| 2328 | ch->ch_s_rin = (ch->ch_s_rin + dlen) & 0xffff; | ||
| 2329 | |||
| 2330 | if (ch->ch_state == CS_READY && | ||
| 2331 | (ch->ch_tun.un_open_count != 0) && | ||
| 2332 | (ch->ch_tun.un_flag & UN_CLOSING) == 0 && | ||
| 2333 | (ch->ch_cflag & CF_CREAD) != 0 && | ||
| 2334 | (ch->ch_flag & (CH_BAUD0 | CH_RX_FLUSH)) == 0 && | ||
| 2335 | (ch->ch_send & RR_RX_FLUSH) == 0) { | ||
| 2336 | |||
| 2337 | if (ch->ch_rin + dlen >= RBUF_MAX) { | ||
| 2338 | n = RBUF_MAX - ch->ch_rin; | ||
| 2339 | |||
| 2340 | memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, n); | ||
| 2341 | |||
| 2342 | ch->ch_rin = 0; | ||
| 2343 | dbuf += n; | ||
| 2344 | dlen -= n; | ||
| 2345 | } | ||
| 2346 | |||
| 2347 | memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, dlen); | ||
| 2348 | |||
| 2349 | ch->ch_rin += dlen; | ||
| 2350 | |||
| 2351 | |||
| 2352 | /* | ||
| 2353 | * If we are not in fastcook mode, or | ||
| 2354 | * if there is a fastcook thread | ||
| 2355 | * waiting for data, send the data to | ||
| 2356 | * the line discipline. | ||
| 2357 | */ | ||
| 2358 | |||
| 2359 | if ((ch->ch_flag & CH_FAST_READ) == 0 || | ||
| 2360 | ch->ch_inwait != 0) { | ||
| 2361 | dgrp_input(ch); | ||
| 2362 | } | ||
| 2363 | |||
| 2364 | /* | ||
| 2365 | * If there is a read thread waiting | ||
| 2366 | * in select, and we are in fastcook | ||
| 2367 | * mode, wake him up. | ||
| 2368 | */ | ||
| 2369 | |||
| 2370 | if (waitqueue_active(&ch->ch_tun.un_tty->read_wait) && | ||
| 2371 | (ch->ch_flag & CH_FAST_READ) != 0) | ||
| 2372 | wake_up_interruptible(&ch->ch_tun.un_tty->read_wait); | ||
| 2373 | |||
| 2374 | /* | ||
| 2375 | * Wake any thread waiting in the | ||
| 2376 | * fastcook loop. | ||
| 2377 | */ | ||
| 2378 | |||
| 2379 | if ((ch->ch_flag & CH_INPUT) != 0) { | ||
| 2380 | ch->ch_flag &= ~CH_INPUT; | ||
| 2381 | wake_up_interruptible(&ch->ch_flag_wait); | ||
| 2382 | } | ||
| 2383 | } | ||
| 2384 | |||
| 2385 | /* | ||
| 2386 | * Fabricate and insert a data packet header to | ||
| 2387 | * preced the remaining data when it comes in. | ||
| 2388 | */ | ||
| 2389 | |||
| 2390 | if (remain < plen) { | ||
| 2391 | dlen = plen - remain; | ||
| 2392 | b = buf; | ||
| 2393 | |||
| 2394 | b[0] = 0x90 + n1; | ||
| 2395 | put_unaligned_be16(dlen, b + 1); | ||
| 2396 | |||
| 2397 | remain = 3; | ||
| 2398 | if (remain > 0 && b != buf) | ||
| 2399 | memcpy(buf, b, remain); | ||
| 2400 | |||
| 2401 | nd->nd_remain = remain; | ||
| 2402 | return; | ||
| 2403 | } | ||
| 2404 | } | ||
| 2405 | |||
| 2406 | /** | 2235 | /** |
| 2407 | * dgrp_receive() -- decode data packets received from the remote PortServer. | 2236 | * dgrp_receive() -- decode data packets received from the remote PortServer. |
| 2408 | * @nd: pointer to a node structure | 2237 | * @nd: pointer to a node structure |
| @@ -2477,8 +2306,7 @@ static void dgrp_receive(struct nd_struct *nd) | |||
| 2477 | plen = dlen + 1; | 2306 | plen = dlen + 1; |
| 2478 | 2307 | ||
| 2479 | dbuf = b + 1; | 2308 | dbuf = b + 1; |
| 2480 | handle_data_in_packet(nd, ch, dlen, plen, n1, dbuf); | 2309 | goto data; |
| 2481 | break; | ||
| 2482 | 2310 | ||
| 2483 | /* | 2311 | /* |
| 2484 | * Process 2-byte header data packet. | 2312 | * Process 2-byte header data packet. |
| @@ -2492,8 +2320,7 @@ static void dgrp_receive(struct nd_struct *nd) | |||
| 2492 | plen = dlen + 2; | 2320 | plen = dlen + 2; |
| 2493 | 2321 | ||
| 2494 | dbuf = b + 2; | 2322 | dbuf = b + 2; |
| 2495 | handle_data_in_packet(nd, ch, dlen, plen, n1, dbuf); | 2323 | goto data; |
| 2496 | break; | ||
| 2497 | 2324 | ||
| 2498 | /* | 2325 | /* |
| 2499 | * Process 3-byte header data packet. | 2326 | * Process 3-byte header data packet. |
| @@ -2508,6 +2335,159 @@ static void dgrp_receive(struct nd_struct *nd) | |||
| 2508 | 2335 | ||
| 2509 | dbuf = b + 3; | 2336 | dbuf = b + 3; |
| 2510 | 2337 | ||
| 2338 | /* | ||
| 2339 | * Common packet handling code. | ||
| 2340 | */ | ||
| 2341 | |||
| 2342 | data: | ||
| 2343 | nd->nd_tx_work = 1; | ||
| 2344 | |||
| 2345 | /* | ||
| 2346 | * Otherwise data should appear only when we are | ||
| 2347 | * in the CS_READY state. | ||
| 2348 | */ | ||
| 2349 | |||
| 2350 | if (ch->ch_state < CS_READY) { | ||
| 2351 | error = "Data received before RWIN established"; | ||
| 2352 | goto prot_error; | ||
| 2353 | } | ||
| 2354 | |||
| 2355 | /* | ||
| 2356 | * Assure that the data received is within the | ||
| 2357 | * allowable window. | ||
| 2358 | */ | ||
| 2359 | |||
| 2360 | n = (ch->ch_s_rwin - ch->ch_s_rin) & 0xffff; | ||
| 2361 | |||
| 2362 | if (dlen > n) { | ||
| 2363 | error = "Receive data overrun"; | ||
| 2364 | goto prot_error; | ||
| 2365 | } | ||
| 2366 | |||
| 2367 | /* | ||
| 2368 | * If we received 3 or less characters, | ||
| 2369 | * assume it is a human typing, and set RTIME | ||
| 2370 | * to 10 milliseconds. | ||
| 2371 | * | ||
| 2372 | * If we receive 10 or more characters, | ||
| 2373 | * assume its not a human typing, and set RTIME | ||
| 2374 | * to 100 milliseconds. | ||
| 2375 | */ | ||
| 2376 | |||
| 2377 | if (ch->ch_edelay != DGRP_RTIME) { | ||
| 2378 | if (ch->ch_rtime != ch->ch_edelay) { | ||
| 2379 | ch->ch_rtime = ch->ch_edelay; | ||
| 2380 | ch->ch_flag |= CH_PARAM; | ||
| 2381 | } | ||
| 2382 | } else if (dlen <= 3) { | ||
| 2383 | if (ch->ch_rtime != 10) { | ||
| 2384 | ch->ch_rtime = 10; | ||
| 2385 | ch->ch_flag |= CH_PARAM; | ||
| 2386 | } | ||
| 2387 | } else { | ||
| 2388 | if (ch->ch_rtime != DGRP_RTIME) { | ||
| 2389 | ch->ch_rtime = DGRP_RTIME; | ||
| 2390 | ch->ch_flag |= CH_PARAM; | ||
| 2391 | } | ||
| 2392 | } | ||
| 2393 | |||
| 2394 | /* | ||
| 2395 | * If a portion of the packet is outside the | ||
| 2396 | * buffer, shorten the effective length of the | ||
| 2397 | * data packet to be the amount of data received. | ||
| 2398 | */ | ||
| 2399 | |||
| 2400 | if (remain < plen) | ||
| 2401 | dlen -= plen - remain; | ||
| 2402 | |||
| 2403 | /* | ||
| 2404 | * Detect if receive flush is now complete. | ||
| 2405 | */ | ||
| 2406 | |||
| 2407 | if ((ch->ch_flag & CH_RX_FLUSH) != 0 && | ||
| 2408 | ((ch->ch_flush_seq - nd->nd_seq_out) & SEQ_MASK) >= | ||
| 2409 | ((nd->nd_seq_in - nd->nd_seq_out) & SEQ_MASK)) { | ||
| 2410 | ch->ch_flag &= ~CH_RX_FLUSH; | ||
| 2411 | } | ||
| 2412 | |||
| 2413 | /* | ||
| 2414 | * If we are ready to receive, move the data into | ||
| 2415 | * the receive buffer. | ||
| 2416 | */ | ||
| 2417 | |||
| 2418 | ch->ch_s_rin = (ch->ch_s_rin + dlen) & 0xffff; | ||
| 2419 | |||
| 2420 | if (ch->ch_state == CS_READY && | ||
| 2421 | (ch->ch_tun.un_open_count != 0) && | ||
| 2422 | (ch->ch_tun.un_flag & UN_CLOSING) == 0 && | ||
| 2423 | (ch->ch_cflag & CF_CREAD) != 0 && | ||
| 2424 | (ch->ch_flag & (CH_BAUD0 | CH_RX_FLUSH)) == 0 && | ||
| 2425 | (ch->ch_send & RR_RX_FLUSH) == 0) { | ||
| 2426 | |||
| 2427 | if (ch->ch_rin + dlen >= RBUF_MAX) { | ||
| 2428 | n = RBUF_MAX - ch->ch_rin; | ||
| 2429 | |||
| 2430 | memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, n); | ||
| 2431 | |||
| 2432 | ch->ch_rin = 0; | ||
| 2433 | dbuf += n; | ||
| 2434 | dlen -= n; | ||
| 2435 | } | ||
| 2436 | |||
| 2437 | memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, dlen); | ||
| 2438 | |||
| 2439 | ch->ch_rin += dlen; | ||
| 2440 | |||
| 2441 | |||
| 2442 | /* | ||
| 2443 | * If we are not in fastcook mode, or | ||
| 2444 | * if there is a fastcook thread | ||
| 2445 | * waiting for data, send the data to | ||
| 2446 | * the line discipline. | ||
| 2447 | */ | ||
| 2448 | |||
| 2449 | if ((ch->ch_flag & CH_FAST_READ) == 0 || | ||
| 2450 | ch->ch_inwait != 0) { | ||
| 2451 | dgrp_input(ch); | ||
| 2452 | } | ||
| 2453 | |||
| 2454 | /* | ||
| 2455 | * If there is a read thread waiting | ||
| 2456 | * in select, and we are in fastcook | ||
| 2457 | * mode, wake him up. | ||
| 2458 | */ | ||
| 2459 | |||
| 2460 | if (waitqueue_active(&ch->ch_tun.un_tty->read_wait) && | ||
| 2461 | (ch->ch_flag & CH_FAST_READ) != 0) | ||
| 2462 | wake_up_interruptible(&ch->ch_tun.un_tty->read_wait); | ||
| 2463 | |||
| 2464 | /* | ||
| 2465 | * Wake any thread waiting in the | ||
| 2466 | * fastcook loop. | ||
| 2467 | */ | ||
| 2468 | |||
| 2469 | if ((ch->ch_flag & CH_INPUT) != 0) { | ||
| 2470 | ch->ch_flag &= ~CH_INPUT; | ||
| 2471 | |||
| 2472 | wake_up_interruptible(&ch->ch_flag_wait); | ||
| 2473 | } | ||
| 2474 | } | ||
| 2475 | |||
| 2476 | /* | ||
| 2477 | * Fabricate and insert a data packet header to | ||
| 2478 | * preced the remaining data when it comes in. | ||
| 2479 | */ | ||
| 2480 | |||
| 2481 | if (remain < plen) { | ||
| 2482 | dlen = plen - remain; | ||
| 2483 | b = buf; | ||
| 2484 | |||
| 2485 | b[0] = 0x90 + n1; | ||
| 2486 | put_unaligned_be16(dlen, b + 1); | ||
| 2487 | |||
| 2488 | remain = 3; | ||
| 2489 | goto done; | ||
| 2490 | } | ||
| 2511 | break; | 2491 | break; |
| 2512 | 2492 | ||
| 2513 | /* | 2493 | /* |
diff --git a/drivers/staging/gdm72xx/gdm_usb.c b/drivers/staging/gdm72xx/gdm_usb.c index f8788bf0a7d3..cdeffe75496b 100644 --- a/drivers/staging/gdm72xx/gdm_usb.c +++ b/drivers/staging/gdm72xx/gdm_usb.c | |||
| @@ -635,11 +635,14 @@ static int gdm_usb_probe(struct usb_interface *intf, | |||
| 635 | #endif /* CONFIG_WIMAX_GDM72XX_USB_PM */ | 635 | #endif /* CONFIG_WIMAX_GDM72XX_USB_PM */ |
| 636 | 636 | ||
| 637 | ret = register_wimax_device(phy_dev, &intf->dev); | 637 | ret = register_wimax_device(phy_dev, &intf->dev); |
| 638 | if (ret) | ||
| 639 | release_usb(udev); | ||
| 638 | 640 | ||
| 639 | out: | 641 | out: |
| 640 | if (ret) { | 642 | if (ret) { |
| 641 | kfree(phy_dev); | 643 | kfree(phy_dev); |
| 642 | kfree(udev); | 644 | kfree(udev); |
| 645 | usb_put_dev(usbdev); | ||
| 643 | } else { | 646 | } else { |
| 644 | usb_set_intfdata(intf, phy_dev); | 647 | usb_set_intfdata(intf, phy_dev); |
| 645 | } | 648 | } |
diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h index 35154d60faf6..c9fedb79e3a2 100644 --- a/drivers/staging/iio/Documentation/iio_utils.h +++ b/drivers/staging/iio/Documentation/iio_utils.h | |||
| @@ -77,7 +77,6 @@ struct iio_channel_info { | |||
| 77 | uint64_t mask; | 77 | uint64_t mask; |
| 78 | unsigned be; | 78 | unsigned be; |
| 79 | unsigned is_signed; | 79 | unsigned is_signed; |
| 80 | unsigned enabled; | ||
| 81 | unsigned location; | 80 | unsigned location; |
| 82 | }; | 81 | }; |
| 83 | 82 | ||
| @@ -335,6 +334,7 @@ inline int build_channel_array(const char *device_dir, | |||
| 335 | while (ent = readdir(dp), ent != NULL) { | 334 | while (ent = readdir(dp), ent != NULL) { |
| 336 | if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), | 335 | if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), |
| 337 | "_en") == 0) { | 336 | "_en") == 0) { |
| 337 | int current_enabled = 0; | ||
| 338 | current = &(*ci_array)[count++]; | 338 | current = &(*ci_array)[count++]; |
| 339 | ret = asprintf(&filename, | 339 | ret = asprintf(&filename, |
| 340 | "%s/%s", scan_el_dir, ent->d_name); | 340 | "%s/%s", scan_el_dir, ent->d_name); |
| @@ -350,10 +350,10 @@ inline int build_channel_array(const char *device_dir, | |||
| 350 | ret = -errno; | 350 | ret = -errno; |
| 351 | goto error_cleanup_array; | 351 | goto error_cleanup_array; |
| 352 | } | 352 | } |
| 353 | fscanf(sysfsfp, "%u", ¤t->enabled); | 353 | fscanf(sysfsfp, "%u", ¤t_enabled); |
| 354 | fclose(sysfsfp); | 354 | fclose(sysfsfp); |
| 355 | 355 | ||
| 356 | if (!current->enabled) { | 356 | if (!current_enabled) { |
| 357 | free(filename); | 357 | free(filename); |
| 358 | count--; | 358 | count--; |
| 359 | continue; | 359 | continue; |
diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c index 5ea36410f716..5708ffc62aec 100644 --- a/drivers/staging/iio/adc/ad799x_core.c +++ b/drivers/staging/iio/adc/ad799x_core.c | |||
| @@ -393,7 +393,7 @@ static const struct iio_event_spec ad799x_events[] = { | |||
| 393 | }, { | 393 | }, { |
| 394 | .type = IIO_EV_TYPE_THRESH, | 394 | .type = IIO_EV_TYPE_THRESH, |
| 395 | .dir = IIO_EV_DIR_FALLING, | 395 | .dir = IIO_EV_DIR_FALLING, |
| 396 | .mask_separate = BIT(IIO_EV_INFO_VALUE), | 396 | .mask_separate = BIT(IIO_EV_INFO_VALUE) | |
| 397 | BIT(IIO_EV_INFO_ENABLE), | 397 | BIT(IIO_EV_INFO_ENABLE), |
| 398 | }, { | 398 | }, { |
| 399 | .type = IIO_EV_TYPE_THRESH, | 399 | .type = IIO_EV_TYPE_THRESH, |
| @@ -409,7 +409,13 @@ static const struct iio_event_spec ad799x_events[] = { | |||
| 409 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ | 409 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ |
| 410 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ | 410 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ |
| 411 | .scan_index = (_index), \ | 411 | .scan_index = (_index), \ |
| 412 | .scan_type = IIO_ST('u', _realbits, 16, 12 - (_realbits)), \ | 412 | .scan_type = { \ |
| 413 | .sign = 'u', \ | ||
| 414 | .realbits = (_realbits), \ | ||
| 415 | .storagebits = 16, \ | ||
| 416 | .shift = 12 - (_realbits), \ | ||
| 417 | .endianness = IIO_BE, \ | ||
| 418 | }, \ | ||
| 413 | .event_spec = _ev_spec, \ | 419 | .event_spec = _ev_spec, \ |
| 414 | .num_event_specs = _num_ev_spec, \ | 420 | .num_event_specs = _num_ev_spec, \ |
| 415 | } | 421 | } |
| @@ -588,7 +594,8 @@ static int ad799x_probe(struct i2c_client *client, | |||
| 588 | return 0; | 594 | return 0; |
| 589 | 595 | ||
| 590 | error_free_irq: | 596 | error_free_irq: |
| 591 | free_irq(client->irq, indio_dev); | 597 | if (client->irq > 0) |
| 598 | free_irq(client->irq, indio_dev); | ||
| 592 | error_cleanup_ring: | 599 | error_cleanup_ring: |
| 593 | ad799x_ring_cleanup(indio_dev); | 600 | ad799x_ring_cleanup(indio_dev); |
| 594 | error_disable_reg: | 601 | error_disable_reg: |
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index df71669bb60e..7fc66a6a6e36 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c | |||
| @@ -1035,8 +1035,6 @@ SHOW_SCALE_AVAILABLE_ATTR(4); | |||
| 1035 | SHOW_SCALE_AVAILABLE_ATTR(5); | 1035 | SHOW_SCALE_AVAILABLE_ATTR(5); |
| 1036 | SHOW_SCALE_AVAILABLE_ATTR(6); | 1036 | SHOW_SCALE_AVAILABLE_ATTR(6); |
| 1037 | SHOW_SCALE_AVAILABLE_ATTR(7); | 1037 | SHOW_SCALE_AVAILABLE_ATTR(7); |
| 1038 | SHOW_SCALE_AVAILABLE_ATTR(8); | ||
| 1039 | SHOW_SCALE_AVAILABLE_ATTR(9); | ||
| 1040 | SHOW_SCALE_AVAILABLE_ATTR(10); | 1038 | SHOW_SCALE_AVAILABLE_ATTR(10); |
| 1041 | SHOW_SCALE_AVAILABLE_ATTR(11); | 1039 | SHOW_SCALE_AVAILABLE_ATTR(11); |
| 1042 | SHOW_SCALE_AVAILABLE_ATTR(12); | 1040 | SHOW_SCALE_AVAILABLE_ATTR(12); |
| @@ -1053,8 +1051,6 @@ static struct attribute *mxs_lradc_attributes[] = { | |||
| 1053 | &iio_dev_attr_in_voltage5_scale_available.dev_attr.attr, | 1051 | &iio_dev_attr_in_voltage5_scale_available.dev_attr.attr, |
| 1054 | &iio_dev_attr_in_voltage6_scale_available.dev_attr.attr, | 1052 | &iio_dev_attr_in_voltage6_scale_available.dev_attr.attr, |
| 1055 | &iio_dev_attr_in_voltage7_scale_available.dev_attr.attr, | 1053 | &iio_dev_attr_in_voltage7_scale_available.dev_attr.attr, |
| 1056 | &iio_dev_attr_in_voltage8_scale_available.dev_attr.attr, | ||
| 1057 | &iio_dev_attr_in_voltage9_scale_available.dev_attr.attr, | ||
| 1058 | &iio_dev_attr_in_voltage10_scale_available.dev_attr.attr, | 1054 | &iio_dev_attr_in_voltage10_scale_available.dev_attr.attr, |
| 1059 | &iio_dev_attr_in_voltage11_scale_available.dev_attr.attr, | 1055 | &iio_dev_attr_in_voltage11_scale_available.dev_attr.attr, |
| 1060 | &iio_dev_attr_in_voltage12_scale_available.dev_attr.attr, | 1056 | &iio_dev_attr_in_voltage12_scale_available.dev_attr.attr, |
| @@ -1613,7 +1609,7 @@ static int mxs_lradc_probe(struct platform_device *pdev) | |||
| 1613 | * of the array. | 1609 | * of the array. |
| 1614 | */ | 1610 | */ |
| 1615 | scale_uv = ((u64)lradc->vref_mv[i] * 100000000) >> | 1611 | scale_uv = ((u64)lradc->vref_mv[i] * 100000000) >> |
| 1616 | (iio->channels[i].scan_type.realbits - s); | 1612 | (LRADC_RESOLUTION - s); |
| 1617 | lradc->scale_avail[i][s].nano = | 1613 | lradc->scale_avail[i][s].nano = |
| 1618 | do_div(scale_uv, 100000000) * 10; | 1614 | do_div(scale_uv, 100000000) * 10; |
| 1619 | lradc->scale_avail[i][s].integer = scale_uv; | 1615 | lradc->scale_avail[i][s].integer = scale_uv; |
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c index 0a4298b744e6..2b96665da8a2 100644 --- a/drivers/staging/iio/impedance-analyzer/ad5933.c +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c | |||
| @@ -629,7 +629,7 @@ static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev) | |||
| 629 | struct iio_buffer *buffer; | 629 | struct iio_buffer *buffer; |
| 630 | 630 | ||
| 631 | buffer = iio_kfifo_allocate(indio_dev); | 631 | buffer = iio_kfifo_allocate(indio_dev); |
| 632 | if (buffer) | 632 | if (!buffer) |
| 633 | return -ENOMEM; | 633 | return -ENOMEM; |
| 634 | 634 | ||
| 635 | iio_device_attach_buffer(indio_dev, buffer); | 635 | iio_device_attach_buffer(indio_dev, buffer); |
diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c index 09ef5fb8bae6..236ed66f116a 100644 --- a/drivers/staging/imx-drm/imx-drm-core.c +++ b/drivers/staging/imx-drm/imx-drm-core.c | |||
| @@ -88,9 +88,9 @@ static int imx_drm_driver_unload(struct drm_device *drm) | |||
| 88 | 88 | ||
| 89 | imx_drm_device_put(); | 89 | imx_drm_device_put(); |
| 90 | 90 | ||
| 91 | drm_vblank_cleanup(imxdrm->drm); | 91 | drm_vblank_cleanup(drm); |
| 92 | drm_kms_helper_poll_fini(imxdrm->drm); | 92 | drm_kms_helper_poll_fini(drm); |
| 93 | drm_mode_config_cleanup(imxdrm->drm); | 93 | drm_mode_config_cleanup(drm); |
| 94 | 94 | ||
| 95 | return 0; | 95 | return 0; |
| 96 | } | 96 | } |
| @@ -142,19 +142,19 @@ EXPORT_SYMBOL_GPL(imx_drm_crtc_panel_format); | |||
| 142 | 142 | ||
| 143 | int imx_drm_crtc_vblank_get(struct imx_drm_crtc *imx_drm_crtc) | 143 | int imx_drm_crtc_vblank_get(struct imx_drm_crtc *imx_drm_crtc) |
| 144 | { | 144 | { |
| 145 | return drm_vblank_get(imx_drm_crtc->imxdrm->drm, imx_drm_crtc->pipe); | 145 | return drm_vblank_get(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe); |
| 146 | } | 146 | } |
| 147 | EXPORT_SYMBOL_GPL(imx_drm_crtc_vblank_get); | 147 | EXPORT_SYMBOL_GPL(imx_drm_crtc_vblank_get); |
| 148 | 148 | ||
| 149 | void imx_drm_crtc_vblank_put(struct imx_drm_crtc *imx_drm_crtc) | 149 | void imx_drm_crtc_vblank_put(struct imx_drm_crtc *imx_drm_crtc) |
| 150 | { | 150 | { |
| 151 | drm_vblank_put(imx_drm_crtc->imxdrm->drm, imx_drm_crtc->pipe); | 151 | drm_vblank_put(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe); |
| 152 | } | 152 | } |
| 153 | EXPORT_SYMBOL_GPL(imx_drm_crtc_vblank_put); | 153 | EXPORT_SYMBOL_GPL(imx_drm_crtc_vblank_put); |
| 154 | 154 | ||
| 155 | void imx_drm_handle_vblank(struct imx_drm_crtc *imx_drm_crtc) | 155 | void imx_drm_handle_vblank(struct imx_drm_crtc *imx_drm_crtc) |
| 156 | { | 156 | { |
| 157 | drm_handle_vblank(imx_drm_crtc->imxdrm->drm, imx_drm_crtc->pipe); | 157 | drm_handle_vblank(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe); |
| 158 | } | 158 | } |
| 159 | EXPORT_SYMBOL_GPL(imx_drm_handle_vblank); | 159 | EXPORT_SYMBOL_GPL(imx_drm_handle_vblank); |
| 160 | 160 | ||
| @@ -370,29 +370,6 @@ static void imx_drm_connector_unregister( | |||
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | /* | 372 | /* |
| 373 | * register a crtc to the drm core | ||
| 374 | */ | ||
| 375 | static int imx_drm_crtc_register(struct imx_drm_crtc *imx_drm_crtc) | ||
| 376 | { | ||
| 377 | struct imx_drm_device *imxdrm = __imx_drm_device(); | ||
| 378 | int ret; | ||
| 379 | |||
| 380 | ret = drm_mode_crtc_set_gamma_size(imx_drm_crtc->crtc, 256); | ||
| 381 | if (ret) | ||
| 382 | return ret; | ||
| 383 | |||
| 384 | drm_crtc_helper_add(imx_drm_crtc->crtc, | ||
| 385 | imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs); | ||
| 386 | |||
| 387 | drm_crtc_init(imxdrm->drm, imx_drm_crtc->crtc, | ||
| 388 | imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs); | ||
| 389 | |||
| 390 | drm_mode_group_reinit(imxdrm->drm); | ||
| 391 | |||
| 392 | return 0; | ||
| 393 | } | ||
| 394 | |||
| 395 | /* | ||
| 396 | * Called by the CRTC driver when all CRTCs are registered. This | 373 | * Called by the CRTC driver when all CRTCs are registered. This |
| 397 | * puts all the pieces together and initializes the driver. | 374 | * puts all the pieces together and initializes the driver. |
| 398 | * Once this is called no more CRTCs can be registered since | 375 | * Once this is called no more CRTCs can be registered since |
| @@ -424,15 +401,15 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) | |||
| 424 | 401 | ||
| 425 | mutex_lock(&imxdrm->mutex); | 402 | mutex_lock(&imxdrm->mutex); |
| 426 | 403 | ||
| 427 | drm_kms_helper_poll_init(imxdrm->drm); | 404 | drm_kms_helper_poll_init(drm); |
| 428 | 405 | ||
| 429 | /* setup the grouping for the legacy output */ | 406 | /* setup the grouping for the legacy output */ |
| 430 | ret = drm_mode_group_init_legacy_group(imxdrm->drm, | 407 | ret = drm_mode_group_init_legacy_group(drm, |
| 431 | &imxdrm->drm->primary->mode_group); | 408 | &drm->primary->mode_group); |
| 432 | if (ret) | 409 | if (ret) |
| 433 | goto err_kms; | 410 | goto err_kms; |
| 434 | 411 | ||
| 435 | ret = drm_vblank_init(imxdrm->drm, MAX_CRTC); | 412 | ret = drm_vblank_init(drm, MAX_CRTC); |
| 436 | if (ret) | 413 | if (ret) |
| 437 | goto err_kms; | 414 | goto err_kms; |
| 438 | 415 | ||
| @@ -441,7 +418,7 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) | |||
| 441 | * by drm timer once a current process gives up ownership of | 418 | * by drm timer once a current process gives up ownership of |
| 442 | * vblank event.(after drm_vblank_put function is called) | 419 | * vblank event.(after drm_vblank_put function is called) |
| 443 | */ | 420 | */ |
| 444 | imxdrm->drm->vblank_disable_allowed = true; | 421 | drm->vblank_disable_allowed = true; |
| 445 | 422 | ||
| 446 | if (!imx_drm_device_get()) { | 423 | if (!imx_drm_device_get()) { |
| 447 | ret = -EINVAL; | 424 | ret = -EINVAL; |
| @@ -536,10 +513,18 @@ int imx_drm_add_crtc(struct drm_crtc *crtc, | |||
| 536 | 513 | ||
| 537 | *new_crtc = imx_drm_crtc; | 514 | *new_crtc = imx_drm_crtc; |
| 538 | 515 | ||
| 539 | ret = imx_drm_crtc_register(imx_drm_crtc); | 516 | ret = drm_mode_crtc_set_gamma_size(imx_drm_crtc->crtc, 256); |
| 540 | if (ret) | 517 | if (ret) |
| 541 | goto err_register; | 518 | goto err_register; |
| 542 | 519 | ||
| 520 | drm_crtc_helper_add(crtc, | ||
| 521 | imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs); | ||
| 522 | |||
| 523 | drm_crtc_init(imxdrm->drm, crtc, | ||
| 524 | imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs); | ||
| 525 | |||
| 526 | drm_mode_group_reinit(imxdrm->drm); | ||
| 527 | |||
| 543 | imx_drm_update_possible_crtcs(); | 528 | imx_drm_update_possible_crtcs(); |
| 544 | 529 | ||
| 545 | mutex_unlock(&imxdrm->mutex); | 530 | mutex_unlock(&imxdrm->mutex); |
diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c index f3a1f5e2e492..62ce0e86f14b 100644 --- a/drivers/staging/imx-drm/imx-hdmi.c +++ b/drivers/staging/imx-drm/imx-hdmi.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
| 17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
| 18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
| 19 | #include <linux/hdmi.h> | ||
| 19 | #include <linux/regmap.h> | 20 | #include <linux/regmap.h> |
| 20 | #include <linux/mfd/syscon.h> | 21 | #include <linux/mfd/syscon.h> |
| 21 | #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> | 22 | #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> |
| @@ -52,11 +53,6 @@ enum hdmi_datamap { | |||
| 52 | YCbCr422_12B = 0x12, | 53 | YCbCr422_12B = 0x12, |
| 53 | }; | 54 | }; |
| 54 | 55 | ||
| 55 | enum hdmi_colorimetry { | ||
| 56 | ITU601, | ||
| 57 | ITU709, | ||
| 58 | }; | ||
| 59 | |||
| 60 | enum imx_hdmi_devtype { | 56 | enum imx_hdmi_devtype { |
| 61 | IMX6Q_HDMI, | 57 | IMX6Q_HDMI, |
| 62 | IMX6DL_HDMI, | 58 | IMX6DL_HDMI, |
| @@ -489,12 +485,12 @@ static void imx_hdmi_update_csc_coeffs(struct imx_hdmi *hdmi) | |||
| 489 | 485 | ||
| 490 | if (is_color_space_conversion(hdmi)) { | 486 | if (is_color_space_conversion(hdmi)) { |
| 491 | if (hdmi->hdmi_data.enc_out_format == RGB) { | 487 | if (hdmi->hdmi_data.enc_out_format == RGB) { |
| 492 | if (hdmi->hdmi_data.colorimetry == ITU601) | 488 | if (hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_601) |
| 493 | csc_coeff = &csc_coeff_rgb_out_eitu601; | 489 | csc_coeff = &csc_coeff_rgb_out_eitu601; |
| 494 | else | 490 | else |
| 495 | csc_coeff = &csc_coeff_rgb_out_eitu709; | 491 | csc_coeff = &csc_coeff_rgb_out_eitu709; |
| 496 | } else if (hdmi->hdmi_data.enc_in_format == RGB) { | 492 | } else if (hdmi->hdmi_data.enc_in_format == RGB) { |
| 497 | if (hdmi->hdmi_data.colorimetry == ITU601) | 493 | if (hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_601) |
| 498 | csc_coeff = &csc_coeff_rgb_in_eitu601; | 494 | csc_coeff = &csc_coeff_rgb_in_eitu601; |
| 499 | else | 495 | else |
| 500 | csc_coeff = &csc_coeff_rgb_in_eitu709; | 496 | csc_coeff = &csc_coeff_rgb_in_eitu709; |
| @@ -1140,16 +1136,16 @@ static void hdmi_config_AVI(struct imx_hdmi *hdmi) | |||
| 1140 | /* Set up colorimetry */ | 1136 | /* Set up colorimetry */ |
| 1141 | if (hdmi->hdmi_data.enc_out_format == XVYCC444) { | 1137 | if (hdmi->hdmi_data.enc_out_format == XVYCC444) { |
| 1142 | colorimetry = HDMI_FC_AVICONF1_COLORIMETRY_EXTENDED_INFO; | 1138 | colorimetry = HDMI_FC_AVICONF1_COLORIMETRY_EXTENDED_INFO; |
| 1143 | if (hdmi->hdmi_data.colorimetry == ITU601) | 1139 | if (hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_601) |
| 1144 | ext_colorimetry = | 1140 | ext_colorimetry = |
| 1145 | HDMI_FC_AVICONF2_EXT_COLORIMETRY_XVYCC601; | 1141 | HDMI_FC_AVICONF2_EXT_COLORIMETRY_XVYCC601; |
| 1146 | else /* hdmi->hdmi_data.colorimetry == ITU709 */ | 1142 | else /*hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_709*/ |
| 1147 | ext_colorimetry = | 1143 | ext_colorimetry = |
| 1148 | HDMI_FC_AVICONF2_EXT_COLORIMETRY_XVYCC709; | 1144 | HDMI_FC_AVICONF2_EXT_COLORIMETRY_XVYCC709; |
| 1149 | } else if (hdmi->hdmi_data.enc_out_format != RGB) { | 1145 | } else if (hdmi->hdmi_data.enc_out_format != RGB) { |
| 1150 | if (hdmi->hdmi_data.colorimetry == ITU601) | 1146 | if (hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_601) |
| 1151 | colorimetry = HDMI_FC_AVICONF1_COLORIMETRY_SMPTE; | 1147 | colorimetry = HDMI_FC_AVICONF1_COLORIMETRY_SMPTE; |
| 1152 | else /* hdmi->hdmi_data.colorimetry == ITU709 */ | 1148 | else /*hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_709*/ |
| 1153 | colorimetry = HDMI_FC_AVICONF1_COLORIMETRY_ITUR; | 1149 | colorimetry = HDMI_FC_AVICONF1_COLORIMETRY_ITUR; |
| 1154 | ext_colorimetry = HDMI_FC_AVICONF2_EXT_COLORIMETRY_XVYCC601; | 1150 | ext_colorimetry = HDMI_FC_AVICONF2_EXT_COLORIMETRY_XVYCC601; |
| 1155 | } else { /* Carries no data */ | 1151 | } else { /* Carries no data */ |
| @@ -1379,9 +1375,9 @@ static int imx_hdmi_setup(struct imx_hdmi *hdmi, struct drm_display_mode *mode) | |||
| 1379 | (hdmi->vic == 21) || (hdmi->vic == 22) || | 1375 | (hdmi->vic == 21) || (hdmi->vic == 22) || |
| 1380 | (hdmi->vic == 2) || (hdmi->vic == 3) || | 1376 | (hdmi->vic == 2) || (hdmi->vic == 3) || |
| 1381 | (hdmi->vic == 17) || (hdmi->vic == 18)) | 1377 | (hdmi->vic == 17) || (hdmi->vic == 18)) |
| 1382 | hdmi->hdmi_data.colorimetry = ITU601; | 1378 | hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_601; |
| 1383 | else | 1379 | else |
| 1384 | hdmi->hdmi_data.colorimetry = ITU709; | 1380 | hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_709; |
| 1385 | 1381 | ||
| 1386 | if ((hdmi->vic == 10) || (hdmi->vic == 11) || | 1382 | if ((hdmi->vic == 10) || (hdmi->vic == 11) || |
| 1387 | (hdmi->vic == 12) || (hdmi->vic == 13) || | 1383 | (hdmi->vic == 12) || (hdmi->vic == 13) || |
diff --git a/drivers/staging/lustre/TODO b/drivers/staging/lustre/TODO index 22742d6d62a8..0a2b6cb3775e 100644 --- a/drivers/staging/lustre/TODO +++ b/drivers/staging/lustre/TODO | |||
| @@ -9,5 +9,6 @@ | |||
| 9 | * Other minor misc cleanups... | 9 | * Other minor misc cleanups... |
| 10 | 10 | ||
| 11 | Please send any patches to Greg Kroah-Hartman <greg@kroah.com>, Andreas Dilger | 11 | Please send any patches to Greg Kroah-Hartman <greg@kroah.com>, Andreas Dilger |
| 12 | <andreas.dilger@intel.com> and Peng Tao <tao.peng@emc.com>. CCing | 12 | <andreas.dilger@intel.com>, Oleg Drokin <oleg.drokin@intel.com> and |
| 13 | hpdd-discuss <hpdd-discuss@lists.01.org> would be great too. | 13 | Peng Tao <tao.peng@emc.com>. CCing hpdd-discuss <hpdd-discuss@lists.01.org> |
| 14 | would be great too. | ||
diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h index 596a15fc8996..037ae8a6d531 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h | |||
| @@ -61,6 +61,8 @@ struct kuc_hdr { | |||
| 61 | __u16 kuc_msglen; /* Including header */ | 61 | __u16 kuc_msglen; /* Including header */ |
| 62 | } __attribute__((aligned(sizeof(__u64)))); | 62 | } __attribute__((aligned(sizeof(__u64)))); |
| 63 | 63 | ||
| 64 | #define KUC_CHANGELOG_MSG_MAXSIZE (sizeof(struct kuc_hdr)+CR_MAXSIZE) | ||
| 65 | |||
| 64 | #define KUC_MAGIC 0x191C /*Lustre9etLinC */ | 66 | #define KUC_MAGIC 0x191C /*Lustre9etLinC */ |
| 65 | #define KUC_FL_BLOCK 0x01 /* Wait for send */ | 67 | #define KUC_FL_BLOCK 0x01 /* Wait for send */ |
| 66 | 68 | ||
diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h index d0d942ced01a..dddccca120c9 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h | |||
| @@ -120,7 +120,7 @@ do { \ | |||
| 120 | do { \ | 120 | do { \ |
| 121 | LASSERT(!in_interrupt() || \ | 121 | LASSERT(!in_interrupt() || \ |
| 122 | ((size) <= LIBCFS_VMALLOC_SIZE && \ | 122 | ((size) <= LIBCFS_VMALLOC_SIZE && \ |
| 123 | ((mask) & GFP_ATOMIC)) != 0); \ | 123 | ((mask) & __GFP_WAIT) == 0)); \ |
| 124 | } while (0) | 124 | } while (0) |
| 125 | 125 | ||
| 126 | #define LIBCFS_ALLOC_POST(ptr, size) \ | 126 | #define LIBCFS_ALLOC_POST(ptr, size) \ |
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index 93648632ba26..6f58ead20393 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | |||
| @@ -529,7 +529,7 @@ kiblnd_kvaddr_to_page (unsigned long vaddr) | |||
| 529 | { | 529 | { |
| 530 | struct page *page; | 530 | struct page *page; |
| 531 | 531 | ||
| 532 | if (is_vmalloc_addr(vaddr)) { | 532 | if (is_vmalloc_addr((void *)vaddr)) { |
| 533 | page = vmalloc_to_page ((void *)vaddr); | 533 | page = vmalloc_to_page ((void *)vaddr); |
| 534 | LASSERT (page != NULL); | 534 | LASSERT (page != NULL); |
| 535 | return page; | 535 | return page; |
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index 68a4f52ec998..b7b53b579c85 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | |||
| @@ -924,7 +924,7 @@ ksocknal_launch_packet (lnet_ni_t *ni, ksock_tx_t *tx, lnet_process_id_t id) | |||
| 924 | int | 924 | int |
| 925 | ksocknal_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) | 925 | ksocknal_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) |
| 926 | { | 926 | { |
| 927 | int mpflag = 0; | 927 | int mpflag = 1; |
| 928 | int type = lntmsg->msg_type; | 928 | int type = lntmsg->msg_type; |
| 929 | lnet_process_id_t target = lntmsg->msg_target; | 929 | lnet_process_id_t target = lntmsg->msg_target; |
| 930 | unsigned int payload_niov = lntmsg->msg_niov; | 930 | unsigned int payload_niov = lntmsg->msg_niov; |
| @@ -993,8 +993,9 @@ ksocknal_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg) | |||
| 993 | 993 | ||
| 994 | /* The first fragment will be set later in pro_pack */ | 994 | /* The first fragment will be set later in pro_pack */ |
| 995 | rc = ksocknal_launch_packet(ni, tx, target); | 995 | rc = ksocknal_launch_packet(ni, tx, target); |
| 996 | if (lntmsg->msg_vmflush) | 996 | if (!mpflag) |
| 997 | cfs_memory_pressure_restore(mpflag); | 997 | cfs_memory_pressure_restore(mpflag); |
| 998 | |||
| 998 | if (rc == 0) | 999 | if (rc == 0) |
| 999 | return (0); | 1000 | return (0); |
| 1000 | 1001 | ||
diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h index 6b6c0240e824..7893d83e131f 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h | |||
| @@ -760,7 +760,8 @@ static inline void hsm_set_cl_error(int *flags, int error) | |||
| 760 | *flags |= (error << CLF_HSM_ERR_L); | 760 | *flags |= (error << CLF_HSM_ERR_L); |
| 761 | } | 761 | } |
| 762 | 762 | ||
| 763 | #define CR_MAXSIZE cfs_size_round(2*NAME_MAX + 1 + sizeof(struct changelog_rec)) | 763 | #define CR_MAXSIZE cfs_size_round(2*NAME_MAX + 1 + \ |
| 764 | sizeof(struct changelog_ext_rec)) | ||
| 764 | 765 | ||
| 765 | struct changelog_rec { | 766 | struct changelog_rec { |
| 766 | __u16 cr_namelen; | 767 | __u16 cr_namelen; |
diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 22d0acc95bc5..52b7731bcc38 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c | |||
| @@ -1086,7 +1086,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl) | |||
| 1086 | break; | 1086 | break; |
| 1087 | case Q_GETQUOTA: | 1087 | case Q_GETQUOTA: |
| 1088 | if (((type == USRQUOTA && | 1088 | if (((type == USRQUOTA && |
| 1089 | uid_eq(current_euid(), make_kuid(&init_user_ns, id))) || | 1089 | !uid_eq(current_euid(), make_kuid(&init_user_ns, id))) || |
| 1090 | (type == GRPQUOTA && | 1090 | (type == GRPQUOTA && |
| 1091 | !in_egroup_p(make_kgid(&init_user_ns, id)))) && | 1091 | !in_egroup_p(make_kgid(&init_user_ns, id)))) && |
| 1092 | (!cfs_capable(CFS_CAP_SYS_ADMIN) || | 1092 | (!cfs_capable(CFS_CAP_SYS_ADMIN) || |
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index d1ad91c34ddc..83013927e131 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c | |||
| @@ -1430,7 +1430,7 @@ static struct kuc_hdr *changelog_kuc_hdr(char *buf, int len, int flags) | |||
| 1430 | { | 1430 | { |
| 1431 | struct kuc_hdr *lh = (struct kuc_hdr *)buf; | 1431 | struct kuc_hdr *lh = (struct kuc_hdr *)buf; |
| 1432 | 1432 | ||
| 1433 | LASSERT(len <= CR_MAXSIZE); | 1433 | LASSERT(len <= KUC_CHANGELOG_MSG_MAXSIZE); |
| 1434 | 1434 | ||
| 1435 | lh->kuc_magic = KUC_MAGIC; | 1435 | lh->kuc_magic = KUC_MAGIC; |
| 1436 | lh->kuc_transport = KUC_TRANSPORT_CHANGELOG; | 1436 | lh->kuc_transport = KUC_TRANSPORT_CHANGELOG; |
| @@ -1503,7 +1503,7 @@ static int mdc_changelog_send_thread(void *csdata) | |||
| 1503 | CDEBUG(D_CHANGELOG, "changelog to fp=%p start "LPU64"\n", | 1503 | CDEBUG(D_CHANGELOG, "changelog to fp=%p start "LPU64"\n", |
| 1504 | cs->cs_fp, cs->cs_startrec); | 1504 | cs->cs_fp, cs->cs_startrec); |
| 1505 | 1505 | ||
| 1506 | OBD_ALLOC(cs->cs_buf, CR_MAXSIZE); | 1506 | OBD_ALLOC(cs->cs_buf, KUC_CHANGELOG_MSG_MAXSIZE); |
| 1507 | if (cs->cs_buf == NULL) | 1507 | if (cs->cs_buf == NULL) |
| 1508 | GOTO(out, rc = -ENOMEM); | 1508 | GOTO(out, rc = -ENOMEM); |
| 1509 | 1509 | ||
| @@ -1540,7 +1540,7 @@ out: | |||
| 1540 | if (ctxt) | 1540 | if (ctxt) |
| 1541 | llog_ctxt_put(ctxt); | 1541 | llog_ctxt_put(ctxt); |
| 1542 | if (cs->cs_buf) | 1542 | if (cs->cs_buf) |
| 1543 | OBD_FREE(cs->cs_buf, CR_MAXSIZE); | 1543 | OBD_FREE(cs->cs_buf, KUC_CHANGELOG_MSG_MAXSIZE); |
| 1544 | OBD_FREE_PTR(cs); | 1544 | OBD_FREE_PTR(cs); |
| 1545 | return rc; | 1545 | return rc; |
| 1546 | } | 1546 | } |
diff --git a/drivers/staging/netlogic/xlr_net.c b/drivers/staging/netlogic/xlr_net.c index eedffed17e39..d8ea25486a33 100644 --- a/drivers/staging/netlogic/xlr_net.c +++ b/drivers/staging/netlogic/xlr_net.c | |||
| @@ -892,6 +892,11 @@ static int xlr_setup_mdio(struct xlr_net_priv *priv, | |||
| 892 | priv->mii_bus->write = xlr_mii_write; | 892 | priv->mii_bus->write = xlr_mii_write; |
| 893 | priv->mii_bus->parent = &pdev->dev; | 893 | priv->mii_bus->parent = &pdev->dev; |
| 894 | priv->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); | 894 | priv->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); |
| 895 | if (priv->mii_bus->irq == NULL) { | ||
| 896 | pr_err("irq alloc failed\n"); | ||
| 897 | mdiobus_free(priv->mii_bus); | ||
| 898 | return -ENOMEM; | ||
| 899 | } | ||
| 895 | priv->mii_bus->irq[priv->phy_addr] = priv->ndev->irq; | 900 | priv->mii_bus->irq[priv->phy_addr] = priv->ndev->irq; |
| 896 | 901 | ||
| 897 | /* Scan only the enabled address */ | 902 | /* Scan only the enabled address */ |
diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c index 47e0a91238a1..5a001d9b4252 100644 --- a/drivers/staging/octeon-usb/octeon-hcd.c +++ b/drivers/staging/octeon-usb/octeon-hcd.c | |||
| @@ -275,13 +275,6 @@ enum cvmx_usb_pipe_flags { | |||
| 275 | */ | 275 | */ |
| 276 | #define MAX_TRANSFER_PACKETS ((1<<10)-1) | 276 | #define MAX_TRANSFER_PACKETS ((1<<10)-1) |
| 277 | 277 | ||
| 278 | enum { | ||
| 279 | USB_CLOCK_TYPE_REF_12, | ||
| 280 | USB_CLOCK_TYPE_REF_24, | ||
| 281 | USB_CLOCK_TYPE_REF_48, | ||
| 282 | USB_CLOCK_TYPE_CRYSTAL_12, | ||
| 283 | }; | ||
| 284 | |||
| 285 | /** | 278 | /** |
| 286 | * Logical transactions may take numerous low level | 279 | * Logical transactions may take numerous low level |
| 287 | * transactions, especially when splits are concerned. This | 280 | * transactions, especially when splits are concerned. This |
| @@ -471,19 +464,6 @@ struct octeon_hcd { | |||
| 471 | /* Returns the IO address to push/pop stuff data from the FIFOs */ | 464 | /* Returns the IO address to push/pop stuff data from the FIFOs */ |
| 472 | #define USB_FIFO_ADDRESS(channel, usb_index) (CVMX_USBCX_GOTGCTL(usb_index) + ((channel)+1)*0x1000) | 465 | #define USB_FIFO_ADDRESS(channel, usb_index) (CVMX_USBCX_GOTGCTL(usb_index) + ((channel)+1)*0x1000) |
| 473 | 466 | ||
| 474 | static int octeon_usb_get_clock_type(void) | ||
| 475 | { | ||
| 476 | switch (cvmx_sysinfo_get()->board_type) { | ||
| 477 | case CVMX_BOARD_TYPE_BBGW_REF: | ||
| 478 | case CVMX_BOARD_TYPE_LANAI2_A: | ||
| 479 | case CVMX_BOARD_TYPE_LANAI2_U: | ||
| 480 | case CVMX_BOARD_TYPE_LANAI2_G: | ||
| 481 | case CVMX_BOARD_TYPE_UBNT_E100: | ||
| 482 | return USB_CLOCK_TYPE_CRYSTAL_12; | ||
| 483 | } | ||
| 484 | return USB_CLOCK_TYPE_REF_48; | ||
| 485 | } | ||
| 486 | |||
| 487 | /** | 467 | /** |
| 488 | * Read a USB 32bit CSR. It performs the necessary address swizzle | 468 | * Read a USB 32bit CSR. It performs the necessary address swizzle |
| 489 | * for 32bit CSRs and logs the value in a readable format if | 469 | * 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) | |||
| 582 | return 0; /* Data0 */ | 562 | return 0; /* Data0 */ |
| 583 | } | 563 | } |
| 584 | 564 | ||
| 585 | |||
| 586 | /** | ||
| 587 | * Return the number of USB ports supported by this Octeon | ||
| 588 | * chip. If the chip doesn't support USB, or is not supported | ||
| 589 | * by this API, a zero will be returned. Most Octeon chips | ||
| 590 | * support one usb port, but some support two ports. | ||
| 591 | * cvmx_usb_initialize() must be called on independent | ||
| 592 | * struct cvmx_usb_state. | ||
| 593 | * | ||
| 594 | * Returns: Number of port, zero if usb isn't supported | ||
| 595 | */ | ||
| 596 | static int cvmx_usb_get_num_ports(void) | ||
| 597 | { | ||
| 598 | int arch_ports = 0; | ||
| 599 | |||
| 600 | if (OCTEON_IS_MODEL(OCTEON_CN56XX)) | ||
| 601 | arch_ports = 1; | ||
| 602 | else if (OCTEON_IS_MODEL(OCTEON_CN52XX)) | ||
| 603 | arch_ports = 2; | ||
| 604 | else if (OCTEON_IS_MODEL(OCTEON_CN50XX)) | ||
| 605 | arch_ports = 1; | ||
| 606 | else if (OCTEON_IS_MODEL(OCTEON_CN31XX)) | ||
| 607 | arch_ports = 1; | ||
| 608 | else if (OCTEON_IS_MODEL(OCTEON_CN30XX)) | ||
| 609 | arch_ports = 1; | ||
| 610 | else | ||
| 611 | arch_ports = 0; | ||
| 612 | |||
| 613 | return arch_ports; | ||
| 614 | } | ||
| 615 | |||
| 616 | /** | 565 | /** |
| 617 | * Initialize a USB port for use. This must be called before any | 566 | * Initialize a USB port for use. This must be called before any |
| 618 | * other access to the Octeon USB port is made. The port starts | 567 | * other access to the Octeon USB port is made. The port starts |
| @@ -628,41 +577,16 @@ static int cvmx_usb_get_num_ports(void) | |||
| 628 | * Returns: 0 or a negative error code. | 577 | * Returns: 0 or a negative error code. |
| 629 | */ | 578 | */ |
| 630 | static int cvmx_usb_initialize(struct cvmx_usb_state *usb, | 579 | static int cvmx_usb_initialize(struct cvmx_usb_state *usb, |
| 631 | int usb_port_number) | 580 | int usb_port_number, |
| 581 | enum cvmx_usb_initialize_flags flags) | ||
| 632 | { | 582 | { |
| 633 | union cvmx_usbnx_clk_ctl usbn_clk_ctl; | 583 | union cvmx_usbnx_clk_ctl usbn_clk_ctl; |
| 634 | union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status; | 584 | union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status; |
| 635 | enum cvmx_usb_initialize_flags flags = 0; | ||
| 636 | int i; | 585 | int i; |
| 637 | 586 | ||
| 638 | /* At first allow 0-1 for the usb port number */ | 587 | /* At first allow 0-1 for the usb port number */ |
| 639 | if ((usb_port_number < 0) || (usb_port_number > 1)) | 588 | if ((usb_port_number < 0) || (usb_port_number > 1)) |
| 640 | return -EINVAL; | 589 | return -EINVAL; |
| 641 | /* For all chips except 52XX there is only one port */ | ||
| 642 | if (!OCTEON_IS_MODEL(OCTEON_CN52XX) && (usb_port_number > 0)) | ||
| 643 | return -EINVAL; | ||
| 644 | /* Try to determine clock type automatically */ | ||
| 645 | if (octeon_usb_get_clock_type() == USB_CLOCK_TYPE_CRYSTAL_12) { | ||
| 646 | /* Only 12 MHZ crystals are supported */ | ||
| 647 | flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI; | ||
| 648 | } else { | ||
| 649 | flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND; | ||
| 650 | |||
| 651 | switch (octeon_usb_get_clock_type()) { | ||
| 652 | case USB_CLOCK_TYPE_REF_12: | ||
| 653 | flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ; | ||
| 654 | break; | ||
| 655 | case USB_CLOCK_TYPE_REF_24: | ||
| 656 | flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ; | ||
| 657 | break; | ||
| 658 | case USB_CLOCK_TYPE_REF_48: | ||
| 659 | flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ; | ||
| 660 | break; | ||
| 661 | default: | ||
| 662 | return -EINVAL; | ||
| 663 | break; | ||
| 664 | } | ||
| 665 | } | ||
| 666 | 590 | ||
| 667 | memset(usb, 0, sizeof(*usb)); | 591 | memset(usb, 0, sizeof(*usb)); |
| 668 | usb->init_flags = flags; | 592 | usb->init_flags = flags; |
| @@ -3431,7 +3355,6 @@ static int octeon_usb_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
| 3431 | return 0; | 3355 | return 0; |
| 3432 | } | 3356 | } |
| 3433 | 3357 | ||
| 3434 | |||
| 3435 | static const struct hc_driver octeon_hc_driver = { | 3358 | static const struct hc_driver octeon_hc_driver = { |
| 3436 | .description = "Octeon USB", | 3359 | .description = "Octeon USB", |
| 3437 | .product_desc = "Octeon Host Controller", | 3360 | .product_desc = "Octeon Host Controller", |
| @@ -3448,15 +3371,74 @@ static const struct hc_driver octeon_hc_driver = { | |||
| 3448 | .hub_control = octeon_usb_hub_control, | 3371 | .hub_control = octeon_usb_hub_control, |
| 3449 | }; | 3372 | }; |
| 3450 | 3373 | ||
| 3451 | 3374 | static int octeon_usb_probe(struct platform_device *pdev) | |
| 3452 | static int octeon_usb_driver_probe(struct device *dev) | ||
| 3453 | { | 3375 | { |
| 3454 | int status; | 3376 | int status; |
| 3455 | int usb_num = to_platform_device(dev)->id; | 3377 | int initialize_flags; |
| 3456 | int irq = platform_get_irq(to_platform_device(dev), 0); | 3378 | int usb_num; |
| 3379 | struct resource *res_mem; | ||
| 3380 | struct device_node *usbn_node; | ||
| 3381 | int irq = platform_get_irq(pdev, 0); | ||
| 3382 | struct device *dev = &pdev->dev; | ||
| 3457 | struct octeon_hcd *priv; | 3383 | struct octeon_hcd *priv; |
| 3458 | struct usb_hcd *hcd; | 3384 | struct usb_hcd *hcd; |
| 3459 | unsigned long flags; | 3385 | unsigned long flags; |
| 3386 | u32 clock_rate = 48000000; | ||
| 3387 | bool is_crystal_clock = false; | ||
| 3388 | const char *clock_type; | ||
| 3389 | int i; | ||
| 3390 | |||
| 3391 | if (dev->of_node == NULL) { | ||
| 3392 | dev_err(dev, "Error: empty of_node\n"); | ||
| 3393 | return -ENXIO; | ||
| 3394 | } | ||
| 3395 | usbn_node = dev->of_node->parent; | ||
| 3396 | |||
| 3397 | i = of_property_read_u32(usbn_node, | ||
| 3398 | "refclk-frequency", &clock_rate); | ||
| 3399 | if (i) { | ||
| 3400 | dev_err(dev, "No USBN \"refclk-frequency\"\n"); | ||
| 3401 | return -ENXIO; | ||
| 3402 | } | ||
| 3403 | switch (clock_rate) { | ||
| 3404 | case 12000000: | ||
| 3405 | initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ; | ||
| 3406 | break; | ||
| 3407 | case 24000000: | ||
| 3408 | initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ; | ||
| 3409 | break; | ||
| 3410 | case 48000000: | ||
| 3411 | initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ; | ||
| 3412 | break; | ||
| 3413 | default: | ||
| 3414 | dev_err(dev, "Illebal USBN \"refclk-frequency\" %u\n", clock_rate); | ||
| 3415 | return -ENXIO; | ||
| 3416 | |||
| 3417 | } | ||
| 3418 | |||
| 3419 | i = of_property_read_string(usbn_node, | ||
| 3420 | "refclk-type", &clock_type); | ||
| 3421 | |||
| 3422 | if (!i && strcmp("crystal", clock_type) == 0) | ||
| 3423 | is_crystal_clock = true; | ||
| 3424 | |||
| 3425 | if (is_crystal_clock) | ||
| 3426 | initialize_flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI; | ||
| 3427 | else | ||
| 3428 | initialize_flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND; | ||
| 3429 | |||
| 3430 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 3431 | if (res_mem == NULL) { | ||
| 3432 | dev_err(dev, "found no memory resource\n"); | ||
| 3433 | return -ENXIO; | ||
| 3434 | } | ||
| 3435 | usb_num = (res_mem->start >> 44) & 1; | ||
| 3436 | |||
| 3437 | if (irq < 0) { | ||
| 3438 | /* Defective device tree, but we know how to fix it. */ | ||
| 3439 | irq_hw_number_t hwirq = usb_num ? (1 << 6) + 17 : 56; | ||
| 3440 | irq = irq_create_mapping(NULL, hwirq); | ||
| 3441 | } | ||
| 3460 | 3442 | ||
| 3461 | /* | 3443 | /* |
| 3462 | * Set the DMA mask to 64bits so we get buffers already translated for | 3444 | * Set the DMA mask to 64bits so we get buffers already translated for |
| @@ -3465,6 +3447,26 @@ static int octeon_usb_driver_probe(struct device *dev) | |||
| 3465 | dev->coherent_dma_mask = ~0; | 3447 | dev->coherent_dma_mask = ~0; |
| 3466 | dev->dma_mask = &dev->coherent_dma_mask; | 3448 | dev->dma_mask = &dev->coherent_dma_mask; |
| 3467 | 3449 | ||
| 3450 | /* | ||
| 3451 | * Only cn52XX and cn56XX have DWC_OTG USB hardware and the | ||
| 3452 | * IOB priority registers. Under heavy network load USB | ||
| 3453 | * hardware can be starved by the IOB causing a crash. Give | ||
| 3454 | * it a priority boost if it has been waiting more than 400 | ||
| 3455 | * cycles to avoid this situation. | ||
| 3456 | * | ||
| 3457 | * Testing indicates that a cnt_val of 8192 is not sufficient, | ||
| 3458 | * but no failures are seen with 4096. We choose a value of | ||
| 3459 | * 400 to give a safety factor of 10. | ||
| 3460 | */ | ||
| 3461 | if (OCTEON_IS_MODEL(OCTEON_CN52XX) || OCTEON_IS_MODEL(OCTEON_CN56XX)) { | ||
| 3462 | union cvmx_iob_n2c_l2c_pri_cnt pri_cnt; | ||
| 3463 | |||
| 3464 | pri_cnt.u64 = 0; | ||
| 3465 | pri_cnt.s.cnt_enb = 1; | ||
| 3466 | pri_cnt.s.cnt_val = 400; | ||
| 3467 | cvmx_write_csr(CVMX_IOB_N2C_L2C_PRI_CNT, pri_cnt.u64); | ||
| 3468 | } | ||
| 3469 | |||
| 3468 | hcd = usb_create_hcd(&octeon_hc_driver, dev, dev_name(dev)); | 3470 | hcd = usb_create_hcd(&octeon_hc_driver, dev, dev_name(dev)); |
| 3469 | if (!hcd) { | 3471 | if (!hcd) { |
| 3470 | dev_dbg(dev, "Failed to allocate memory for HCD\n"); | 3472 | dev_dbg(dev, "Failed to allocate memory for HCD\n"); |
| @@ -3478,7 +3480,7 @@ static int octeon_usb_driver_probe(struct device *dev) | |||
| 3478 | tasklet_init(&priv->dequeue_tasklet, octeon_usb_urb_dequeue_work, (unsigned long)priv); | 3480 | tasklet_init(&priv->dequeue_tasklet, octeon_usb_urb_dequeue_work, (unsigned long)priv); |
| 3479 | INIT_LIST_HEAD(&priv->dequeue_list); | 3481 | INIT_LIST_HEAD(&priv->dequeue_list); |
| 3480 | 3482 | ||
| 3481 | status = cvmx_usb_initialize(&priv->usb, usb_num); | 3483 | status = cvmx_usb_initialize(&priv->usb, usb_num, initialize_flags); |
| 3482 | if (status) { | 3484 | if (status) { |
| 3483 | dev_dbg(dev, "USB initialization failed with %d\n", status); | 3485 | dev_dbg(dev, "USB initialization failed with %d\n", status); |
| 3484 | kfree(hcd); | 3486 | kfree(hcd); |
| @@ -3492,7 +3494,7 @@ static int octeon_usb_driver_probe(struct device *dev) | |||
| 3492 | cvmx_usb_poll(&priv->usb); | 3494 | cvmx_usb_poll(&priv->usb); |
| 3493 | spin_unlock_irqrestore(&priv->lock, flags); | 3495 | spin_unlock_irqrestore(&priv->lock, flags); |
| 3494 | 3496 | ||
| 3495 | status = usb_add_hcd(hcd, irq, IRQF_SHARED); | 3497 | status = usb_add_hcd(hcd, irq, 0); |
| 3496 | if (status) { | 3498 | if (status) { |
| 3497 | dev_dbg(dev, "USB add HCD failed with %d\n", status); | 3499 | dev_dbg(dev, "USB add HCD failed with %d\n", status); |
| 3498 | kfree(hcd); | 3500 | kfree(hcd); |
| @@ -3500,14 +3502,15 @@ static int octeon_usb_driver_probe(struct device *dev) | |||
| 3500 | } | 3502 | } |
| 3501 | device_wakeup_enable(hcd->self.controller); | 3503 | device_wakeup_enable(hcd->self.controller); |
| 3502 | 3504 | ||
| 3503 | dev_dbg(dev, "Registered HCD for port %d on irq %d\n", usb_num, irq); | 3505 | dev_info(dev, "Registered HCD for port %d on irq %d\n", usb_num, irq); |
| 3504 | 3506 | ||
| 3505 | return 0; | 3507 | return 0; |
| 3506 | } | 3508 | } |
| 3507 | 3509 | ||
| 3508 | static int octeon_usb_driver_remove(struct device *dev) | 3510 | static int octeon_usb_remove(struct platform_device *pdev) |
| 3509 | { | 3511 | { |
| 3510 | int status; | 3512 | int status; |
| 3513 | struct device *dev = &pdev->dev; | ||
| 3511 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 3514 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
| 3512 | struct octeon_hcd *priv = hcd_to_octeon(hcd); | 3515 | struct octeon_hcd *priv = hcd_to_octeon(hcd); |
| 3513 | unsigned long flags; | 3516 | unsigned long flags; |
| @@ -3525,85 +3528,41 @@ static int octeon_usb_driver_remove(struct device *dev) | |||
| 3525 | return 0; | 3528 | return 0; |
| 3526 | } | 3529 | } |
| 3527 | 3530 | ||
| 3528 | static struct device_driver octeon_usb_driver = { | 3531 | static struct of_device_id octeon_usb_match[] = { |
| 3529 | .name = "OcteonUSB", | 3532 | { |
| 3530 | .bus = &platform_bus_type, | 3533 | .compatible = "cavium,octeon-5750-usbc", |
| 3531 | .probe = octeon_usb_driver_probe, | 3534 | }, |
| 3532 | .remove = octeon_usb_driver_remove, | 3535 | {}, |
| 3533 | }; | 3536 | }; |
| 3534 | 3537 | ||
| 3538 | static struct platform_driver octeon_usb_driver = { | ||
| 3539 | .driver = { | ||
| 3540 | .name = "OcteonUSB", | ||
| 3541 | .owner = THIS_MODULE, | ||
| 3542 | .of_match_table = octeon_usb_match, | ||
| 3543 | }, | ||
| 3544 | .probe = octeon_usb_probe, | ||
| 3545 | .remove = octeon_usb_remove, | ||
| 3546 | }; | ||
| 3535 | 3547 | ||
| 3536 | #define MAX_USB_PORTS 10 | 3548 | static int __init octeon_usb_driver_init(void) |
| 3537 | static struct platform_device *pdev_glob[MAX_USB_PORTS]; | ||
| 3538 | static int octeon_usb_registered; | ||
| 3539 | static int __init octeon_usb_module_init(void) | ||
| 3540 | { | 3549 | { |
| 3541 | int num_devices = cvmx_usb_get_num_ports(); | 3550 | if (usb_disabled()) |
| 3542 | int device; | 3551 | return 0; |
| 3543 | |||
| 3544 | if (usb_disabled() || num_devices == 0) | ||
| 3545 | return -ENODEV; | ||
| 3546 | |||
| 3547 | if (driver_register(&octeon_usb_driver)) | ||
| 3548 | return -ENOMEM; | ||
| 3549 | |||
| 3550 | octeon_usb_registered = 1; | ||
| 3551 | |||
| 3552 | /* | ||
| 3553 | * Only cn52XX and cn56XX have DWC_OTG USB hardware and the | ||
| 3554 | * IOB priority registers. Under heavy network load USB | ||
| 3555 | * hardware can be starved by the IOB causing a crash. Give | ||
| 3556 | * it a priority boost if it has been waiting more than 400 | ||
| 3557 | * cycles to avoid this situation. | ||
| 3558 | * | ||
| 3559 | * Testing indicates that a cnt_val of 8192 is not sufficient, | ||
| 3560 | * but no failures are seen with 4096. We choose a value of | ||
| 3561 | * 400 to give a safety factor of 10. | ||
| 3562 | */ | ||
| 3563 | if (OCTEON_IS_MODEL(OCTEON_CN52XX) || OCTEON_IS_MODEL(OCTEON_CN56XX)) { | ||
| 3564 | union cvmx_iob_n2c_l2c_pri_cnt pri_cnt; | ||
| 3565 | |||
| 3566 | pri_cnt.u64 = 0; | ||
| 3567 | pri_cnt.s.cnt_enb = 1; | ||
| 3568 | pri_cnt.s.cnt_val = 400; | ||
| 3569 | cvmx_write_csr(CVMX_IOB_N2C_L2C_PRI_CNT, pri_cnt.u64); | ||
| 3570 | } | ||
| 3571 | |||
| 3572 | for (device = 0; device < num_devices; device++) { | ||
| 3573 | struct resource irq_resource; | ||
| 3574 | struct platform_device *pdev; | ||
| 3575 | memset(&irq_resource, 0, sizeof(irq_resource)); | ||
| 3576 | irq_resource.start = (device == 0) ? OCTEON_IRQ_USB0 : OCTEON_IRQ_USB1; | ||
| 3577 | irq_resource.end = irq_resource.start; | ||
| 3578 | irq_resource.flags = IORESOURCE_IRQ; | ||
| 3579 | pdev = platform_device_register_simple((char *)octeon_usb_driver. name, device, &irq_resource, 1); | ||
| 3580 | if (IS_ERR(pdev)) { | ||
| 3581 | driver_unregister(&octeon_usb_driver); | ||
| 3582 | octeon_usb_registered = 0; | ||
| 3583 | return PTR_ERR(pdev); | ||
| 3584 | } | ||
| 3585 | if (device < MAX_USB_PORTS) | ||
| 3586 | pdev_glob[device] = pdev; | ||
| 3587 | 3552 | ||
| 3588 | } | 3553 | return platform_driver_register(&octeon_usb_driver); |
| 3589 | return 0; | ||
| 3590 | } | 3554 | } |
| 3555 | module_init(octeon_usb_driver_init); | ||
| 3591 | 3556 | ||
| 3592 | static void __exit octeon_usb_module_cleanup(void) | 3557 | static void __exit octeon_usb_driver_exit(void) |
| 3593 | { | 3558 | { |
| 3594 | int i; | 3559 | if (usb_disabled()) |
| 3560 | return; | ||
| 3595 | 3561 | ||
| 3596 | for (i = 0; i < MAX_USB_PORTS; i++) | 3562 | platform_driver_unregister(&octeon_usb_driver); |
| 3597 | if (pdev_glob[i]) { | ||
| 3598 | platform_device_unregister(pdev_glob[i]); | ||
| 3599 | pdev_glob[i] = NULL; | ||
| 3600 | } | ||
| 3601 | if (octeon_usb_registered) | ||
| 3602 | driver_unregister(&octeon_usb_driver); | ||
| 3603 | } | 3563 | } |
| 3564 | module_exit(octeon_usb_driver_exit); | ||
| 3604 | 3565 | ||
| 3605 | MODULE_LICENSE("GPL"); | 3566 | MODULE_LICENSE("GPL"); |
| 3606 | MODULE_AUTHOR("Cavium Networks <support@caviumnetworks.com>"); | 3567 | MODULE_AUTHOR("Cavium, Inc. <support@cavium.com>"); |
| 3607 | MODULE_DESCRIPTION("Cavium Networks Octeon USB Host driver."); | 3568 | MODULE_DESCRIPTION("Cavium Inc. OCTEON USB Host driver."); |
| 3608 | module_init(octeon_usb_module_init); | ||
| 3609 | module_exit(octeon_usb_module_cleanup); | ||
diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c index cb060364dfe7..5d965cf06d59 100644 --- a/drivers/staging/ozwpan/ozproto.c +++ b/drivers/staging/ozwpan/ozproto.c | |||
| @@ -668,8 +668,8 @@ void oz_binding_add(const char *net_dev) | |||
| 668 | if (binding) { | 668 | if (binding) { |
| 669 | binding->ptype.type = __constant_htons(OZ_ETHERTYPE); | 669 | binding->ptype.type = __constant_htons(OZ_ETHERTYPE); |
| 670 | binding->ptype.func = oz_pkt_recv; | 670 | binding->ptype.func = oz_pkt_recv; |
| 671 | memcpy(binding->name, net_dev, OZ_MAX_BINDING_LEN); | ||
| 672 | if (net_dev && *net_dev) { | 671 | if (net_dev && *net_dev) { |
| 672 | memcpy(binding->name, net_dev, OZ_MAX_BINDING_LEN); | ||
| 673 | oz_dbg(ON, "Adding binding: %s\n", net_dev); | 673 | oz_dbg(ON, "Adding binding: %s\n", net_dev); |
| 674 | binding->ptype.dev = | 674 | binding->ptype.dev = |
| 675 | dev_get_by_name(&init_net, net_dev); | 675 | dev_get_by_name(&init_net, net_dev); |
| @@ -680,6 +680,7 @@ void oz_binding_add(const char *net_dev) | |||
| 680 | } | 680 | } |
| 681 | } else { | 681 | } else { |
| 682 | oz_dbg(ON, "Binding to all netcards\n"); | 682 | oz_dbg(ON, "Binding to all netcards\n"); |
| 683 | memset(binding->name, 0, OZ_MAX_BINDING_LEN); | ||
| 683 | binding->ptype.dev = NULL; | 684 | binding->ptype.dev = NULL; |
| 684 | } | 685 | } |
| 685 | if (binding) { | 686 | if (binding) { |
diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index 153ec61493ab..96df62f95b6b 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c | |||
| @@ -912,12 +912,12 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) | |||
| 912 | unsigned char *pbuf; | 912 | unsigned char *pbuf; |
| 913 | u32 wpa_ielen = 0; | 913 | u32 wpa_ielen = 0; |
| 914 | u8 *pbssid = GetAddr3Ptr(pframe); | 914 | u8 *pbssid = GetAddr3Ptr(pframe); |
| 915 | u32 hidden_ssid = 0; | ||
| 916 | struct HT_info_element *pht_info = NULL; | 915 | struct HT_info_element *pht_info = NULL; |
| 917 | struct rtw_ieee80211_ht_cap *pht_cap = NULL; | 916 | struct rtw_ieee80211_ht_cap *pht_cap = NULL; |
| 918 | u32 bcn_channel; | 917 | u32 bcn_channel; |
| 919 | unsigned short ht_cap_info; | 918 | unsigned short ht_cap_info; |
| 920 | unsigned char ht_info_infos_0; | 919 | unsigned char ht_info_infos_0; |
| 920 | int ssid_len; | ||
| 921 | 921 | ||
| 922 | if (is_client_associated_to_ap(Adapter) == false) | 922 | if (is_client_associated_to_ap(Adapter) == false) |
| 923 | return true; | 923 | return true; |
| @@ -999,21 +999,15 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) | |||
| 999 | } | 999 | } |
| 1000 | 1000 | ||
| 1001 | /* checking SSID */ | 1001 | /* checking SSID */ |
| 1002 | ssid_len = 0; | ||
| 1002 | p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SSID_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_); | 1003 | p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SSID_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_); |
| 1003 | if (p == NULL) { | 1004 | if (p) { |
| 1004 | DBG_88E("%s marc: cannot find SSID for survey event\n", __func__); | 1005 | ssid_len = *(p + 1); |
| 1005 | hidden_ssid = true; | 1006 | if (ssid_len > NDIS_802_11_LENGTH_SSID) |
| 1006 | } else { | 1007 | ssid_len = 0; |
| 1007 | hidden_ssid = false; | ||
| 1008 | } | ||
| 1009 | |||
| 1010 | if ((NULL != p) && (false == hidden_ssid && (*(p + 1)))) { | ||
| 1011 | memcpy(bssid->Ssid.Ssid, (p + 2), *(p + 1)); | ||
| 1012 | bssid->Ssid.SsidLength = *(p + 1); | ||
| 1013 | } else { | ||
| 1014 | bssid->Ssid.SsidLength = 0; | ||
| 1015 | bssid->Ssid.Ssid[0] = '\0'; | ||
| 1016 | } | 1008 | } |
| 1009 | memcpy(bssid->Ssid.Ssid, (p + 2), ssid_len); | ||
| 1010 | bssid->Ssid.SsidLength = ssid_len; | ||
| 1017 | 1011 | ||
| 1018 | RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("%s bssid.Ssid.Ssid:%s bssid.Ssid.SsidLength:%d " | 1012 | RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("%s bssid.Ssid.Ssid:%s bssid.Ssid.SsidLength:%d " |
| 1019 | "cur_network->network.Ssid.Ssid:%s len:%d\n", __func__, bssid->Ssid.Ssid, | 1013 | "cur_network->network.Ssid.Ssid:%s len:%d\n", __func__, bssid->Ssid.Ssid, |
diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c index dec992569476..4ad80ae1067f 100644 --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | |||
| @@ -2500,7 +2500,7 @@ static int rtw_mp_ioctl_hdl(struct net_device *dev, struct iw_request_info *info | |||
| 2500 | ("rtw_mp_ioctl_hdl: subcode [%d], len[%d], buffer_len[%d]\r\n", | 2500 | ("rtw_mp_ioctl_hdl: subcode [%d], len[%d], buffer_len[%d]\r\n", |
| 2501 | poidparam->subcode, poidparam->len, len)); | 2501 | poidparam->subcode, poidparam->len, len)); |
| 2502 | 2502 | ||
| 2503 | if (poidparam->subcode >= MAX_MP_IOCTL_SUBCODE) { | 2503 | if (poidparam->subcode >= ARRAY_SIZE(mp_ioctl_hdl)) { |
| 2504 | RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, ("no matching drvext subcodes\r\n")); | 2504 | RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, ("no matching drvext subcodes\r\n")); |
| 2505 | ret = -EINVAL; | 2505 | ret = -EINVAL; |
| 2506 | goto _rtw_mp_ioctl_hdl_exit; | 2506 | goto _rtw_mp_ioctl_hdl_exit; |
| @@ -3164,9 +3164,7 @@ static int rtw_p2p_get_go_device_address(struct net_device *dev, | |||
| 3164 | u8 *p2pie; | 3164 | u8 *p2pie; |
| 3165 | uint p2pielen = 0, attr_contentlen = 0; | 3165 | uint p2pielen = 0, attr_contentlen = 0; |
| 3166 | u8 attr_content[100] = {0x00}; | 3166 | u8 attr_content[100] = {0x00}; |
| 3167 | 3167 | u8 go_devadd_str[17 + 12] = {}; | |
| 3168 | u8 go_devadd_str[17 + 10] = {0x00}; | ||
| 3169 | /* +10 is for the str "go_devadd =", we have to clear it at wrqu->data.pointer */ | ||
| 3170 | 3168 | ||
| 3171 | /* Commented by Albert 20121209 */ | 3169 | /* Commented by Albert 20121209 */ |
| 3172 | /* The input data is the GO's interface address which the application wants to know its device address. */ | 3170 | /* 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, | |||
| 3223 | spin_unlock_bh(&pmlmepriv->scanned_queue.lock); | 3221 | spin_unlock_bh(&pmlmepriv->scanned_queue.lock); |
| 3224 | 3222 | ||
| 3225 | if (!blnMatch) | 3223 | if (!blnMatch) |
| 3226 | sprintf(go_devadd_str, "\n\ndev_add = NULL"); | 3224 | snprintf(go_devadd_str, sizeof(go_devadd_str), "\n\ndev_add = NULL"); |
| 3227 | else | 3225 | else |
| 3228 | sprintf(go_devadd_str, "\n\ndev_add =%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", | 3226 | snprintf(go_devadd_str, sizeof(go_devadd_str), "\n\ndev_add =%.2X:%.2X:%.2X:%.2X:%.2X:%.2X", |
| 3229 | attr_content[0], attr_content[1], attr_content[2], attr_content[3], attr_content[4], attr_content[5]); | 3227 | attr_content[0], attr_content[1], attr_content[2], attr_content[3], attr_content[4], attr_content[5]); |
| 3230 | 3228 | ||
| 3231 | if (copy_to_user(wrqu->data.pointer, go_devadd_str, 10 + 17)) | 3229 | if (copy_to_user(wrqu->data.pointer, go_devadd_str, sizeof(go_devadd_str))) |
| 3232 | return -EFAULT; | 3230 | return -EFAULT; |
| 3233 | return ret; | 3231 | return ret; |
| 3234 | } | 3232 | } |
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 0a341d6ec51f..a70dcef1419e 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c | |||
| @@ -53,7 +53,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = { | |||
| 53 | {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */ | 53 | {USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */ |
| 54 | /*=== Customer ID ===*/ | 54 | /*=== Customer ID ===*/ |
| 55 | /****** 8188EUS ********/ | 55 | /****** 8188EUS ********/ |
| 56 | {USB_DEVICE(0x8179, 0x07B8)}, /* Abocom - Abocom */ | 56 | {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ |
| 57 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ | 57 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ |
| 58 | {} /* Terminating entry */ | 58 | {} /* Terminating entry */ |
| 59 | }; | 59 | }; |
diff --git a/drivers/staging/rtl8821ae/Kconfig b/drivers/staging/rtl8821ae/Kconfig index 2aa5dac2f1df..abccc9dabd65 100644 --- a/drivers/staging/rtl8821ae/Kconfig +++ b/drivers/staging/rtl8821ae/Kconfig | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | config R8821AE | 1 | config R8821AE |
| 2 | tristate "RealTek RTL8821AE Wireless LAN NIC driver" | 2 | tristate "RealTek RTL8821AE Wireless LAN NIC driver" |
| 3 | depends on PCI && WLAN | 3 | depends on PCI && WLAN && MAC80211 |
| 4 | depends on m | 4 | depends on m |
| 5 | select WIRELESS_EXT | 5 | select WIRELESS_EXT |
| 6 | select WEXT_PRIV | 6 | select WEXT_PRIV |
diff --git a/drivers/staging/rtl8821ae/wifi.h b/drivers/staging/rtl8821ae/wifi.h index cfe88a1efd55..76bef93ad70a 100644 --- a/drivers/staging/rtl8821ae/wifi.h +++ b/drivers/staging/rtl8821ae/wifi.h | |||
| @@ -1414,7 +1414,7 @@ struct rtl_dm { | |||
| 1414 | 1414 | ||
| 1415 | 1415 | ||
| 1416 | /*88e tx power tracking*/ | 1416 | /*88e tx power tracking*/ |
| 1417 | u8 bb_swing_idx_ofdm[2]; | 1417 | u8 bb_swing_idx_ofdm[MAX_RF_PATH]; |
| 1418 | u8 bb_swing_idx_ofdm_current; | 1418 | u8 bb_swing_idx_ofdm_current; |
| 1419 | u8 bb_swing_idx_ofdm_base[MAX_RF_PATH]; | 1419 | u8 bb_swing_idx_ofdm_base[MAX_RF_PATH]; |
| 1420 | bool bb_swing_flag_Ofdm; | 1420 | bool bb_swing_flag_Ofdm; |
diff --git a/drivers/staging/usbip/userspace/libsrc/names.c b/drivers/staging/usbip/userspace/libsrc/names.c index 3c8d28b771e0..81ff8522405c 100644 --- a/drivers/staging/usbip/userspace/libsrc/names.c +++ b/drivers/staging/usbip/userspace/libsrc/names.c | |||
| @@ -169,14 +169,14 @@ static void *my_malloc(size_t size) | |||
| 169 | struct pool *p; | 169 | struct pool *p; |
| 170 | 170 | ||
| 171 | p = calloc(1, sizeof(struct pool)); | 171 | p = calloc(1, sizeof(struct pool)); |
| 172 | if (!p) { | 172 | if (!p) |
| 173 | free(p); | ||
| 174 | return NULL; | 173 | return NULL; |
| 175 | } | ||
| 176 | 174 | ||
| 177 | p->mem = calloc(1, size); | 175 | p->mem = calloc(1, size); |
| 178 | if (!p->mem) | 176 | if (!p->mem) { |
| 177 | free(p); | ||
| 179 | return NULL; | 178 | return NULL; |
| 179 | } | ||
| 180 | 180 | ||
| 181 | p->next = pool_head; | 181 | p->next = pool_head; |
| 182 | pool_head = p; | 182 | pool_head = p; |
diff --git a/drivers/staging/usbip/vhci_sysfs.c b/drivers/staging/usbip/vhci_sysfs.c index 9b51586d11d9..0141bc34d5cc 100644 --- a/drivers/staging/usbip/vhci_sysfs.c +++ b/drivers/staging/usbip/vhci_sysfs.c | |||
| @@ -149,7 +149,8 @@ static int valid_args(__u32 rhport, enum usb_device_speed speed) | |||
| 149 | case USB_SPEED_WIRELESS: | 149 | case USB_SPEED_WIRELESS: |
| 150 | break; | 150 | break; |
| 151 | default: | 151 | default: |
| 152 | pr_err("speed %d\n", speed); | 152 | pr_err("Failed attach request for unsupported USB speed: %s\n", |
| 153 | usb_speed_string(speed)); | ||
| 153 | return -EINVAL; | 154 | return -EINVAL; |
| 154 | } | 155 | } |
| 155 | 156 | ||
diff --git a/drivers/staging/wlags49_h2/wl_wext.c b/drivers/staging/wlags49_h2/wl_wext.c index 4a1ddaf5e00f..187fc060de26 100644 --- a/drivers/staging/wlags49_h2/wl_wext.c +++ b/drivers/staging/wlags49_h2/wl_wext.c | |||
| @@ -1061,7 +1061,7 @@ static int wireless_set_essid(struct net_device *dev, struct iw_request_info *in | |||
| 1061 | goto out; | 1061 | goto out; |
| 1062 | } | 1062 | } |
| 1063 | 1063 | ||
| 1064 | if (data->flags != 0 && data->length > HCF_MAX_NAME_LEN + 1) { | 1064 | if (data->flags != 0 && data->length > HCF_MAX_NAME_LEN) { |
| 1065 | ret = -EINVAL; | 1065 | ret = -EINVAL; |
| 1066 | goto out; | 1066 | goto out; |
| 1067 | } | 1067 | } |
