From patchwork Mon Sep 28 07:00:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 523237 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 95724140B04 for ; Mon, 28 Sep 2015 17:02:32 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=gsV8+8yo; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756341AbbI1HCT (ORCPT ); Mon, 28 Sep 2015 03:02:19 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:35417 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753914AbbI1HCQ (ORCPT ); Mon, 28 Sep 2015 03:02:16 -0400 Received: by wicge5 with SMTP id ge5so90736187wic.0; Mon, 28 Sep 2015 00:02:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3eD+9h+e5Xyv6dv9p2dN0rQy0Eo31H+gfE/C62gikPs=; b=gsV8+8yo5HEKfaBYErQs7j01vKQlv7cbswRrzHKqVYyKzpwPv+Gh9b5ut+/Bl4wgwS fK1YsuA9ZB7wI0f6jh7bq9RDQ+L+SaplvvGiWvLaaDRPcyaV+CXq8dGbG6xcV5yDqui0 LMzFJEIv67fTD5rKQn3zwxrG9egXr38BBf0X4i2kUp6nPAbX7O0aw8xGw+PjqUe1k/7O xEKXx26R1aJcopmmQpoyYr/OHriyacwNex8D6dXCT3ze/r0RbJu+SBf+gr1wRfppp1gz aWDdzNkwRSeVg2IRBP2lfib3BcERfW9HdU8n/XQi0eAKAUi4WD1ShSjt/9RKXTe9tTSP gzjQ== X-Received: by 10.194.58.40 with SMTP id n8mr23547358wjq.134.1443423735316; Mon, 28 Sep 2015 00:02:15 -0700 (PDT) Received: from omega.localdomain (p4FD38193.dip0.t-ipconnect.de. [79.211.129.147]) by smtp.gmail.com with ESMTPSA id fx2sm16602830wib.24.2015.09.28.00.02.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Sep 2015 00:02:14 -0700 (PDT) From: Alexander Aring To: linux-wpan@vger.kernel.org Cc: kernel@pengutronix.de, netdev@vger.kernel.org, phoebe.buckheister@itwm.fraunhofer.de, Alexander Aring , "David S. Miller" Subject: [PATCH bluetooth-next 1/4] netlink: add nla_get for le32 and le64 Date: Mon, 28 Sep 2015 09:00:23 +0200 Message-Id: <1443423626-3609-2-git-send-email-alex.aring@gmail.com> X-Mailer: git-send-email 2.5.3 In-Reply-To: <1443423626-3609-1-git-send-email-alex.aring@gmail.com> References: <1443423626-3609-1-git-send-email-alex.aring@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch adds missing inline wrappers for nla_get_le32 and nla_get_le64. The 802.15.4 MAC byteorder is little endian and we keep the byteorder for fields like address configuration in the same byteorder as it comes from the MAC layer. To provide these fields for nl802154 userspace applications, we need these inline wrappers for netlink. Cc: David S. Miller Signed-off-by: Alexander Aring --- include/net/netlink.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/net/netlink.h b/include/net/netlink.h index 2a5dbcc..0e31727 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h @@ -1004,6 +1004,15 @@ static inline __be32 nla_get_be32(const struct nlattr *nla) } /** + * nla_get_le32 - return payload of __le32 attribute + * @nla: __le32 netlink attribute + */ +static inline __le32 nla_get_le32(const struct nlattr *nla) +{ + return *(__le32 *) nla_data(nla); +} + +/** * nla_get_u16 - return payload of u16 attribute * @nla: u16 netlink attribute */ @@ -1066,6 +1075,15 @@ static inline __be64 nla_get_be64(const struct nlattr *nla) } /** + * nla_get_le64 - return payload of __le64 attribute + * @nla: __le64 netlink attribute + */ +static inline __le64 nla_get_le64(const struct nlattr *nla) +{ + return *(__le64 *) nla_data(nla); +} + +/** * nla_get_s32 - return payload of s32 attribute * @nla: s32 netlink attribute */