Re: [RFC Patch 16/19] ACPI: Introduce helper function acpi_dev_filter_resource_type()

2015-01-15 Thread Jiang Liu
On 2015/1/16 5:30, Thomas Gleixner wrote:
> On Thu, 8 Jan 2015, Jiang Liu wrote:
> 
>> Introduce helper function acpi_dev_filter_resource_type(), which may
>> be used by acpi_dev_get_resources() to filer out resource based on
>> resource type.
>>
>> Signed-off-by: Jiang Liu 
>> ---
>>  drivers/acpi/resource.c |   54 
>> +++
>>  include/linux/acpi.h|1 +
>>  2 files changed, 55 insertions(+)
>>
>> diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
>> index 54204ac94f8e..8ea7c26d6915 100644
>> --- a/drivers/acpi/resource.c
>> +++ b/drivers/acpi/resource.c
>> @@ -570,3 +570,57 @@ int acpi_dev_get_resources(struct acpi_device *adev, 
>> struct list_head *list,
>>  return c.count;
>>  }
>>  EXPORT_SYMBOL_GPL(acpi_dev_get_resources);
>> +
>> +/**
>> + * acpi_dev_filter_resource_type - Filter ACPI resource according to 
>> resource
>> + * types
>> + * @ares: Input ACPI resource object.
>> + * @arg: Valid resource types of IORESOURCE_XXX
>> + *
>> + * This is a hepler function to support acpi_dev_get_resources(), which 
>> filters
>> + * ACPI resource objects according to resource types.
>> + */
>> +int acpi_dev_filter_resource_type(struct acpi_resource *ares, void *arg)
> 
> Why is the filter a void pointer instead of an simple unsigned long?
> That does not make any sense as you convert it to unsigned long right away:
> 
>> +{
>> +unsigned long type = 0, types = (unsigned long)arg;
> 
> So this should be:
> 
> int acpi_dev_filter_resource_type(struct acpi_resource *ares, unsigned long 
> type_mask)
> 
> or something like that.
Hi Thomas,
I used void * instead of unsigned long for type_mask so
acpi_dev_filter_resource_type() could directly used by
acpi_dev_get_resources(). Otherwise we need to use something like
acpi_dev_get_resources(..., (void *)acpi_dev_filter_resource_type, ...).
I will find a way to solve this:)
Regards!
Gerry

> 
> Thanks,
> 
>   tglx
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC Patch 16/19] ACPI: Introduce helper function acpi_dev_filter_resource_type()

2015-01-15 Thread Thomas Gleixner
On Thu, 8 Jan 2015, Jiang Liu wrote:

> Introduce helper function acpi_dev_filter_resource_type(), which may
> be used by acpi_dev_get_resources() to filer out resource based on
> resource type.
> 
> Signed-off-by: Jiang Liu 
> ---
>  drivers/acpi/resource.c |   54 
> +++
>  include/linux/acpi.h|1 +
>  2 files changed, 55 insertions(+)
> 
> diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
> index 54204ac94f8e..8ea7c26d6915 100644
> --- a/drivers/acpi/resource.c
> +++ b/drivers/acpi/resource.c
> @@ -570,3 +570,57 @@ int acpi_dev_get_resources(struct acpi_device *adev, 
> struct list_head *list,
>   return c.count;
>  }
>  EXPORT_SYMBOL_GPL(acpi_dev_get_resources);
> +
> +/**
> + * acpi_dev_filter_resource_type - Filter ACPI resource according to resource
> + *  types
> + * @ares: Input ACPI resource object.
> + * @arg: Valid resource types of IORESOURCE_XXX
> + *
> + * This is a hepler function to support acpi_dev_get_resources(), which 
> filters
> + * ACPI resource objects according to resource types.
> + */
> +int acpi_dev_filter_resource_type(struct acpi_resource *ares, void *arg)

Why is the filter a void pointer instead of an simple unsigned long?
That does not make any sense as you convert it to unsigned long right away:

> +{
> + unsigned long type = 0, types = (unsigned long)arg;

So this should be:

int acpi_dev_filter_resource_type(struct acpi_resource *ares, unsigned long 
type_mask)

or something like that.

Thanks,

tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC Patch 16/19] ACPI: Introduce helper function acpi_dev_filter_resource_type()

2015-01-15 Thread Thomas Gleixner
On Thu, 8 Jan 2015, Jiang Liu wrote:

 Introduce helper function acpi_dev_filter_resource_type(), which may
 be used by acpi_dev_get_resources() to filer out resource based on
 resource type.
 
 Signed-off-by: Jiang Liu jiang@linux.intel.com
 ---
  drivers/acpi/resource.c |   54 
 +++
  include/linux/acpi.h|1 +
  2 files changed, 55 insertions(+)
 
 diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
 index 54204ac94f8e..8ea7c26d6915 100644
 --- a/drivers/acpi/resource.c
 +++ b/drivers/acpi/resource.c
 @@ -570,3 +570,57 @@ int acpi_dev_get_resources(struct acpi_device *adev, 
 struct list_head *list,
   return c.count;
  }
  EXPORT_SYMBOL_GPL(acpi_dev_get_resources);
 +
 +/**
 + * acpi_dev_filter_resource_type - Filter ACPI resource according to resource
 + *  types
 + * @ares: Input ACPI resource object.
 + * @arg: Valid resource types of IORESOURCE_XXX
 + *
 + * This is a hepler function to support acpi_dev_get_resources(), which 
 filters
 + * ACPI resource objects according to resource types.
 + */
 +int acpi_dev_filter_resource_type(struct acpi_resource *ares, void *arg)

Why is the filter a void pointer instead of an simple unsigned long?
That does not make any sense as you convert it to unsigned long right away:

 +{
 + unsigned long type = 0, types = (unsigned long)arg;

So this should be:

int acpi_dev_filter_resource_type(struct acpi_resource *ares, unsigned long 
type_mask)

or something like that.

Thanks,

tglx
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC Patch 16/19] ACPI: Introduce helper function acpi_dev_filter_resource_type()

2015-01-15 Thread Jiang Liu
On 2015/1/16 5:30, Thomas Gleixner wrote:
 On Thu, 8 Jan 2015, Jiang Liu wrote:
 
 Introduce helper function acpi_dev_filter_resource_type(), which may
 be used by acpi_dev_get_resources() to filer out resource based on
 resource type.

 Signed-off-by: Jiang Liu jiang@linux.intel.com
 ---
  drivers/acpi/resource.c |   54 
 +++
  include/linux/acpi.h|1 +
  2 files changed, 55 insertions(+)

 diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
 index 54204ac94f8e..8ea7c26d6915 100644
 --- a/drivers/acpi/resource.c
 +++ b/drivers/acpi/resource.c
 @@ -570,3 +570,57 @@ int acpi_dev_get_resources(struct acpi_device *adev, 
 struct list_head *list,
  return c.count;
  }
  EXPORT_SYMBOL_GPL(acpi_dev_get_resources);
 +
 +/**
 + * acpi_dev_filter_resource_type - Filter ACPI resource according to 
 resource
 + * types
 + * @ares: Input ACPI resource object.
 + * @arg: Valid resource types of IORESOURCE_XXX
 + *
 + * This is a hepler function to support acpi_dev_get_resources(), which 
 filters
 + * ACPI resource objects according to resource types.
 + */
 +int acpi_dev_filter_resource_type(struct acpi_resource *ares, void *arg)
 
 Why is the filter a void pointer instead of an simple unsigned long?
 That does not make any sense as you convert it to unsigned long right away:
 
 +{
 +unsigned long type = 0, types = (unsigned long)arg;
 
 So this should be:
 
 int acpi_dev_filter_resource_type(struct acpi_resource *ares, unsigned long 
 type_mask)
 
 or something like that.
Hi Thomas,
I used void * instead of unsigned long for type_mask so
acpi_dev_filter_resource_type() could directly used by
acpi_dev_get_resources(). Otherwise we need to use something like
acpi_dev_get_resources(..., (void *)acpi_dev_filter_resource_type, ...).
I will find a way to solve this:)
Regards!
Gerry

 
 Thanks,
 
   tglx
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/