#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/rpmsg.h>
#include <linux/wwan.h>
struct rpmsg_wwan_dev { … };
static int rpmsg_wwan_ctrl_callback(struct rpmsg_device *rpdev,
void *buf, int len, void *priv, u32 src)
{ … }
static int rpmsg_wwan_ctrl_start(struct wwan_port *port)
{ … }
static void rpmsg_wwan_ctrl_stop(struct wwan_port *port)
{ … }
static int rpmsg_wwan_ctrl_tx(struct wwan_port *port, struct sk_buff *skb)
{ … }
static int rpmsg_wwan_ctrl_tx_blocking(struct wwan_port *port, struct sk_buff *skb)
{ … }
static __poll_t rpmsg_wwan_ctrl_tx_poll(struct wwan_port *port,
struct file *filp, poll_table *wait)
{ … }
static const struct wwan_port_ops rpmsg_wwan_pops = …;
static struct device *rpmsg_wwan_find_parent(struct device *dev)
{ … }
static int rpmsg_wwan_ctrl_probe(struct rpmsg_device *rpdev)
{
struct rpmsg_wwan_dev *rpwwan;
struct wwan_port *port;
struct device *parent;
parent = rpmsg_wwan_find_parent(&rpdev->dev);
if (!parent)
return -ENODEV;
rpwwan = devm_kzalloc(&rpdev->dev, sizeof(*rpwwan), GFP_KERNEL);
if (!rpwwan)
return -ENOMEM;
rpwwan->rpdev = rpdev;
dev_set_drvdata(&rpdev->dev, rpwwan);
port = wwan_create_port(parent, rpdev->id.driver_data,
&rpmsg_wwan_pops, NULL, rpwwan);
if (IS_ERR(port))
return PTR_ERR(port);
rpwwan->wwan_port = port;
return 0;
};
static void rpmsg_wwan_ctrl_remove(struct rpmsg_device *rpdev)
{ … }
static const struct rpmsg_device_id rpmsg_wwan_ctrl_id_table[] = …;
MODULE_DEVICE_TABLE(rpmsg, rpmsg_wwan_ctrl_id_table);
static struct rpmsg_driver rpmsg_wwan_ctrl_driver = …;
module_rpmsg_driver(…) …;
MODULE_LICENSE(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;