Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4673784rwd; Tue, 23 May 2023 10:45:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ66kfzMkkGKcK++uPcWRrISJ61glXCJy/hNiPuBWtp+21pRthSlEbRX6o2S3dctD3Zlmy2k X-Received: by 2002:a05:6a20:918f:b0:101:4348:3e44 with SMTP id v15-20020a056a20918f00b0010143483e44mr16358574pzd.12.1684863940039; Tue, 23 May 2023 10:45:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684863940; cv=pass; d=google.com; s=arc-20160816; b=C6jUTcsyABxB52sQCPZbLVxujS5wttquCIw5xVVpJ0yBc+27PZ8jQvPdtju4InEU8/ VW1/mDgS44qhZMbDErV/KO72bqRXdO62wMusDn8QtnmzRyTdYUQIX2r9JsaZaFAkltVb p/EV5vAfbymTEcD8/83ijbyeRpV0EfVwtHA2XBbDGRWtmM02Tea41eu9wig0u736ZuIB 2nIirP9+5pX8752XBdEoQ9WV8ltxv9yCO6dT8Cr3loVG+rWrc0nTj2accNVWHx4xlsj5 Kh4ZMuXQU4NBZwA/pnsmfqjoT1yQ/jyuD8hHwzM4XpPQLmk/XKjZcIR2rAy/WTYyZLd5 /VfA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aJANENL85gsGC2hfqCVR4IXN7gKgfp43J7J0EGCtheI=; b=noQAmZUU3X2Mo5mXqpI+RxvyrPa8/LcsMAh9NeZp8XFYt9vl7fcZSMil1q3xiLAzRi LBesBTO4wmnCBjjJEPJH4/7ZmjLcMifI2dE3bXSkit/pXI7QU0lFhLNzFEYfnyq/bKJ7 qA3z2x0Zc8FKCD5PhL2Sm39wes0QaPFrUwXyxqs1dWHUObOHkL/YhKXM3LolgTn53883 D8LV7pgrE0SbR0sjffq1JWMlu9FBGX8rBx35X4bbAXrfcsEBDpimyF2MY/tbCs29NKY1 D56ODFY4Isyj7eyJ+Ncn23DV53oVInmfnEXyL69QYo4kst2t9VH7i02rB5iPooUimIYg +l/w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@esdhannover.onmicrosoft.com header.s=selector1-esdhannover-onmicrosoft-com header.b=bvw6s9+L; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v8-20020a63b648000000b00534769ac7acsi6697203pgt.879.2023.05.23.10.45.26; Tue, 23 May 2023 10:45:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@esdhannover.onmicrosoft.com header.s=selector1-esdhannover-onmicrosoft-com header.b=bvw6s9+L; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237847AbjEWRc3 (ORCPT + 99 others); Tue, 23 May 2023 13:32:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236990AbjEWRc0 (ORCPT ); Tue, 23 May 2023 13:32:26 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2108.outbound.protection.outlook.com [40.107.20.108]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07255E7C; Tue, 23 May 2023 10:31:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MIMVMM599AGJQSfCOxSodiFz3x0RIkv7AdDrImkirxRadin5j7CNRC4zxFr6vHRnSyHhtgzCffvgXodOmTEWLfVyBkjQB/LjV7qe7Tktq6rljjgKuzT439L3E7CyeGFIG/RC30/myDw66yF+oLYPm3qWZN2CFyzATZIhiIEB+uZYWpI7cTfww9lTm4phllKGFiNvwebGQVRqaV+8eqBDmnXYe0po5bulfEaGia3Ogwreyc1mCmRJSGm01O6gtyP1yvgm5mBZ2gVzEWUridNeuhShuLaICOZh5V7fBFHpj554Xr/Mw3c7K7LNN6SoWkaebV86H1vWjBae2a1cQhyfWA== 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=aJANENL85gsGC2hfqCVR4IXN7gKgfp43J7J0EGCtheI=; b=eWfUp2/mVm57dig7AkHPERY3xwnXLJFM2ONCRKwicivxPVlyQSa0KvqdEllUw9dHvFSGlXSzTG1FyYe3LYIRe0Daa14Gc5CLuGRBZbsucQf36i5jXt533AfXm0oY6YtV01tKJQtS9joO3SwMvfPrTO1/eXpr06uS43S2xjIKyBGizzAIxJC+3qE/wL0q4/SzTbu0qNVLCotGlA5Re3AKsQNzUqI1yZZ7mFmkHNoRAXi0d7s37eNZVYYKTPRQ0x2KOaHvSstkd8CW2yHCWBH9gh8+Ja3QRnK01C6tgnCYTf6Ib46+maZu+bIWQTACjkbnyaZfO6W2cbP5FNtPKEOW7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=softfail (sender ip is 80.151.164.27) smtp.rcpttodomain=esd.eu smtp.mailfrom=esd.eu; dmarc=none action=none header.from=esd.eu; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=esdhannover.onmicrosoft.com; s=selector1-esdhannover-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aJANENL85gsGC2hfqCVR4IXN7gKgfp43J7J0EGCtheI=; b=bvw6s9+LK0ilJvRIu0JvNoOHAmLBjNlUNR3QxXmqYTIijDBAUG1v7+9hsJrO5TdEFY7G8jHwYmuO0v16b2WCcdNEdLiCd+7R07HS0s3G6yh7Ff5iyo/JqNAP+wlUzQZbZKGfXEumisnQSy69zzZWLNmXIHC1mhYxVZC2oGsq8q8= Received: from FR0P281CA0054.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:48::16) by AS8PR03MB8737.eurprd03.prod.outlook.com (2603:10a6:20b:538::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29; Tue, 23 May 2023 17:31:07 +0000 Received: from VI1EUR06FT029.eop-eur06.prod.protection.outlook.com (2603:10a6:d10:48:cafe::b5) by FR0P281CA0054.outlook.office365.com (2603:10a6:d10:48::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.14 via Frontend Transport; Tue, 23 May 2023 17:31:07 +0000 X-MS-Exchange-Authentication-Results: spf=softfail (sender IP is 80.151.164.27) smtp.mailfrom=esd.eu; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=esd.eu; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning esd.eu discourages use of 80.151.164.27 as permitted sender) Received: from esd-s7.esd (80.151.164.27) by VI1EUR06FT029.mail.protection.outlook.com (10.13.7.190) with Microsoft SMTP Server id 15.20.6433.14 via Frontend Transport; Tue, 23 May 2023 17:31:07 +0000 Received: from esd-s20.esd.local (jenkins.esd.local [10.0.0.190]) by esd-s7.esd (Postfix) with ESMTPS id 030307C16D8; Tue, 23 May 2023 19:31:07 +0200 (CEST) Received: by esd-s20.esd.local (Postfix, from userid 2046) id E86DA2E1805; Tue, 23 May 2023 19:31:06 +0200 (CEST) From: Frank Jungclaus To: linux-can@vger.kernel.org, Marc Kleine-Budde , Wolfgang Grandegger , Vincent Mailhol Cc: =?UTF-8?q?Stefan=20M=C3=A4tje?= , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Frank Jungclaus Subject: [PATCH 1/2] can: esd_usb: Make use of kernel macros BIT() and GENMASK() Date: Tue, 23 May 2023 19:31:04 +0200 Message-Id: <20230523173105.3175086-2-frank.jungclaus@esd.eu> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230523173105.3175086-1-frank.jungclaus@esd.eu> References: <20230523173105.3175086-1-frank.jungclaus@esd.eu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1EUR06FT029:EE_|AS8PR03MB8737:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: a33d73f2-8373-47c3-459f-08db5bb37df1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8p+kTB5F2ZyBSk1MU/Byy9UR04VQ2NVXQHX9e8brm5tRSB2+G3YX0l6kM3aK4+7cD3O4j0F1zAt80DERzBoz+lYyWWFoWX2bcj1yB6zsbbgg4Fq7f6CljG9uf04GKKt8ajmFILyZ1gN70W+4pTNTpOOvstW9oWUwARIwIMaBMmHiC2k8lrr9QXgMLL1qNCTmaghS8srUJDrfwcKkSdJG7pgZBOvnUE6J76kANfVpNey/nuXDRjgI2SQkcAd7Jl5QZuNt3Jbvk3PH5HT2uLVAC5nAmBE+sLJPvHN7LfFy6ZTJX5HUxV8CMRHzAS0kcxgmzZKJ7uZEaH2hym0nXWJGHchuKvtMIkEElJDYj4OOpl8c9T1oawkTSR++cLQ2bVzXKWNYbrys8184ADtmi2uzHG0E1udjkAvr+flGAuAwBQh24qHoR+AX4buWnRlJXHScCmxv8TYO1+Y6h06hyVbIHUyIZ7gS+W9IXRIhP8R6n2mUhnh86KZK+Twl4uxXaPj4vTw2w22SPv7MwbgI30DHfexYjt0X3I376RxddN7eEvDLyMoIZPGpmuOk5yuVQ+scjHIWmtIa4Vl1zXCRSQtoCmKYBJI8EiYIDir4ONPKqS7g3QnP0bC+vY0msb8aOWVb/sjE8Xyix6PQQJaf+X4xG0OEMOuxYFXLQzd3JoiAb1TghUKGcN1QfzF4AHI+RdyKaxyCu2/Lrhhp8q/paAz8XQ== X-Forefront-Antispam-Report: CIP:80.151.164.27;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:esd-s7.esd;PTR:p5097a41b.dip0.t-ipconnect.de;CAT:NONE;SFS:(13230028)(4636009)(346002)(136003)(39840400004)(396003)(376002)(451199021)(36840700001)(46966006)(82310400005)(70206006)(70586007)(478600001)(41300700001)(110136005)(54906003)(42186006)(316002)(4326008)(86362001)(8936002)(8676002)(5660300002)(44832011)(356005)(6266002)(26005)(186003)(81166007)(1076003)(83380400001)(2906002)(40480700001)(336012)(2616005)(36756003)(36860700001)(47076005);DIR:OUT;SFP:1102; X-OriginatorOrg: esd.eu X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2023 17:31:07.2513 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a33d73f2-8373-47c3-459f-08db5bb37df1 X-MS-Exchange-CrossTenant-Id: 5a9c3a1d-52db-4235-b74c-9fd851db2e6b X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5a9c3a1d-52db-4235-b74c-9fd851db2e6b;Ip=[80.151.164.27];Helo=[esd-s7.esd] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR06FT029.eop-eur06.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB8737 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make use of kernel macros BIT() and GENMASK(). Signed-off-by: Frank Jungclaus --- drivers/net/can/usb/esd_usb.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/net/can/usb/esd_usb.c b/drivers/net/can/usb/esd_usb.c index 1399b832ea3f..d40a04db7458 100644 --- a/drivers/net/can/usb/esd_usb.c +++ b/drivers/net/can/usb/esd_usb.c @@ -67,23 +67,23 @@ MODULE_LICENSE("GPL v2"); #define ESD_USB_TRIPLE_SAMPLES BIT(23) /* esd IDADD message */ -#define ESD_USB_ID_ENABLE 0x80 +#define ESD_USB_ID_ENABLE BIT(7) #define ESD_USB_MAX_ID_SEGMENT 64 /* SJA1000 ECC register (emulated by usb firmware) */ -#define ESD_USB_SJA1000_ECC_SEG 0x1F -#define ESD_USB_SJA1000_ECC_DIR 0x20 -#define ESD_USB_SJA1000_ECC_ERR 0x06 +#define ESD_USB_SJA1000_ECC_SEG GENMASK(4, 0) +#define ESD_USB_SJA1000_ECC_DIR BIT(5) +#define ESD_USB_SJA1000_ECC_ERR BIT(2, 1) #define ESD_USB_SJA1000_ECC_BIT 0x00 -#define ESD_USB_SJA1000_ECC_FORM 0x40 -#define ESD_USB_SJA1000_ECC_STUFF 0x80 -#define ESD_USB_SJA1000_ECC_MASK 0xc0 +#define ESD_USB_SJA1000_ECC_FORM BIT(6) +#define ESD_USB_SJA1000_ECC_STUFF BIT(7) +#define ESD_USB_SJA1000_ECC_MASK GENMASK(7, 6) /* esd bus state event codes */ -#define ESD_USB_BUSSTATE_MASK 0xc0 -#define ESD_USB_BUSSTATE_WARN 0x40 -#define ESD_USB_BUSSTATE_ERRPASSIVE 0x80 -#define ESD_USB_BUSSTATE_BUSOFF 0xc0 +#define ESD_USB_BUSSTATE_MASK GENMASK(7, 6) +#define ESD_USB_BUSSTATE_WARN BIT(6) +#define ESD_USB_BUSSTATE_ERRPASSIVE BIT(7) +#define ESD_USB_BUSSTATE_BUSOFF GENMASK(7, 6) #define ESD_USB_RX_BUFFER_SIZE 1024 #define ESD_USB_MAX_RX_URBS 4 @@ -652,9 +652,9 @@ static int esd_usb_start(struct esd_usb_net_priv *priv) msg->filter.net = priv->index; msg->filter.option = ESD_USB_ID_ENABLE; /* start with segment 0 */ for (i = 0; i < ESD_USB_MAX_ID_SEGMENT; i++) - msg->filter.mask[i] = cpu_to_le32(0xffffffff); + msg->filter.mask[i] = cpu_to_le32(GENMASK(31, 0)); /* enable 29bit extended IDs */ - msg->filter.mask[ESD_USB_MAX_ID_SEGMENT] = cpu_to_le32(0x00000001); + msg->filter.mask[ESD_USB_MAX_ID_SEGMENT] = cpu_to_le32(BIT(0)); err = esd_usb_send_msg(dev, msg); if (err) @@ -796,7 +796,7 @@ static netdev_tx_t esd_usb_start_xmit(struct sk_buff *skb, context->echo_index = i; /* hnd must not be 0 - MSB is stripped in txdone handling */ - msg->tx.hnd = 0x80000000 | i; /* returned in TX done message */ + msg->tx.hnd = BIT(31) | i; /* returned in TX done message */ usb_fill_bulk_urb(urb, dev->udev, usb_sndbulkpipe(dev->udev, 2), buf, msg->hdr.len * sizeof(u32), /* convert to # of bytes */ -- 2.25.1