Skip to content

Commit

Permalink
staging:iio: Streamline API function naming
Browse files Browse the repository at this point in the history
Currently we use two different naming schemes in the IIO API, iio_verb_object
and iio_object_verb. E.g iio_device_register and iio_allocate_device. This
patches renames instances of the later to the former. The patch also renames allocate to
alloc as this seems to be the preferred form throughout the kernel.

In particular the following renames are performed by the patch:
	iio_put_device -> iio_device_put
	iio_allocate_device -> iio_device_alloc
	iio_free_device -> iio_device_free
	iio_get_trigger -> iio_trigger_get
	iio_put_trigger -> iio_trigger_put
	iio_allocate_trigger -> iio_trigger_alloc
	iio_free_trigger -> iio_trigger_free

The conversion was done with the following coccinelle patch with manual fixes to
comments and documentation.

<smpl>
@@
@@
-iio_put_device
+iio_device_put
@@
@@
-iio_allocate_device
+iio_device_alloc
@@
@@
-iio_free_device
+iio_device_free
@@
@@
-iio_get_trigger
+iio_trigger_get
@@
@@
-iio_put_trigger
+iio_trigger_put
@@
@@
-iio_allocate_trigger
+iio_trigger_alloc
@@
@@
-iio_free_trigger
+iio_trigger_free
</smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Lars-Peter Clausen authored and Greg Kroah-Hartman committed Apr 30, 2012
1 parent 5d4a678 commit 7cbb753
Show file tree
Hide file tree
Showing 91 changed files with 280 additions and 280 deletions.
8 changes: 4 additions & 4 deletions drivers/iio/industrialio-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ static struct device_type iio_dev_type = {
.release = iio_dev_release,
};

struct iio_dev *iio_allocate_device(int sizeof_priv)
struct iio_dev *iio_device_alloc(int sizeof_priv)
{
struct iio_dev *dev;
size_t alloc_size;
Expand Down Expand Up @@ -773,16 +773,16 @@ struct iio_dev *iio_allocate_device(int sizeof_priv)

return dev;
}
EXPORT_SYMBOL(iio_allocate_device);
EXPORT_SYMBOL(iio_device_alloc);

void iio_free_device(struct iio_dev *dev)
void iio_device_free(struct iio_dev *dev)
{
if (dev) {
ida_simple_remove(&iio_ida, dev->id);
kfree(dev);
}
}
EXPORT_SYMBOL(iio_free_device);
EXPORT_SYMBOL(iio_device_free);

/**
* iio_chrdev_open() - chrdev file open for buffer access and ioctls
Expand Down
14 changes: 7 additions & 7 deletions drivers/iio/industrialio-trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ static ssize_t iio_trigger_write_current(struct device *dev,
indio_dev->trig = trig;

if (oldtrig && indio_dev->trig != oldtrig)
iio_put_trigger(oldtrig);
iio_trigger_put(oldtrig);
if (indio_dev->trig)
iio_get_trigger(indio_dev->trig);
iio_trigger_get(indio_dev->trig);

return len;
}
Expand Down Expand Up @@ -426,7 +426,7 @@ static void iio_trig_subirqunmask(struct irq_data *d)
trig->subirqs[d->irq - trig->subirq_base].enabled = true;
}

struct iio_trigger *iio_allocate_trigger(const char *fmt, ...)
struct iio_trigger *iio_trigger_alloc(const char *fmt, ...)
{
va_list vargs;
struct iio_trigger *trig;
Expand Down Expand Up @@ -472,14 +472,14 @@ struct iio_trigger *iio_allocate_trigger(const char *fmt, ...)
}
return trig;
}
EXPORT_SYMBOL(iio_allocate_trigger);
EXPORT_SYMBOL(iio_trigger_alloc);

void iio_free_trigger(struct iio_trigger *trig)
void iio_trigger_free(struct iio_trigger *trig)
{
if (trig)
put_device(&trig->dev);
}
EXPORT_SYMBOL(iio_free_trigger);
EXPORT_SYMBOL(iio_trigger_free);

void iio_device_register_trigger_consumer(struct iio_dev *indio_dev)
{
Expand All @@ -491,7 +491,7 @@ void iio_device_unregister_trigger_consumer(struct iio_dev *indio_dev)
{
/* Clean up and associated but not attached triggers references */
if (indio_dev->trig)
iio_put_trigger(indio_dev->trig);
iio_trigger_put(indio_dev->trig);
}

int iio_triggered_buffer_postenable(struct iio_dev *indio_dev)
Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/iio/Documentation/device.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The crucial structure for device drivers in iio is iio_dev.

First allocate one using:

struct iio_dev *indio_dev = iio_allocate_device(sizeof(struct chip_state));
struct iio_dev *indio_dev = iio_device_alloc(sizeof(struct chip_state));
where chip_state is a structure of local state data for this instance of
the chip.

Expand Down Expand Up @@ -78,4 +78,4 @@ be registered afterwards (otherwise the whole parentage of devices
gets confused)

On remove, iio_device_unregister(indio_dev) will remove the device from
the core, and iio_free_device will clean up.
the core, and iio_device_free will clean up.
2 changes: 1 addition & 1 deletion drivers/staging/iio/Documentation/trigger.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ an IIO device. Whilst this can create device specific complexities
such triggers are registered with the core in the same way as
stand-alone triggers.

struct iio_trig *trig = iio_allocate_trigger("<trigger format string>", ...);
struct iio_trig *trig = iio_trigger_alloc("<trigger format string>", ...);

allocates a trigger structure. The key elements to then fill in within
a driver are:
Expand Down
6 changes: 3 additions & 3 deletions drivers/staging/iio/accel/adis16201_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ static int __devinit adis16201_probe(struct spi_device *spi)
struct iio_dev *indio_dev;

/* setup the industrialio driver allocated elements */
indio_dev = iio_allocate_device(sizeof(*st));
indio_dev = iio_device_alloc(sizeof(*st));
if (indio_dev == NULL) {
ret = -ENOMEM;
goto error_ret;
Expand Down Expand Up @@ -587,7 +587,7 @@ static int __devinit adis16201_probe(struct spi_device *spi)
error_unreg_ring_funcs:
adis16201_unconfigure_ring(indio_dev);
error_free_dev:
iio_free_device(indio_dev);
iio_device_free(indio_dev);
error_ret:
return ret;
}
Expand All @@ -600,7 +600,7 @@ static int adis16201_remove(struct spi_device *spi)
adis16201_remove_trigger(indio_dev);
iio_buffer_unregister(indio_dev);
adis16201_unconfigure_ring(indio_dev);
iio_free_device(indio_dev);
iio_device_free(indio_dev);

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/staging/iio/accel/adis16201_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int adis16201_probe_trigger(struct iio_dev *indio_dev)
int ret;
struct adis16201_state *st = iio_priv(indio_dev);

st->trig = iio_allocate_trigger("adis16201-dev%d", indio_dev->id);
st->trig = iio_trigger_alloc("adis16201-dev%d", indio_dev->id);
if (st->trig == NULL) {
ret = -ENOMEM;
goto error_ret;
Expand All @@ -56,7 +56,7 @@ int adis16201_probe_trigger(struct iio_dev *indio_dev)
error_free_irq:
free_irq(st->us->irq, st->trig);
error_free_trig:
iio_free_trigger(st->trig);
iio_trigger_free(st->trig);
error_ret:
return ret;
}
Expand All @@ -67,5 +67,5 @@ void adis16201_remove_trigger(struct iio_dev *indio_dev)

iio_trigger_unregister(state->trig);
free_irq(state->us->irq, state->trig);
iio_free_trigger(state->trig);
iio_trigger_free(state->trig);
}
6 changes: 3 additions & 3 deletions drivers/staging/iio/accel/adis16203_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ static int __devinit adis16203_probe(struct spi_device *spi)
struct adis16203_state *st;

/* setup the industrialio driver allocated elements */
indio_dev = iio_allocate_device(sizeof(*st));
indio_dev = iio_device_alloc(sizeof(*st));
if (indio_dev == NULL) {
ret = -ENOMEM;
goto error_ret;
Expand Down Expand Up @@ -523,7 +523,7 @@ static int __devinit adis16203_probe(struct spi_device *spi)
error_unreg_ring_funcs:
adis16203_unconfigure_ring(indio_dev);
error_free_dev:
iio_free_device(indio_dev);
iio_device_free(indio_dev);
error_ret:
return ret;
}
Expand All @@ -536,7 +536,7 @@ static int adis16203_remove(struct spi_device *spi)
adis16203_remove_trigger(indio_dev);
iio_buffer_unregister(indio_dev);
adis16203_unconfigure_ring(indio_dev);
iio_free_device(indio_dev);
iio_device_free(indio_dev);

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/staging/iio/accel/adis16203_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int adis16203_probe_trigger(struct iio_dev *indio_dev)
int ret;
struct adis16203_state *st = iio_priv(indio_dev);

st->trig = iio_allocate_trigger("adis16203-dev%d", indio_dev->id);
st->trig = iio_trigger_alloc("adis16203-dev%d", indio_dev->id);
if (st->trig == NULL) {
ret = -ENOMEM;
goto error_ret;
Expand Down Expand Up @@ -58,7 +58,7 @@ int adis16203_probe_trigger(struct iio_dev *indio_dev)
error_free_irq:
free_irq(st->us->irq, st->trig);
error_free_trig:
iio_free_trigger(st->trig);
iio_trigger_free(st->trig);
error_ret:
return ret;
}
Expand All @@ -69,5 +69,5 @@ void adis16203_remove_trigger(struct iio_dev *indio_dev)

iio_trigger_unregister(st->trig);
free_irq(st->us->irq, st->trig);
iio_free_trigger(st->trig);
iio_trigger_free(st->trig);
}
6 changes: 3 additions & 3 deletions drivers/staging/iio/accel/adis16204_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ static int __devinit adis16204_probe(struct spi_device *spi)
struct iio_dev *indio_dev;

/* setup the industrialio driver allocated elements */
indio_dev = iio_allocate_device(sizeof(*st));
indio_dev = iio_device_alloc(sizeof(*st));
if (indio_dev == NULL) {
ret = -ENOMEM;
goto error_ret;
Expand Down Expand Up @@ -598,7 +598,7 @@ static int __devinit adis16204_probe(struct spi_device *spi)
error_unreg_ring_funcs:
adis16204_unconfigure_ring(indio_dev);
error_free_dev:
iio_free_device(indio_dev);
iio_device_free(indio_dev);
error_ret:
return ret;
}
Expand All @@ -611,7 +611,7 @@ static int adis16204_remove(struct spi_device *spi)
adis16204_remove_trigger(indio_dev);
iio_buffer_unregister(indio_dev);
adis16204_unconfigure_ring(indio_dev);
iio_free_device(indio_dev);
iio_device_free(indio_dev);

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/staging/iio/accel/adis16204_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int adis16204_probe_trigger(struct iio_dev *indio_dev)
int ret;
struct adis16204_state *st = iio_priv(indio_dev);

st->trig = iio_allocate_trigger("adis16204-dev%d", indio_dev->id);
st->trig = iio_trigger_alloc("adis16204-dev%d", indio_dev->id);
if (st->trig == NULL) {
ret = -ENOMEM;
goto error_ret;
Expand Down Expand Up @@ -58,7 +58,7 @@ int adis16204_probe_trigger(struct iio_dev *indio_dev)
error_free_irq:
free_irq(st->us->irq, st->trig);
error_free_trig:
iio_free_trigger(st->trig);
iio_trigger_free(st->trig);
error_ret:
return ret;
}
Expand All @@ -69,5 +69,5 @@ void adis16204_remove_trigger(struct iio_dev *indio_dev)

iio_trigger_unregister(state->trig);
free_irq(state->us->irq, state->trig);
iio_free_trigger(state->trig);
iio_trigger_free(state->trig);
}
6 changes: 3 additions & 3 deletions drivers/staging/iio/accel/adis16209_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ static int __devinit adis16209_probe(struct spi_device *spi)
struct iio_dev *indio_dev;

/* setup the industrialio driver allocated elements */
indio_dev = iio_allocate_device(sizeof(*st));
indio_dev = iio_device_alloc(sizeof(*st));
if (indio_dev == NULL) {
ret = -ENOMEM;
goto error_ret;
Expand Down Expand Up @@ -597,7 +597,7 @@ static int __devinit adis16209_probe(struct spi_device *spi)
error_unreg_ring_funcs:
adis16209_unconfigure_ring(indio_dev);
error_free_dev:
iio_free_device(indio_dev);
iio_device_free(indio_dev);
error_ret:
return ret;
}
Expand All @@ -612,7 +612,7 @@ static int adis16209_remove(struct spi_device *spi)
adis16209_remove_trigger(indio_dev);
iio_buffer_unregister(indio_dev);
adis16209_unconfigure_ring(indio_dev);
iio_free_device(indio_dev);
iio_device_free(indio_dev);

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/staging/iio/accel/adis16209_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int adis16209_probe_trigger(struct iio_dev *indio_dev)
int ret;
struct adis16209_state *st = iio_priv(indio_dev);

st->trig = iio_allocate_trigger("adis16209-dev%d", indio_dev->id);
st->trig = iio_trigger_alloc("adis16209-dev%d", indio_dev->id);
if (st->trig == NULL) {
ret = -ENOMEM;
goto error_ret;
Expand Down Expand Up @@ -66,7 +66,7 @@ int adis16209_probe_trigger(struct iio_dev *indio_dev)
error_free_irq:
free_irq(st->us->irq, st->trig);
error_free_trig:
iio_free_trigger(st->trig);
iio_trigger_free(st->trig);
error_ret:
return ret;
}
Expand All @@ -77,5 +77,5 @@ void adis16209_remove_trigger(struct iio_dev *indio_dev)

iio_trigger_unregister(st->trig);
free_irq(st->us->irq, st->trig);
iio_free_trigger(st->trig);
iio_trigger_free(st->trig);
}
6 changes: 3 additions & 3 deletions drivers/staging/iio/accel/adis16220_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ static int __devinit adis16220_probe(struct spi_device *spi)
struct iio_dev *indio_dev;

/* setup the industrialio driver allocated elements */
indio_dev = iio_allocate_device(sizeof(*st));
indio_dev = iio_device_alloc(sizeof(*st));
if (indio_dev == NULL) {
ret = -ENOMEM;
goto error_ret;
Expand Down Expand Up @@ -685,7 +685,7 @@ static int __devinit adis16220_probe(struct spi_device *spi)
error_unregister_dev:
iio_device_unregister(indio_dev);
error_free_dev:
iio_free_device(indio_dev);
iio_device_free(indio_dev);
error_ret:
return ret;
}
Expand All @@ -700,7 +700,7 @@ static int adis16220_remove(struct spi_device *spi)
sysfs_remove_bin_file(&indio_dev->dev.kobj, &adc1_bin);
sysfs_remove_bin_file(&indio_dev->dev.kobj, &accel_bin);
iio_device_unregister(indio_dev);
iio_free_device(indio_dev);
iio_device_free(indio_dev);

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/staging/iio/accel/adis16240_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ static int __devinit adis16240_probe(struct spi_device *spi)
struct iio_dev *indio_dev;

/* setup the industrialio driver allocated elements */
indio_dev = iio_allocate_device(sizeof(*st));
indio_dev = iio_device_alloc(sizeof(*st));
if (indio_dev == NULL) {
ret = -ENOMEM;
goto error_ret;
Expand Down Expand Up @@ -631,7 +631,7 @@ static int __devinit adis16240_probe(struct spi_device *spi)
error_unreg_ring_funcs:
adis16240_unconfigure_ring(indio_dev);
error_free_dev:
iio_free_device(indio_dev);
iio_device_free(indio_dev);
error_ret:
return ret;
}
Expand All @@ -647,7 +647,7 @@ static int adis16240_remove(struct spi_device *spi)
adis16240_remove_trigger(indio_dev);
iio_buffer_unregister(indio_dev);
adis16240_unconfigure_ring(indio_dev);
iio_free_device(indio_dev);
iio_device_free(indio_dev);

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/staging/iio/accel/adis16240_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int adis16240_probe_trigger(struct iio_dev *indio_dev)
int ret;
struct adis16240_state *st = iio_priv(indio_dev);

st->trig = iio_allocate_trigger("adis16240-dev%d", indio_dev->id);
st->trig = iio_trigger_alloc("adis16240-dev%d", indio_dev->id);
if (st->trig == NULL) {
ret = -ENOMEM;
goto error_ret;
Expand Down Expand Up @@ -67,7 +67,7 @@ int adis16240_probe_trigger(struct iio_dev *indio_dev)
error_free_irq:
free_irq(st->us->irq, st->trig);
error_free_trig:
iio_free_trigger(st->trig);
iio_trigger_free(st->trig);
error_ret:
return ret;
}
Expand All @@ -78,5 +78,5 @@ void adis16240_remove_trigger(struct iio_dev *indio_dev)

iio_trigger_unregister(st->trig);
free_irq(st->us->irq, st->trig);
iio_free_trigger(st->trig);
iio_trigger_free(st->trig);
}
Loading

0 comments on commit 7cbb753

Please sign in to comment.