diff mbox

[01/02] ACPI: sysfs eject support for ACPI scan handlers

Message ID 1360191056-13293-2-git-send-email-toshi.kani@hp.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Toshi Kani Feb. 6, 2013, 10:50 p.m. UTC
Changed sysfs eject, acpi_eject_store(), to support ACPI scan handlers.

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
---
 drivers/acpi/scan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
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

Comments

Yasuaki Ishimatsu Feb. 8, 2013, 12:50 a.m. UTC | #1
Hi Toshi,

2013/02/07 7:50, Toshi Kani wrote:
> Changed sysfs eject, acpi_eject_store(), to support ACPI scan handlers.
> 
> Signed-off-by: Toshi Kani <toshi.kani@hp.com>
> ---
>   drivers/acpi/scan.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index cfd7a69..3ff632e 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -203,7 +203,7 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
>   		return -EINVAL;
>   	}
>   #ifndef FORCE_EJECT

> -	if (acpi_device->driver == NULL) {
> +	if (!acpi_device->driver && !acpi_device->handler) {

I don't understand the fix.

The if sentence becomes true, when both acpi_device->driver and acpi_device->handler
are NULL. It means that acpi_eject_store() runs if either acpi_device->driver or
acpi_device->handler has pointer. Is it O.K.?

I think it should be if (!acpi_device->driver || !acpi_device->handler).

Thanks,
Yasuaki Ishimatsu

>   		ret = -ENODEV;
>   		goto err;
>   	}
> --
> 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
> 


--
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
Toshi Kani Feb. 8, 2013, 1:10 a.m. UTC | #2
On Fri, 2013-02-08 at 09:50 +0900, Yasuaki Ishimatsu wrote:
> Hi Toshi,
> 
> 2013/02/07 7:50, Toshi Kani wrote:
> > Changed sysfs eject, acpi_eject_store(), to support ACPI scan handlers.
> > 
> > Signed-off-by: Toshi Kani <toshi.kani@hp.com>
> > ---
> >   drivers/acpi/scan.c |    2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> > index cfd7a69..3ff632e 100644
> > --- a/drivers/acpi/scan.c
> > +++ b/drivers/acpi/scan.c
> > @@ -203,7 +203,7 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
> >   		return -EINVAL;
> >   	}
> >   #ifndef FORCE_EJECT
> 
> > -	if (acpi_device->driver == NULL) {
> > +	if (!acpi_device->driver && !acpi_device->handler) {
> 
> I don't understand the fix.
> 
> The if sentence becomes true, when both acpi_device->driver and acpi_device->handler
> are NULL. It means that acpi_eject_store() runs if either acpi_device->driver or
> acpi_device->handler has pointer. Is it O.K.?

Yes.

> I think it should be if (!acpi_device->driver || !acpi_device->handler).

No, the condition has to be "&&" because an acpi_device is _either_
bound to an ACPI driver or an ACPI scan handler. 

Thanks,
-Toshi


--
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
Toshi Kani Feb. 8, 2013, 1:25 a.m. UTC | #3
On Fri, 2013-02-08 at 10:33 +0900, Yasuaki Ishimatsu wrote:
> 2013/02/08 10:10, Toshi Kani wrote:
> > On Fri, 2013-02-08 at 09:50 +0900, Yasuaki Ishimatsu wrote:
> >> Hi Toshi,
> >>
> >> 2013/02/07 7:50, Toshi Kani wrote:
> >>> Changed sysfs eject, acpi_eject_store(), to support ACPI scan handlers.
> >>>
> >>> Signed-off-by: Toshi Kani <toshi.kani@hp.com>
> >>> ---
> >>>    drivers/acpi/scan.c |    2 +-
> >>>    1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> >>> index cfd7a69..3ff632e 100644
> >>> --- a/drivers/acpi/scan.c
> >>> +++ b/drivers/acpi/scan.c
> >>> @@ -203,7 +203,7 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
> >>>    		return -EINVAL;
> >>>    	}
> >>>    #ifndef FORCE_EJECT
> >>
> >>> -	if (acpi_device->driver == NULL) {
> >>> +	if (!acpi_device->driver && !acpi_device->handler) {
> >>
> >> I don't understand the fix.
> >>
> >> The if sentence becomes true, when both acpi_device->driver and acpi_device->handler
> >> are NULL. It means that acpi_eject_store() runs if either acpi_device->driver or
> >> acpi_device->handler has pointer. Is it O.K.?
> >
> > Yes.
> >
> >> I think it should be if (!acpi_device->driver || !acpi_device->handler).
> >
> > No, the condition has to be "&&" because an acpi_device is _either_
> > bound to an ACPI driver or an ACPI scan handler.
> 
> Thank you for you clarification. I understood it.
> 
> Acked-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>

Thanks Yasuaki!
-Toshi


> 
> Thanks,
> Yasuaki Ishimatsu
> 
> >
> > Thanks,
> > -Toshi
> >
> >
> 
> 


--
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
Yasuaki Ishimatsu Feb. 8, 2013, 1:33 a.m. UTC | #4
2013/02/08 10:10, Toshi Kani wrote:
> On Fri, 2013-02-08 at 09:50 +0900, Yasuaki Ishimatsu wrote:
>> Hi Toshi,
>>
>> 2013/02/07 7:50, Toshi Kani wrote:
>>> Changed sysfs eject, acpi_eject_store(), to support ACPI scan handlers.
>>>
>>> Signed-off-by: Toshi Kani <toshi.kani@hp.com>
>>> ---
>>>    drivers/acpi/scan.c |    2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
>>> index cfd7a69..3ff632e 100644
>>> --- a/drivers/acpi/scan.c
>>> +++ b/drivers/acpi/scan.c
>>> @@ -203,7 +203,7 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
>>>    		return -EINVAL;
>>>    	}
>>>    #ifndef FORCE_EJECT
>>
>>> -	if (acpi_device->driver == NULL) {
>>> +	if (!acpi_device->driver && !acpi_device->handler) {
>>
>> I don't understand the fix.
>>
>> The if sentence becomes true, when both acpi_device->driver and acpi_device->handler
>> are NULL. It means that acpi_eject_store() runs if either acpi_device->driver or
>> acpi_device->handler has pointer. Is it O.K.?
>
> Yes.
>
>> I think it should be if (!acpi_device->driver || !acpi_device->handler).
>
> No, the condition has to be "&&" because an acpi_device is _either_
> bound to an ACPI driver or an ACPI scan handler.

Thank you for you clarification. I understood it.

Acked-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>

Thanks,
Yasuaki Ishimatsu

>
> Thanks,
> -Toshi
>
>


--
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
diff mbox

Patch

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index cfd7a69..3ff632e 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -203,7 +203,7 @@  acpi_eject_store(struct device *d, struct device_attribute *attr,
 		return -EINVAL;
 	}
 #ifndef FORCE_EJECT
-	if (acpi_device->driver == NULL) {
+	if (!acpi_device->driver && !acpi_device->handler) {
 		ret = -ENODEV;
 		goto err;
 	}