Re: [PATCH 1/3] Revert adf411b819adc9fa96e9b3e638c7480d5e71d27

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2008-11-18 at 20:40 +0900, Kenji Kaneshige wrote:
> Andrew Patterson wrote:
> > On Sat, 2008-11-01 at 15:55 +0900, Taku Izumi wrote:
> >> Revert adf411b819adc9fa96e9b3e638c7480d5e71d270.
> >>
> >> The commit adf411b819adc9fa96e9b3e638c7480d5e71d270 was based on the
> >> improper assumption that queried result was not updated when _OSC
> >> support field was changed. But, in fact, queried result is updated
> >> whenever _OSC support field was changed through __acpi_query_osc().
> >> As a result, the commit adf411b819adc9fa96e9b3e638c7480d5e71d270 only
> >> introduced unnecessary additional _OSC evaluation...
> >>
> >> Signed-off-by: Kenji Kaneshige <kaneshige.kenji@xxxxxxxxxxxxxx>
> >> Signed-off-by: Taku Izumi <izumi.taku@xxxxxxxxxxxxxx>
> >>
> >> ---
> >>   drivers/pci/pci-acpi.c |   31 ++++++++++++++++++-------------
> >>   1 file changed, 18 insertions(+), 13 deletions(-)
> >>
> >> Index: 20081031/drivers/pci/pci-acpi.c
> >> ===================================================================
> >> --- 20081031.orig/drivers/pci/pci-acpi.c
> >> +++ 20081031/drivers/pci/pci-acpi.c
> >> @@ -24,13 +24,15 @@ struct acpi_osc_data {
> >>   	acpi_handle handle;
> >>   	u32 support_set;
> >>   	u32 control_set;
> >> +	int is_queried;
> >> +	u32 query_result;
> >>   	struct list_head sibiling;
> >>   };
> >>   static LIST_HEAD(acpi_osc_data_list);
> >>
> >>   struct acpi_osc_args {
> >>   	u32 capbuf[3];
> >> -	u32 ctrl_result;
> >> +	u32 query_result;
> >>   };
> >>
> >>   static DEFINE_MUTEX(pci_acpi_lock);
> >> @@ -108,8 +110,9 @@ static acpi_status acpi_run_osc(acpi_han
> >>   		goto out_kfree;
> >>   	}
> >>   out_success:
> >> -	osc_args->ctrl_result =
> >> -		*((u32 *)(out_obj->buffer.pointer + 8));
> >> +	if (flags & OSC_QUERY_ENABLE)
> >> +		osc_args->query_result =
> >> +			*((u32 *)(out_obj->buffer.pointer + 8));
> >>   	status = AE_OK;
> >>
> >>   out_kfree:
> >> @@ -117,8 +120,7 @@ out_kfree:
> >>   	return status;
> >>   }
> >>
> >> -static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data,
> >> -				    u32 *result)
> >> +static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data)
> >>   {
> >>   	acpi_status status;
> >>   	u32 support_set;
> >> @@ -133,7 +135,8 @@ static acpi_status __acpi_query_osc(u32
> >>   	status = acpi_run_osc(osc_data->handle, &osc_args);
> >>   	if (ACPI_SUCCESS(status)) {
> >>   		osc_data->support_set = support_set;
> >> -		*result = osc_args.ctrl_result;
> >> +		osc_data->query_result = osc_args.query_result;
> >> +		osc_data->is_queried = 1;
> >>   	}
> >>
> >>   	return status;
> >> @@ -144,7 +147,7 @@ static acpi_status acpi_query_osc(acpi_h
> >>   {
> >>   	acpi_status status;
> >>   	struct acpi_osc_data *osc_data;
> >> -	u32 flags = (unsigned long)context, dummy;
> >> +	u32 flags = (unsigned long)context;
> >>   	acpi_handle tmp;
> >>
> >>   	status = acpi_get_handle(handle, "_OSC", &tmp);
> >> @@ -158,7 +161,7 @@ static acpi_status acpi_query_osc(acpi_h
> >>   		goto out;
> >>   	}
> >>
> >> -	__acpi_query_osc(flags, osc_data, &dummy);
> >> +	__acpi_query_osc(flags, osc_data);
> >>   out:
> >>   	mutex_unlock(&pci_acpi_lock);
> >>   	return AE_OK;
> >> @@ -192,7 +195,7 @@ acpi_status __pci_osc_support_set(u32 fl
> >>   acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
> >>   {
> >>   	acpi_status status;
> >> -	u32 ctrlset, control_set, result;
> >> +	u32 ctrlset, control_set;
> >>   	acpi_handle tmp;
> >>   	struct acpi_osc_data *osc_data;
> >>   	struct acpi_osc_args osc_args;
> >> @@ -215,11 +218,13 @@ acpi_status pci_osc_control_set(acpi_han
> >>   		goto out;
> >>   	}
> >>
> >> -	status = __acpi_query_osc(osc_data->support_set, osc_data, &result);
> >> -	if (ACPI_FAILURE(status))
> >> -		goto out;
> >> +	if (!osc_data->is_queried) {
> >> +		status = __acpi_query_osc(osc_data->support_set, osc_data);
> >> +		if (ACPI_FAILURE(status))
> >> +			goto out;
> >> +	}
> >>
> >> -	if ((result & ctrlset) != ctrlset) {
> >> +	if ((osc_data->query_result & ctrlset) != ctrlset) {
> >>   		status = AE_SUPPORT;
> >>   		goto out;
> >>   	}
> >>
> > 
> > The latest code in the pci-2.6/linux-next branch runs __acpi_query_osc()
> > in acpi_pci_root_add(). This happens before any calls to
> > pci_osc_control_set(), so this patch/revert should no longer be
> > necessary.
> > 
> 
> Though I might be misunderstanding, I think you mean that we should
> modify pci_osc_control_set() not to call __acpi_query_osc()

Yes.

>  in any
> case rather than applying this patch (reverting the commit
> adf411b819adc9fa96e9b3e638c7480d5e71d270). Correct?
> 
> I think we should apply this patch first, and then making another
> patch to modify pci_osc_control_set() not to call __acpi_query_osc()
> because current pci_acpi_osc_support() can fail with -ENOMEM.

Good point. This patch will need to be respun for pci-2.6/linux-next.
Note that the original patch did not remove the no longer needed "dummy"
variable in __acpi_query_osc().

>  In
> this case, pci_osc_control_set() must query control. Maybe we need to
> modify some data structures (acpi_osc_data, acpi_pci_root, etc.) to
> prevent -ENOMEM when we modify pci_osc_control_set() not to call
> __acpi_query_osc().

I think Willy's plan was to move this structure into acpi_pci_root
structure which would eliminate the -ENOMEM problem. We can remove the
call then.

> 
> Thanks,
> Kenji Kaneshige
> 
> 
-- 
Andrew Patterson
Hewlett-Packard

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux