mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: introduce managed input devices (add devres support)
Date: Wed, 31 Oct 2012 14:37:01 -0700	[thread overview]
Message-ID: <5132958.JXBGbd4rj1@dtor-d630.eng.vmware.com> (raw)
In-Reply-To: <20121031210532.GX2945@htj.dyndns.org>

On Wednesday, October 31, 2012 02:05:32 PM Tejun Heo wrote:
> Hello, Dmitry.
> 
> On Mon, Oct 22, 2012 at 10:35:14PM -0700, Dmitry Torokhov wrote:
> > There is a demand from driver's writers to use managed devices framework
> > for their drivers. Unfortunately up to this moment input devices did not
> > provide support for managed devices and that lead to mixing two styles
> > of resource management which usually introduced more bugs, such as
> > manually unregistering input device but relying in devres to free
> > interrupt handler which (unless device is properly shut off) can cause
> > ISR to reference already freed memory.
> > 
> > This change introduces devm_input_allocate_device() that will allocate
> > managed instance of input device so that driver writers who prefer
> > using devm_* framework do not have to mix 2 styles.
> 
> It generally looks good to me although it's a bit unusual to use
> devres on device.  Given the way input_dev is used, it probably makes
> sense, I guess.
> 
> One thing tho.  If possible and there aren't too many, wouldn't it be
> better to convert all to use devres.  Having two different lifetime
> fules tends to lead to gotchas.

Not all drivers use devres for rest of their resources so it makes sense
to have unmanaged versions (like we have request_irq/devm_request_irq).
Besides:

[dtor@dtor-ws vmci]$ grep -r input_allocate_device drivers/ | wc -l
298

so I'd rather not ;)

Thanks.

-- 
Dmitry


  reply	other threads:[~2012-10-31 21:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-23  5:35 Dmitry Torokhov
2012-10-29 18:22 ` Henrik Rydberg
2012-10-29 18:59   ` Dmitry Torokhov
2012-10-29 20:02     ` Henrik Rydberg
2012-10-29 20:40       ` Dmitry Torokhov
2012-10-29 21:32         ` Henrik Rydberg
2012-10-29 22:12           ` Dmitry Torokhov
2012-10-31 21:05 ` Tejun Heo
2012-10-31 21:37   ` Dmitry Torokhov [this message]
2012-10-31 21:38     ` Tejun Heo

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=5132958.JXBGbd4rj1@dtor-d630.eng.vmware.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@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

all inboxes | Powered by JetHome®