diff mbox

[v2,3/5] ACPI / bus: Switch to use new generic UUID API

Message ID 20170531194152.65927-4-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andy Shevchenko May 31, 2017, 7:41 p.m. UTC
There are new types and helpers that are supposed to be used in new code.

As a preparation to get rid of legacy types and API functions do
the conversion here.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/acpi/bus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Rafael J. Wysocki May 31, 2017, 10:42 p.m. UTC | #1
On Wednesday, May 31, 2017 10:41:50 PM Andy Shevchenko wrote:
> There are new types and helpers that are supposed to be used in new code.
> 
> As a preparation to get rid of legacy types and API functions do
> the conversion here.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Thanks,
Rafael
kernel test robot May 31, 2017, 11:56 p.m. UTC | #2
Hi Andy,

[auto build test WARNING on pm/linux-next]
[also build test WARNING on v4.12-rc3 next-20170531]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/ACPI-et-al-convert-to-use-new-UUID-API/20170601-072311
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-x010-201722 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/acpi/bus.c: In function 'acpi_run_osc':
   drivers/acpi/bus.c:228:2: error: unknown type name 'guid_t'
     guid_t guid;
     ^~~~~~
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from drivers/acpi/bus.c:21:
   drivers/acpi/bus.c:234:6: error: implicit declaration of function 'guid_parse' [-Werror=implicit-function-declaration]
     if (guid_parse(context->uuid_str, &guid))
         ^
   include/linux/compiler.h:160:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/acpi/bus.c:234:2: note: in expansion of macro 'if'
     if (guid_parse(context->uuid_str, &guid))
     ^~
   cc1: some warnings being treated as errors

vim +/if +234 drivers/acpi/bus.c

   218		return AE_OK;
   219	}
   220	EXPORT_SYMBOL_GPL(acpi_str_to_uuid);
   221	
   222	acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
   223	{
   224		acpi_status status;
   225		struct acpi_object_list input;
   226		union acpi_object in_params[4];
   227		union acpi_object *out_obj;
   228		guid_t guid;
   229		u32 errors;
   230		struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
   231	
   232		if (!context)
   233			return AE_ERROR;
 > 234		if (guid_parse(context->uuid_str, &guid))
   235			return AE_ERROR;
   236		context->ret.length = ACPI_ALLOCATE_BUFFER;
   237		context->ret.pointer = NULL;
   238	
   239		/* Setting up input parameters */
   240		input.count = 4;
   241		input.pointer = in_params;
   242		in_params[0].type 		= ACPI_TYPE_BUFFER;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot June 1, 2017, 12:05 a.m. UTC | #3
Hi Andy,

[auto build test ERROR on pm/linux-next]
[also build test ERROR on v4.12-rc3 next-20170531]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/ACPI-et-al-convert-to-use-new-UUID-API/20170601-072311
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-x019-201722 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/acpi/bus.c: In function 'acpi_run_osc':
>> drivers/acpi/bus.c:228:2: error: unknown type name 'guid_t'
     guid_t guid;
     ^~~~~~
>> drivers/acpi/bus.c:234:6: error: implicit declaration of function 'guid_parse' [-Werror=implicit-function-declaration]
     if (guid_parse(context->uuid_str, &guid))
         ^~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/guid_t +228 drivers/acpi/bus.c

   222	acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
   223	{
   224		acpi_status status;
   225		struct acpi_object_list input;
   226		union acpi_object in_params[4];
   227		union acpi_object *out_obj;
 > 228		guid_t guid;
   229		u32 errors;
   230		struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
   231	
   232		if (!context)
   233			return AE_ERROR;
 > 234		if (guid_parse(context->uuid_str, &guid))
   235			return AE_ERROR;
   236		context->ret.length = ACPI_ALLOCATE_BUFFER;
   237		context->ret.pointer = NULL;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Christoph Hellwig June 5, 2017, 4:03 p.m. UTC | #4
> +	in_params[0].buffer.pointer	= (u8 *)&guid;

Any idea why the pointer is defined as a u8 * in union acpi_object
instead of a void?
Andy Shevchenko June 5, 2017, 4:20 p.m. UTC | #5
On Mon, 2017-06-05 at 18:03 +0200, Christoph Hellwig wrote:
> > +	in_params[0].buffer.pointer	= (u8 *)&guid;
> 
> Any idea why the pointer is defined as a u8 * in union acpi_object
> instead of a void?

I guess this question to Rafael.
Rafael J. Wysocki June 5, 2017, 8:37 p.m. UTC | #6
On Mon, Jun 5, 2017 at 6:20 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Mon, 2017-06-05 at 18:03 +0200, Christoph Hellwig wrote:
>> > +   in_params[0].buffer.pointer     = (u8 *)&guid;
>>
>> Any idea why the pointer is defined as a u8 * in union acpi_object
>> instead of a void?
>
> I guess this question to Rafael.

That data type is defined in upstream ACPICA and the reason why it is
defined the way it is has something to do with history I suppose.

Thanks,
Rafael
Christoph Hellwig June 6, 2017, 9:58 a.m. UTC | #7
On Mon, Jun 05, 2017 at 10:37:41PM +0200, Rafael J. Wysocki wrote:
> On Mon, Jun 5, 2017 at 6:20 PM, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Mon, 2017-06-05 at 18:03 +0200, Christoph Hellwig wrote:
> >> > +   in_params[0].buffer.pointer     = (u8 *)&guid;
> >>
> >> Any idea why the pointer is defined as a u8 * in union acpi_object
> >> instead of a void?
> >
> > I guess this question to Rafael.
> 
> That data type is defined in upstream ACPICA and the reason why it is
> defined the way it is has something to do with history I suppose.

Ok, I'll send a patch to fix it - just about every user of the field
currently requires a cast, which is not a good thing.
diff mbox

Patch

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 784bda663d16..042cd16265b3 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -225,13 +225,13 @@  acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
 	struct acpi_object_list input;
 	union acpi_object in_params[4];
 	union acpi_object *out_obj;
-	u8 uuid[16];
+	guid_t guid;
 	u32 errors;
 	struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
 
 	if (!context)
 		return AE_ERROR;
-	if (ACPI_FAILURE(acpi_str_to_uuid(context->uuid_str, uuid)))
+	if (guid_parse(context->uuid_str, &guid))
 		return AE_ERROR;
 	context->ret.length = ACPI_ALLOCATE_BUFFER;
 	context->ret.pointer = NULL;
@@ -241,7 +241,7 @@  acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
 	input.pointer = in_params;
 	in_params[0].type 		= ACPI_TYPE_BUFFER;
 	in_params[0].buffer.length 	= 16;
-	in_params[0].buffer.pointer	= uuid;
+	in_params[0].buffer.pointer	= (u8 *)&guid;
 	in_params[1].type 		= ACPI_TYPE_INTEGER;
 	in_params[1].integer.value 	= context->rev;
 	in_params[2].type 		= ACPI_TYPE_INTEGER;