Re: [PATCH] Input: introduce managed input devices (add devres support)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux