All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Cosmin Tanislav <demonsingur@gmail.com>
Cc: cosmin.tanislav@analog.com, Jean Delvare <jdelvare@suse.com>,
	linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 03/10] hwmon: adt7x10: use devm_request_threaded_irq
Date: Tue, 21 Dec 2021 08:08:58 -0800	[thread overview]
Message-ID: <82012996-b266-873a-699a-26d77bcb7e5a@roeck-us.net> (raw)
In-Reply-To: <20211221123944.2683245-3-demonsingur@gmail.com>

On 12/21/21 4:39 AM, Cosmin Tanislav wrote:
> From: Cosmin Tanislav <cosmin.tanislav@analog.com>
> 
> To simplify the core driver remove function.
> 
> Signed-off-by: Cosmin Tanislav <cosmin.tanislav@analog.com>
> ---
>   drivers/hwmon/adt7x10.c | 11 +++++------
>   1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/hwmon/adt7x10.c b/drivers/hwmon/adt7x10.c
> index dbe9f1ad7db0..48adc0344e88 100644
> --- a/drivers/hwmon/adt7x10.c
> +++ b/drivers/hwmon/adt7x10.c
> @@ -402,9 +402,11 @@ int adt7x10_probe(struct device *dev, const char *name, int irq,
>   	}
>   
>   	if (irq > 0) {
> -		ret = request_threaded_irq(irq, NULL, adt7x10_irq_handler,
> -				IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> -				dev_name(dev), dev);
> +		ret = devm_request_threaded_irq(dev, irq, NULL,
> +						adt7x10_irq_handler,
> +						IRQF_TRIGGER_FALLING |
> +						IRQF_ONESHOT,
> +						dev_name(dev), dev);
>   		if (ret)
>   			goto exit_hwmon_device_unregister;
>   	}
> @@ -425,9 +427,6 @@ void adt7x10_remove(struct device *dev, int irq)
>   {
>   	struct adt7x10_data *data = dev_get_drvdata(dev);
>   
> -	if (irq > 0)
> -		free_irq(irq, dev);
> -
>   	hwmon_device_unregister(data->hwmon_dev);
>   	sysfs_remove_group(&dev->kobj, &adt7x10_group);
>   	if (data->oldconfig != data->config)
> 

This will keep the interrupt running after the hwmon device was removed,
and after the configuration was restored. If an interrupt occurs at that time,
the handler may potentially access released data. I don't mind making those
changes, but the patches will have to be well sequenced to ensure that each
patch on its own doesn't leave a crippled driver behind. Again, "oh, this will
be ok after the entire series was applied" is not acceptable.

Thanks,
Guenter

  reply	other threads:[~2021-12-21 16:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21 12:39 [PATCH v1 01/10] hwmon: adt7x10: store bus_dev in private data Cosmin Tanislav
2021-12-21 12:39 ` [PATCH v1 02/10] hwmon: adt7x10: do not create name attr Cosmin Tanislav
2021-12-21 15:17   ` Guenter Roeck
2021-12-21 12:39 ` [PATCH v1 03/10] hwmon: adt7x10: use devm_request_threaded_irq Cosmin Tanislav
2021-12-21 16:08   ` Guenter Roeck [this message]
2021-12-21 12:39 ` [PATCH v1 04/10] hwmon: adt7x10: avoid storing hwinfo dev into private data Cosmin Tanislav
2021-12-21 15:16   ` Guenter Roeck
2021-12-21 12:39 ` [PATCH v1 05/10] hwmon: adt7x10: pass hwinfo dev to irq handler Cosmin Tanislav
2021-12-21 12:39 ` [PATCH v1 06/10] hwmon: adt7x10: extract read/write methods from show/store Cosmin Tanislav
2021-12-21 12:39 ` [PATCH v1 07/10] hwmon: adt7x10: remove attrs Cosmin Tanislav
2021-12-21 15:23   ` Guenter Roeck
2021-12-21 12:39 ` [PATCH v1 08/10] hwmon: adt7x10: use hwmon_device_register_with_info Cosmin Tanislav
2021-12-21 12:39 ` [PATCH v1 09/10] hwmon: adt7x10: use devm_hwmon_device_register_with_info Cosmin Tanislav
2021-12-21 15:34   ` Guenter Roeck
2021-12-21 12:39 ` [PATCH v1 10/10] hwmon: adt7x10: use hwmon_notify_event Cosmin Tanislav

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=82012996-b266-873a-699a-26d77bcb7e5a@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=cosmin.tanislav@analog.com \
    --cc=demonsingur@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@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 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.