All of lore.kernel.org
 help / color / mirror / Atom feed
From: Enric Balletbo Serra <eballetbo@gmail.com>
To: Vincent Palatin <vpalatin@chromium.org>
Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>,
	Lee Jones <lee.jones@linaro.org>,
	Guenter Roeck <groeck@chromium.org>,
	Gwendal Grignou <gwendal@chromium.org>,
	Benson Leung <bleung@chromium.org>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel@collabora.com
Subject: Re: [PATCH 2/6] mfd: cros_ec: free IRQ automatically
Date: Tue, 20 Feb 2018 09:52:22 +0100	[thread overview]
Message-ID: <CAFqH_53KekHzh_WGBN8WVFexb3DRCpu-pW4ffv3U0U7NUe99nw@mail.gmail.com> (raw)
In-Reply-To: <CAP_ceTzdA6TgO4H2CCa4rJOjQvLL4tfFD8DnCZeJp67rWiSrdg@mail.gmail.com>

Hi Vincent,

2018-02-20 9:00 GMT+01:00 Vincent Palatin <vpalatin@chromium.org>:
> On Mon, Feb 19, 2018 at 11:40 PM, Enric Balletbo i Serra
> <enric.balletbo@collabora.com> wrote:
>> From: Vincent Palatin <vpalatin@chromium.org>
>>
>> Free the IRQ we might have requested when removing the cros_ec device,
>> so we can unload and reload the driver properly.
>>
>> Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
>> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>> ---
>>  drivers/mfd/cros_ec.c | 17 ++++++-----------
>>  1 file changed, 6 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c
>> index 74780f2964a1..d1a4fbee9380 100644
>> --- a/drivers/mfd/cros_ec.c
>> +++ b/drivers/mfd/cros_ec.c
>> @@ -119,9 +119,9 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
>>         }
>>
>>         if (ec_dev->irq) {
>> -               err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread,
>> -                                          IRQF_TRIGGER_LOW | IRQF_ONESHOT,
>> -                                          "chromeos-ec", ec_dev);
>> +               err = devm_request_threaded_irq(dev, ec_dev->irq, NULL,
>> +                               ec_irq_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
>> +                               "chromeos-ec", ec_dev);
>>                 if (err) {
>>                         dev_err(dev, "Failed to request IRQ %d: %d",
>>                                 ec_dev->irq, err);
>> @@ -135,7 +135,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
>>                 dev_err(dev,
>>                         "Failed to register Embedded Controller subdevice %d\n",
>>                         err);
>> -               goto fail_mfd;
>> +               return err;
>>         }
>>
>>         if (ec_dev->max_passthru) {
>> @@ -153,7 +153,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
>>                         dev_err(dev,
>>                                 "Failed to register Power Delivery subdevice %d\n",
>>                                 err);
>> -                       goto fail_mfd;
>> +                       return err;
>>                 }
>>         }
>>
>> @@ -162,7 +162,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
>>                 if (err) {
>>                         mfd_remove_devices(dev);
>>                         dev_err(dev, "Failed to register sub-devices\n");
>> -                       goto fail_mfd;
>> +                       return err;
>>                 }
>>         }
>>
>> @@ -180,11 +180,6 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
>>         cros_ec_acpi_install_gpe_handler(dev);
>>
>>         return 0;
>> -
>> -fail_mfd:
>> -       if (ec_dev->irq)
>> -               free_irq(ec_dev->irq, ec_dev);
>> -       return err;
>>  }
>>  EXPORT_SYMBOL(cros_ec_register);
>
>
> You need to remove the "free_irq(ec_dev->irq, ec_dev);" in cros_ec_remove() too.
> as done there:
> https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/866858/15/drivers/mfd/cros_ec.c
>
> it was missing originally but was added by: 'f58b14e6632a mfd:
> cros_ec: Free IRQ on exit'
>

Many thanks to catch this. I'll wait a bit more for if I receive more
feedback on the other patches and send a second version of this
patchset.

Regards,
  Enric

>
>>
>> --
>> 2.16.1
>>

  reply	other threads:[~2018-02-20  8:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-19 22:40 [PATCH 2/6] mfd: cros_ec: free IRQ automatically Enric Balletbo i Serra
2018-02-20  8:00 ` Vincent Palatin
2018-02-20  8:52   ` Enric Balletbo Serra [this message]
2018-03-07 15:18     ` Lee Jones

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=CAFqH_53KekHzh_WGBN8WVFexb3DRCpu-pW4ffv3U0U7NUe99nw@mail.gmail.com \
    --to=eballetbo@gmail.com \
    --cc=bleung@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=groeck@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=kernel@collabora.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vpalatin@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.