public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Igor Murzov <intergalactic.anonymous@gmail.com>
Cc: Zhang Rui <rui.zhang@intel.com>, Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Igor Murzov <e-mail@date.by>, "Sergey V." <sftp.mtuci@gmail.com>
Subject: Re: [RFC][PATCH 2/2] ACPI video: Don't start video device until its associated input device has been reigstered
Date: Tue, 28 Feb 2012 16:39:15 -0800	[thread overview]
Message-ID: <20120229003915.GA11111@core.coreip.homeip.net> (raw)
In-Reply-To: <20120229035518.306c57a8@garik>

On Wed, Feb 29, 2012 at 03:55:18AM +0400, Igor Murzov wrote:
> From 202f25d44b1cf871697c88a6a3a8d854674db4d8 Mon Sep 17 00:00:00 2001
> From: Igor Murzov <e-mail@date.by>
> Date: Mon, 27 Feb 2012 21:57:59 +0400
> Subject: [PATCH 2/2] ACPI video: Don't start video device until its
>  associated input device has been reigstered

> 
> ---
>  drivers/acpi/video.c |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
> index 1bc6370..b9e114c 100644
> --- a/drivers/acpi/video.c
> +++ b/drivers/acpi/video.c
> @@ -1659,9 +1659,6 @@ static int acpi_video_bus_add(struct acpi_device *device)
>  	error = acpi_video_bus_get_devices(video, device);
>  	if (error)
>  		goto err_free_video;
> -	error = acpi_video_bus_start_devices(video);
> -	if (error)
> -		goto err_put_video;
>  
>  	video->input = input = input_allocate_device();
>  	if (!input) {
> @@ -1703,13 +1700,18 @@ static int acpi_video_bus_add(struct acpi_device *device)
>  	if (error)
>  		goto err_free_input_dev;
>  
> +	error = acpi_video_bus_start_devices(video);
> +	if (error)
> +		goto err_unregister_pm_notifier;
> +

Registered input device should be unregistered with
input_unregister_device(), not input_free_device(). Your change breaks
this.

Also, notify() will not be called until acpi_video_bus_add() completes
so current code should be perfectly fine.

>  	return 0;
>  
> + err_unregister_pm_notifier:
> +	unregister_pm_notifier(&video->pm_nb);
>   err_free_input_dev:
>  	input_free_device(input);
>   err_stop_video:
>  	acpi_video_bus_stop_devices(video);
> - err_put_video:
>  	acpi_video_bus_put_devices(video);
>  	kfree(video->attached_array);
>   err_free_video:
> -- 
> 1.7.5.1
> 

Thanks.

-- 
Dmitry

  parent reply	other threads:[~2012-02-29  0:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20120229035142.31016e6f@garik>
2012-02-29  0:12 ` [PATCH 1/2] ACPI video: Harden video bus adding Dmitry Torokhov
2012-02-29  0:44   ` Igor Murzov
     [not found] ` <20120229035518.306c57a8@garik>
2012-02-29  0:39   ` Dmitry Torokhov [this message]
2012-02-29  1:17     ` [RFC][PATCH 2/2] ACPI video: Don't start video device until its associated input device has been reigstered Dmitry Torokhov

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=20120229003915.GA11111@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=e-mail@date.by \
    --cc=intergalactic.anonymous@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=sftp.mtuci@gmail.com \
    /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