Skip to content

Commit b0de415

Browse files
committed
Merge tag 'staging-4.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver fixes from Greg KH: "Here are a number of iio and staging driver fixes for reported issues for 4.2-rc4. All have been in linux-next for a while with no problems" * tag 'staging-4.2-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (34 commits) iio:light:stk3310: make endianness independent of host iio:light:stk3310: move device register to end of probe iio: mma8452: use iio event type IIO_EV_TYPE_MAG iio: mcp320x: Fix NULL pointer dereference iio: adc: vf610: fix the adc register read fail issue iio: mlx96014: Replace offset sign iio: magnetometer: mmc35240: fix SET/RESET sequence iio: magnetometer: mmc35240: Fix SET/RESET mask iio: magnetometer: mmc35240: Fix crash in pm suspend iio:magnetometer:bmc150_magn: output intended variable iio:magnetometer:bmc150_magn: add regmap dependency staging: vt6656: check ieee80211_bss_conf bssid not NULL staging: vt6655: check ieee80211_bss_conf bssid not NULL iio: tmp006: Check channel info on write iio: sx9500: Add missing init in sx9500_buffer_pre{en,dis}able() iio:light:ltr501: fix regmap dependency iio:light:ltr501: fix variable in ltr501_init iio: sx9500: fix bug in compensation code iio: sx9500: rework error handling of raw readings iio: magnetometer: mmc35240: fix available sampling frequencies ...
2 parents e433b65 + 00243b1 commit b0de415

File tree

8 files changed

+31
-26
lines changed

8 files changed

+31
-26
lines changed

drivers/iio/accel/mma8452.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,21 +557,21 @@ static void mma8452_transient_interrupt(struct iio_dev *indio_dev)
557557
if (src & MMA8452_TRANSIENT_SRC_XTRANSE)
558558
iio_push_event(indio_dev,
559559
IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_X,
560-
IIO_EV_TYPE_THRESH,
560+
IIO_EV_TYPE_MAG,
561561
IIO_EV_DIR_RISING),
562562
ts);
563563

564564
if (src & MMA8452_TRANSIENT_SRC_YTRANSE)
565565
iio_push_event(indio_dev,
566566
IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_Y,
567-
IIO_EV_TYPE_THRESH,
567+
IIO_EV_TYPE_MAG,
568568
IIO_EV_DIR_RISING),
569569
ts);
570570

571571
if (src & MMA8452_TRANSIENT_SRC_ZTRANSE)
572572
iio_push_event(indio_dev,
573573
IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_Z,
574-
IIO_EV_TYPE_THRESH,
574+
IIO_EV_TYPE_MAG,
575575
IIO_EV_DIR_RISING),
576576
ts);
577577
}
@@ -644,7 +644,7 @@ static int mma8452_reg_access_dbg(struct iio_dev *indio_dev,
644644

645645
static const struct iio_event_spec mma8452_transient_event[] = {
646646
{
647-
.type = IIO_EV_TYPE_THRESH,
647+
.type = IIO_EV_TYPE_MAG,
648648
.dir = IIO_EV_DIR_RISING,
649649
.mask_separate = BIT(IIO_EV_INFO_ENABLE),
650650
.mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) |

drivers/iio/adc/mcp320x.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ static int mcp320x_probe(struct spi_device *spi)
299299
indio_dev->channels = chip_info->channels;
300300
indio_dev->num_channels = chip_info->num_channels;
301301

302+
adc->chip_info = chip_info;
303+
302304
adc->transfer[0].tx_buf = &adc->tx_buf;
303305
adc->transfer[0].len = sizeof(adc->tx_buf);
304306
adc->transfer[1].rx_buf = adc->rx_buf;

drivers/iio/adc/vf610_adc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ static int vf610_adc_reg_access(struct iio_dev *indio_dev,
635635
struct vf610_adc *info = iio_priv(indio_dev);
636636

637637
if ((readval == NULL) ||
638-
(!(reg % 4) || (reg > VF610_REG_ADC_PCTL)))
638+
((reg % 4) || (reg > VF610_REG_ADC_PCTL)))
639639
return -EINVAL;
640640

641641
*readval = readl(info->regs + reg);

drivers/iio/light/stk3310.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ static int stk3310_read_event(struct iio_dev *indio_dev,
200200
int *val, int *val2)
201201
{
202202
u8 reg;
203-
u16 buf;
203+
__be16 buf;
204204
int ret;
205205
struct stk3310_data *data = iio_priv(indio_dev);
206206

@@ -222,7 +222,7 @@ static int stk3310_read_event(struct iio_dev *indio_dev,
222222
dev_err(&data->client->dev, "register read failed\n");
223223
return ret;
224224
}
225-
*val = swab16(buf);
225+
*val = be16_to_cpu(buf);
226226

227227
return IIO_VAL_INT;
228228
}
@@ -235,7 +235,7 @@ static int stk3310_write_event(struct iio_dev *indio_dev,
235235
int val, int val2)
236236
{
237237
u8 reg;
238-
u16 buf;
238+
__be16 buf;
239239
int ret;
240240
unsigned int index;
241241
struct stk3310_data *data = iio_priv(indio_dev);
@@ -252,7 +252,7 @@ static int stk3310_write_event(struct iio_dev *indio_dev,
252252
else
253253
return -EINVAL;
254254

255-
buf = swab16(val);
255+
buf = cpu_to_be16(val);
256256
ret = regmap_bulk_write(data->regmap, reg, &buf, 2);
257257
if (ret < 0)
258258
dev_err(&client->dev, "failed to set PS threshold!\n");
@@ -301,7 +301,7 @@ static int stk3310_read_raw(struct iio_dev *indio_dev,
301301
int *val, int *val2, long mask)
302302
{
303303
u8 reg;
304-
u16 buf;
304+
__be16 buf;
305305
int ret;
306306
unsigned int index;
307307
struct stk3310_data *data = iio_priv(indio_dev);
@@ -322,7 +322,7 @@ static int stk3310_read_raw(struct iio_dev *indio_dev,
322322
mutex_unlock(&data->lock);
323323
return ret;
324324
}
325-
*val = swab16(buf);
325+
*val = be16_to_cpu(buf);
326326
mutex_unlock(&data->lock);
327327
return IIO_VAL_INT;
328328
case IIO_CHAN_INFO_INT_TIME:
@@ -608,13 +608,7 @@ static int stk3310_probe(struct i2c_client *client,
608608
if (ret < 0)
609609
return ret;
610610

611-
ret = iio_device_register(indio_dev);
612-
if (ret < 0) {
613-
dev_err(&client->dev, "device_register failed\n");
614-
stk3310_set_state(data, STK3310_STATE_STANDBY);
615-
}
616-
617-
if (client->irq <= 0)
611+
if (client->irq < 0)
618612
client->irq = stk3310_gpio_probe(client);
619613

620614
if (client->irq >= 0) {
@@ -629,6 +623,12 @@ static int stk3310_probe(struct i2c_client *client,
629623
client->irq);
630624
}
631625

626+
ret = iio_device_register(indio_dev);
627+
if (ret < 0) {
628+
dev_err(&client->dev, "device_register failed\n");
629+
stk3310_set_state(data, STK3310_STATE_STANDBY);
630+
}
631+
632632
return ret;
633633
}
634634

drivers/iio/magnetometer/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ config IIO_ST_MAGN_SPI_3AXIS
9090
config BMC150_MAGN
9191
tristate "Bosch BMC150 Magnetometer Driver"
9292
depends on I2C
93+
select REGMAP_I2C
9394
select IIO_BUFFER
9495
select IIO_TRIGGERED_BUFFER
9596
help

drivers/iio/magnetometer/bmc150_magn.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,11 +706,11 @@ static int bmc150_magn_init(struct bmc150_magn_data *data)
706706
goto err_poweroff;
707707
}
708708
if (chip_id != BMC150_MAGN_CHIP_ID_VAL) {
709-
dev_err(&data->client->dev, "Invalid chip id 0x%x\n", ret);
709+
dev_err(&data->client->dev, "Invalid chip id 0x%x\n", chip_id);
710710
ret = -ENODEV;
711711
goto err_poweroff;
712712
}
713-
dev_dbg(&data->client->dev, "Chip id %x\n", ret);
713+
dev_dbg(&data->client->dev, "Chip id %x\n", chip_id);
714714

715715
preset = bmc150_magn_presets_table[BMC150_MAGN_DEFAULT_PRESET];
716716
ret = bmc150_magn_set_odr(data, preset.odr);

drivers/iio/magnetometer/mmc35240.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ static int mmc35240_hw_set(struct mmc35240_data *data, bool set)
202202
coil_bit = MMC35240_CTRL0_RESET_BIT;
203203

204204
return regmap_update_bits(data->regmap, MMC35240_REG_CTRL0,
205-
MMC35240_CTRL0_REFILL_BIT,
206-
coil_bit);
205+
coil_bit, coil_bit);
206+
207207
}
208208

209209
static int mmc35240_init(struct mmc35240_data *data)
@@ -222,14 +222,15 @@ static int mmc35240_init(struct mmc35240_data *data)
222222

223223
/*
224224
* make sure we restore sensor characteristics, by doing
225-
* a RESET/SET sequence
225+
* a SET/RESET sequence, the axis polarity being naturally
226+
* aligned after RESET
226227
*/
227-
ret = mmc35240_hw_set(data, false);
228+
ret = mmc35240_hw_set(data, true);
228229
if (ret < 0)
229230
return ret;
230231
usleep_range(MMC53240_WAIT_SET_RESET, MMC53240_WAIT_SET_RESET + 1);
231232

232-
ret = mmc35240_hw_set(data, true);
233+
ret = mmc35240_hw_set(data, false);
233234
if (ret < 0)
234235
return ret;
235236

@@ -503,6 +504,7 @@ static int mmc35240_probe(struct i2c_client *client,
503504
}
504505

505506
data = iio_priv(indio_dev);
507+
i2c_set_clientdata(client, indio_dev);
506508
data->client = client;
507509
data->regmap = regmap;
508510
data->res = MMC35240_16_BITS_SLOW;

drivers/iio/temperature/mlx90614.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static int mlx90614_read_raw(struct iio_dev *indio_dev,
204204
*val = ret;
205205
return IIO_VAL_INT;
206206
case IIO_CHAN_INFO_OFFSET:
207-
*val = 13657;
207+
*val = -13657;
208208
*val2 = 500000;
209209
return IIO_VAL_INT_PLUS_MICRO;
210210
case IIO_CHAN_INFO_SCALE:

0 commit comments

Comments
 (0)