From patchwork Thu Jan 13 08:55:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 12712458 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2DF3C433F5 for ; Thu, 13 Jan 2022 08:56:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233133AbiAMI4e (ORCPT ); Thu, 13 Jan 2022 03:56:34 -0500 Received: from mail-co1nam11on2086.outbound.protection.outlook.com ([40.107.220.86]:28322 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231709AbiAMI4G (ORCPT ); Thu, 13 Jan 2022 03:56:06 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bNt4Z6bVn2ZeH+6DmZRfqsXB13ei8JOIWT4Wti0K1gnAbAa1YxSNbyq/Vg1gkh7bA18Nz+h7ZcWoGyS0W1G3orRXD/zqRyy5SvDAXHIYszZSvmwweGQmRKuHOtpYcT7F+wam+NqbHysWBjz+aolHxgU/xFCj3MSt2De7NRJY/y7GEdljHz7rj2JYwKBqkBCiKlpYNk3x4mX9RIBARP2Bmlkwf/WUCI2HvllnGK0+nbfPAYOiyvHw2lrXgC/YUvM4Yj3QgSho1mji4NvCjweHQYiVp8O7WCKcGFi6U3Y3PfLdCfD3ZS8FlgIrQMRZWTkXDS8d20DLQgH6Eurw49S+tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nL2ckEzABAEpqhcSpNv/SBV9/l2lXuMeaPOSaepFJzs=; b=jOkMhzlS6UI6hjrxT4kmIQIISTXIfkWCQ1jdsuRfhtNeE4gMXtAnjJ78ZyWtBVopjRtOZnr9Wn2z1h8VptQVlZlyaGrlP+QOBo84rxG4NJZKpgjHgEdNOAUOFgDwG6UgrOOuz2hGm89F4GkOPATbT+wiuAMuMKOzquOP54ZLucz96lU1V9hdRHFZl1n+/7J8NssxQeMPAcA9RsPP1DeFO36NbCGk+GsCBP8j++71OzDLgLW7O3Gsr6A5ypRSG2Xf2Dkp0jhDqsPbQjqwpqBzqIb5d8hw+XtRIfWTuwneB2OJ8N43KT9CjdwF0K9GiGUl7h46ljRM5qP5rxib9ySnLg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nL2ckEzABAEpqhcSpNv/SBV9/l2lXuMeaPOSaepFJzs=; b=ncW4zNi9fa7LzBMIzP+hjHGAo4jsmLO1CPhcfZwvBzNOj0R1GDqNKcDAu0iIP+DtlPn0ClOLCl7K9H4C0ECOJhSyhB8BY+kLUUwY50ws6Vq7JOwALDG+3HdhkN0fkhB1sV025VXMxflWjh3Ruw6gcMHDpucfTabws3IExewNkZ4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=silabs.com; Received: from PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) by BY5PR11MB4040.namprd11.prod.outlook.com (2603:10b6:a03:186::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.10; Thu, 13 Jan 2022 08:55:54 +0000 Received: from PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::d031:da9e:71a:73e4]) by PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::d031:da9e:71a:73e4%5]) with mapi id 15.20.4888.011; Thu, 13 Jan 2022 08:55:54 +0000 From: Jerome Pouiller To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH 08/31] staging: wfx: use IS_ALIGNED() Date: Thu, 13 Jan 2022 09:55:01 +0100 Message-Id: <20220113085524.1110708-9-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220113085524.1110708-1-Jerome.Pouiller@silabs.com> References: <20220113085524.1110708-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: SA0PR11CA0117.namprd11.prod.outlook.com (2603:10b6:806:d1::32) To PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 42e4d412-aad3-46f7-ce86-08d9d672817b X-MS-TrafficTypeDiagnostic: BY5PR11MB4040:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:85; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4OFh3JLRDWZqhlZYJ2r/Ytvr0aiTU2DgmXGz3BXoJS3XAOgvJQ4eW1BuEJ3jLi4FoWmuamc3KT4nsD1NKEpyw/TtaKs+yeiw62X72lrngsvOzdCkoUogUONf25TCZRB63WATnUmkFAIQCM/E0bayNYcS2EOd6HfHqGsMFuhEgWU4AV65kkmZ1K5BGn3hvnseDV0S84ZmjpZ5KDqhN4T8oyUFqjFKr2rxo5MrrdNjVJyujZDWeM32Q+dSoX2VIHAaYnzDqjtJDy/6r8tOBBtCF7MCxZ9loHNazRoFOr3UzcNgog57wu5+dx2kZG68unzJ3VLHaB46+Il+/OlVwlpI6QBTXhDUqYHRuRunZ3VzkLEx6NjEbNcQgOY1Q+o45kneQtZtVbguqEiwVbBwApWALSXRfp92hgmy9e5EZMOqK6WGRG1G64X5z05rQl2ehDnYG5YUp6NK5YC4b0Sp3Wg3h0LSuxwDL+AMGjRfNVP4WlUAJioUTamo7kRIxDY8bo5Ja2z+tucZfBcRVbqjQzWUEE0546fDHLeHFOc9RsvxDlUQ2eoLyPP00+IayocuI9F7I4efgjcXkAyVkgLRDLlL5ccUwI6nAvS4DSuKLRJNIEWOCTyssDpSwlPjp2U9MkRkpLGE/oBh+Ehro1/lUn4jmA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5657.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(6506007)(508600001)(186003)(38100700002)(4326008)(8936002)(6512007)(6666004)(66946007)(83380400001)(1076003)(2616005)(54906003)(86362001)(66556008)(2906002)(66476007)(316002)(52116002)(36756003)(5660300002)(66574015)(8676002)(6486002)(107886003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ss4UQZmg+Nspw3o32Ev44CrafWBb?= =?utf-8?q?opwlhjZzjBNRaVL/WJtNJFm1diNyeh64fG5Es7Ai7SXqe4+Nu5RP1w9FsHG7S1191?= =?utf-8?q?HKFyUYDpTPHbwVJ3xSTGSzarxCqAYZJtfu+RZyAukJz2WeCtTFr/+3iiMcsSSIBce?= =?utf-8?q?9gg2u0wnPi8O44fiiHZph+CoYMpJ1uOGDYZZe2uk2m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+Jf9xdsep?= =?utf-8?q?Fx7b+ktf6mF5sqkis1nGoq6BnIY9I/1CeHqcub5/sgIvfbzesHqYls/rN8rjTm4co?= =?utf-8?q?7PAlzFcuApsFwp38J7zWgZ1QlXrntEHfazedNEiby+aj/xxXwrv12PrHKsKRWsx+b?= =?utf-8?q?T7dWBvzkh96/VeLlmBKskBw8Tu4AyXpmnSGeZa9F/KQZqK8hunemXjptNQ2ECvoxW?= =?utf-8?q?91u0QJwLOIjFXWHctRayJwZeutQlJRaEWDGJFS8R3XMhIzwEnkyOXRPWRQfaMvtTW?= =?utf-8?q?vbCJrHdQxA0SykbRGHOuoVXMpshz+giV0nTve2YZHO+DyPzp8Qnue2wR1jqYidchW?= =?utf-8?q?nSjiQg6OiTDrWpVgLQvG0giY2mhguyTwdljHKx3G8h8LMtu35AzaXroV5+5XsUW6C?= =?utf-8?q?Q/9g23CCThMGov8b6E6H3uB6fhasN8RLGbjPrTynOUx/1r6thZGfo89KMNgjf0jde?= =?utf-8?q?klxBXHoKHRjXi/OfJIFJ5lPRo7CQesagDfGynPWh0jZT+fzfgOtvC5j0xwf3nb8WM?= =?utf-8?q?ZJ6+2n4yghYNQS61fyyJaq+SDZD2iYuZ+UOswumzXfDVqgKQUufff8=3D?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42e4d412-aad3-46f7-ce86-08d9d672817b X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5657.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2022 08:55:53.9125 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4Bc3TGifiGnF8+OXqraaWQHWkRNDzN0VFdEafz9baEDxV5qo+UnFM83LgryXzdg4i4+fMBwaqYZzHinfY3pt3g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR11MB4040 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller It "IS_ALIGNED(ptr, 4)" is more explicit than "ptr & 3". Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/bus_sdio.c | 9 +++++---- drivers/staging/wfx/hwio.c | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index a670176ba06f..42aeab30bf0a 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "bus.h" #include "wfx.h" @@ -40,8 +41,8 @@ static int wfx_sdio_copy_from_io(void *priv, unsigned int reg_id, int ret; WARN(reg_id > 7, "chip only has 7 registers"); - WARN(((uintptr_t)dst) & 3, "unaligned buffer size"); - WARN(count & 3, "unaligned buffer address"); + WARN(!IS_ALIGNED((uintptr_t)dst, 4), "unaligned buffer address"); + WARN(!IS_ALIGNED(count, 4), "unaligned buffer size"); /* Use queue mode buffers */ if (reg_id == WFX_REG_IN_OUT_QUEUE) @@ -61,8 +62,8 @@ static int wfx_sdio_copy_to_io(void *priv, unsigned int reg_id, int ret; WARN(reg_id > 7, "chip only has 7 registers"); - WARN(((uintptr_t)src) & 3, "unaligned buffer size"); - WARN(count & 3, "unaligned buffer address"); + WARN(!IS_ALIGNED((uintptr_t)src, 4), "unaligned buffer address"); + WARN(!IS_ALIGNED(count, 4), "unaligned buffer size"); /* Use queue mode buffers */ if (reg_id == WFX_REG_IN_OUT_QUEUE) diff --git a/drivers/staging/wfx/hwio.c b/drivers/staging/wfx/hwio.c index 393bcb1e2f4e..a2a37efc51a6 100644 --- a/drivers/staging/wfx/hwio.c +++ b/drivers/staging/wfx/hwio.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "hwio.h" #include "wfx.h" @@ -221,7 +222,7 @@ int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t len) { int ret; - WARN((long)buf & 3, "%s: unaligned buffer", __func__); + WARN(!IS_ALIGNED((uintptr_t)buf, 4), "unaligned buffer"); wdev->hwbus_ops->lock(wdev->hwbus_priv); ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, WFX_REG_IN_OUT_QUEUE, buf, len); @@ -237,7 +238,7 @@ int wfx_data_write(struct wfx_dev *wdev, const void *buf, size_t len) { int ret; - WARN((long)buf & 3, "%s: unaligned buffer", __func__); + WARN(!IS_ALIGNED((uintptr_t)buf, 4), "unaligned buffer"); wdev->hwbus_ops->lock(wdev->hwbus_priv); ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, WFX_REG_IN_OUT_QUEUE, buf, len);