Skip to content

Commit 7cbb753

Browse files
larsclausengregkh
authored andcommitted
staging:iio: Streamline API function naming
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>
1 parent 5d4a678 commit 7cbb753

91 files changed

Lines changed: 280 additions & 280 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/iio/industrialio-core.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ static struct device_type iio_dev_type = {
737737
.release = iio_dev_release,
738738
};
739739

740-
struct iio_dev *iio_allocate_device(int sizeof_priv)
740+
struct iio_dev *iio_device_alloc(int sizeof_priv)
741741
{
742742
struct iio_dev *dev;
743743
size_t alloc_size;
@@ -773,16 +773,16 @@ struct iio_dev *iio_allocate_device(int sizeof_priv)
773773

774774
return dev;
775775
}
776-
EXPORT_SYMBOL(iio_allocate_device);
776+
EXPORT_SYMBOL(iio_device_alloc);
777777

778-
void iio_free_device(struct iio_dev *dev)
778+
void iio_device_free(struct iio_dev *dev)
779779
{
780780
if (dev) {
781781
ida_simple_remove(&iio_ida, dev->id);
782782
kfree(dev);
783783
}
784784
}
785-
EXPORT_SYMBOL(iio_free_device);
785+
EXPORT_SYMBOL(iio_device_free);
786786

787787
/**
788788
* iio_chrdev_open() - chrdev file open for buffer access and ioctls

‎drivers/iio/industrialio-trigger.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,9 @@ static ssize_t iio_trigger_write_current(struct device *dev,
360360
indio_dev->trig = trig;
361361

362362
if (oldtrig && indio_dev->trig != oldtrig)
363-
iio_put_trigger(oldtrig);
363+
iio_trigger_put(oldtrig);
364364
if (indio_dev->trig)
365-
iio_get_trigger(indio_dev->trig);
365+
iio_trigger_get(indio_dev->trig);
366366

367367
return len;
368368
}
@@ -426,7 +426,7 @@ static void iio_trig_subirqunmask(struct irq_data *d)
426426
trig->subirqs[d->irq - trig->subirq_base].enabled = true;
427427
}
428428

429-
struct iio_trigger *iio_allocate_trigger(const char *fmt, ...)
429+
struct iio_trigger *iio_trigger_alloc(const char *fmt, ...)
430430
{
431431
va_list vargs;
432432
struct iio_trigger *trig;
@@ -472,14 +472,14 @@ struct iio_trigger *iio_allocate_trigger(const char *fmt, ...)
472472
}
473473
return trig;
474474
}
475-
EXPORT_SYMBOL(iio_allocate_trigger);
475+
EXPORT_SYMBOL(iio_trigger_alloc);
476476

477-
void iio_free_trigger(struct iio_trigger *trig)
477+
void iio_trigger_free(struct iio_trigger *trig)
478478
{
479479
if (trig)
480480
put_device(&trig->dev);
481481
}
482-
EXPORT_SYMBOL(iio_free_trigger);
482+
EXPORT_SYMBOL(iio_trigger_free);
483483

484484
void iio_device_register_trigger_consumer(struct iio_dev *indio_dev)
485485
{
@@ -491,7 +491,7 @@ void iio_device_unregister_trigger_consumer(struct iio_dev *indio_dev)
491491
{
492492
/* Clean up and associated but not attached triggers references */
493493
if (indio_dev->trig)
494-
iio_put_trigger(indio_dev->trig);
494+
iio_trigger_put(indio_dev->trig);
495495
}
496496

497497
int iio_triggered_buffer_postenable(struct iio_dev *indio_dev)

‎drivers/staging/iio/Documentation/device.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The crucial structure for device drivers in iio is iio_dev.
88

99
First allocate one using:
1010

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

@@ -78,4 +78,4 @@ be registered afterwards (otherwise the whole parentage of devices
7878
gets confused)
7979

8080
On remove, iio_device_unregister(indio_dev) will remove the device from
81-
the core, and iio_free_device will clean up.
81+
the core, and iio_device_free will clean up.

‎drivers/staging/iio/Documentation/trigger.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ an IIO device. Whilst this can create device specific complexities
55
such triggers are registered with the core in the same way as
66
stand-alone triggers.
77

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

1010
allocates a trigger structure. The key elements to then fill in within
1111
a driver are:

‎drivers/staging/iio/accel/adis16201_core.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ static int __devinit adis16201_probe(struct spi_device *spi)
532532
struct iio_dev *indio_dev;
533533

534534
/* setup the industrialio driver allocated elements */
535-
indio_dev = iio_allocate_device(sizeof(*st));
535+
indio_dev = iio_device_alloc(sizeof(*st));
536536
if (indio_dev == NULL) {
537537
ret = -ENOMEM;
538538
goto error_ret;
@@ -587,7 +587,7 @@ static int __devinit adis16201_probe(struct spi_device *spi)
587587
error_unreg_ring_funcs:
588588
adis16201_unconfigure_ring(indio_dev);
589589
error_free_dev:
590-
iio_free_device(indio_dev);
590+
iio_device_free(indio_dev);
591591
error_ret:
592592
return ret;
593593
}
@@ -600,7 +600,7 @@ static int adis16201_remove(struct spi_device *spi)
600600
adis16201_remove_trigger(indio_dev);
601601
iio_buffer_unregister(indio_dev);
602602
adis16201_unconfigure_ring(indio_dev);
603-
iio_free_device(indio_dev);
603+
iio_device_free(indio_dev);
604604

605605
return 0;
606606
}

‎drivers/staging/iio/accel/adis16201_trigger.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int adis16201_probe_trigger(struct iio_dev *indio_dev)
2929
int ret;
3030
struct adis16201_state *st = iio_priv(indio_dev);
3131

32-
st->trig = iio_allocate_trigger("adis16201-dev%d", indio_dev->id);
32+
st->trig = iio_trigger_alloc("adis16201-dev%d", indio_dev->id);
3333
if (st->trig == NULL) {
3434
ret = -ENOMEM;
3535
goto error_ret;
@@ -56,7 +56,7 @@ int adis16201_probe_trigger(struct iio_dev *indio_dev)
5656
error_free_irq:
5757
free_irq(st->us->irq, st->trig);
5858
error_free_trig:
59-
iio_free_trigger(st->trig);
59+
iio_trigger_free(st->trig);
6060
error_ret:
6161
return ret;
6262
}
@@ -67,5 +67,5 @@ void adis16201_remove_trigger(struct iio_dev *indio_dev)
6767

6868
iio_trigger_unregister(state->trig);
6969
free_irq(state->us->irq, state->trig);
70-
iio_free_trigger(state->trig);
70+
iio_trigger_free(state->trig);
7171
}

‎drivers/staging/iio/accel/adis16203_core.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ static int __devinit adis16203_probe(struct spi_device *spi)
469469
struct adis16203_state *st;
470470

471471
/* setup the industrialio driver allocated elements */
472-
indio_dev = iio_allocate_device(sizeof(*st));
472+
indio_dev = iio_device_alloc(sizeof(*st));
473473
if (indio_dev == NULL) {
474474
ret = -ENOMEM;
475475
goto error_ret;
@@ -523,7 +523,7 @@ static int __devinit adis16203_probe(struct spi_device *spi)
523523
error_unreg_ring_funcs:
524524
adis16203_unconfigure_ring(indio_dev);
525525
error_free_dev:
526-
iio_free_device(indio_dev);
526+
iio_device_free(indio_dev);
527527
error_ret:
528528
return ret;
529529
}
@@ -536,7 +536,7 @@ static int adis16203_remove(struct spi_device *spi)
536536
adis16203_remove_trigger(indio_dev);
537537
iio_buffer_unregister(indio_dev);
538538
adis16203_unconfigure_ring(indio_dev);
539-
iio_free_device(indio_dev);
539+
iio_device_free(indio_dev);
540540

541541
return 0;
542542
}

‎drivers/staging/iio/accel/adis16203_trigger.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int adis16203_probe_trigger(struct iio_dev *indio_dev)
2929
int ret;
3030
struct adis16203_state *st = iio_priv(indio_dev);
3131

32-
st->trig = iio_allocate_trigger("adis16203-dev%d", indio_dev->id);
32+
st->trig = iio_trigger_alloc("adis16203-dev%d", indio_dev->id);
3333
if (st->trig == NULL) {
3434
ret = -ENOMEM;
3535
goto error_ret;
@@ -58,7 +58,7 @@ int adis16203_probe_trigger(struct iio_dev *indio_dev)
5858
error_free_irq:
5959
free_irq(st->us->irq, st->trig);
6060
error_free_trig:
61-
iio_free_trigger(st->trig);
61+
iio_trigger_free(st->trig);
6262
error_ret:
6363
return ret;
6464
}
@@ -69,5 +69,5 @@ void adis16203_remove_trigger(struct iio_dev *indio_dev)
6969

7070
iio_trigger_unregister(st->trig);
7171
free_irq(st->us->irq, st->trig);
72-
iio_free_trigger(st->trig);
72+
iio_trigger_free(st->trig);
7373
}

‎drivers/staging/iio/accel/adis16204_core.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ static int __devinit adis16204_probe(struct spi_device *spi)
545545
struct iio_dev *indio_dev;
546546

547547
/* setup the industrialio driver allocated elements */
548-
indio_dev = iio_allocate_device(sizeof(*st));
548+
indio_dev = iio_device_alloc(sizeof(*st));
549549
if (indio_dev == NULL) {
550550
ret = -ENOMEM;
551551
goto error_ret;
@@ -598,7 +598,7 @@ static int __devinit adis16204_probe(struct spi_device *spi)
598598
error_unreg_ring_funcs:
599599
adis16204_unconfigure_ring(indio_dev);
600600
error_free_dev:
601-
iio_free_device(indio_dev);
601+
iio_device_free(indio_dev);
602602
error_ret:
603603
return ret;
604604
}
@@ -611,7 +611,7 @@ static int adis16204_remove(struct spi_device *spi)
611611
adis16204_remove_trigger(indio_dev);
612612
iio_buffer_unregister(indio_dev);
613613
adis16204_unconfigure_ring(indio_dev);
614-
iio_free_device(indio_dev);
614+
iio_device_free(indio_dev);
615615

616616
return 0;
617617
}

‎drivers/staging/iio/accel/adis16204_trigger.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int adis16204_probe_trigger(struct iio_dev *indio_dev)
2929
int ret;
3030
struct adis16204_state *st = iio_priv(indio_dev);
3131

32-
st->trig = iio_allocate_trigger("adis16204-dev%d", indio_dev->id);
32+
st->trig = iio_trigger_alloc("adis16204-dev%d", indio_dev->id);
3333
if (st->trig == NULL) {
3434
ret = -ENOMEM;
3535
goto error_ret;
@@ -58,7 +58,7 @@ int adis16204_probe_trigger(struct iio_dev *indio_dev)
5858
error_free_irq:
5959
free_irq(st->us->irq, st->trig);
6060
error_free_trig:
61-
iio_free_trigger(st->trig);
61+
iio_trigger_free(st->trig);
6262
error_ret:
6363
return ret;
6464
}
@@ -69,5 +69,5 @@ void adis16204_remove_trigger(struct iio_dev *indio_dev)
6969

7070
iio_trigger_unregister(state->trig);
7171
free_irq(state->us->irq, state->trig);
72-
iio_free_trigger(state->trig);
72+
iio_trigger_free(state->trig);
7373
}

0 commit comments

Comments
 (0)