Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1570821
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 2/2] iio: distance: add devantech us ranger srf04 |
| Date | 2017-01-31 16:20 +0100 |
| Message-ID | <t5InT-2gX-17@gated-at.bofh.it> (permalink) |
| References | <t5jIR-45O-7@gated-at.bofh.it> <t5qU1-4V-7@gated-at.bofh.it> <t5B33-6i4-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 31 January 2017 07:19:16 GMT+00:00, Peter Meerwald-Stadler <pmeerw@pmeerw.net> wrote:
>
>> > + indio_dev->num_channels = ARRAY_SIZE(srf04_chan_spec);
>> > +
>> > + return iio_device_register(indio_dev);
>> > +}
>> > +
>> > +static int srf04_remove(struct platform_device *pdev)
>> > +{
>> > + struct iio_dev *indio_dev = platform_get_drvdata(pdev);
>> > +
>> > + iio_device_unregister(indio_dev);
>> With nothing else in here, you can use devm_iio_device_register
>> and drop the remove entirely.
>
>can devm_request_irq() and devm_iio_device_register() be used together?
>if both are devm_ we cant't guarantee that iio_device_unregister()
>comes
>first in _remove()?
>
>these devm_ things...
Yes. It is ordered and guarantees unwind in opposite order for a given Dev structure.
>
>> > +
>> > + return 0;
>> > +}
>> > +
>> > +static const struct of_device_id of_srf04_match[] = {
>> > + { .compatible = "devantech,srf04", },
>> > + {},
>> > +};
>> > +
>> > +MODULE_DEVICE_TABLE(of, of_srf04_match);
>> > +
>> > +static struct platform_driver srf04_driver = {
>> > + .probe = srf04_probe,
>> > + .remove = srf04_remove,
>> > + .driver = {
>> > + .name = "srf04-gpio",
>> > + .of_match_table = of_srf04_match,
>> > + },
>> > +};
>> > +
>> > +module_platform_driver(srf04_driver);
>> > +
>> > +MODULE_AUTHOR("Andreas Klinger <ak@it-klinger.de>");
>> > +MODULE_DESCRIPTION("SRF04 ultrasonic sensor for distance measuring
>using GPIOs");
>> > +MODULE_LICENSE("GPL");
>> > +MODULE_ALIAS("platform:srf04");
>> >
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-iio"
>in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH v2 2/2] iio: distance: add devantech us ranger srf04 Jonathan Cameron <jic23@kernel.org> - 2017-01-30 21:40 +0100
Re: [PATCH v2 2/2] iio: distance: add devantech us ranger srf04 Peter Meerwald-Stadler <pmeerw@pmeerw.net> - 2017-01-31 08:30 +0100
Re: [PATCH v2 2/2] iio: distance: add devantech us ranger srf04 Jonathan Cameron <jic23@kernel.org> - 2017-01-31 16:20 +0100
csiph-web