From nobody Wed Apr 8 00:00:34 2026 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 DA0F1C4332F for ; Thu, 20 Oct 2022 07:55:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231164AbiJTHzP (ORCPT ); Thu, 20 Oct 2022 03:55:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230522AbiJTHzF (ORCPT ); Thu, 20 Oct 2022 03:55:05 -0400 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A244663862 for ; Thu, 20 Oct 2022 00:55:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1666252491; bh=3oEoMwohNKBPd+zk6iCl10WIgxrx6LNO3Rbth/3kk7g=; h=X-EA-Auth:Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=D9VDSL17zM99E1AoGoa2p8hqjggURknRtQ7Zte31rggp6x1JRUCU/8dITHRCmSMcc xjv8PwALQxEQ+FD6DTfJ4ENINt6oabw4xXIHkwdwUGX+uWDnBoDn8Tys+UA76yCVxL rao8TaLRCJf12RodOBsu7hQ+QPSD+CWKMba02xTI= Received: by b-6.in.mailobj.net [192.168.90.16] with ESMTP via [213.182.55.206] Thu, 20 Oct 2022 09:54:51 +0200 (CEST) X-EA-Auth: Xb2yLyLmfMaCBszIMlAVa3vz57SUh8jcot+dWk3Tbu4xgXSg5FKIPIb93od9bNjMEOoYioj4q8Ce1xzHnqsZvAR6IEaDmGt9 Date: Thu, 20 Oct 2022 13:24:46 +0530 From: Deepak R Varma To: outreachy@lists.linux.dev, Larry.Finger@lwfinger.net, phil@philpotter.co.uk, paskripkin@gmail.com, gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, kumarpraveen@linux.microsoft.com, saurabh.truth@gmail.com Subject: [PATCH v3 04/10] staging: r8188eu: use htons macro instead of __constant_htons Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Macro "htons" is more efficient and clearer. It should be used for constants instead of the __constant_htons macro. Resolves following checkpatch script complaint: WARNING: __constant_htons should be htons Signed-off-by: Deepak R Varma --- Changes in v3: 1. Make this a driver-wide change. Feedback from philipp.g.hortmann@gmai= l.com 2. Correct spelling in patch log. Feedback from joe@perches.com drivers/staging/r8188eu/core/rtw_br_ext.c | 6 +++--- drivers/staging/r8188eu/core/rtw_xmit.c | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8= 188eu/core/rtw_br_ext.c index 14797c2d6d76..718133c991d7 100644 --- a/drivers/staging/r8188eu/core/rtw_br_ext.c +++ b/drivers/staging/r8188eu/core/rtw_br_ext.c @@ -609,14 +609,14 @@ void dhcp_flag_bcast(struct adapter *priv, struct sk_= buff *skb) if (!priv->ethBrExtInfo.dhcp_bcst_disable) { __be16 protocol =3D *((__be16 *)(skb->data + 2 * ETH_ALEN)); - if (protocol =3D=3D __constant_htons(ETH_P_IP)) { /* IP */ + if (protocol =3D=3D htons(ETH_P_IP)) { /* IP */ struct iphdr *iph =3D (struct iphdr *)(skb->data + ETH_HLEN); if (iph->protocol =3D=3D IPPROTO_UDP) { /* UDP */ struct udphdr *udph =3D (struct udphdr *)((size_t)iph + (iph->ihl << 2= )); - if ((udph->source =3D=3D __constant_htons(CLIENT_PORT)) && - (udph->dest =3D=3D __constant_htons(SERVER_PORT))) { /* DHCP requ= est */ + if ((udph->source =3D=3D htons(CLIENT_PORT)) && + (udph->dest =3D=3D htons(SERVER_PORT))) { /* DHCP request */ struct dhcpMessage *dhcph =3D (struct dhcpMessage *)((size_t)udph + sizeof(struct udphdr)); u32 cookie =3D be32_to_cpu((__be32)dhcph->cookie); diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r818= 8eu/core/rtw_xmit.c index 873d2c5c3634..4f8220428328 100644 --- a/drivers/staging/r8188eu/core/rtw_xmit.c +++ b/drivers/staging/r8188eu/core/rtw_xmit.c @@ -1622,14 +1622,14 @@ static int rtw_br_client_tx(struct adapter *padapte= r, struct sk_buff **pskb) spin_lock_bh(&padapter->br_ext_lock); if (!(skb->data[0] & 1) && br_port && memcmp(skb->data + ETH_ALEN, padapter->br_mac, ETH_ALEN) && - *((__be16 *)(skb->data + ETH_ALEN * 2)) !=3D __constant_htons(ETH_P_8= 021Q) && - *((__be16 *)(skb->data + ETH_ALEN * 2)) =3D=3D __constant_htons(ETH_P= _IP) && + *((__be16 *)(skb->data + ETH_ALEN * 2)) !=3D htons(ETH_P_8021Q) && + *((__be16 *)(skb->data + ETH_ALEN * 2)) =3D=3D htons(ETH_P_IP) && !memcmp(padapter->scdb_mac, skb->data + ETH_ALEN, ETH_ALEN) && padapt= er->scdb_entry) { memcpy(skb->data + ETH_ALEN, GET_MY_HWADDR(padapter), ETH_ALEN); padapter->scdb_entry->ageing_timer =3D jiffies; spin_unlock_bh(&padapter->br_ext_lock); } else { - if (*((__be16 *)(skb->data + ETH_ALEN * 2)) =3D=3D __constant_htons(ETH_= P_8021Q)) { + if (*((__be16 *)(skb->data + ETH_ALEN * 2)) =3D=3D htons(ETH_P_8021Q)) { is_vlan_tag =3D 1; vlan_hdr =3D *((unsigned short *)(skb->data + ETH_ALEN * 2 + 2)); for (i =3D 0; i < 6; i++) @@ -1637,10 +1637,10 @@ static int rtw_br_client_tx(struct adapter *padapte= r, struct sk_buff **pskb) skb_pull(skb, 4); } if (!memcmp(skb->data + ETH_ALEN, padapter->br_mac, ETH_ALEN) && - (*((__be16 *)(skb->data + ETH_ALEN * 2)) =3D=3D __constant_htons(ETH= _P_IP))) + (*((__be16 *)(skb->data + ETH_ALEN * 2)) =3D=3D htons(ETH_P_IP))) memcpy(padapter->br_ip, skb->data + WLAN_ETHHDR_LEN + 12, 4); - if (*((__be16 *)(skb->data + ETH_ALEN * 2)) =3D=3D __constant_htons(ETH_= P_IP)) { + if (*((__be16 *)(skb->data + ETH_ALEN * 2)) =3D=3D htons(ETH_P_IP)) { if (memcmp(padapter->scdb_mac, skb->data + ETH_ALEN, ETH_ALEN)) { padapter->scdb_entry =3D (struct nat25_network_db_entry *)scdb_findEnt= ry(padapter, skb->data + WLAN_ETHHDR_LEN + 12); @@ -1669,7 +1669,7 @@ static int rtw_br_client_tx(struct adapter *padapter,= struct sk_buff **pskb) skb_push(skb, 4); for (i =3D 0; i < 6; i++) *((unsigned short *)(skb->data + i * 2)) =3D *((unsigned short *)(sk= b->data + 4 + i * 2)); - *((__be16 *)(skb->data + ETH_ALEN * 2)) =3D __constant_htons(ETH_P_80= 21Q); + *((__be16 *)(skb->data + ETH_ALEN * 2)) =3D htons(ETH_P_8021Q); *((unsigned short *)(skb->data + ETH_ALEN * 2 + 2)) =3D vlan_hdr; } @@ -1708,7 +1708,7 @@ static int rtw_br_client_tx(struct adapter *padapter,= struct sk_buff **pskb) skb_push(skb, 4); for (i =3D 0; i < 6; i++) *((unsigned short *)(skb->data + i * 2)) =3D *((unsigned short *)(skb-= >data + 4 + i * 2)); - *((__be16 *)(skb->data + ETH_ALEN * 2)) =3D __constant_htons(ETH_P_8021= Q); + *((__be16 *)(skb->data + ETH_ALEN * 2)) =3D htons(ETH_P_8021Q); *((unsigned short *)(skb->data + ETH_ALEN * 2 + 2)) =3D vlan_hdr; } } -- 2.30.2