From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Shevchenko Subject: [PATCH v1 1/8] lib/uuid: Introduce uuid_{be|le}_cmp_p{p}() helpers Date: Fri, 21 Apr 2017 17:46:38 +0300 Message-ID: <20170421144645.45189-1-andriy.shevchenko@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" To: Andrew Morton , linux-kernel@vger.kernel.org, Arnd Bergmann , Mika Westerberg , alsa-devel@alsa-project.org, linux-input@vger.kernel.org, kvm@vger.kernel.org, devel@linuxdriverproject.org, linux-efi@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Alex Williamson , Ard Biesheuvel , Vinod Koul , Haiyang Zhang , "Rafael J. Wysocki" , Liam Girdwood , Benjamin Tissoires , Matt Fleming , Kirti Wankhede , Mark Brown , Srinivas Pandruvada , Stephen Hemminger , Tomas Winkler , Andy Shevchenko List-Id: linux-input@vger.kernel.org New helpers take pointers to uuid_{be|le} as parameters. When using them on a raw data we don't need to do an ugly dereference and, in some cases, a type casting. Cc: Andrew Morton Cc: Arnd Bergmann Cc: Liam Girdwood Cc: Mark Brown Cc: Vinod Koul Cc: Srinivas Pandruvada Cc: Benjamin Tissoires Cc: Kirti Wankhede Cc: Alex Williamson Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Stephen Hemminger Cc: Tomas Winkler Cc: Matt Fleming Cc: Ard Biesheuvel Cc: "Rafael J. Wysocki" Signed-off-by: Andy Shevchenko --- include/linux/uuid.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/linux/uuid.h b/include/linux/uuid.h index 4dff73a89758..45312cb5ac65 100644 --- a/include/linux/uuid.h +++ b/include/linux/uuid.h @@ -58,6 +58,26 @@ static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2) return memcmp(&u1, &u2, sizeof(uuid_be)); } +static inline int uuid_le_cmp_p(const uuid_le *pu1, const uuid_le u2) +{ + return memcmp(pu1, &u2, sizeof(uuid_le)); +} + +static inline int uuid_be_cmp_p(const uuid_be *pu1, const uuid_be u2) +{ + return memcmp(pu1, &u2, sizeof(uuid_be)); +} + +static inline int uuid_le_cmp_pp(const uuid_le *pu1, const uuid_le *pu2) +{ + return memcmp(pu1, pu2, sizeof(uuid_le)); +} + +static inline int uuid_be_cmp_pp(const uuid_be *pu1, const uuid_be *pu2) +{ + return memcmp(pu1, pu2, sizeof(uuid_be)); +} + void generate_random_uuid(unsigned char uuid[16]); extern void uuid_le_gen(uuid_le *u); -- 2.11.0