From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4689C35E958 for ; Wed, 8 Apr 2026 01:52:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775613121; cv=none; b=Iqs7g5f6QuzD4a1lUVjktzo5dJ32r6hvW5IePoHe0G3NAs/sj/npAYnPLZo8SMAy2D448bByU/x0cwKdTSv7jG5QlwL3W8TNA/4KJi6+UxNm1sl2a82AvfwiIa2chmnzTJaJori3Y11zyynXm9UsTGYLDev7/Tx2MEsVGo/Zhto= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775613121; c=relaxed/simple; bh=Ta6AbvpaQKsB+xbANDMPvvgsDTmaP0zw1a4aSz+TAlo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=i61ryFX9gPZuijb7mveOYqGsdr96KnM4wzA/+wbYm/3oSdesQw5U+G5rq3Sm3dsoTZ29efbog32A9xdYsD1NB2JDZ//KfkoJMoS5RA9wMxcI5WNUdWAHFjwZ2Z0G/MHs/l+dClRFURb382ZuHWaX54nZKFIja7YQUsd2cfJPJss= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=EjZvaDfd; arc=none smtp.client-ip=91.218.175.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="EjZvaDfd" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1775613108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Iml5tzxAij83Kcy1JFiKcagKYg83tbdrbaf1N6ZaV+E=; b=EjZvaDfdWhvhMHNkEgJrN6DKVIyz4OgrB4R2CZdmSy5qp67zQf/fXra9qaoxxuPOt6YCmz h4LUbBgyioUPdGCoQl6Dh0f/JoGDj1IlI1UiE6PR3Ivs4j/YhHwQnquk6LW9nF7aNmiNiB cxZS81Hg49lZUHvz2Jatb27DFL5uiTo= From: Qingfang Deng To: Michal Ostrowski , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Kees Cook , Dawid Osuchowski , Qingfang Deng , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: linux-ppp@vger.kernel.org Subject: [PATCH net-next 1/2] pppox: remove sk_pppox() helper Date: Wed, 8 Apr 2026 09:51:33 +0800 Message-ID: <20260408015138.280687-1-qingfang.deng@linux.dev> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT The sk member can be directly accessed from struct pppox_sock without relying on type casting. Remove the sk_pppox() helper and update all call sites to use po->sk directly. Signed-off-by: Qingfang Deng --- drivers/net/ppp/pppoe.c | 10 +++++----- drivers/net/ppp/pptp.c | 6 +++--- include/linux/if_pppox.h | 5 ----- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index 1ac61c273b28..d546a7af0d54 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c @@ -231,7 +231,7 @@ static inline struct pppox_sock *get_item(struct pppoe_net *pn, __be16 sid, struct pppox_sock *po; po = __get_item(pn, sid, addr, ifindex); - if (po && !refcount_inc_not_zero(&sk_pppox(po)->sk_refcnt)) + if (po && !refcount_inc_not_zero(&po->sk.sk_refcnt)) po = NULL; return po; @@ -273,7 +273,7 @@ static void pppoe_flush_dev(struct net_device *dev) if (!po) break; - sk = sk_pppox(po); + sk = &po->sk; /* We always grab the socket lock, followed by the * hash_lock, in that order. Since we should hold the @@ -413,7 +413,7 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev, if (!po) goto drop; - return __sk_receive_skb(sk_pppox(po), skb, 0, 1, false); + return __sk_receive_skb(&po->sk, skb, 0, 1, false); drop: kfree_skb(skb); @@ -425,7 +425,7 @@ static void pppoe_unbind_sock_work(struct work_struct *work) { struct pppox_sock *po = container_of(work, struct pppox_sock, proto.pppoe.padt_work); - struct sock *sk = sk_pppox(po); + struct sock *sk = &po->sk; lock_sock(sk); if (po->pppoe_dev) { @@ -469,7 +469,7 @@ static int pppoe_disc_rcv(struct sk_buff *skb, struct net_device *dev, po = get_item(pn, ph->sid, eth_hdr(skb)->h_source, dev->ifindex); if (po) if (!schedule_work(&po->proto.pppoe.padt_work)) - sock_put(sk_pppox(po)); + sock_put(&po->sk); abort: kfree_skb(skb); diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c index b18acd810561..cc8c102122d8 100644 --- a/drivers/net/ppp/pptp.c +++ b/drivers/net/ppp/pptp.c @@ -62,7 +62,7 @@ static struct pppox_sock *lookup_chan(u16 call_id, __be32 s_addr) if (opt->dst_addr.sin_addr.s_addr != s_addr) sock = NULL; else - sock_hold(sk_pppox(sock)); + sock_hold(&sock->sk); } rcu_read_unlock(); @@ -164,7 +164,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb) struct iphdr *iph; int max_headroom; - if (sk_pppox(po)->sk_state & PPPOX_DEAD) + if (po->sk.sk_state & PPPOX_DEAD) goto tx_drop; rt = pptp_route_output(po, &fl4); @@ -375,7 +375,7 @@ static int pptp_rcv(struct sk_buff *skb) if (po) { skb_dst_drop(skb); nf_reset_ct(skb); - return sk_receive_skb(sk_pppox(po), skb, 0); + return sk_receive_skb(&po->sk, skb, 0); } drop: kfree_skb(skb); diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h index 8bbf676c2a85..636772693f9a 100644 --- a/include/linux/if_pppox.h +++ b/include/linux/if_pppox.h @@ -57,11 +57,6 @@ static inline struct pppox_sock *pppox_sk(struct sock *sk) return (struct pppox_sock *)sk; } -static inline struct sock *sk_pppox(struct pppox_sock *po) -{ - return (struct sock *)po; -} - struct module; struct pppox_proto { -- 2.43.0