mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
Various minor IIO fixes for staging-next.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQIcBAABAgAGBQJP/x8tAAoJEFSFNJnE9BaI8OIP/AxZKFDFdVV/yPFwfVVY/Hig HuhXSxRbEx70ck0gkTTtD2dZGTtBQsJy4uOlOncG4OpEnu22AlI/tr5cEohuzV8F 4Vqx6kZoxtMZgoKzA1cE7u7F3753+cWeWC6Z0/45pqU4Oc4X4igi1/4LesxH+2Ct lmv/KnCsjxkb6aByp9Hz9xADBfDdsQ5fe1kxMx1Oj6jLqzFXnsqbUQ6Oj0NjSWUK NSaKiKUCGEVRBj6uT0ajzVTghZ4iCSW4mNfoln7LYUYdH3pEZ4VVwiu3/PnlnxTR SqxTj4ldsgIn471bmVQV0LdaNHf9dtO1br1l7AOEnzv1ah2XyxGhmq2IdshVbf/y g2eTreGln/fJt9h+r124m3gxC/FsHYiK3+ax2KW4SB0oRGiqXV8Q6QqmNGhhXOW+ DBZDZez+5mdNYn2M8p017OAsgDeH+ra1LZ1N8dvIw7FZhXFSLjYLFp0Fpgfmkc0G sed13A72HqWkbqQjih2V1OYcsyVcfxtOqXmXfakju+utsgjb0awIt7fvUTLOxphK VMUBN96rAhGwZ260Dpf1TEY5iVQ3SpN8hzX+eAObtBolBVtUEMqfAqcagdRBWK3B ZELZ31HKAsOA+E+mX6KU75Oe474ARfXZB/DSX5I78rJSKHZ4LEhSNAsoiAwpoch0 8CMyF2hPAEKH1BgB5VdJ =UMCQ -----END PGP SIGNATURE----- Merge tag 'fixes-togreg-3.6a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into work-next Various minor IIO fixes for staging-next.
This commit is contained in:
commit
fc6ed2c641
@ -122,25 +122,6 @@ enum ad5064_type {
|
||||
ID_AD5668_2,
|
||||
};
|
||||
|
||||
static int ad5064_i2c_write(struct ad5064_state *st, unsigned int cmd,
|
||||
unsigned int addr, unsigned int val)
|
||||
{
|
||||
struct i2c_client *i2c = to_i2c_client(st->dev);
|
||||
|
||||
st->data.i2c[0] = (cmd << 4) | addr;
|
||||
put_unaligned_be16(val, &st->data.i2c[1]);
|
||||
return i2c_master_send(i2c, st->data.i2c, 3);
|
||||
}
|
||||
|
||||
static int ad5064_spi_write(struct ad5064_state *st, unsigned int cmd,
|
||||
unsigned int addr, unsigned int val)
|
||||
{
|
||||
struct spi_device *spi = to_spi_device(st->dev);
|
||||
|
||||
st->data.spi = cpu_to_be32(AD5064_CMD(cmd) | AD5064_ADDR(addr) | val);
|
||||
return spi_write(spi, &st->data.spi, sizeof(st->data.spi));
|
||||
}
|
||||
|
||||
static int ad5064_write(struct ad5064_state *st, unsigned int cmd,
|
||||
unsigned int addr, unsigned int val, unsigned int shift)
|
||||
{
|
||||
@ -533,6 +514,15 @@ static int __devexit ad5064_remove(struct device *dev)
|
||||
|
||||
#if IS_ENABLED(CONFIG_SPI_MASTER)
|
||||
|
||||
static int ad5064_spi_write(struct ad5064_state *st, unsigned int cmd,
|
||||
unsigned int addr, unsigned int val)
|
||||
{
|
||||
struct spi_device *spi = to_spi_device(st->dev);
|
||||
|
||||
st->data.spi = cpu_to_be32(AD5064_CMD(cmd) | AD5064_ADDR(addr) | val);
|
||||
return spi_write(spi, &st->data.spi, sizeof(st->data.spi));
|
||||
}
|
||||
|
||||
static int __devinit ad5064_spi_probe(struct spi_device *spi)
|
||||
{
|
||||
const struct spi_device_id *id = spi_get_device_id(spi);
|
||||
@ -582,7 +572,7 @@ static int __init ad5064_spi_register_driver(void)
|
||||
return spi_register_driver(&ad5064_spi_driver);
|
||||
}
|
||||
|
||||
static void __exit ad5064_spi_unregister_driver(void)
|
||||
static void ad5064_spi_unregister_driver(void)
|
||||
{
|
||||
spi_unregister_driver(&ad5064_spi_driver);
|
||||
}
|
||||
@ -596,6 +586,16 @@ static inline void ad5064_spi_unregister_driver(void) { }
|
||||
|
||||
#if IS_ENABLED(CONFIG_I2C)
|
||||
|
||||
static int ad5064_i2c_write(struct ad5064_state *st, unsigned int cmd,
|
||||
unsigned int addr, unsigned int val)
|
||||
{
|
||||
struct i2c_client *i2c = to_i2c_client(st->dev);
|
||||
|
||||
st->data.i2c[0] = (cmd << 4) | addr;
|
||||
put_unaligned_be16(val, &st->data.i2c[1]);
|
||||
return i2c_master_send(i2c, st->data.i2c, 3);
|
||||
}
|
||||
|
||||
static int __devinit ad5064_i2c_probe(struct i2c_client *i2c,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
|
@ -198,11 +198,12 @@ struct iio_channel *iio_channel_get_all(const char *name)
|
||||
iio_device_get(chans[mapind].indio_dev);
|
||||
mapind++;
|
||||
}
|
||||
mutex_unlock(&iio_map_list_lock);
|
||||
if (mapind == 0) {
|
||||
ret = -ENODEV;
|
||||
goto error_free_chans;
|
||||
}
|
||||
mutex_unlock(&iio_map_list_lock);
|
||||
|
||||
return chans;
|
||||
|
||||
error_free_chans:
|
||||
|
@ -74,7 +74,7 @@ static irqreturn_t max1363_trigger_handler(int irq, void *p)
|
||||
else
|
||||
b_sent = i2c_master_recv(st->client, rxbuf, numvals);
|
||||
if (b_sent < 0)
|
||||
goto done;
|
||||
goto done_free;
|
||||
|
||||
time_ns = iio_get_time_ns();
|
||||
|
||||
@ -82,9 +82,10 @@ static irqreturn_t max1363_trigger_handler(int irq, void *p)
|
||||
memcpy(rxbuf + d_size - sizeof(s64), &time_ns, sizeof(time_ns));
|
||||
iio_push_to_buffer(indio_dev->buffer, rxbuf, time_ns);
|
||||
|
||||
done_free:
|
||||
kfree(rxbuf);
|
||||
done:
|
||||
iio_trigger_notify_done(indio_dev->trig);
|
||||
kfree(rxbuf);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user