From patchwork Tue Jan 6 03:53:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaishali Thakkar X-Patchwork-Id: 5571841 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BA38FBF6C3 for ; Tue, 6 Jan 2015 03:53:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D208120303 for ; Tue, 6 Jan 2015 03:53:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C46D9202EB for ; Tue, 6 Jan 2015 03:53:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753688AbbAFDx1 (ORCPT ); Mon, 5 Jan 2015 22:53:27 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:34501 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751011AbbAFDx1 (ORCPT ); Mon, 5 Jan 2015 22:53:27 -0500 Received: by mail-pa0-f47.google.com with SMTP id kq14so30080083pab.20 for ; Mon, 05 Jan 2015 19:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=5t/ZEjlFVDf2KNqAlcxnG/uWD61iIDHPNg2JJefFhsE=; b=vBkEOuyRAYegqor5SQxH+8LbAtjYGz6tk6KCGq9mHngIYAqfMe3r/vO8Na5C/5bE/c Bjl4bJTMrBGbT+FHY+7cZqrZwUUuVaGXW6oxLX/iMZNEbadrKjuATca+YoYcJFLoFlZI m/Rx829yu4TZEBN2H6YLdLU3S3FA7O56fAP3gIatp6yWpx1C0Rr3e0pwvmHcruF0++Ny BLci9q42TwU7GFykZNsofLSEZGxX9proJ8mOVCizV0bzPdSyOHMG+hAM0W6JtKPBp1jf Dsm5wu92l6Lj1jVpHg2zeJm86PN+TKYxs/0ZFjL5U2nVYldK40O4kSAoJM9FqFZxk1IW LFDg== X-Received: by 10.68.68.172 with SMTP id x12mr153739037pbt.71.1420516406801; Mon, 05 Jan 2015 19:53:26 -0800 (PST) Received: from vaishali-Ideapad-Z570 ([182.237.15.237]) by mx.google.com with ESMTPSA id j9sm55509238pdl.72.2015.01.05.19.53.24 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 Jan 2015 19:53:25 -0800 (PST) Date: Tue, 6 Jan 2015 09:23:19 +0530 From: Vaishali Thakkar To: "John W. Linville" Cc: "Franky (Zhenhui) Lin" , Arend van Spriel , Hante Meuleman , Brett Rudley , linux-wireless@vger.kernel.org Subject: [PATCH] brcmfmac: Use put_unaligned_le32 Message-ID: <20150106035319.GA4082@vaishali-Ideapad-Z570> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB, T_DKIM_INVALID, T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch introduces the use of function put_unaligned_le32. This is done using Coccinelle and semantic patch used is as follows: @a@ typedef u32, __le32, uint32_t; {u32,__le32,uint32_t} e32; identifier tmp; expression ptr; expression y,e; type T; type T; @@ - tmp = cpu_to_le32(y); <+... when != tmp ( - memcpy(ptr, (T)&tmp, \(4\|sizeof(u32)\|sizeof(__le32)\|sizeof(uint32_t)\|s + put_unaligned_le32(y,ptr); | - memcpy(ptr, (T)&tmp, ...); + put_unaligned_le32(y,ptr); ) ...+> ? tmp = e @@ type T; identifier a.tmp; @@ - T tmp; ...when != tmp Signed-off-by: Vaishali Thakkar --- drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 28fa25b..6d37618 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c @@ -3550,17 +3550,12 @@ static u32 brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8 *ie_ptr, u32 ie_len, s8 *add_del_cmd) { - __le32 iecount_le; - __le32 pktflag_le; - strncpy(iebuf, add_del_cmd, VNDR_IE_CMD_LEN - 1); iebuf[VNDR_IE_CMD_LEN - 1] = '\0'; - iecount_le = cpu_to_le32(1); - memcpy(&iebuf[VNDR_IE_COUNT_OFFSET], &iecount_le, sizeof(iecount_le)); + put_unaligned_le32(1, &iebuf[VNDR_IE_COUNT_OFFSET]); - pktflag_le = cpu_to_le32(pktflag); - memcpy(&iebuf[VNDR_IE_PKTFLAG_OFFSET], &pktflag_le, sizeof(pktflag_le)); + put_unaligned_le32(pktflag, &iebuf[VNDR_IE_PKTFLAG_OFFSET]); memcpy(&iebuf[VNDR_IE_VSIE_OFFSET], ie_ptr, ie_len);