mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Andreas Klinger <ak@it-klinger.de>,
	lars@metafoo.de, linux-kernel@vger.kernel.org,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH v2 2/2] iio: distance: add devantech us ranger srf04
Date: Tue, 31 Jan 2017 15:01:36 +0000	[thread overview]
Message-ID: <5F017199-2372-448C-9A67-B86D8113F984@kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.02.1701310816520.1494@pmeerw.net>



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.

      reply	other threads:[~2017-01-31 15:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-30 12:51 Andreas Klinger
2017-01-30 20:36 ` Jonathan Cameron
2017-01-31  7:19   ` Peter Meerwald-Stadler
2017-01-31 15:01     ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5F017199-2372-448C-9A67-B86D8113F984@kernel.org \
    --to=jic23@kernel.org \
    --cc=ak@it-klinger.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®