Commit 7ca363f6 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge branch 'staging-linus' into staging-work

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: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parents e4b41af1 a0f45252
......@@ -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;
}
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;
}
......@@ -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];
......@@ -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 @@ 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,
};
......@@ -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 @@ static int __init ion_dummy_init(void)
}
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, &param);
if (IS_ERR(heap->task)) {
pr_err("%s: creating thread for deferred free failed\n",
__func__);
return PTR_ERR_OR_ZERO(heap->task);
}
sched_setscheduler(heap->task, SCHED_IDLE, &param);
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 */
......
......@@ -2232,177 +2232,6 @@ static ssize_t dgrp_net_read(struct file *file, char __user *buf, size_t count,
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);
}
......
......@@ -77,7 +77,6 @@ struct iio_channel_info {
uint64_t mask;
unsigned be;
unsigned is_signed;
unsigned enabled;
unsigned location;
};
......@@ -335,6 +334,7 @@ inline int build_channel_array(const char *device_dir,
while (ent = readdir(dp), ent != NULL) {
if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"),
"_en") == 0) {
int current_enabled = 0;
current = &(*ci_array)[count++];
ret = asprintf(&filename,
"%s/%s", scan_el_dir, ent->d_name);
......@@ -350,10 +350,10 @@ inline int build_channel_array(const char *device_dir,
ret = -errno;
goto error_cleanup_array;
}
fscanf(sysfsfp, "%u", &current->enabled);
fscanf(sysfsfp, "%u", &current_enabled);
fclose(sysfsfp);
if (!current->enabled) {
if (!current_enabled) {
free(filename);
count--;
continue;
......
......@@ -393,7 +393,7 @@ static const struct iio_event_spec ad799x_events[] = {
}, {
.type = IIO_EV_TYPE_THRESH,
.dir = IIO_EV_DIR_FALLING,
.mask_separate = BIT(IIO_EV_INFO_VALUE),
.mask_separate = BIT(IIO_EV_INFO_VALUE) |
BIT(IIO_EV_INFO_ENABLE),
}, {
.type = IIO_EV_TYPE_THRESH,
......@@ -409,7 +409,13 @@ static const struct iio_event_spec ad799x_events[] = {
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
.scan_index = (_index), \
.scan_type = IIO_ST('u', _realbits, 16, 12 - (_realbits)), \
.scan_type = { \
.sign = 'u', \
.realbits = (_realbits), \
.storagebits = 16, \
.shift = 12 - (_realbits), \
.endianness = IIO_BE, \
}, \
.event_spec = _ev_spec, \
.num_event_specs = _num_ev_spec, \
}
......@@ -588,7 +594,8 @@ static int ad799x_probe(struct i2c_client *client,
return 0;
error_free_irq:
free_irq(client->irq, indio_dev);
if (client->irq > 0)
free_irq(client->irq, indio_dev);
error_cleanup_ring:
ad799x_ring_cleanup(indio_dev);
error_disable_reg:
......
......@@ -1035,8 +1035,6 @@ SHOW_SCALE_AVAILABLE_ATTR(4);
SHOW_SCALE_AVAILABLE_ATTR(5);
SHOW_SCALE_AVAILABLE_ATTR(6);
SHOW_SCALE_AVAILABLE_ATTR(7);
SHOW_SCALE_AVAILABLE_ATTR(8);
SHOW_SCALE_AVAILABLE_ATTR(9);
SHOW_SCALE_AVAILABLE_ATTR(10);
SHOW_SCALE_AVAILABLE_ATTR(11);
SHOW_SCALE_AVAILABLE_ATTR(12);
......@@ -1053,8 +1051,6 @@ static struct attribute *mxs_lradc_attributes[] = {
&iio_dev_attr_in_voltage5_scale_available.dev_attr.attr,
&iio_dev_attr_in_voltage6_scale_available.dev_attr.attr,
&iio_dev_attr_in_voltage7_scale_available.dev_attr.attr,
&iio_dev_attr_in_voltage8_scale_available.dev_attr.attr,
&iio_dev_attr_in_voltage9_scale_available.dev_attr.attr,
&iio_dev_attr_in_voltage10_scale_available.dev_attr.attr,
&iio_dev_attr_in_voltage11_scale_available.dev_attr.attr,
&iio_dev_attr_in_voltage12_scale_available.dev_attr.attr,
......@@ -1613,7 +1609,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
* of the array.
*/
scale_uv = ((u64)lradc->vref_mv[i] * 100000000) >>
(iio->channels[i].scan_type.realbits - s);
(LRADC_RESOLUTION - s);
lradc->scale_avail[i][s].nano =
do_div(scale_uv, 100000000) * 10;
lradc->scale_avail[i][s].integer = scale_uv;
......
......@@ -629,7 +629,7 @@ static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev)
struct iio_buffer *buffer;
buffer = iio_kfifo_allocate(indio_dev);
if (buffer)
if (!buffer)
return -ENOMEM;
iio_device_attach_buffer(indio_dev, buffer);
......
......@@ -88,9 +88,9 @@ static int imx_drm_driver_unload(struct drm_device *drm)
imx_drm_device_put();
drm_vblank_cleanup(imxdrm->drm);
drm_kms_helper_poll_fini(imxdrm->drm);
drm_mode_config_cleanup(imxdrm->drm);
drm_vblank_cleanup(drm);
drm_kms_helper_poll_fini(drm);
drm_mode_config_cleanup(drm);
return 0;
}
......@@ -142,19 +142,19 @@ EXPORT_SYMBOL_GPL(imx_drm_crtc_panel_format);
int imx_drm_crtc_vblank_get(struct imx_drm_crtc *imx_drm_crtc)
{
return drm_vblank_get(imx_drm_crtc->imxdrm->drm, imx_drm_crtc->pipe);
return drm_vblank_get(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe);
}
EXPORT_SYMBOL_GPL(imx_drm_crtc_vblank_get);
void imx_drm_crtc_vblank_put(struct imx_drm_crtc *imx_drm_crtc)
{
drm_vblank_put(imx_drm_crtc->imxdrm->drm, imx_drm_crtc->pipe);
drm_vblank_put(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe);
}
EXPORT_SYMBOL_GPL(imx_drm_crtc_vblank_put);
void imx_drm_handle_vblank(struct imx_drm_crtc *imx_drm_crtc)
{
drm_handle_vblank(imx_drm_crtc->imxdrm->drm, imx_drm_crtc->pipe);
drm_handle_vblank(imx_drm_crtc->crtc->dev, imx_drm_crtc->pipe);
}
EXPORT_SYMBOL_GPL(imx_drm_handle_vblank);
......@@ -369,29 +369,6 @@ static void imx_drm_connector_unregister(
drm_mode_group_reinit(imxdrm->drm);
}
/*
* register a crtc to the drm core
*/
static int imx_drm_crtc_register(struct imx_drm_crtc *imx_drm_crtc)
{
struct imx_drm_device *imxdrm = __imx_drm_device();
int ret;
ret = drm_mode_crtc_set_gamma_size(imx_drm_crtc->crtc, 256);
if (ret)
return ret;
drm_crtc_helper_add(imx_drm_crtc->crtc,
imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs);
drm_crtc_init(imxdrm->drm, imx_drm_crtc->crtc,
imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs);
drm_mode_group_reinit(imxdrm->drm);
return 0;
}
/*
* Called by the CRTC driver when all CRTCs are registered. This
* puts all the pieces together and initializes the driver.
......@@ -424,15 +401,15 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
mutex_lock(&imxdrm->mutex);
drm_kms_helper_poll_init(imxdrm->drm);
drm_kms_helper_poll_init(drm);
/* setup the grouping for the legacy output */
ret = drm_mode_group_init_legacy_group(imxdrm->drm,
&imxdrm->drm->primary->mode_group);
ret = drm_mode_group_init_legacy_group(drm,
&drm->primary->mode_group);
if (ret)
goto err_kms;
ret = drm_vblank_init(imxdrm->drm, MAX_CRTC);
ret = drm_vblank_init(drm, MAX_CRTC);
if (ret)
goto err_kms;
......@@ -441,7 +418,7 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
* by drm timer once a current process gives up ownership of
* vblank event.(after drm_vblank_put function is called)
*/
imxdrm->drm->vblank_disable_allowed = true;
drm->vblank_disable_allowed = true;
if (!imx_drm_device_get()) {
ret = -EINVAL;
......@@ -536,10 +513,18 @@ int imx_drm_add_crtc(struct drm_crtc *crtc,
*new_crtc = imx_drm_crtc;
ret = imx_drm_crtc_register(imx_drm_crtc);
ret = drm_mode_crtc_set_gamma_size(imx_drm_crtc->crtc, 256);
if (ret)
goto err_register;
drm_crtc_helper_add(crtc,
imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs);
drm_crtc_init(imxdrm->drm, crtc,
imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs);
drm_mode_group_reinit(imxdrm->drm);
imx_drm_update_possible_crtcs();
mutex_unlock(&imxdrm->mutex);
......
......@@ -16,6 +16,7 @@
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/clk.h>
#include <linux/hdmi.h>
#include <linux/regmap.h>
#include <linux/mfd/syscon.h>
#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
......@@ -52,11 +53,6 @@ enum hdmi_datamap {
YCbCr422_12B = 0x12,
};
enum hdmi_colorimetry {
ITU601,
ITU709,
};
enum imx_hdmi_devtype {
IMX6Q_HDMI,
IMX6DL_HDMI,
......@@ -494,12 +490,12 @@ static void imx_hdmi_update_csc_coeffs(struct imx_hdmi *hdmi)
if (is_color_space_conversion(hdmi)) {
if (hdmi->hdmi_data.enc_out_format == RGB) {
if (hdmi->hdmi_data.colorimetry == ITU601)
if (hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_601)
csc_coeff = &csc_coeff_rgb_out_eitu601;
else
csc_coeff = &csc_coeff_rgb_out_eitu709;
} else if (hdmi->hdmi_data.enc_in_format == RGB) {
if (hdmi->hdmi_data.colorimetry == ITU601)
if (hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_601)
csc_coeff = &csc_coeff_rgb_in_eitu601;
else
csc_coeff = &csc_coeff_rgb_in_eitu709;
......@@ -1145,16 +1141,16 @@ static void hdmi_config_AVI(struct imx_hdmi *hdmi)
/* Set up colorimetry */
if (hdmi->hdmi_data.enc_out_format == XVYCC444) {
colorimetry = HDMI_FC_AVICONF1_COLORIMETRY_EXTENDED_INFO;
if (hdmi->hdmi_data.colorimetry == ITU601)
if (hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_601)
ext_colorimetry =
HDMI_FC_AVICONF2_EXT_COLORIMETRY_XVYCC601;
else /* hdmi->hdmi_data.colorimetry == ITU709 */
else /*hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_709*/
ext_colorimetry =
HDMI_FC_AVICONF2_EXT_COLORIMETRY_XVYCC709;
} else if (hdmi->hdmi_data.enc_out_format != RGB) {
if (hdmi->hdmi_data.colorimetry == ITU601)
if (hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_601)
colorimetry = HDMI_FC_AVICONF1_COLORIMETRY_SMPTE;
else /* hdmi->hdmi_data.colorimetry == ITU709 */
else /*hdmi->hdmi_data.colorimetry == HDMI_COLORIMETRY_ITU_709*/
colorimetry = HDMI_FC_AVICONF1_COLORIMETRY_ITUR;
ext_colorimetry = HDMI_FC_AVICONF2_EXT_COLORIMETRY_XVYCC601;
} else { /* Carries no data */
......@@ -1384,9 +1380,9 @@ static int imx_hdmi_setup(struct imx_hdmi *hdmi, struct drm_display_mode *mode)
(hdmi->vic == 21) || (hdmi->vic == 22) ||
(hdmi->vic == 2) || (hdmi->vic == 3) ||
(hdmi->vic == 17) || (hdmi->vic == 18))
hdmi->hdmi_data.colorimetry = ITU601;
hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_601;
else
hdmi->hdmi_data.colorimetry = ITU709;
hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_709;
if ((hdmi->vic == 10) || (hdmi->vic == 11) ||
(hdmi->vic == 12) || (hdmi->vic == 13) ||
......
......@@ -9,5 +9,6 @@
* Other minor misc cleanups...
Please send any patches to Greg Kroah-Hartman <greg@kroah.com>, Andreas Dilger
<andreas.dilger@intel.com> and Peng Tao <tao.peng@emc.com>. CCing
hpdd-discuss <hpdd-discuss@lists.01.org> would be great too.
<andreas.dilger@intel.com>, Oleg Drokin <oleg.drokin@intel.com> and
Peng Tao <tao.peng@emc.com>. CCing hpdd-discuss <hpdd-discuss@lists.01.org>
would be great too.
......@@ -61,6 +61,8 @@ struct kuc_hdr {
__u16 kuc_msglen; /* Including header */
} __attribute__((aligned(sizeof(__u64))));
#define KUC_CHANGELOG_MSG_MAXSIZE (sizeof(struct kuc_hdr)+CR_MAXSIZE)
#define KUC_MAGIC 0x191C /*Lustre9etLinC */
#define KUC_FL_BLOCK 0x01 /* Wait for send */
......
......@@ -120,7 +120,7 @@ do { \
do { \
LASSERT(!in_interrupt() || \
((size) <= LIBCFS_VMALLOC_SIZE && \
((mask) & GFP_ATOMIC)) != 0); \
((mask) & __GFP_WAIT) == 0)); \
} while (0)
#define LIBCFS_ALLOC_POST(ptr, size) \
......
......@@ -924,7 +924,7 @@ ksocknal_launch_packet (lnet_ni_t *ni, ksock_tx_t *tx, lnet_process_id_t id)
int
ksocknal_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg)
{
int mpflag = 0;
int mpflag = 1;
int type = lntmsg->msg_type;
lnet_process_id_t target = lntmsg->msg_target;
unsigned int payload_niov = lntmsg->msg_niov;
......@@ -993,8 +993,9 @@ ksocknal_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg)
/* The first fragment will be set later in pro_pack */
rc = ksocknal_launch_packet(ni, tx, target);
if (lntmsg->msg_vmflush)
if (!mpflag)
cfs_memory_pressure_restore(mpflag);
if (rc == 0)
return (0);
......
......@@ -760,7 +760,8 @@ static inline void hsm_set_cl_error(int *flags, int error)
*flags |= (error << CLF_HSM_ERR_L);
}
#define CR_MAXSIZE cfs_size_round(2*NAME_MAX + 1 + sizeof(struct changelog_rec))
#define CR_MAXSIZE cfs_size_round(2*NAME_MAX + 1 + \
sizeof(struct changelog_ext_rec))
struct changelog_rec {
__u16 cr_namelen;
......
......@@ -1091,7 +1091,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl)
break;
case Q_GETQUOTA:
if (((type == USRQUOTA &&
uid_eq(current_euid(), make_kuid(&init_user_ns, id))) ||
!uid_eq(current_euid(), make_kuid(&init_user_ns, id))) ||
(type == GRPQUOTA &&
!in_egroup_p(make_kgid(&init_user_ns, id)))) &&
(!capable(CFS_CAP_SYS_ADMIN) ||
......
......@@ -1430,7 +1430,7 @@ static struct kuc_hdr *changelog_kuc_hdr(char *buf, int len, int flags)
{
struct kuc_hdr *lh = (struct kuc_hdr *)buf;
LASSERT(len <= CR_MAXSIZE);
LASSERT(len <= KUC_CHANGELOG_MSG_MAXSIZE);
lh->kuc_magic = KUC_MAGIC;
lh->kuc_transport = KUC_TRANSPORT_CHANGELOG;
......@@ -1503,7 +1503,7 @@ static int mdc_changelog_send_thread(void *csdata)
CDEBUG(D_CHANGELOG, "changelog to fp=%p start "LPU64"\n",
cs->cs_fp, cs->cs_startrec);
OBD_ALLOC(cs->cs_buf, CR_MAXSIZE);
OBD_ALLOC(cs->cs_buf, KUC_CHANGELOG_MSG_MAXSIZE);
if (cs->cs_buf == NULL)
GOTO(out, rc = -ENOMEM);
......@@ -1540,7 +1540,7 @@ static int mdc_changelog_send_thread(void *csdata)
if (ctxt)
llog_ctxt_put(ctxt);
if (cs->cs_buf)
OBD_FREE(cs->cs_buf, CR_MAXSIZE);
OBD_FREE(cs->cs_buf, KUC_CHANGELOG_MSG_MAXSIZE);
OBD_FREE_PTR(cs);
return rc;
}
......
......@@ -892,6 +892,11 @@ static int xlr_setup_mdio(struct xlr_net_priv *priv,
priv->mii_bus->write = xlr_mii_write;
priv->mii_bus->parent = &pdev->dev;
priv->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
if (priv->mii_bus->irq == NULL) {
pr_err("irq alloc failed\n");
mdiobus_free(priv->mii_bus);
return -ENOMEM;
}
priv->mii_bus->irq[priv->phy_addr] = priv->ndev->irq;
/* Scan only the enabled address */
......
This diff is collapsed.
......@@ -912,12 +912,12 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)
unsigned char *pbuf;
u32 wpa_ielen = 0;
u8 *pbssid = GetAddr3Ptr(pframe);
u32 hidden_ssid = 0;
struct HT_info_element *pht_info = NULL;
struct rtw_ieee80211_ht_cap *pht_cap = NULL;
u32 bcn_channel;
unsigned short ht_cap_info;
unsigned char ht_info_infos_0;
int ssid_len;
if (is_client_associated_to_ap(Adapter) == false)
return true;
......@@ -999,21 +999,15 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)
}
/* checking SSID */
ssid_len = 0;
p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SSID_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
if (p == NULL) {
DBG_88E("%s marc: cannot find SSID for survey event\n", __func__);
hidden_ssid = true;
} else {
hidden_ssid = false;
}
if ((NULL != p) && (false == hidden_ssid && (*(p + 1)))) {
memcpy(bssid->Ssid.Ssid, (p + 2), *(p + 1));
bssid->Ssid.SsidLength = *(p + 1);
} else {
bssid->Ssid.SsidLength = 0;
bssid->Ssid.Ssid[0] = '\0';
if (p) {
ssid_len = *(p + 1);
if (ssid_len > NDIS_802_11_LENGTH_SSID)
ssid_len = 0;
}
memcpy(bssid->Ssid.Ssid, (p + 2), ssid_len);
bssid->Ssid.SsidLength = ssid_len;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("%s bssid.Ssid.Ssid:%s bssid.Ssid.SsidLength:%d "
"cur_network->network.Ssid.Ssid:%s len:%d\n", __func__, bssid->Ssid.Ssid,
......
......@@ -2500,7 +2500,7 @@ static int rtw_mp_ioctl_hdl(struct net_device *dev, struct iw_request_info *info
("rtw_mp_ioctl_hdl: subcode [%d], len[%d], buffer_len[%d]\r\n",
poidparam->subcode, poidparam->len, len));
if (poidparam->subcode >= MAX_MP_IOCTL_SUBCODE) {
if (poidparam->subcode >= ARRAY_SIZE(mp_ioctl_hdl)) {
RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, ("no matching drvext subcodes\r\n"));
ret = -EINVAL;
goto _rtw_mp_ioctl_hdl_exit;
......@@ -3164,9 +3164,7 @@ static int rtw_p2p_get_go_device_address(struct net_device *dev,
u8 *p2pie;
uint p2pielen = 0, attr_contentlen = 0;
u8 attr_content[100] = {0x00};
u8 go_devadd_str[17 + 10] = {0x00};
/* +10 is for the str "go_devadd =", we have to clear it at wrqu->data.pointer */
u8 go_devadd_str[17 + 12] = {};
/* Commented by Albert 20121209 */
/* The input data is the GO's interface address which the application wants to know its device address. */
......@@ -3223,12 +3221,12 @@ static int rtw_p2p_get_go_device_address(struct net_device *dev,
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
if (!blnMatch)
sprintf(go_devadd_str, "\n\ndev_add = NULL");
snprintf(go_devadd_str, sizeof(go_devadd_str), "\n\ndev_add = NULL");
else
sprintf(go_devadd_str, "\n\ndev_add =%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
snprintf(go_devadd_str, sizeof(go_devadd_str), "\n\ndev_add =%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
attr_content[0], attr_content[1], attr_content[2], attr_content[3], attr_content[4], attr_content[5]);
if (copy_to_user(wrqu->data.pointer, go_devadd_str, 10 + 17))
if (copy_to_user(wrqu->data.pointer, go_devadd_str, sizeof(go_devadd_str)))
return -EFAULT;
return ret;
}
......
......@@ -53,7 +53,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
{USB_DEVICE(USB_VENDER_ID_REALTEK, 0x0179)}, /* 8188ETV */
/*=== Customer ID ===*/
/****** 8188EUS ********/
{USB_DEVICE(0x8179, 0x07B8)}, /* Abocom - Abocom */
{USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */
{USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */
{} /* Terminating entry */
};
......
......@@ -1414,7 +1414,7 @@ struct rtl_dm {
/*88e tx power tracking*/
u8 bb_swing_idx_ofdm[2];
u8 bb_swing_idx_ofdm[MAX_RF_PATH];
u8 bb_swing_idx_ofdm_current;
u8 bb_swing_idx_ofdm_base[MAX_RF_PATH];
bool bb_swing_flag_Ofdm;
......
......@@ -169,14 +169,14 @@ static void *my_malloc(size_t size)
struct pool *p;
p = calloc(1, sizeof(struct pool));
if (!p) {
free(p);
if (!p)
return NULL;
}
p->mem = calloc(1, size);
if (!p->mem)
if (!p->mem) {
free(p);
return NULL;
}
p->next = pool_head;
pool_head = p;
......
......@@ -149,7 +149,8 @@ static int valid_args(__u32 rhport, enum usb_device_speed speed)
case USB_SPEED_WIRELESS:
break;
default:
pr_err("speed %d\n", speed);
pr_err("Failed attach request for unsupported USB speed: %s\n",
usb_speed_string(speed));
return -EINVAL;
}
......
......@@ -1061,7 +1061,7 @@ static int wireless_set_essid(struct net_device *dev, struct iw_request_info *in
goto out;
}
if (data->flags != 0 && data->length > HCF_MAX_NAME_LEN + 1) {
if (data->flags != 0 && data->length > HCF_MAX_NAME_LEN) {
ret = -EINVAL;
goto out;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment