mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Duggan <andrew@duggan.us>
To: Guenter Roeck <linux@roeck-us.net>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andrew Duggan <aduggan@synaptics.com>
Subject: Re: [PATCH] Input: synaptics-rmi4 - Fix error handling in I2C transport driver
Date: Sat, 01 Oct 2016 10:51:22 -0700	[thread overview]
Message-ID: <1475344282.167439.742908153.6FED06E9@webmail.messagingengine.com> (raw)
In-Reply-To: <d94362b3-8659-e995-aeb3-eab04ab4548c@roeck-us.net>



On Sat, Oct 1, 2016, at 10:45 AM, Guenter Roeck wrote:
> On 10/01/2016 10:27 AM, Andrew Duggan wrote:
> >
> >
> > On Fri, Sep 30, 2016, at 08:44 PM, Guenter Roeck wrote:
> >> On 09/30/2016 04:02 PM, Dmitry Torokhov wrote:
> >>> On Fri, Sep 30, 2016 at 03:54:03PM -0700, Dmitry Torokhov wrote:
> >>>> On Thu, Sep 29, 2016 at 10:55:40AM -0700, Bjorn Andersson wrote:
> >>>>> On Wed 28 Sep 17:37 PDT 2016, Guenter Roeck wrote:
> >>>>>
> >>>>>> Instantiating the rmi4 I2C transport driver without interrupts assigned
> >>>>>> (for example using manual i2c instantiation from the command line)
> >>>>>> caused the driver to fail to load, but it does not clean up its
> >>>>>> regulator or transport device registrations. Result is a crash at a later
> >>>>>> time, for example when rebooting the system.
> >>>>>>
> >>>>>> Fixes: 946c8432aab0 ("Input: synaptics-rmi4 - support regulator supplies")
> >>>>>
> >>>>> Sorry for that.
> >>>>>
> >>>>>> Fixes: fdf51604f104 ("Input: synaptics-rmi4 - add I2C transport driver")
> >>>>>> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> >>>>>
> >>>>> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> >>>>
> >>>> Applied, thank you.
> >>>
> >>> I take it back. rmi_i2c_init_irq() uses devm* so this whole thing mixes
> >>> up devm* and manual unregistering and unwind order is completely
> >>> broken.
> >>>
> >> Oops ...
> >>
> >>> 1. Why do we register interrupt from transport drivers and not make it
> >>> part of rmi_register_transport_device()?
> >
> > Not all RMI devices will have access to interrupts (ie HID and SMBus).
> > The same goes for regulators. Here is a reference to a previous
> > discussion regarding both:
> > https://lkml.org/lkml/2016/5/9/1055
> >
> >>
> >> rmi_register_transport_device() doesn't take dev as parameter.
> >>
> >>> 2. If we need to use some non-devm-ised resources we should use
> >>> devm_add_action[_or_reset] to work these operations into devm stream.
> >>
> >
> > Since the regulator functions have their own devm_ versions I would
> > suggest switching to those functions to avoid dealing with
> > unregistering.
> >
> Maybe I am missing something, but I don't see a
> devm_regulator_bulk_enable().
> devm_regulator_bulk_get() is already used.
> 

Yeah, I was just double checking that too. You're right, they are
already using the devm version.

Andrew

> Guenter
> 
> > Registering and unregistering the transport device is a bit more
> > complicated since these functions add and put the rmi_dev device. But,
> > it sounds like we can handle the unregister using
> > devm_add_action_or_reset().
> >

  reply	other threads:[~2016-10-01 17:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-29  0:37 Guenter Roeck
2016-09-29 17:55 ` Bjorn Andersson
2016-09-30 22:54   ` Dmitry Torokhov
2016-09-30 23:02     ` Dmitry Torokhov
2016-10-01  3:44       ` Guenter Roeck
2016-10-01 17:27         ` Andrew Duggan
2016-10-01 17:45           ` Guenter Roeck
2016-10-01 17:51             ` Andrew Duggan [this message]
2016-10-01 19:04           ` Dmitry Torokhov
2016-10-01 20:46             ` Guenter Roeck
2016-10-01  3:03     ` Guenter Roeck

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=1475344282.167439.742908153.6FED06E9@webmail.messagingengine.com \
    --to=andrew@duggan.us \
    --cc=aduggan@synaptics.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.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®