linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Mack <zonque@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, jhovold@gmail.com,
	hartleys@visionengravers.com
Subject: Re: [PATCH v2 1/2] input: rotary-encoder: switch to devm_* allocation of GPIOs and IRQs
Date: Wed, 25 Jul 2012 20:04:38 +0200	[thread overview]
Message-ID: <50103536.4030109@gmail.com> (raw)
In-Reply-To: <20120725162948.GB6276@core.coreip.homeip.net>

On 25.07.2012 18:29, Dmitry Torokhov wrote:
> On Wed, Jul 25, 2012 at 06:07:24PM +0200, Daniel Mack wrote:
>> On 25.07.2012 18:05, Dmitry Torokhov wrote:
>>> On Wed, Jul 25, 2012 at 09:43:47AM +0200, Daniel Mack wrote:
>>>> @@ -263,12 +243,7 @@ exit_free_mem:
>>>>  static int __devexit rotary_encoder_remove(struct platform_device *pdev)
>>>>  {
>>>>  	struct rotary_encoder *encoder = platform_get_drvdata(pdev);
>>>> -	struct rotary_encoder_platform_data *pdata = pdev->dev.platform_data;
>>>>  
>>>> -	free_irq(encoder->irq_a, encoder);
>>>> -	free_irq(encoder->irq_b, encoder);
>>>> -	gpio_free(pdata->gpio_a);
>>>> -	gpio_free(pdata->gpio_b);
>>>>  	input_unregister_device(encoder->input);
>>>
>>> Another botched devm_ conversion. *sigh*
>>>
>>> Input device gone, IRQ arrives, kernel goes oops, machine hangs hard.
>>>
>>> Please, do not use devm_ interfaces unless... Actually, just do not use
>>> nor suggest devm_interfaces until all resources are devm-ized. Mixing 2
>>> styles of releasing resources leads to trouble.
>>
>> Ok, makes sense. Thanks for noticing. Are you happy with the first
>> version I submitted then?
> 
> I have a few issues with that version as well:
> 
> 1. It writes over platform_data field in the device which does nto
> belong to the driver (this field belongs to the platform/board code);
> 
> 2. I believe we should favor kernel supplied data over firmware
> allowing users to override DT bindings, if needed;

Ok, this is different from what I saw in other drivers, but I'm fine
with that.

> 3. It still uses devm_* to allocate memory and as I said I do not like
> mixing 2 styles of managign resources in one driver.

Ok, sorry again. I didn't closely follow that new development, hence I
wasn't aware of these pitfalls.

New patch series coming up.




  reply	other threads:[~2012-07-25 18:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25  7:43 [PATCH v2 1/2] input: rotary-encoder: switch to devm_* allocation of GPIOs and IRQs Daniel Mack
2012-07-25  7:43 ` [PATCH v2 2/2] input: rotary-encoder: add DT bindings Daniel Mack
2012-07-25 16:05 ` [PATCH v2 1/2] input: rotary-encoder: switch to devm_* allocation of GPIOs and IRQs Dmitry Torokhov
2012-07-25 16:07   ` Daniel Mack
2012-07-25 16:29     ` Dmitry Torokhov
2012-07-25 18:04       ` Daniel Mack [this message]
2012-07-25 16:07   ` H Hartley Sweeten

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=50103536.4030109@gmail.com \
    --to=zonque@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hartleys@visionengravers.com \
    --cc=jhovold@gmail.com \
    --cc=linux-input@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).