You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge tag 'staging-3.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver fixes from Greg KH: "Here are a number (lots, I know) of fixes for staging drivers to resolve a bunch of reported issues. The largest patches here is one revert of a patch that is in 3.14-rc1 to fix reported problems, and a sync of a usb host driver that required some ARM patches to go in before it could be accepted (which is why it missed -rc1) All of these have been in linux-next for a while with no reported issues" * tag 'staging-3.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (56 commits) staging/rtl8821ae: fix build, depends on MAC80211 iio: max1363: Use devm_regulator_get_optional for optional regulator iio:accel:bma180: Use modifier instead of index in channel specification iio: adis16400: Set timestamp as the last element in chan_spec iio: ak8975: Fix calculation formula for convert micro tesla to gauss unit staging:iio:ad799x fix typo in ad799x_events[] iio: mxs-lradc: remove useless scale_available files iio: mxs-lradc: fix buffer overflow iio:magnetometer:mag3110: Fix output of decimal digits in show_int_plus_micros() iio:magnetometer:mag3110: Report busy in _read_raw() / write_raw() when buffer is enabled wlags49_h2: Fix overflow in wireless_set_essid() xlr_net: Fix missing trivial allocation check staging: r8188eu: overflow in rtw_p2p_get_go_device_address() staging: r8188eu: array overflow in rtw_mp_ioctl_hdl() staging: r8188eu: Fix typo in USB_DEVICE list usbip/userspace/libsrc/names.c: memory leak gpu: ion: dereferencing an ERR_PTR staging: comedi: usbduxsigma: fix unaligned dereferences staging: comedi: fix too early cleanup in comedi_auto_config() staging: android: ion: dummy: fix an error code ...
This commit is contained in:
@@ -447,14 +447,14 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = {
|
||||
{ },
|
||||
};
|
||||
|
||||
#define BMA180_CHANNEL(_index) { \
|
||||
#define BMA180_CHANNEL(_axis) { \
|
||||
.type = IIO_ACCEL, \
|
||||
.indexed = 1, \
|
||||
.channel = (_index), \
|
||||
.modified = 1, \
|
||||
.channel2 = IIO_MOD_##_axis, \
|
||||
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
|
||||
BIT(IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY), \
|
||||
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
|
||||
.scan_index = (_index), \
|
||||
.scan_index = AXIS_##_axis, \
|
||||
.scan_type = { \
|
||||
.sign = 's', \
|
||||
.realbits = 14, \
|
||||
@@ -465,10 +465,10 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = {
|
||||
}
|
||||
|
||||
static const struct iio_chan_spec bma180_channels[] = {
|
||||
BMA180_CHANNEL(AXIS_X),
|
||||
BMA180_CHANNEL(AXIS_Y),
|
||||
BMA180_CHANNEL(AXIS_Z),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(4),
|
||||
BMA180_CHANNEL(X),
|
||||
BMA180_CHANNEL(Y),
|
||||
BMA180_CHANNEL(Z),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(3),
|
||||
};
|
||||
|
||||
static irqreturn_t bma180_trigger_handler(int irq, void *p)
|
||||
|
||||
@@ -1560,7 +1560,7 @@ static int max1363_probe(struct i2c_client *client,
|
||||
st->client = client;
|
||||
|
||||
st->vref_uv = st->chip_info->int_vref_mv * 1000;
|
||||
vref = devm_regulator_get(&client->dev, "vref");
|
||||
vref = devm_regulator_get_optional(&client->dev, "vref");
|
||||
if (!IS_ERR(vref)) {
|
||||
int vref_uv;
|
||||
|
||||
|
||||
@@ -189,6 +189,7 @@ enum {
|
||||
ADIS16300_SCAN_INCLI_X,
|
||||
ADIS16300_SCAN_INCLI_Y,
|
||||
ADIS16400_SCAN_ADC,
|
||||
ADIS16400_SCAN_TIMESTAMP,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_IIO_BUFFER
|
||||
|
||||
@@ -632,7 +632,7 @@ static const struct iio_chan_spec adis16400_channels[] = {
|
||||
ADIS16400_MAGN_CHAN(Z, ADIS16400_ZMAGN_OUT, 14),
|
||||
ADIS16400_TEMP_CHAN(ADIS16400_TEMP_OUT, 12),
|
||||
ADIS16400_AUX_ADC_CHAN(ADIS16400_AUX_ADC, 12),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(12)
|
||||
IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
|
||||
};
|
||||
|
||||
static const struct iio_chan_spec adis16448_channels[] = {
|
||||
@@ -659,7 +659,7 @@ static const struct iio_chan_spec adis16448_channels[] = {
|
||||
},
|
||||
},
|
||||
ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(11)
|
||||
IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
|
||||
};
|
||||
|
||||
static const struct iio_chan_spec adis16350_channels[] = {
|
||||
@@ -677,7 +677,7 @@ static const struct iio_chan_spec adis16350_channels[] = {
|
||||
ADIS16400_MOD_TEMP_CHAN(X, ADIS16350_XTEMP_OUT, 12),
|
||||
ADIS16400_MOD_TEMP_CHAN(Y, ADIS16350_YTEMP_OUT, 12),
|
||||
ADIS16400_MOD_TEMP_CHAN(Z, ADIS16350_ZTEMP_OUT, 12),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(11)
|
||||
IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
|
||||
};
|
||||
|
||||
static const struct iio_chan_spec adis16300_channels[] = {
|
||||
@@ -690,7 +690,7 @@ static const struct iio_chan_spec adis16300_channels[] = {
|
||||
ADIS16400_AUX_ADC_CHAN(ADIS16300_AUX_ADC, 12),
|
||||
ADIS16400_INCLI_CHAN(X, ADIS16300_PITCH_OUT, 13),
|
||||
ADIS16400_INCLI_CHAN(Y, ADIS16300_ROLL_OUT, 13),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(14)
|
||||
IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
|
||||
};
|
||||
|
||||
static const struct iio_chan_spec adis16334_channels[] = {
|
||||
@@ -701,7 +701,7 @@ static const struct iio_chan_spec adis16334_channels[] = {
|
||||
ADIS16400_ACCEL_CHAN(Y, ADIS16400_YACCL_OUT, 14),
|
||||
ADIS16400_ACCEL_CHAN(Z, ADIS16400_ZACCL_OUT, 14),
|
||||
ADIS16400_TEMP_CHAN(ADIS16350_XTEMP_OUT, 12),
|
||||
IIO_CHAN_SOFT_TIMESTAMP(8)
|
||||
IIO_CHAN_SOFT_TIMESTAMP(ADIS16400_SCAN_TIMESTAMP),
|
||||
};
|
||||
|
||||
static struct attribute *adis16400_attributes[] = {
|
||||
|
||||
@@ -460,10 +460,14 @@ static int tsl2563_write_raw(struct iio_dev *indio_dev,
|
||||
{
|
||||
struct tsl2563_chip *chip = iio_priv(indio_dev);
|
||||
|
||||
if (chan->channel == IIO_MOD_LIGHT_BOTH)
|
||||
if (mask != IIO_CHAN_INFO_CALIBSCALE)
|
||||
return -EINVAL;
|
||||
if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
|
||||
chip->calib0 = calib_from_sysfs(val);
|
||||
else
|
||||
else if (chan->channel2 == IIO_MOD_LIGHT_IR)
|
||||
chip->calib1 = calib_from_sysfs(val);
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -472,14 +476,14 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
|
||||
struct iio_chan_spec const *chan,
|
||||
int *val,
|
||||
int *val2,
|
||||
long m)
|
||||
long mask)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
u32 calib0, calib1;
|
||||
struct tsl2563_chip *chip = iio_priv(indio_dev);
|
||||
|
||||
mutex_lock(&chip->lock);
|
||||
switch (m) {
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
case IIO_CHAN_INFO_PROCESSED:
|
||||
switch (chan->type) {
|
||||
@@ -498,7 +502,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
|
||||
ret = tsl2563_get_adc(chip);
|
||||
if (ret)
|
||||
goto error_ret;
|
||||
if (chan->channel == 0)
|
||||
if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
|
||||
*val = chip->data0;
|
||||
else
|
||||
*val = chip->data1;
|
||||
@@ -510,7 +514,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
|
||||
break;
|
||||
|
||||
case IIO_CHAN_INFO_CALIBSCALE:
|
||||
if (chan->channel == 0)
|
||||
if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
|
||||
*val = calib_to_sysfs(chip->calib0);
|
||||
else
|
||||
*val = calib_to_sysfs(chip->calib1);
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
#define AK8975_MAX_CONVERSION_TIMEOUT 500
|
||||
#define AK8975_CONVERSION_DONE_POLL_TIME 10
|
||||
#define AK8975_DATA_READY_TIMEOUT ((100*HZ)/1000)
|
||||
#define RAW_TO_GAUSS(asa) ((((asa) + 128) * 3000) / 256)
|
||||
|
||||
/*
|
||||
* Per-instance context data for the device.
|
||||
@@ -265,15 +266,15 @@ static int ak8975_setup(struct i2c_client *client)
|
||||
*
|
||||
* Since 1uT = 0.01 gauss, our final scale factor becomes:
|
||||
*
|
||||
* Hadj = H * ((ASA + 128) / 256) * 3/10 * 100
|
||||
* Hadj = H * ((ASA + 128) * 30 / 256
|
||||
* Hadj = H * ((ASA + 128) / 256) * 3/10 * 1/100
|
||||
* Hadj = H * ((ASA + 128) * 0.003) / 256
|
||||
*
|
||||
* Since ASA doesn't change, we cache the resultant scale factor into the
|
||||
* device context in ak8975_setup().
|
||||
*/
|
||||
data->raw_to_gauss[0] = ((data->asa[0] + 128) * 30) >> 8;
|
||||
data->raw_to_gauss[1] = ((data->asa[1] + 128) * 30) >> 8;
|
||||
data->raw_to_gauss[2] = ((data->asa[2] + 128) * 30) >> 8;
|
||||
data->raw_to_gauss[0] = RAW_TO_GAUSS(data->asa[0]);
|
||||
data->raw_to_gauss[1] = RAW_TO_GAUSS(data->asa[1]);
|
||||
data->raw_to_gauss[2] = RAW_TO_GAUSS(data->asa[2]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -428,8 +429,9 @@ static int ak8975_read_raw(struct iio_dev *indio_dev,
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
return ak8975_read_axis(indio_dev, chan->address, val);
|
||||
case IIO_CHAN_INFO_SCALE:
|
||||
*val = data->raw_to_gauss[chan->address];
|
||||
return IIO_VAL_INT;
|
||||
*val = 0;
|
||||
*val2 = data->raw_to_gauss[chan->address];
|
||||
return IIO_VAL_INT_PLUS_MICRO;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ static ssize_t mag3110_show_int_plus_micros(char *buf,
|
||||
|
||||
while (n-- > 0)
|
||||
len += scnprintf(buf + len, PAGE_SIZE - len,
|
||||
"%d.%d ", vals[n][0], vals[n][1]);
|
||||
"%d.%06d ", vals[n][0], vals[n][1]);
|
||||
|
||||
/* replace trailing space by newline */
|
||||
buf[len - 1] = '\n';
|
||||
@@ -154,6 +154,9 @@ static int mag3110_read_raw(struct iio_dev *indio_dev,
|
||||
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
if (iio_buffer_enabled(indio_dev))
|
||||
return -EBUSY;
|
||||
|
||||
switch (chan->type) {
|
||||
case IIO_MAGN: /* in 0.1 uT / LSB */
|
||||
ret = mag3110_read(data, buffer);
|
||||
@@ -199,6 +202,9 @@ static int mag3110_write_raw(struct iio_dev *indio_dev,
|
||||
struct mag3110_data *data = iio_priv(indio_dev);
|
||||
int rate;
|
||||
|
||||
if (iio_buffer_enabled(indio_dev))
|
||||
return -EBUSY;
|
||||
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_SAMP_FREQ:
|
||||
rate = mag3110_get_samp_freq_index(data, val, val2);
|
||||
|
||||
@@ -295,21 +295,29 @@ static ssize_t ashmem_read(struct file *file, char __user *buf,
|
||||
|
||||
/* If size is not set, or set to 0, always return EOF. */
|
||||
if (asma->size == 0)
|
||||
goto out;
|
||||
goto out_unlock;
|
||||
|
||||
if (!asma->file) {
|
||||
ret = -EBADF;
|
||||
goto out;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
|
||||
/*
|
||||
* asma and asma->file are used outside the lock here. We assume
|
||||
* once asma->file is set it will never be changed, and will not
|
||||
* be destroyed until all references to the file are dropped and
|
||||
* ashmem_release is called.
|
||||
*/
|
||||
ret = asma->file->f_op->read(asma->file, buf, len, pos);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
if (ret >= 0) {
|
||||
/** Update backing file pos, since f_ops->read() doesn't */
|
||||
asma->file->f_pos = *pos;
|
||||
}
|
||||
return ret;
|
||||
|
||||
/** Update backing file pos, since f_ops->read() doesn't */
|
||||
asma->file->f_pos = *pos;
|
||||
|
||||
out:
|
||||
out_unlock:
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
return ret;
|
||||
}
|
||||
@@ -498,6 +506,7 @@ out:
|
||||
|
||||
static int set_name(struct ashmem_area *asma, void __user *name)
|
||||
{
|
||||
int len;
|
||||
int ret = 0;
|
||||
char local_name[ASHMEM_NAME_LEN];
|
||||
|
||||
@@ -510,21 +519,19 @@ static int set_name(struct ashmem_area *asma, void __user *name)
|
||||
* variable that does not need protection and later copy the local
|
||||
* variable to the structure member with lock held.
|
||||
*/
|
||||
if (copy_from_user(local_name, name, ASHMEM_NAME_LEN))
|
||||
return -EFAULT;
|
||||
|
||||
len = strncpy_from_user(local_name, name, ASHMEM_NAME_LEN);
|
||||
if (len < 0)
|
||||
return len;
|
||||
if (len == ASHMEM_NAME_LEN)
|
||||
local_name[ASHMEM_NAME_LEN - 1] = '\0';
|
||||
mutex_lock(&ashmem_mutex);
|
||||
/* cannot change an existing mapping's name */
|
||||
if (unlikely(asma->file)) {
|
||||
if (unlikely(asma->file))
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
memcpy(asma->name + ASHMEM_NAME_PREFIX_LEN,
|
||||
local_name, ASHMEM_NAME_LEN);
|
||||
asma->name[ASHMEM_FULL_NAME_LEN-1] = '\0';
|
||||
out:
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
else
|
||||
strcpy(asma->name + ASHMEM_NAME_PREFIX_LEN, local_name);
|
||||
|
||||
mutex_unlock(&ashmem_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,14 @@ struct compat_ion_custom_data {
|
||||
compat_ulong_t arg;
|
||||
};
|
||||
|
||||
struct compat_ion_handle_data {
|
||||
compat_int_t handle;
|
||||
};
|
||||
|
||||
#define COMPAT_ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \
|
||||
struct compat_ion_allocation_data)
|
||||
#define COMPAT_ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
|
||||
#define COMPAT_ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, \
|
||||
struct compat_ion_handle_data)
|
||||
#define COMPAT_ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, \
|
||||
struct compat_ion_custom_data)
|
||||
|
||||
@@ -64,6 +69,19 @@ static int compat_get_ion_allocation_data(
|
||||
return err;
|
||||
}
|
||||
|
||||
static int compat_get_ion_handle_data(
|
||||
struct compat_ion_handle_data __user *data32,
|
||||
struct ion_handle_data __user *data)
|
||||
{
|
||||
compat_int_t i;
|
||||
int err;
|
||||
|
||||
err = get_user(i, &data32->handle);
|
||||
err |= put_user(i, &data->handle);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int compat_put_ion_allocation_data(
|
||||
struct compat_ion_allocation_data __user *data32,
|
||||
struct ion_allocation_data __user *data)
|
||||
@@ -132,8 +150,8 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
}
|
||||
case COMPAT_ION_IOC_FREE:
|
||||
{
|
||||
struct compat_ion_allocation_data __user *data32;
|
||||
struct ion_allocation_data __user *data;
|
||||
struct compat_ion_handle_data __user *data32;
|
||||
struct ion_handle_data __user *data;
|
||||
int err;
|
||||
|
||||
data32 = compat_ptr(arg);
|
||||
@@ -141,7 +159,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
if (data == NULL)
|
||||
return -EFAULT;
|
||||
|
||||
err = compat_get_ion_allocation_data(data32, data);
|
||||
err = compat_get_ion_handle_data(data32, data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
#include <linux/err.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/sizes.h>
|
||||
#include <linux/io.h>
|
||||
#include "ion.h"
|
||||
#include "ion_priv.h"
|
||||
|
||||
@@ -57,7 +59,7 @@ struct ion_platform_heap dummy_heaps[] = {
|
||||
};
|
||||
|
||||
struct ion_platform_data dummy_ion_pdata = {
|
||||
.nr = 4,
|
||||
.nr = ARRAY_SIZE(dummy_heaps),
|
||||
.heaps = dummy_heaps,
|
||||
};
|
||||
|
||||
@@ -69,7 +71,7 @@ static int __init ion_dummy_init(void)
|
||||
heaps = kzalloc(sizeof(struct ion_heap *) * dummy_ion_pdata.nr,
|
||||
GFP_KERNEL);
|
||||
if (!heaps)
|
||||
return PTR_ERR(heaps);
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
/* Allocate a dummy carveout heap */
|
||||
@@ -128,6 +130,7 @@ err:
|
||||
}
|
||||
return err;
|
||||
}
|
||||
device_initcall(ion_dummy_init);
|
||||
|
||||
static void __exit ion_dummy_exit(void)
|
||||
{
|
||||
@@ -152,7 +155,4 @@ static void __exit ion_dummy_exit(void)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
module_init(ion_dummy_init);
|
||||
module_exit(ion_dummy_exit);
|
||||
|
||||
__exitcall(ion_dummy_exit);
|
||||
|
||||
@@ -243,12 +243,12 @@ int ion_heap_init_deferred_free(struct ion_heap *heap)
|
||||
init_waitqueue_head(&heap->waitqueue);
|
||||
heap->task = kthread_run(ion_heap_deferred_free, heap,
|
||||
"%s", heap->name);
|
||||
sched_setscheduler(heap->task, SCHED_IDLE, ¶m);
|
||||
if (IS_ERR(heap->task)) {
|
||||
pr_err("%s: creating thread for deferred free failed\n",
|
||||
__func__);
|
||||
return PTR_RET(heap->task);
|
||||
}
|
||||
sched_setscheduler(heap->task, SCHED_IDLE, ¶m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#ifndef _ION_PRIV_H
|
||||
#define _ION_PRIV_H
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/dma-direction.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/mm_types.h>
|
||||
|
||||
@@ -124,6 +124,7 @@ static struct page_info *alloc_largest_available(struct ion_system_heap *heap,
|
||||
|
||||
info->page = page;
|
||||
info->order = orders[i];
|
||||
INIT_LIST_HEAD(&info->list);
|
||||
return info;
|
||||
}
|
||||
kfree(info);
|
||||
@@ -145,12 +146,15 @@ static int ion_system_heap_allocate(struct ion_heap *heap,
|
||||
struct list_head pages;
|
||||
struct page_info *info, *tmp_info;
|
||||
int i = 0;
|
||||
long size_remaining = PAGE_ALIGN(size);
|
||||
unsigned long size_remaining = PAGE_ALIGN(size);
|
||||
unsigned int max_order = orders[0];
|
||||
|
||||
if (align > PAGE_SIZE)
|
||||
return -EINVAL;
|
||||
|
||||
if (size / PAGE_SIZE > totalram_pages / 2)
|
||||
return -ENOMEM;
|
||||
|
||||
INIT_LIST_HEAD(&pages);
|
||||
while (size_remaining > 0) {
|
||||
info = alloc_largest_available(sys_heap, buffer, size_remaining,
|
||||
|
||||
@@ -35,10 +35,27 @@ struct sw_sync_pt {
|
||||
u32 value;
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_SW_SYNC)
|
||||
struct sw_sync_timeline *sw_sync_timeline_create(const char *name);
|
||||
void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc);
|
||||
|
||||
struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value);
|
||||
#else
|
||||
static inline struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
|
||||
{
|
||||
}
|
||||
|
||||
static inline struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj,
|
||||
u32 value)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif /* IS_ENABLED(CONFIG_SW_SYNC) */
|
||||
|
||||
#endif /* __KERNEL __ */
|
||||
|
||||
|
||||
@@ -79,27 +79,27 @@ static void sync_timeline_free(struct kref *kref)
|
||||
container_of(kref, struct sync_timeline, kref);
|
||||
unsigned long flags;
|
||||
|
||||
if (obj->ops->release_obj)
|
||||
obj->ops->release_obj(obj);
|
||||
|
||||
spin_lock_irqsave(&sync_timeline_list_lock, flags);
|
||||
list_del(&obj->sync_timeline_list);
|
||||
spin_unlock_irqrestore(&sync_timeline_list_lock, flags);
|
||||
|
||||
if (obj->ops->release_obj)
|
||||
obj->ops->release_obj(obj);
|
||||
|
||||
kfree(obj);
|
||||
}
|
||||
|
||||
void sync_timeline_destroy(struct sync_timeline *obj)
|
||||
{
|
||||
obj->destroyed = true;
|
||||
smp_wmb();
|
||||
|
||||
/*
|
||||
* If this is not the last reference, signal any children
|
||||
* that their parent is going away.
|
||||
* signal any children that their parent is going away.
|
||||
*/
|
||||
sync_timeline_signal(obj);
|
||||
|
||||
if (!kref_put(&obj->kref, sync_timeline_free))
|
||||
sync_timeline_signal(obj);
|
||||
kref_put(&obj->kref, sync_timeline_free);
|
||||
}
|
||||
EXPORT_SYMBOL(sync_timeline_destroy);
|
||||
|
||||
|
||||
@@ -616,8 +616,6 @@ int comedi_auto_config(struct device *hardware_device,
|
||||
ret = driver->auto_attach(dev, context);
|
||||
if (ret >= 0)
|
||||
ret = comedi_device_postconfig(dev);
|
||||
if (ret < 0)
|
||||
comedi_device_detach(dev);
|
||||
mutex_unlock(&dev->mutex);
|
||||
|
||||
if (ret < 0) {
|
||||
|
||||
@@ -494,6 +494,7 @@ static int pci171x_insn_write_ao(struct comedi_device *dev,
|
||||
struct comedi_insn *insn, unsigned int *data)
|
||||
{
|
||||
struct pci1710_private *devpriv = dev->private;
|
||||
unsigned int val;
|
||||
int n, chan, range, ofs;
|
||||
|
||||
chan = CR_CHAN(insn->chanspec);
|
||||
@@ -509,11 +510,14 @@ static int pci171x_insn_write_ao(struct comedi_device *dev,
|
||||
outw(devpriv->da_ranges, dev->iobase + PCI171x_DAREF);
|
||||
ofs = PCI171x_DA1;
|
||||
}
|
||||
val = devpriv->ao_data[chan];
|
||||
|
||||
for (n = 0; n < insn->n; n++)
|
||||
outw(data[n], dev->iobase + ofs);
|
||||
for (n = 0; n < insn->n; n++) {
|
||||
val = data[n];
|
||||
outw(val, dev->iobase + ofs);
|
||||
}
|
||||
|
||||
devpriv->ao_data[chan] = data[n];
|
||||
devpriv->ao_data[chan] = val;
|
||||
|
||||
return n;
|
||||
|
||||
@@ -679,6 +683,7 @@ static int pci1720_insn_write_ao(struct comedi_device *dev,
|
||||
struct comedi_insn *insn, unsigned int *data)
|
||||
{
|
||||
struct pci1710_private *devpriv = dev->private;
|
||||
unsigned int val;
|
||||
int n, rangereg, chan;
|
||||
|
||||
chan = CR_CHAN(insn->chanspec);
|
||||
@@ -688,13 +693,15 @@ static int pci1720_insn_write_ao(struct comedi_device *dev,
|
||||
outb(rangereg, dev->iobase + PCI1720_RANGE);
|
||||
devpriv->da_ranges = rangereg;
|
||||
}
|
||||
val = devpriv->ao_data[chan];
|
||||
|
||||
for (n = 0; n < insn->n; n++) {
|
||||
outw(data[n], dev->iobase + PCI1720_DA0 + (chan << 1));
|
||||
val = data[n];
|
||||
outw(val, dev->iobase + PCI1720_DA0 + (chan << 1));
|
||||
outb(0, dev->iobase + PCI1720_SYNCOUT); /* update outputs */
|
||||
}
|
||||
|
||||
devpriv->ao_data[chan] = data[n];
|
||||
devpriv->ao_data[chan] = val;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include <linux/usb.h>
|
||||
#include <linux/fcntl.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
#include "comedi_fc.h"
|
||||
#include "../comedidev.h"
|
||||
@@ -792,7 +793,8 @@ static int usbduxsigma_ai_insn_read(struct comedi_device *dev,
|
||||
}
|
||||
|
||||
/* 32 bits big endian from the A/D converter */
|
||||
val = be32_to_cpu(*((uint32_t *)((devpriv->insn_buf) + 1)));
|
||||
val = be32_to_cpu(get_unaligned((uint32_t
|
||||
*)(devpriv->insn_buf + 1)));
|
||||
val &= 0x00ffffff; /* strip status byte */
|
||||
val ^= 0x00800000; /* convert to unsigned */
|
||||
|
||||
@@ -1357,7 +1359,7 @@ static int usbduxsigma_getstatusinfo(struct comedi_device *dev, int chan)
|
||||
return ret;
|
||||
|
||||
/* 32 bits big endian from the A/D converter */
|
||||
val = be32_to_cpu(*((uint32_t *)((devpriv->insn_buf)+1)));
|
||||
val = be32_to_cpu(get_unaligned((uint32_t *)(devpriv->insn_buf + 1)));
|
||||
val &= 0x00ffffff; /* strip status byte */
|
||||
val ^= 0x00800000; /* convert to unsigned */
|
||||
|
||||
|
||||
+155
-175
@@ -2232,177 +2232,6 @@ done:
|
||||
return rtn;
|
||||
}
|
||||
|
||||
/*
|
||||
* Common Packet Handling code
|
||||
*/
|
||||
|
||||
static void handle_data_in_packet(struct nd_struct *nd, struct ch_struct *ch,
|
||||
long dlen, long plen, int n1, u8 *dbuf)
|
||||
{
|
||||
char *error;
|
||||
long n;
|
||||
long remain;
|
||||
u8 *buf;
|
||||
u8 *b;
|
||||
|
||||
remain = nd->nd_remain;
|
||||
nd->nd_tx_work = 1;
|
||||
|
||||
/*
|
||||
* Otherwise data should appear only when we are
|
||||
* in the CS_READY state.
|
||||
*/
|
||||
|
||||
if (ch->ch_state < CS_READY) {
|
||||
error = "Data received before RWIN established";
|
||||
nd->nd_remain = 0;
|
||||
nd->nd_state = NS_SEND_ERROR;
|
||||
nd->nd_error = error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Assure that the data received is within the
|
||||
* allowable window.
|
||||
*/
|
||||
|
||||
n = (ch->ch_s_rwin - ch->ch_s_rin) & 0xffff;
|
||||
|
||||
if (dlen > n) {
|
||||
error = "Receive data overrun";
|
||||
nd->nd_remain = 0;
|
||||
nd->nd_state = NS_SEND_ERROR;
|
||||
nd->nd_error = error;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we received 3 or less characters,
|
||||
* assume it is a human typing, and set RTIME
|
||||
* to 10 milliseconds.
|
||||
*
|
||||
* If we receive 10 or more characters,
|
||||
* assume its not a human typing, and set RTIME
|
||||
* to 100 milliseconds.
|
||||
*/
|
||||
|
||||
if (ch->ch_edelay != DGRP_RTIME) {
|
||||
if (ch->ch_rtime != ch->ch_edelay) {
|
||||
ch->ch_rtime = ch->ch_edelay;
|
||||
ch->ch_flag |= CH_PARAM;
|
||||
}
|
||||
} else if (dlen <= 3) {
|
||||
if (ch->ch_rtime != 10) {
|
||||
ch->ch_rtime = 10;
|
||||
ch->ch_flag |= CH_PARAM;
|
||||
}
|
||||
} else {
|
||||
if (ch->ch_rtime != DGRP_RTIME) {
|
||||
ch->ch_rtime = DGRP_RTIME;
|
||||
ch->ch_flag |= CH_PARAM;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If a portion of the packet is outside the
|
||||
* buffer, shorten the effective length of the
|
||||
* data packet to be the amount of data received.
|
||||
*/
|
||||
|
||||
if (remain < plen)
|
||||
dlen -= plen - remain;
|
||||
|
||||
/*
|
||||
* Detect if receive flush is now complete.
|
||||
*/
|
||||
|
||||
if ((ch->ch_flag & CH_RX_FLUSH) != 0 &&
|
||||
((ch->ch_flush_seq - nd->nd_seq_out) & SEQ_MASK) >=
|
||||
((nd->nd_seq_in - nd->nd_seq_out) & SEQ_MASK)) {
|
||||
ch->ch_flag &= ~CH_RX_FLUSH;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are ready to receive, move the data into
|
||||
* the receive buffer.
|
||||
*/
|
||||
|
||||
ch->ch_s_rin = (ch->ch_s_rin + dlen) & 0xffff;
|
||||
|
||||
if (ch->ch_state == CS_READY &&
|
||||
(ch->ch_tun.un_open_count != 0) &&
|
||||
(ch->ch_tun.un_flag & UN_CLOSING) == 0 &&
|
||||
(ch->ch_cflag & CF_CREAD) != 0 &&
|
||||
(ch->ch_flag & (CH_BAUD0 | CH_RX_FLUSH)) == 0 &&
|
||||
(ch->ch_send & RR_RX_FLUSH) == 0) {
|
||||
|
||||
if (ch->ch_rin + dlen >= RBUF_MAX) {
|
||||
n = RBUF_MAX - ch->ch_rin;
|
||||
|
||||
memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, n);
|
||||
|
||||
ch->ch_rin = 0;
|
||||
dbuf += n;
|
||||
dlen -= n;
|
||||
}
|
||||
|
||||
memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, dlen);
|
||||
|
||||
ch->ch_rin += dlen;
|
||||
|
||||
|
||||
/*
|
||||
* If we are not in fastcook mode, or
|
||||
* if there is a fastcook thread
|
||||
* waiting for data, send the data to
|
||||
* the line discipline.
|
||||
*/
|
||||
|
||||
if ((ch->ch_flag & CH_FAST_READ) == 0 ||
|
||||
ch->ch_inwait != 0) {
|
||||
dgrp_input(ch);
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is a read thread waiting
|
||||
* in select, and we are in fastcook
|
||||
* mode, wake him up.
|
||||
*/
|
||||
|
||||
if (waitqueue_active(&ch->ch_tun.un_tty->read_wait) &&
|
||||
(ch->ch_flag & CH_FAST_READ) != 0)
|
||||
wake_up_interruptible(&ch->ch_tun.un_tty->read_wait);
|
||||
|
||||
/*
|
||||
* Wake any thread waiting in the
|
||||
* fastcook loop.
|
||||
*/
|
||||
|
||||
if ((ch->ch_flag & CH_INPUT) != 0) {
|
||||
ch->ch_flag &= ~CH_INPUT;
|
||||
wake_up_interruptible(&ch->ch_flag_wait);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Fabricate and insert a data packet header to
|
||||
* preced the remaining data when it comes in.
|
||||
*/
|
||||
|
||||
if (remain < plen) {
|
||||
dlen = plen - remain;
|
||||
b = buf;
|
||||
|
||||
b[0] = 0x90 + n1;
|
||||
put_unaligned_be16(dlen, b + 1);
|
||||
|
||||
remain = 3;
|
||||
if (remain > 0 && b != buf)
|
||||
memcpy(buf, b, remain);
|
||||
|
||||
nd->nd_remain = remain;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* dgrp_receive() -- decode data packets received from the remote PortServer.
|
||||
* @nd: pointer to a node structure
|
||||
@@ -2477,8 +2306,7 @@ static void dgrp_receive(struct nd_struct *nd)
|
||||
plen = dlen + 1;
|
||||
|
||||
dbuf = b + 1;
|
||||
handle_data_in_packet(nd, ch, dlen, plen, n1, dbuf);
|
||||
break;
|
||||
goto data;
|
||||
|
||||
/*
|
||||
* Process 2-byte header data packet.
|
||||
@@ -2492,8 +2320,7 @@ static void dgrp_receive(struct nd_struct *nd)
|
||||
plen = dlen + 2;
|
||||
|
||||
dbuf = b + 2;
|
||||
handle_data_in_packet(nd, ch, dlen, plen, n1, dbuf);
|
||||
break;
|
||||
goto data;
|
||||
|
||||
/*
|
||||
* Process 3-byte header data packet.
|
||||
@@ -2508,6 +2335,159 @@ static void dgrp_receive(struct nd_struct *nd)
|
||||
|
||||
dbuf = b + 3;
|
||||
|
||||
/*
|
||||
* Common packet handling code.
|
||||
*/
|
||||
|
||||
data:
|
||||
nd->nd_tx_work = 1;
|
||||
|
||||
/*
|
||||
* Otherwise data should appear only when we are
|
||||
* in the CS_READY state.
|
||||
*/
|
||||
|
||||
if (ch->ch_state < CS_READY) {
|
||||
error = "Data received before RWIN established";
|
||||
goto prot_error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Assure that the data received is within the
|
||||
* allowable window.
|
||||
*/
|
||||
|
||||
n = (ch->ch_s_rwin - ch->ch_s_rin) & 0xffff;
|
||||
|
||||
if (dlen > n) {
|
||||
error = "Receive data overrun";
|
||||
goto prot_error;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we received 3 or less characters,
|
||||
* assume it is a human typing, and set RTIME
|
||||
* to 10 milliseconds.
|
||||
*
|
||||
* If we receive 10 or more characters,
|
||||
* assume its not a human typing, and set RTIME
|
||||
* to 100 milliseconds.
|
||||
*/
|
||||
|
||||
if (ch->ch_edelay != DGRP_RTIME) {
|
||||
if (ch->ch_rtime != ch->ch_edelay) {
|
||||
ch->ch_rtime = ch->ch_edelay;
|
||||
ch->ch_flag |= CH_PARAM;
|
||||
}
|
||||
} else if (dlen <= 3) {
|
||||
if (ch->ch_rtime != 10) {
|
||||
ch->ch_rtime = 10;
|
||||
ch->ch_flag |= CH_PARAM;
|
||||
}
|
||||
} else {
|
||||
if (ch->ch_rtime != DGRP_RTIME) {
|
||||
ch->ch_rtime = DGRP_RTIME;
|
||||
ch->ch_flag |= CH_PARAM;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If a portion of the packet is outside the
|
||||
* buffer, shorten the effective length of the
|
||||
* data packet to be the amount of data received.
|
||||
*/
|
||||
|
||||
if (remain < plen)
|
||||
dlen -= plen - remain;
|
||||
|
||||
/*
|
||||
* Detect if receive flush is now complete.
|
||||
*/
|
||||
|
||||
if ((ch->ch_flag & CH_RX_FLUSH) != 0 &&
|
||||
((ch->ch_flush_seq - nd->nd_seq_out) & SEQ_MASK) >=
|
||||
((nd->nd_seq_in - nd->nd_seq_out) & SEQ_MASK)) {
|
||||
ch->ch_flag &= ~CH_RX_FLUSH;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are ready to receive, move the data into
|
||||
* the receive buffer.
|
||||
*/
|
||||
|
||||
ch->ch_s_rin = (ch->ch_s_rin + dlen) & 0xffff;
|
||||
|
||||
if (ch->ch_state == CS_READY &&
|
||||
(ch->ch_tun.un_open_count != 0) &&
|
||||
(ch->ch_tun.un_flag & UN_CLOSING) == 0 &&
|
||||
(ch->ch_cflag & CF_CREAD) != 0 &&
|
||||
(ch->ch_flag & (CH_BAUD0 | CH_RX_FLUSH)) == 0 &&
|
||||
(ch->ch_send & RR_RX_FLUSH) == 0) {
|
||||
|
||||
if (ch->ch_rin + dlen >= RBUF_MAX) {
|
||||
n = RBUF_MAX - ch->ch_rin;
|
||||
|
||||
memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, n);
|
||||
|
||||
ch->ch_rin = 0;
|
||||
dbuf += n;
|
||||
dlen -= n;
|
||||
}
|
||||
|
||||
memcpy(ch->ch_rbuf + ch->ch_rin, dbuf, dlen);
|
||||
|
||||
ch->ch_rin += dlen;
|
||||
|
||||
|
||||
/*
|
||||
* If we are not in fastcook mode, or
|
||||
* if there is a fastcook thread
|
||||
* waiting for data, send the data to
|
||||
* the line discipline.
|
||||
*/
|
||||
|
||||
if ((ch->ch_flag & CH_FAST_READ) == 0 ||
|
||||
ch->ch_inwait != 0) {
|
||||
dgrp_input(ch);
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is a read thread waiting
|
||||
* in select, and we are in fastcook
|
||||
* mode, wake him up.
|
||||
*/
|
||||
|
||||
if (waitqueue_active(&ch->ch_tun.un_tty->read_wait) &&
|
||||
(ch->ch_flag & CH_FAST_READ) != 0)
|
||||
wake_up_interruptible(&ch->ch_tun.un_tty->read_wait);
|
||||
|
||||
/*
|
||||
* Wake any thread waiting in the
|
||||
* fastcook loop.
|
||||
*/
|
||||
|
||||
if ((ch->ch_flag & CH_INPUT) != 0) {
|
||||
ch->ch_flag &= ~CH_INPUT;
|
||||
|
||||
wake_up_interruptible(&ch->ch_flag_wait);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Fabricate and insert a data packet header to
|
||||
* preced the remaining data when it comes in.
|
||||
*/
|
||||
|
||||
if (remain < plen) {
|
||||
dlen = plen - remain;
|
||||
b = buf;
|
||||
|
||||
b[0] = 0x90 + n1;
|
||||
put_unaligned_be16(dlen, b + 1);
|
||||
|
||||
remain = 3;
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
|
||||
@@ -635,11 +635,14 @@ static int gdm_usb_probe(struct usb_interface *intf,
|
||||
#endif /* CONFIG_WIMAX_GDM72XX_USB_PM */
|
||||
|
||||
ret = register_wimax_device(phy_dev, &intf->dev);
|
||||
if (ret)
|
||||
release_usb(udev);
|
||||
|
||||
out:
|
||||
if (ret) {
|
||||
kfree(phy_dev);
|
||||
kfree(udev);
|
||||
usb_put_dev(usbdev);
|
||||
} else {
|
||||
usb_set_intfdata(intf, phy_dev);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user