All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI / button: remove pointer to old lid_sysfs on unbind
@ 2016-07-28 10:19 Benjamin Tissoires
  2016-07-29  4:35 ` Zheng, Lv
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Tissoires @ 2016-07-28 10:19 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, linux-kernel

When we removed the procfs dir on error or if the driver is
unbound, the two variables acpi_lid_dir and acpi_button_dir
were not reset. On the next rebind, those static variables
were not null and we couldn't re-register the device again.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
 drivers/acpi/button.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 5c3b091..e413599 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -188,9 +188,11 @@ done:
 remove_dev_dir:
 	remove_proc_entry(acpi_device_bid(device),
 			  acpi_lid_dir);
+	acpi_lid_dir = NULL;
 	acpi_device_dir(device) = NULL;
 remove_lid_dir:
 	remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
+	acpi_button_dir = NULL;
 remove_button_dir:
 	remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
 	goto done;
@@ -207,8 +209,10 @@ static int acpi_button_remove_fs(struct acpi_device *device)
 			  acpi_device_dir(device));
 	remove_proc_entry(acpi_device_bid(device),
 			  acpi_lid_dir);
+	acpi_lid_dir = NULL;
 	acpi_device_dir(device) = NULL;
 	remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
+	acpi_button_dir = NULL;
 	remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
 
 	return 0;
-- 
2.5.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] ACPI / button: remove pointer to old lid_sysfs on unbind
  2016-07-28 10:19 [PATCH] ACPI / button: remove pointer to old lid_sysfs on unbind Benjamin Tissoires
@ 2016-07-29  4:35 ` Zheng, Lv
  2016-07-29  7:53   ` Benjamin Tissoires
  0 siblings, 1 reply; 3+ messages in thread
From: Zheng, Lv @ 2016-07-29  4:35 UTC (permalink / raw)
  To: Benjamin Tissoires, Rafael J. Wysocki; +Cc: linux-acpi, linux-kernel

Hi, Benjamin

> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
> owner@vger.kernel.org] On Behalf Of Benjamin Tissoires
> Subject: [PATCH] ACPI / button: remove pointer to old lid_sysfs on unbind
> 
> When we removed the procfs dir on error or if the driver is
> unbound, the two variables acpi_lid_dir and acpi_button_dir
> were not reset. On the next rebind, those static variables
> were not null and we couldn't re-register the device again.
> 
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
>  drivers/acpi/button.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
> index 5c3b091..e413599 100644
> --- a/drivers/acpi/button.c
> +++ b/drivers/acpi/button.c
> @@ -188,9 +188,11 @@ done:
[Lv Zheng] 
I have a concern here for acpi_button_add_fs().
It looks like that this function doesn't support 2 lid devices.
So why do we need /proc/acpi/button/lid/LID0 folder?

>  remove_dev_dir:
>  	remove_proc_entry(acpi_device_bid(device),
>  			  acpi_lid_dir);
> +	acpi_lid_dir = NULL;
>  	acpi_device_dir(device) = NULL;
>  remove_lid_dir:
>  	remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID,
> acpi_button_dir);
[Lv Zheng] 
Should acpi_lid_dir = NULL be put here?

> +	acpi_button_dir = NULL;
>  remove_button_dir:
>  	remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
[Lv Zheng] 
Should acpi_button_dir = NULL be put here?

>  	goto done;
> @@ -207,8 +209,10 @@ static int acpi_button_remove_fs(struct
> acpi_device *device)
>  			  acpi_device_dir(device));
>  	remove_proc_entry(acpi_device_bid(device),
>  			  acpi_lid_dir);
> +	acpi_lid_dir = NULL;
>  	acpi_device_dir(device) = NULL;
>  	remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID,
> acpi_button_dir);
[Lv Zheng] 
Should acpi_lid_dir = NULL be put here?

> +	acpi_button_dir = NULL;
>  	remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
[Lv Zheng] 
Should acpi_button_dir = NULL be put here?

Thanks and best regards
Lv

> 
>  	return 0;
> --
> 2.5.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPI / button: remove pointer to old lid_sysfs on unbind
  2016-07-29  4:35 ` Zheng, Lv
@ 2016-07-29  7:53   ` Benjamin Tissoires
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Tissoires @ 2016-07-29  7:53 UTC (permalink / raw)
  To: Zheng, Lv; +Cc: Rafael J. Wysocki, linux-acpi, linux-kernel

On Jul 29 2016 or thereabouts, Zheng, Lv wrote:
> Hi, Benjamin
> 
> > From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
> > owner@vger.kernel.org] On Behalf Of Benjamin Tissoires
> > Subject: [PATCH] ACPI / button: remove pointer to old lid_sysfs on unbind
> > 
> > When we removed the procfs dir on error or if the driver is
> > unbound, the two variables acpi_lid_dir and acpi_button_dir
> > were not reset. On the next rebind, those static variables
> > were not null and we couldn't re-register the device again.
> > 
> > Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> > ---
> >  drivers/acpi/button.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
> > index 5c3b091..e413599 100644
> > --- a/drivers/acpi/button.c
> > +++ b/drivers/acpi/button.c
> > @@ -188,9 +188,11 @@ done:
> [Lv Zheng] 
> I have a concern here for acpi_button_add_fs().
> It looks like that this function doesn't support 2 lid devices.
> So why do we need /proc/acpi/button/lid/LID0 folder?

History I guess?

- (re)introduced in b34a803 "[ACPI] restore /proc/acpi/button/ (ala 2.6.12)"
  (2005-08-03)
- procfs cleaned up in 912b742 "ACPI button: remove unused procfs I/F"
  (2011-03-23)

And I would believe given that it was introduced prior 2.6.12, it's now
kernel ABI.

> 
> >  remove_dev_dir:
> >  	remove_proc_entry(acpi_device_bid(device),
> >  			  acpi_lid_dir);
> > +	acpi_lid_dir = NULL;
> >  	acpi_device_dir(device) = NULL;
> >  remove_lid_dir:
> >  	remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID,
> > acpi_button_dir);
> [Lv Zheng] 
> Should acpi_lid_dir = NULL be put here?

Right

> 
> > +	acpi_button_dir = NULL;
> >  remove_button_dir:
> >  	remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
> [Lv Zheng] 
> Should acpi_button_dir = NULL be put here?
> 

Right

> >  	goto done;
> > @@ -207,8 +209,10 @@ static int acpi_button_remove_fs(struct
> > acpi_device *device)
> >  			  acpi_device_dir(device));
> >  	remove_proc_entry(acpi_device_bid(device),
> >  			  acpi_lid_dir);
> > +	acpi_lid_dir = NULL;
> >  	acpi_device_dir(device) = NULL;
> >  	remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID,
> > acpi_button_dir);
> [Lv Zheng] 
> Should acpi_lid_dir = NULL be put here?
> 
> > +	acpi_button_dir = NULL;
> >  	remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
> [Lv Zheng] 
> Should acpi_button_dir = NULL be put here?

Right for these too to, but it won't change the result in the end :)

I'll send a v2 ASAP.

Cheers,
Benjamin

> 
> Thanks and best regards
> Lv
> 
> > 
> >  	return 0;
> > --
> > 2.5.5
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-29  7:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-28 10:19 [PATCH] ACPI / button: remove pointer to old lid_sysfs on unbind Benjamin Tissoires
2016-07-29  4:35 ` Zheng, Lv
2016-07-29  7:53   ` Benjamin Tissoires

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.