From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mika Westerberg Subject: Re: [PATCH v1 06/10] device property: switch to use UUID API Date: Thu, 18 Feb 2016 13:07:54 +0200 Message-ID: <20160218110754.GG1742@lahna.fi.intel.com> References: <1455711448-124103-1-git-send-email-andriy.shevchenko@linux.intel.com> <1455711448-124103-7-git-send-email-andriy.shevchenko@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1455711448-124103-7-git-send-email-andriy.shevchenko@linux.intel.com> Sender: linux-acpi-owner@vger.kernel.org To: Andy Shevchenko Cc: "Rafael J. Wysocki" , Theodore Ts'o , Arnd Bergmann , Greg Kroah-Hartman , Jarkko Sakkinen , Jani Nikula , David Airlie , Benjamin Tissoires , Bjorn Helgaas , Mathias Nyman , Matt Fleming , Lv Zheng , Mark Brown , Zhang Rui , Andrew Morton , Rasmus Villemoes , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-efi@vger.kernel.org, linux-api@vger.kernel.org, linux-nvdimm@lists.01.org List-Id: linux-api@vger.kernel.org On Wed, Feb 17, 2016 at 02:17:24PM +0200, Andy Shevchenko wrote: > Switch to use a generic UUID API instead of custom approach. It allows to > define UUIDs, compare them, and validate. > > Signed-off-by: Andy Shevchenko > --- > drivers/acpi/property.c | 18 ++++++++---------- > 1 file changed, 8 insertions(+), 10 deletions(-) > > diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c > index 2aee416..1e75305 100644 > --- a/drivers/acpi/property.c > +++ b/drivers/acpi/property.c > @@ -25,15 +25,13 @@ static int acpi_data_get_property_array(struct acpi_device_data *data, > 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 > -}; > +static const uuid_le prp_uuid = > + UUID_LE(0xdaffd814, 0x6eba, 0x4d8c, > + 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 > -}; > +static const uuid_le ads_uuid = > + UUID_LE(0xdbb8e3e6, 0x5886, 0x4ba6, > + 0x87, 0x95, 0x13, 0x19, 0xf5, 0x2a, 0x96, 0x6b); This looks better than the original but it is still not too readable. I think it would be better to have uuid as string like: static const char *ads_uuid = "dbb8e3e6-5886-4ba6-8795-1319f52a966b"; and then convert that to the right byte presentation when first time used. That would match the uuid format in the ACPI (and device properties) spec. and thus make it easier to read and understand. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1425643AbcBRLIG (ORCPT ); Thu, 18 Feb 2016 06:08:06 -0500 Received: from mga02.intel.com ([134.134.136.20]:28529 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750926AbcBRLID (ORCPT ); Thu, 18 Feb 2016 06:08:03 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,464,1449561600"; d="scan'208";a="888568663" Date: Thu, 18 Feb 2016 13:07:54 +0200 From: Mika Westerberg To: Andy Shevchenko Cc: "Rafael J. Wysocki" , "Theodore Ts'o" , Arnd Bergmann , Greg Kroah-Hartman , Jarkko Sakkinen , Jani Nikula , David Airlie , Benjamin Tissoires , Bjorn Helgaas , Mathias Nyman , Matt Fleming , Lv Zheng , Mark Brown , Zhang Rui , Andrew Morton , Rasmus Villemoes , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-efi@vger.kernel.org, linux-api@vger.kernel.org, linux-nvdimm@ml01.01.org Subject: Re: [PATCH v1 06/10] device property: switch to use UUID API Message-ID: <20160218110754.GG1742@lahna.fi.intel.com> References: <1455711448-124103-1-git-send-email-andriy.shevchenko@linux.intel.com> <1455711448-124103-7-git-send-email-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1455711448-124103-7-git-send-email-andriy.shevchenko@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 17, 2016 at 02:17:24PM +0200, Andy Shevchenko wrote: > Switch to use a generic UUID API instead of custom approach. It allows to > define UUIDs, compare them, and validate. > > Signed-off-by: Andy Shevchenko > --- > drivers/acpi/property.c | 18 ++++++++---------- > 1 file changed, 8 insertions(+), 10 deletions(-) > > diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c > index 2aee416..1e75305 100644 > --- a/drivers/acpi/property.c > +++ b/drivers/acpi/property.c > @@ -25,15 +25,13 @@ static int acpi_data_get_property_array(struct acpi_device_data *data, > 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 > -}; > +static const uuid_le prp_uuid = > + UUID_LE(0xdaffd814, 0x6eba, 0x4d8c, > + 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 > -}; > +static const uuid_le ads_uuid = > + UUID_LE(0xdbb8e3e6, 0x5886, 0x4ba6, > + 0x87, 0x95, 0x13, 0x19, 0xf5, 0x2a, 0x96, 0x6b); This looks better than the original but it is still not too readable. I think it would be better to have uuid as string like: static const char *ads_uuid = "dbb8e3e6-5886-4ba6-8795-1319f52a966b"; and then convert that to the right byte presentation when first time used. That would match the uuid format in the ACPI (and device properties) spec. and thus make it easier to read and understand.