mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
net: wwan: t7xx: use union to group port type specific data
Use union inside t7xx_port to group port type specific data members. Signed-off-by: M Chetan Kumar <m.chetan.kumar@linux.intel.com> Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
b0e01253a7
commit
fece7a8c65
@@ -99,7 +99,6 @@ struct t7xx_port_conf {
|
|||||||
struct t7xx_port {
|
struct t7xx_port {
|
||||||
/* Members not initialized in definition */
|
/* Members not initialized in definition */
|
||||||
const struct t7xx_port_conf *port_conf;
|
const struct t7xx_port_conf *port_conf;
|
||||||
struct wwan_port *wwan_port;
|
|
||||||
struct t7xx_pci_dev *t7xx_dev;
|
struct t7xx_pci_dev *t7xx_dev;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
u16 seq_nums[2]; /* TX/RX sequence numbers */
|
u16 seq_nums[2]; /* TX/RX sequence numbers */
|
||||||
@@ -122,6 +121,11 @@ struct t7xx_port {
|
|||||||
int rx_length_th;
|
int rx_length_th;
|
||||||
bool chan_enable;
|
bool chan_enable;
|
||||||
struct task_struct *thread;
|
struct task_struct *thread;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
struct wwan_port *wwan_port;
|
||||||
|
} wwan;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sk_buff *t7xx_port_alloc_skb(int payload);
|
struct sk_buff *t7xx_port_alloc_skb(int payload);
|
||||||
|
|||||||
@@ -109,12 +109,12 @@ static int t7xx_port_wwan_init(struct t7xx_port *port)
|
|||||||
|
|
||||||
static void t7xx_port_wwan_uninit(struct t7xx_port *port)
|
static void t7xx_port_wwan_uninit(struct t7xx_port *port)
|
||||||
{
|
{
|
||||||
if (!port->wwan_port)
|
if (!port->wwan.wwan_port)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
port->rx_length_th = 0;
|
port->rx_length_th = 0;
|
||||||
wwan_remove_port(port->wwan_port);
|
wwan_remove_port(port->wwan.wwan_port);
|
||||||
port->wwan_port = NULL;
|
port->wwan.wwan_port = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int t7xx_port_wwan_recv_skb(struct t7xx_port *port, struct sk_buff *skb)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wwan_port_rx(port->wwan_port, skb);
|
wwan_port_rx(port->wwan.wwan_port, skb);
|
||||||
return 0;
|
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)
|
if (state != MD_STATE_READY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!port->wwan_port) {
|
if (!port->wwan.wwan_port) {
|
||||||
port->wwan_port = wwan_create_port(port->dev, port_conf->port_type,
|
port->wwan.wwan_port = wwan_create_port(port->dev, port_conf->port_type,
|
||||||
&wwan_ops, port);
|
&wwan_ops, port);
|
||||||
if (IS_ERR(port->wwan_port))
|
if (IS_ERR(port->wwan.wwan_port))
|
||||||
dev_err(port->dev, "Unable to create WWWAN port %s", port_conf->name);
|
dev_err(port->dev, "Unable to create WWWAN port %s", port_conf->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user