Skip to content

Commit

Permalink
Merge branch 'staging-linus' into staging-work
Browse files Browse the repository at this point in the history
This is to pull in the lustre fixes so that others can continue to work
on updating the lustre codebase, as well as resolve some merge issues
with the ion and ocproto drivers to keep linux-next happy.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Greg Kroah-Hartman committed Feb 8, 2014
2 parents e4b41af + a0f4525 commit 7ca363f
Show file tree
Hide file tree
Showing 42 changed files with 502 additions and 506 deletions.
16 changes: 8 additions & 8 deletions drivers/iio/accel/bma180.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/adc/max1363.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions drivers/iio/imu/adis16400.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ enum {
ADIS16300_SCAN_INCLI_X,
ADIS16300_SCAN_INCLI_Y,
ADIS16400_SCAN_ADC,
ADIS16400_SCAN_TIMESTAMP,
};

#ifdef CONFIG_IIO_BUFFER
Expand Down
10 changes: 5 additions & 5 deletions drivers/iio/imu/adis16400_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand All @@ -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[] = {
Expand All @@ -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[] = {
Expand All @@ -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[] = {
Expand All @@ -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[] = {
Expand Down
16 changes: 10 additions & 6 deletions drivers/iio/light/tsl2563.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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) {
Expand All @@ -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;
Expand All @@ -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);
Expand Down
16 changes: 9 additions & 7 deletions drivers/iio/magnetometer/ak8975.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 7 additions & 1 deletion drivers/iio/magnetometer/mag3110.c
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
45 changes: 26 additions & 19 deletions drivers/staging/android/ashmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

ret = asma->file->f_op->read(asma->file, buf, len, pos);
if (ret < 0)
goto out;
mutex_unlock(&ashmem_mutex);

/** Update backing file pos, since f_ops->read() doesn't */
asma->file->f_pos = *pos;
/*
* 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) {
/** Update backing file pos, since f_ops->read() doesn't */
asma->file->f_pos = *pos;
}
return ret;

out:
out_unlock:
mutex_unlock(&ashmem_mutex);
return ret;
}
Expand Down Expand Up @@ -498,6 +506,7 @@ static int set_prot_mask(struct ashmem_area *asma, unsigned long prot)

static int set_name(struct ashmem_area *asma, void __user *name)
{
int len;
int ret = 0;
char local_name[ASHMEM_NAME_LEN];

Expand All @@ -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;
}

Expand Down
26 changes: 22 additions & 4 deletions drivers/staging/android/ion/compat_ion.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
Expand Down Expand Up @@ -132,16 +150,16 @@ 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);
data = compat_alloc_user_space(sizeof(*data));
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;

Expand Down
12 changes: 6 additions & 6 deletions drivers/staging/android/ion/ion_dummy_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -57,7 +59,7 @@ static struct ion_platform_heap dummy_heaps[] = {
};

static struct ion_platform_data dummy_ion_pdata = {
.nr = 4,
.nr = ARRAY_SIZE(dummy_heaps),
.heaps = dummy_heaps,
};

Expand All @@ -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 */
Expand Down Expand Up @@ -128,6 +130,7 @@ static int __init ion_dummy_init(void)
}
return err;
}
device_initcall(ion_dummy_init);

static void __exit ion_dummy_exit(void)
{
Expand All @@ -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);
Loading

0 comments on commit 7ca363f

Please sign in to comment.