linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devel-tBiZLqfeLfOHmIFyCCdPziST3g8Odh+X@public.gmane.org,
	sparmaintainer-GLv8BlqOqDDQT0dZR+AlfA@public.gmane.org,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Lukas Wunner <lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
Cc: Andy Shevchenko
	<andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	"Rafael J. Wysocki" <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org>,
	Mika Westerberg
	<mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Subject: [PATCH v1 6/6] device property: Switch to use new generic UUID API
Date: Wed, 19 Jul 2017 21:28:57 +0300	[thread overview]
Message-ID: <20170719182857.73693-7-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20170719182857.73693-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

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.

Cc: "Rafael J. Wysocki" <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org>
Cc: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 drivers/acpi/property.c | 50 ++++++++++++++++++++++++-------------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 917c789f953d..a7fdbe083a7e 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -24,16 +24,14 @@ static int acpi_data_get_property_array(struct acpi_device_data *data,
 					acpi_object_type type,
 					const union acpi_object **obj);
 
-/* ACPI _DSD device properties UUID: daffd814-6eba-4d8c-8a91-bc9bbf4aa301 */
-static const u8 prp_uuid[16] = {
-	0x14, 0xd8, 0xff, 0xda, 0xba, 0x6e, 0x8c, 0x4d,
-	0x8a, 0x91, 0xbc, 0x9b, 0xbf, 0x4a, 0xa3, 0x01
-};
-/* ACPI _DSD data subnodes UUID: dbb8e3e6-5886-4ba6-8795-1319f52a966b */
-static const u8 ads_uuid[16] = {
-	0xe6, 0xe3, 0xb8, 0xdb, 0x86, 0x58, 0xa6, 0x4b,
-	0x87, 0x95, 0x13, 0x19, 0xf5, 0x2a, 0x96, 0x6b
-};
+/* ACPI _DSD device properties GUID: daffd814-6eba-4d8c-8a91-bc9bbf4aa301 */
+static const guid_t prp_guid =
+	GUID_INIT(0xdaffd814, 0x6eba, 0x4d8c,
+		  0x8a, 0x91, 0xbc, 0x9b, 0xbf, 0x4a, 0xa3, 0x01);
+/* ACPI _DSD data subnodes GUID: dbb8e3e6-5886-4ba6-8795-1319f52a966b */
+static const guid_t ads_guid =
+	GUID_INIT(0xdbb8e3e6, 0x5886, 0x4ba6,
+		  0x87, 0x95, 0x13, 0x19, 0xf5, 0x2a, 0x96, 0x6b);
 
 static bool acpi_enumerate_nondev_subnodes(acpi_handle scope,
 					   const union acpi_object *desc,
@@ -190,22 +188,23 @@ static bool acpi_enumerate_nondev_subnodes(acpi_handle scope,
 {
 	int i;
 
-	/* Look for the ACPI data subnodes UUID. */
+	/* Look for the ACPI data subnodes GUID. */
 	for (i = 0; i < desc->package.count; i += 2) {
-		const union acpi_object *uuid, *links;
+		const union acpi_object *guid, *links;
 
-		uuid = &desc->package.elements[i];
+		guid = &desc->package.elements[i];
 		links = &desc->package.elements[i + 1];
 
 		/*
-		 * The first element must be a UUID and the second one must be
+		 * The first element must be a GUID and the second one must be
 		 * a package.
 		 */
-		if (uuid->type != ACPI_TYPE_BUFFER || uuid->buffer.length != 16
-		    || links->type != ACPI_TYPE_PACKAGE)
+		if (guid->type != ACPI_TYPE_BUFFER ||
+		    guid->buffer.length != 16 ||
+		    links->type != ACPI_TYPE_PACKAGE)
 			break;
 
-		if (memcmp(uuid->buffer.pointer, ads_uuid, sizeof(ads_uuid)))
+		if (!guid_equal((guid_t *)guid->buffer.pointer, &ads_guid))
 			continue;
 
 		return acpi_add_nondev_subnodes(scope, links, &data->subnodes,
@@ -298,26 +297,27 @@ static bool acpi_extract_properties(const union acpi_object *desc,
 	if (desc->package.count % 2)
 		return false;
 
-	/* Look for the device properties UUID. */
+	/* Look for the device properties GUID. */
 	for (i = 0; i < desc->package.count; i += 2) {
-		const union acpi_object *uuid, *properties;
+		const union acpi_object *guid, *properties;
 
-		uuid = &desc->package.elements[i];
+		guid = &desc->package.elements[i];
 		properties = &desc->package.elements[i + 1];
 
 		/*
-		 * The first element must be a UUID and the second one must be
+		 * The first element must be a GUID and the second one must be
 		 * a package.
 		 */
-		if (uuid->type != ACPI_TYPE_BUFFER || uuid->buffer.length != 16
-		    || properties->type != ACPI_TYPE_PACKAGE)
+		if (guid->type != ACPI_TYPE_BUFFER ||
+		    guid->buffer.length != 16 ||
+		    properties->type != ACPI_TYPE_PACKAGE)
 			break;
 
-		if (memcmp(uuid->buffer.pointer, prp_uuid, sizeof(prp_uuid)))
+		if (!guid_equal((guid_t *)guid->buffer.pointer, &prp_guid))
 			continue;
 
 		/*
-		 * We found the matching UUID. Now validate the format of the
+		 * We found the matching GUID. Now validate the format of the
 		 * package immediately following it.
 		 */
 		if (!acpi_properties_format_valid(properties))
-- 
2.11.0

  parent reply	other threads:[~2017-07-19 18:28 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-19 18:28 [PATCH v1 0/6] uuid: Convert rest users to new API Andy Shevchenko
2017-07-19 18:28 ` [PATCH v1 1/6] efi: Switch to use new generic UUID API Andy Shevchenko
2017-07-20 12:18   ` Ard Biesheuvel
2017-07-25 10:40     ` Andy Shevchenko
     [not found]       ` <1500979206.29303.228.camel-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-07-26  7:52         ` Christoph Hellwig
     [not found]           ` <20170726075212.GB10959-jcswGhMUV9g@public.gmane.org>
2017-07-26  8:36             ` Ard Biesheuvel
2017-08-30 12:41   ` Christoph Hellwig
     [not found] ` <20170719182857.73693-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-07-19 18:28   ` [PATCH v1 2/6] mei: " Andy Shevchenko
     [not found]     ` <20170719182857.73693-3-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-07-22 18:45       ` kbuild test robot
2017-07-19 18:28   ` Andy Shevchenko [this message]
     [not found]     ` <20170719182857.73693-7-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-07-19 19:27       ` [PATCH v1 6/6] device property: " Rafael J. Wysocki
2017-07-25 14:12     ` Mika Westerberg
2017-07-26  0:21       ` Rafael J. Wysocki
2017-07-26  0:35         ` Andy Shevchenko
2017-07-26  0:27           ` Rafael J. Wysocki
2017-07-26 10:03             ` Andy Shevchenko
2017-07-26 18:58               ` Rafael J. Wysocki
2017-08-30 12:41             ` Christoph Hellwig
2017-08-30 13:46               ` Rafael J. Wysocki
2017-08-30 13:57                 ` Christoph Hellwig
2017-07-19 18:28 ` [PATCH v1 3/6] staging: unisys: " Andy Shevchenko
2017-07-26 10:01   ` Andy Shevchenko
2017-07-30 15:32     ` Greg Kroah-Hartman
2017-07-30 17:26       ` Andy Shevchenko
     [not found]         ` <CAHp75Vf+Us5n2_u94sVGs7xuvfF-qoaG4tvmixvqRARo68TT7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-07-30 17:37           ` Greg Kroah-Hartman
2017-07-31 17:20             ` Andy Shevchenko
2017-08-30 12:38               ` Christoph Hellwig
2017-08-30 13:09                 ` Andy Shevchenko
     [not found]                 ` <20170830123845.lw4vkjbcvivi5hpi-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2017-08-30 13:11                   ` Greg Kroah-Hartman
2017-07-19 18:28 ` [PATCH v1 4/6] vmbus: " Andy Shevchenko
2017-07-19 20:18   ` Haiyang Zhang
2017-07-19 21:54     ` Andy Shevchenko
2017-07-22 18:46   ` kbuild test robot
     [not found]   ` <20170719182857.73693-5-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-07-24 15:54     ` Christoph Hellwig
2017-07-19 18:28 ` [PATCH v1 5/6] uuid: Kill uapi/uuid.h Andy Shevchenko
     [not found]   ` <20170719182857.73693-6-andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-07-22 18:48     ` kbuild test robot
2017-07-24 15:54     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170719182857.73693-7-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko-vuqaysv1563yd54fqh9/ca@public.gmane.org \
    --cc=devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org \
    --cc=devel-tBiZLqfeLfOHmIFyCCdPziST3g8Odh+X@public.gmane.org \
    --cc=hch-jcswGhMUV9g@public.gmane.org \
    --cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org \
    --cc=mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org \
    --cc=sparmaintainer-GLv8BlqOqDDQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).