Commit 21c9eb7c authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'staging-4.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging/IIO fixes from Greg KH:
 "These are mostly all IIO driver fixes, resolving a number of tiny
  issues. There's also a ccree and lustre fix in here as well, both fix
  problems found in those codebases.

  All have been in linux-next with no reported issues"

* tag 'staging-4.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: ccree: fix buffer copy
  staging/lustre/lov: remove set_fs() call from lov_getstripe()
  staging: ccree: add CRYPTO dependency
  iio: adc: sun4i-gpadc-iio: fix parent device being used in devm function
  iio: light: ltr501 Fix interchanged als/ps register field
  iio: adc: bcm_iproc_adc: swap primary and secondary isr handler's
  iio: trigger: fix NULL pointer dereference in iio_trigger_write_current()
  iio: adc: max9611: Fix attribute measure unit
  iio: adc: ti_am335x_adc: allocating too much in probe
  iio: adc: sun4i-gpadc-iio: Fix module autoload when OF devices are registered
  iio: adc: sun4i-gpadc-iio: Fix module autoload when PLATFORM devices are registered
  iio: proximity: as3935: fix iio_trigger_poll issue
  iio: proximity: as3935: fix AS3935_INT mask
  iio: adc: Max9611: checking for ERR_PTR instead of NULL in probe
  iio: proximity: as3935: recalibrate RCO after resume
parents 246baac2 26f4b1f7
...@@ -143,7 +143,7 @@ static void iproc_adc_reg_dump(struct iio_dev *indio_dev) ...@@ -143,7 +143,7 @@ static void iproc_adc_reg_dump(struct iio_dev *indio_dev)
iproc_adc_dbg_reg(dev, adc_priv, IPROC_SOFT_BYPASS_DATA); iproc_adc_dbg_reg(dev, adc_priv, IPROC_SOFT_BYPASS_DATA);
} }
static irqreturn_t iproc_adc_interrupt_handler(int irq, void *data) static irqreturn_t iproc_adc_interrupt_thread(int irq, void *data)
{ {
u32 channel_intr_status; u32 channel_intr_status;
u32 intr_status; u32 intr_status;
...@@ -167,7 +167,7 @@ static irqreturn_t iproc_adc_interrupt_handler(int irq, void *data) ...@@ -167,7 +167,7 @@ static irqreturn_t iproc_adc_interrupt_handler(int irq, void *data)
return IRQ_NONE; return IRQ_NONE;
} }
static irqreturn_t iproc_adc_interrupt_thread(int irq, void *data) static irqreturn_t iproc_adc_interrupt_handler(int irq, void *data)
{ {
irqreturn_t retval = IRQ_NONE; irqreturn_t retval = IRQ_NONE;
struct iproc_adc_priv *adc_priv; struct iproc_adc_priv *adc_priv;
...@@ -181,7 +181,7 @@ static irqreturn_t iproc_adc_interrupt_thread(int irq, void *data) ...@@ -181,7 +181,7 @@ static irqreturn_t iproc_adc_interrupt_thread(int irq, void *data)
adc_priv = iio_priv(indio_dev); adc_priv = iio_priv(indio_dev);
regmap_read(adc_priv->regmap, IPROC_INTERRUPT_STATUS, &intr_status); regmap_read(adc_priv->regmap, IPROC_INTERRUPT_STATUS, &intr_status);
dev_dbg(&indio_dev->dev, "iproc_adc_interrupt_thread(),INTRPT_STS:%x\n", dev_dbg(&indio_dev->dev, "iproc_adc_interrupt_handler(),INTRPT_STS:%x\n",
intr_status); intr_status);
intr_channels = (intr_status & IPROC_ADC_INTR_MASK) >> IPROC_ADC_INTR; intr_channels = (intr_status & IPROC_ADC_INTR_MASK) >> IPROC_ADC_INTR;
...@@ -566,8 +566,8 @@ static int iproc_adc_probe(struct platform_device *pdev) ...@@ -566,8 +566,8 @@ static int iproc_adc_probe(struct platform_device *pdev)
} }
ret = devm_request_threaded_irq(&pdev->dev, adc_priv->irqno, ret = devm_request_threaded_irq(&pdev->dev, adc_priv->irqno,
iproc_adc_interrupt_thread,
iproc_adc_interrupt_handler, iproc_adc_interrupt_handler,
iproc_adc_interrupt_thread,
IRQF_SHARED, "iproc-adc", indio_dev); IRQF_SHARED, "iproc-adc", indio_dev);
if (ret) { if (ret) {
dev_err(&pdev->dev, "request_irq error %d\n", ret); dev_err(&pdev->dev, "request_irq error %d\n", ret);
......
...@@ -438,10 +438,10 @@ static ssize_t max9611_shunt_resistor_show(struct device *dev, ...@@ -438,10 +438,10 @@ static ssize_t max9611_shunt_resistor_show(struct device *dev,
struct max9611_dev *max9611 = iio_priv(dev_to_iio_dev(dev)); struct max9611_dev *max9611 = iio_priv(dev_to_iio_dev(dev));
unsigned int i, r; unsigned int i, r;
i = max9611->shunt_resistor_uohm / 1000; i = max9611->shunt_resistor_uohm / 1000000;
r = max9611->shunt_resistor_uohm % 1000; r = max9611->shunt_resistor_uohm % 1000000;
return sprintf(buf, "%u.%03u\n", i, r); return sprintf(buf, "%u.%06u\n", i, r);
} }
static IIO_DEVICE_ATTR(in_power_shunt_resistor, 0444, static IIO_DEVICE_ATTR(in_power_shunt_resistor, 0444,
...@@ -536,8 +536,8 @@ static int max9611_probe(struct i2c_client *client, ...@@ -536,8 +536,8 @@ static int max9611_probe(struct i2c_client *client,
int ret; int ret;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*max9611)); indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*max9611));
if (IS_ERR(indio_dev)) if (!indio_dev)
return PTR_ERR(indio_dev); return -ENOMEM;
i2c_set_clientdata(client, indio_dev); i2c_set_clientdata(client, indio_dev);
......
...@@ -105,6 +105,8 @@ struct sun4i_gpadc_iio { ...@@ -105,6 +105,8 @@ struct sun4i_gpadc_iio {
bool no_irq; bool no_irq;
/* prevents concurrent reads of temperature and ADC */ /* prevents concurrent reads of temperature and ADC */
struct mutex mutex; struct mutex mutex;
struct thermal_zone_device *tzd;
struct device *sensor_device;
}; };
#define SUN4I_GPADC_ADC_CHANNEL(_channel, _name) { \ #define SUN4I_GPADC_ADC_CHANNEL(_channel, _name) { \
...@@ -502,7 +504,6 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, ...@@ -502,7 +504,6 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev,
{ {
struct sun4i_gpadc_iio *info = iio_priv(indio_dev); struct sun4i_gpadc_iio *info = iio_priv(indio_dev);
const struct of_device_id *of_dev; const struct of_device_id *of_dev;
struct thermal_zone_device *tzd;
struct resource *mem; struct resource *mem;
void __iomem *base; void __iomem *base;
int ret; int ret;
...@@ -532,13 +533,14 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, ...@@ -532,13 +533,14 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev,
if (!IS_ENABLED(CONFIG_THERMAL_OF)) if (!IS_ENABLED(CONFIG_THERMAL_OF))
return 0; return 0;
tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, info, info->sensor_device = &pdev->dev;
&sun4i_ts_tz_ops); info->tzd = thermal_zone_of_sensor_register(info->sensor_device, 0,
if (IS_ERR(tzd)) info, &sun4i_ts_tz_ops);
if (IS_ERR(info->tzd))
dev_err(&pdev->dev, "could not register thermal sensor: %ld\n", dev_err(&pdev->dev, "could not register thermal sensor: %ld\n",
PTR_ERR(tzd)); PTR_ERR(info->tzd));
return PTR_ERR_OR_ZERO(tzd); return PTR_ERR_OR_ZERO(info->tzd);
} }
static int sun4i_gpadc_probe_mfd(struct platform_device *pdev, static int sun4i_gpadc_probe_mfd(struct platform_device *pdev,
...@@ -584,15 +586,15 @@ static int sun4i_gpadc_probe_mfd(struct platform_device *pdev, ...@@ -584,15 +586,15 @@ static int sun4i_gpadc_probe_mfd(struct platform_device *pdev,
* of_node, and the device from this driver as third argument to * of_node, and the device from this driver as third argument to
* return the temperature. * return the temperature.
*/ */
struct thermal_zone_device *tzd; info->sensor_device = pdev->dev.parent;
tzd = devm_thermal_zone_of_sensor_register(pdev->dev.parent, 0, info->tzd = thermal_zone_of_sensor_register(info->sensor_device,
info, 0, info,
&sun4i_ts_tz_ops); &sun4i_ts_tz_ops);
if (IS_ERR(tzd)) { if (IS_ERR(info->tzd)) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"could not register thermal sensor: %ld\n", "could not register thermal sensor: %ld\n",
PTR_ERR(tzd)); PTR_ERR(info->tzd));
return PTR_ERR(tzd); return PTR_ERR(info->tzd);
} }
} else { } else {
indio_dev->num_channels = indio_dev->num_channels =
...@@ -688,7 +690,13 @@ static int sun4i_gpadc_remove(struct platform_device *pdev) ...@@ -688,7 +690,13 @@ static int sun4i_gpadc_remove(struct platform_device *pdev)
pm_runtime_put(&pdev->dev); pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
if (!info->no_irq && IS_ENABLED(CONFIG_THERMAL_OF))
if (!IS_ENABLED(CONFIG_THERMAL_OF))
return 0;
thermal_zone_of_sensor_unregister(info->sensor_device, info->tzd);
if (!info->no_irq)
iio_map_array_unregister(indio_dev); iio_map_array_unregister(indio_dev);
return 0; return 0;
...@@ -700,6 +708,7 @@ static const struct platform_device_id sun4i_gpadc_id[] = { ...@@ -700,6 +708,7 @@ static const struct platform_device_id sun4i_gpadc_id[] = {
{ "sun6i-a31-gpadc-iio", (kernel_ulong_t)&sun6i_gpadc_data }, { "sun6i-a31-gpadc-iio", (kernel_ulong_t)&sun6i_gpadc_data },
{ /* sentinel */ }, { /* sentinel */ },
}; };
MODULE_DEVICE_TABLE(platform, sun4i_gpadc_id);
static struct platform_driver sun4i_gpadc_driver = { static struct platform_driver sun4i_gpadc_driver = {
.driver = { .driver = {
...@@ -711,6 +720,7 @@ static struct platform_driver sun4i_gpadc_driver = { ...@@ -711,6 +720,7 @@ static struct platform_driver sun4i_gpadc_driver = {
.probe = sun4i_gpadc_probe, .probe = sun4i_gpadc_probe,
.remove = sun4i_gpadc_remove, .remove = sun4i_gpadc_remove,
}; };
MODULE_DEVICE_TABLE(of, sun4i_gpadc_of_id);
module_platform_driver(sun4i_gpadc_driver); module_platform_driver(sun4i_gpadc_driver);
......
...@@ -614,7 +614,7 @@ static int tiadc_probe(struct platform_device *pdev) ...@@ -614,7 +614,7 @@ static int tiadc_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*indio_dev)); indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc_dev));
if (indio_dev == NULL) { if (indio_dev == NULL) {
dev_err(&pdev->dev, "failed to allocate iio device\n"); dev_err(&pdev->dev, "failed to allocate iio device\n");
return -ENOMEM; return -ENOMEM;
......
...@@ -451,6 +451,7 @@ static ssize_t iio_trigger_write_current(struct device *dev, ...@@ -451,6 +451,7 @@ static ssize_t iio_trigger_write_current(struct device *dev,
return len; return len;
out_trigger_put: out_trigger_put:
if (trig)
iio_trigger_put(trig); iio_trigger_put(trig);
return ret; return ret;
} }
......
...@@ -74,9 +74,9 @@ static const int int_time_mapping[] = {100000, 50000, 200000, 400000}; ...@@ -74,9 +74,9 @@ static const int int_time_mapping[] = {100000, 50000, 200000, 400000};
static const struct reg_field reg_field_it = static const struct reg_field reg_field_it =
REG_FIELD(LTR501_ALS_MEAS_RATE, 3, 4); REG_FIELD(LTR501_ALS_MEAS_RATE, 3, 4);
static const struct reg_field reg_field_als_intr = static const struct reg_field reg_field_als_intr =
REG_FIELD(LTR501_INTR, 0, 0);
static const struct reg_field reg_field_ps_intr =
REG_FIELD(LTR501_INTR, 1, 1); REG_FIELD(LTR501_INTR, 1, 1);
static const struct reg_field reg_field_ps_intr =
REG_FIELD(LTR501_INTR, 0, 0);
static const struct reg_field reg_field_als_rate = static const struct reg_field reg_field_als_rate =
REG_FIELD(LTR501_ALS_MEAS_RATE, 0, 2); REG_FIELD(LTR501_ALS_MEAS_RATE, 0, 2);
static const struct reg_field reg_field_ps_rate = static const struct reg_field reg_field_ps_rate =
......
...@@ -40,9 +40,9 @@ ...@@ -40,9 +40,9 @@
#define AS3935_AFE_PWR_BIT BIT(0) #define AS3935_AFE_PWR_BIT BIT(0)
#define AS3935_INT 0x03 #define AS3935_INT 0x03
#define AS3935_INT_MASK 0x07 #define AS3935_INT_MASK 0x0f
#define AS3935_EVENT_INT BIT(3) #define AS3935_EVENT_INT BIT(3)
#define AS3935_NOISE_INT BIT(1) #define AS3935_NOISE_INT BIT(0)
#define AS3935_DATA 0x07 #define AS3935_DATA 0x07
#define AS3935_DATA_MASK 0x3F #define AS3935_DATA_MASK 0x3F
...@@ -215,7 +215,7 @@ static irqreturn_t as3935_trigger_handler(int irq, void *private) ...@@ -215,7 +215,7 @@ static irqreturn_t as3935_trigger_handler(int irq, void *private)
st->buffer[0] = val & AS3935_DATA_MASK; st->buffer[0] = val & AS3935_DATA_MASK;
iio_push_to_buffers_with_timestamp(indio_dev, &st->buffer, iio_push_to_buffers_with_timestamp(indio_dev, &st->buffer,
pf->timestamp); iio_get_time_ns(indio_dev));
err_read: err_read:
iio_trigger_notify_done(indio_dev->trig); iio_trigger_notify_done(indio_dev->trig);
...@@ -244,7 +244,7 @@ static void as3935_event_work(struct work_struct *work) ...@@ -244,7 +244,7 @@ static void as3935_event_work(struct work_struct *work)
switch (val) { switch (val) {
case AS3935_EVENT_INT: case AS3935_EVENT_INT:
iio_trigger_poll(st->trig); iio_trigger_poll_chained(st->trig);
break; break;
case AS3935_NOISE_INT: case AS3935_NOISE_INT:
dev_warn(&st->spi->dev, "noise level is too high\n"); dev_warn(&st->spi->dev, "noise level is too high\n");
...@@ -269,8 +269,6 @@ static irqreturn_t as3935_interrupt_handler(int irq, void *private) ...@@ -269,8 +269,6 @@ static irqreturn_t as3935_interrupt_handler(int irq, void *private)
static void calibrate_as3935(struct as3935_state *st) static void calibrate_as3935(struct as3935_state *st)
{ {
mutex_lock(&st->lock);
/* mask disturber interrupt bit */ /* mask disturber interrupt bit */
as3935_write(st, AS3935_INT, BIT(5)); as3935_write(st, AS3935_INT, BIT(5));
...@@ -280,8 +278,6 @@ static void calibrate_as3935(struct as3935_state *st) ...@@ -280,8 +278,6 @@ static void calibrate_as3935(struct as3935_state *st)
mdelay(2); mdelay(2);
as3935_write(st, AS3935_TUNE_CAP, (st->tune_cap / TUNE_CAP_DIV)); as3935_write(st, AS3935_TUNE_CAP, (st->tune_cap / TUNE_CAP_DIV));
mutex_unlock(&st->lock);
} }
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
...@@ -318,6 +314,8 @@ static int as3935_resume(struct device *dev) ...@@ -318,6 +314,8 @@ static int as3935_resume(struct device *dev)
val &= ~AS3935_AFE_PWR_BIT; val &= ~AS3935_AFE_PWR_BIT;
ret = as3935_write(st, AS3935_AFE_GAIN, val); ret = as3935_write(st, AS3935_AFE_GAIN, val);
calibrate_as3935(st);
err_resume: err_resume:
mutex_unlock(&st->lock); mutex_unlock(&st->lock);
......
config CRYPTO_DEV_CCREE config CRYPTO_DEV_CCREE
tristate "Support for ARM TrustZone CryptoCell C7XX family of Crypto accelerators" tristate "Support for ARM TrustZone CryptoCell C7XX family of Crypto accelerators"
depends on CRYPTO_HW && OF && HAS_DMA depends on CRYPTO && CRYPTO_HW && OF && HAS_DMA
default n default n
select CRYPTO_HASH select CRYPTO_HASH
select CRYPTO_BLKCIPHER select CRYPTO_BLKCIPHER
......
...@@ -216,7 +216,8 @@ void ssi_buffer_mgr_copy_scatterlist_portion( ...@@ -216,7 +216,8 @@ void ssi_buffer_mgr_copy_scatterlist_portion(
uint32_t nents, lbytes; uint32_t nents, lbytes;
nents = ssi_buffer_mgr_get_sgl_nents(sg, end, &lbytes, NULL); nents = ssi_buffer_mgr_get_sgl_nents(sg, end, &lbytes, NULL);
sg_copy_buffer(sg, nents, (void *)dest, (end - to_skip), 0, (direct == SSI_SG_TO_BUF)); sg_copy_buffer(sg, nents, (void *)dest, (end - to_skip + 1), to_skip,
(direct == SSI_SG_TO_BUF));
} }
static inline int ssi_buffer_mgr_render_buff_to_mlli( static inline int ssi_buffer_mgr_render_buff_to_mlli(
......
...@@ -293,18 +293,10 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, ...@@ -293,18 +293,10 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm,
size_t lmmk_size; size_t lmmk_size;
size_t lum_size; size_t lum_size;
int rc; int rc;
mm_segment_t seg;
if (!lsm) if (!lsm)
return -ENODATA; return -ENODATA;
/*
* "Switch to kernel segment" to allow copying from kernel space by
* copy_{to,from}_user().
*/
seg = get_fs();
set_fs(KERNEL_DS);
if (lsm->lsm_magic != LOV_MAGIC_V1 && lsm->lsm_magic != LOV_MAGIC_V3) { if (lsm->lsm_magic != LOV_MAGIC_V1 && lsm->lsm_magic != LOV_MAGIC_V3) {
CERROR("bad LSM MAGIC: 0x%08X != 0x%08X nor 0x%08X\n", CERROR("bad LSM MAGIC: 0x%08X != 0x%08X nor 0x%08X\n",
lsm->lsm_magic, LOV_MAGIC_V1, LOV_MAGIC_V3); lsm->lsm_magic, LOV_MAGIC_V1, LOV_MAGIC_V3);
...@@ -406,6 +398,5 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, ...@@ -406,6 +398,5 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm,
out_free: out_free:
kvfree(lmmk); kvfree(lmmk);
out: out:
set_fs(seg);
return rc; return rc;
} }
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