From patchwork Fri Apr 21 14:46:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 9693163 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9FB946038D for ; Fri, 21 Apr 2017 17:06:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B19728654 for ; Fri, 21 Apr 2017 17:06:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C9C328636; Fri, 21 Apr 2017 17:06:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E06E28636 for ; Fri, 21 Apr 2017 17:06:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162154AbdDURCx (ORCPT ); Fri, 21 Apr 2017 13:02:53 -0400 Received: from mga05.intel.com ([192.55.52.43]:29704 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162139AbdDURCp (ORCPT ); Fri, 21 Apr 2017 13:02:45 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP; 21 Apr 2017 07:47:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,230,1488873600"; d="scan'208";a="77249647" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 21 Apr 2017 07:46:59 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0652719F; Fri, 21 Apr 2017 17:46:58 +0300 (EEST) From: Andy Shevchenko 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: Andy Shevchenko , Liam Girdwood , Mark Brown , Vinod Koul , Srinivas Pandruvada , Benjamin Tissoires , Kirti Wankhede , Alex Williamson , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Tomas Winkler , Matt Fleming , Ard Biesheuvel , "Rafael J. Wysocki" 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> X-Mailer: git-send-email 2.11.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);