From patchwork Mon Dec 12 07:50:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You-Sheng Yang X-Patchwork-Id: 1714832 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NVv1v0f40z240J for ; Mon, 12 Dec 2022 18:50:42 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1p4da6-0002yi-Ug; Mon, 12 Dec 2022 07:50:34 +0000 Received: from mail-pj1-f54.google.com ([209.85.216.54]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1p4da3-0002xj-Ez for kernel-team@lists.ubuntu.com; Mon, 12 Dec 2022 07:50:31 +0000 Received: by mail-pj1-f54.google.com with SMTP id q17-20020a17090aa01100b002194cba32e9so14802228pjp.1 for ; Sun, 11 Dec 2022 23:50:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vcbaQlCGENv0tokk63hMwjXFmGgKUpyyYuyu7J9MPpc=; b=YqYethwub6OLaij00cA1WAcEEZQeTADJRxeVsUUvcP/AWROLd/JbAIwhvKpmzhbiYO TMarzZPwl4NO0Yjn5Lb2AorOFiDkfwgIbsSJR+t67pzIyB+YdbIhMBN9JAtuWD4em5el itRfkXSVHAZNj7Ti9Q7FvwjfNhzP1N4r4KRqpwKLXCrJcCBWfD0LsO4yzrZMraFCOs7E GudzDujCSJuSglnLPBdWeZY+0LtHnVHWstXXpnANvcPY3KJ0PoggZMNoG5/cZSGRUnhJ tQ0lHixs+B7KcvLsYfJbCt3ACwyGA8tOKeN9eFbf7Z6SrUCJ/RNfSrvEMmXdvQj1IU80 8jTw== X-Gm-Message-State: ANoB5pmyFbndC2e0HwyLuOb//It4O9QW0oYpKuJlrQrGQAKWvn+lkxXz nOEKky0oBC19wp85cxHrvmvAwEBPvmg= X-Google-Smtp-Source: AA0mqf6bPci5pftDqJxV0bqm+AYYsyhDVt1ydkJqIbxLrsE0BFf4TVtHviOGA1ZZoDXVgwD7yPLEeg== X-Received: by 2002:a17:902:cf0f:b0:189:d193:91ff with SMTP id i15-20020a170902cf0f00b00189d19391ffmr17530673plg.61.1670831429369; Sun, 11 Dec 2022 23:50:29 -0800 (PST) Received: from yewun.. (61-227-116-5.dynamic-ip.hinet.net. [61.227.116.5]) by smtp.gmail.com with ESMTPSA id g10-20020a170902934a00b00189758e2b99sm5613615plp.92.2022.12.11.23.50.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Dec 2022 23:50:28 -0800 (PST) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/2][SRU][OEM-6.1] net: wwan: t7xx: use union to group port type specific data Date: Mon, 12 Dec 2022 15:50:23 +0800 Message-Id: <20221212075024.3165087-2-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221212075024.3165087-1-vicamo.yang@canonical.com> References: <20221212075024.3165087-1-vicamo.yang@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.216.54; envelope-from=vicamo@gmail.com; helo=mail-pj1-f54.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: M Chetan Kumar BugLink: https://bugs.launchpad.net/bugs/1997686 Use union inside t7xx_port to group port type specific data members. Signed-off-by: M Chetan Kumar Reviewed-by: Sergey Ryazanov Signed-off-by: David S. Miller (cherry picked from commit fece7a8c65d1476b901b969a07b2979e1b459e66 linux-next) Signed-off-by: You-Sheng Yang (vicamo) --- drivers/net/wwan/t7xx/t7xx_port.h | 6 +++++- drivers/net/wwan/t7xx/t7xx_port_wwan.c | 16 ++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/net/wwan/t7xx/t7xx_port.h b/drivers/net/wwan/t7xx/t7xx_port.h index 4a29bd04cbe2..5177055521b8 100644 --- a/drivers/net/wwan/t7xx/t7xx_port.h +++ b/drivers/net/wwan/t7xx/t7xx_port.h @@ -105,7 +105,6 @@ struct t7xx_port_conf { struct t7xx_port { /* Members not initialized in definition */ const struct t7xx_port_conf *port_conf; - struct wwan_port *wwan_port; struct t7xx_pci_dev *t7xx_dev; struct device *dev; u16 seq_nums[2]; /* TX/RX sequence numbers */ @@ -128,6 +127,11 @@ struct t7xx_port { int rx_length_th; bool chan_enable; struct task_struct *thread; + union { + struct { + struct wwan_port *wwan_port; + } wwan; + }; }; struct sk_buff *t7xx_port_alloc_skb(int payload); diff --git a/drivers/net/wwan/t7xx/t7xx_port_wwan.c b/drivers/net/wwan/t7xx/t7xx_port_wwan.c index 33931bfd78fd..24bd21942403 100644 --- a/drivers/net/wwan/t7xx/t7xx_port_wwan.c +++ b/drivers/net/wwan/t7xx/t7xx_port_wwan.c @@ -109,12 +109,12 @@ static int t7xx_port_wwan_init(struct t7xx_port *port) static void t7xx_port_wwan_uninit(struct t7xx_port *port) { - if (!port->wwan_port) + if (!port->wwan.wwan_port) return; port->rx_length_th = 0; - wwan_remove_port(port->wwan_port); - port->wwan_port = NULL; + wwan_remove_port(port->wwan.wwan_port); + port->wwan.wwan_port = NULL; } static int t7xx_port_wwan_recv_skb(struct t7xx_port *port, struct sk_buff *skb) @@ -129,7 +129,7 @@ static int t7xx_port_wwan_recv_skb(struct t7xx_port *port, struct sk_buff *skb) return 0; } - wwan_port_rx(port->wwan_port, skb); + wwan_port_rx(port->wwan.wwan_port, skb); return 0; } @@ -158,10 +158,10 @@ static void t7xx_port_wwan_md_state_notify(struct t7xx_port *port, unsigned int if (state != MD_STATE_READY) return; - if (!port->wwan_port) { - port->wwan_port = wwan_create_port(port->dev, port_conf->port_type, - &wwan_ops, port); - if (IS_ERR(port->wwan_port)) + if (!port->wwan.wwan_port) { + port->wwan.wwan_port = wwan_create_port(port->dev, port_conf->port_type, + &wwan_ops, port); + if (IS_ERR(port->wwan.wwan_port)) dev_err(port->dev, "Unable to create WWWAN port %s", port_conf->name); } }