* GNU General Public License for more details.
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/version.h>
#include <linux/etherdevice.h>
#include <linux/ip.h>
ret = netif_rx_ni(skb);
if (ret == NET_RX_DROP) {
- printk(KERN_ERR "glte: rx - dropped\n");
nic->stats.rx_dropped++;
} else {
nic->stats.rx_packets++;
nic_type = gdm_lte_tx_nic_type(dev, skb);
if (nic_type == 0) {
- printk(KERN_ERR "glte: tx - invalid nic_type\n");
+ netdev_err(dev, "tx - invalid nic_type\n");
return -1;
}
ret = copy_to_user(data->buf, gdm_dev_endian(nic), sizeof(struct dev_endian_t));
if (ret)
- printk(KERN_INFO "glte: state - failed to copy\n");
+ netdev_info(dev, "state - failed to copy\n");
}
static int gdm_lte_ioctl_get_data(struct wm_req_t *req, struct net_device *dev)
get_dev_endian(&req->data, dev);
break;
default:
- printk(KERN_ERR "glte: ioctl - unknown type %d\n", id);
+ netdev_err(dev, "ioctl - unknown type %d\n", id);
break;
}
return 0;
return 0;
}
- printk(KERN_ERR "glte: event init failed\n");
+ pr_err("event init failed\n");
return -1;
}
eth.h_proto = htons(ETH_P_IPV6);
vlan_eth.h_vlan_encapsulated_proto = htons(ETH_P_IPV6);
} else {
- printk(KERN_ERR "glte: Unknown IP version %d\n", ip_version);
+ netdev_err(dev, "Unknown IP version %d\n", ip_version);
return;
}
}
nic_type = gdm_dev32_to_cpu(phy_dev->get_endian(phy_dev->priv_dev), sdu->nic_type);
if (cmd_evt != LTE_RX_SDU) {
- printk(KERN_ERR "glte: rx sdu wrong hci %04x\n", cmd_evt);
+ pr_err("rx sdu wrong hci %04x\n", cmd_evt);
return;
}
if (hci_len < 12) {
- printk(KERN_ERR "glte: rx sdu invalid len %d\n", hci_len);
+ pr_err("rx sdu invalid len %d\n", hci_len);
return;
}
dev = phy_dev->dev[index];
gdm_lte_netif_rx(dev, (char *)sdu->data, (int)(hci_len-12), nic_type);
} else {
- printk(KERN_ERR "glte: rx sdu invalid nic_type : %x\n", nic_type);
+ pr_err("rx sdu invalid nic_type :%x\n", nic_type);
}
data += ((hci_len+3) & 0xfffc) + HCI_HEADER_SIZE;
nic->pdn_table.dft_eps_id = gdm_dev32_to_cpu(gdm_dev_endian(nic), pdn_table->dft_eps_id);
nic->pdn_table.nic_type = gdm_dev32_to_cpu(gdm_dev_endian(nic), pdn_table->nic_type);
- printk(KERN_INFO "glte: pdn %s activated, nic_type=0x%x\n",
- dev->name, nic->pdn_table.nic_type);
+ netdev_info(dev, "pdn activated, nic_type=0x%x\n",
+ nic->pdn_table.nic_type);
} else {
memset(&nic->pdn_table, 0x00, sizeof(struct pdn_table));
- printk(KERN_INFO "glte: pdn %s deactivated\n",
- dev->name);
+ netdev_info(dev, "pdn deactivated\n");
}
}
gdm_lte_multi_sdu_pkt(phy_dev, buf, len);
break;
case LTE_LINK_ON_OFF_INDICATION:
- {
- struct hci_connect_ind *connect_ind = (struct hci_connect_ind *)buf;
- printk(KERN_INFO "glte: link %s\n",
- connect_ind->connect ? "on" : "off");
- }
+ netdev_info(dev, "link %s\n",
+ ((struct hci_connect_ind *)buf)->connect
+ ? "on" : "off");
break;
case LTE_PDN_TABLE_IND:
pdn_table = (struct hci_pdn_table_ind *)buf;
{
/* if zero address or multicast bit set, restore the default value */
if (is_zero_ether_addr(mac_address) || (mac_address[0] & 0x01)) {
- printk(KERN_ERR "glte: MAC invalid, restoring default\n");
+ pr_err("MAC invalid, restoring default\n");
memcpy(mac_address, gdm_lte_macaddr, 6);
}
}
/* Allocate netdev */
net = alloc_netdev(sizeof(struct nic), pdn_dev_name, ether_setup);
if (net == NULL) {
- printk(KERN_ERR "glte: alloc_netdev failed\n");
+ pr_err("alloc_netdev failed\n");
ret = -ENOMEM;
goto err;
}
* GNU General Public License for more details.
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h>
packet_type = __le16_to_cpu(mux_header->packet_type);
if (start_flag != START_FLAG) {
- printk(KERN_ERR "glte: invalid START_FLAG %x\n",
- start_flag);
+ pr_err("invalid START_FLAG %x\n", start_flag);
break;
}
if (len - packet_size_sum <
MUX_HEADER_SIZE + payload_size + dummy_cnt) {
- printk(KERN_ERR "glte: invalid payload : %d %d %04x\n",
- payload_size, len,
- packet_type
- );
+ pr_err("invalid payload : %d %d %04x\n",
+ payload_size, len, packet_type);
break;
}
index = packet_type_to_index(packet_type);
if (index < 0) {
- printk(KERN_ERR "glte: invalid index %d\n", index);
+ pr_err("invalid index %d\n", index);
break;
}
ret = up_to_host(r);
if (ret == TO_HOST_BUFFER_REQUEST_FAIL)
- printk(KERN_ERR "glte: failed to send mux data to host\n");
+ pr_err("failed to send mux data to host\n");
else
put_rx_struct(rx, r);
}
if (urb->status) {
if (mux_dev->usb_state == PM_NORMAL)
- printk(KERN_ERR "glte: gdm_mux_rcv_complete urb status error %d\n", urb->status);
+ pr_err("%s: urb status error %d\n",
+ __func__, urb->status);
put_rx_struct(rx, r);
} else {
r->len = r->urb->actual_length;
int ret;
if (!usbdev) {
- printk(KERN_ERR "glte: device is disconnected\n");
+ pr_err("device is disconnected\n");
return -ENODEV;
}
r = get_rx_struct(rx);
if (!r) {
- printk(KERN_ERR "glte: get_rx_struct fail\n");
+ pr_err("get_rx_struct fail\n");
return -ENOMEM;
}
put_rx_struct(rx, r);
- printk(KERN_ERR "glte: usb_submit_urb ret=%d\n", ret);
+ pr_err("usb_submit_urb ret=%d\n", ret);
}
usb_mark_last_busy(usbdev);
struct mux_tx *t = urb->context;
if (urb->status == -ECONNRESET) {
- printk(KERN_INFO "glte: CONNRESET\n");
+ pr_info("CONNRESET\n");
free_mux_tx(t);
return;
}
t = alloc_mux_tx(total_len);
if (!t) {
- printk(KERN_ERR "glte: alloc_mux_tx fail\n");
+ pr_err("alloc_mux_tx fail\n");
spin_unlock_irqrestore(&mux_dev->write_lock, flags);
return -ENOMEM;
}
spin_unlock_irqrestore(&mux_dev->write_lock, flags);
if (ret)
- printk(KERN_ERR "glte: usb_submit_urb Error : %d\n", ret);
+ pr_err("usb_submit_urb Error: %d\n", ret);
usb_mark_last_busy(usbdev);
);
if (ret < 0)
- printk(KERN_ERR "glte: usb_control_msg error : %d\n", ret);
+ pr_err("usb_control_msg error: %d\n", ret);
return ret < 0 ? ret : 0;
}
idVendor = __le16_to_cpu(usbdev->descriptor.idVendor);
idProduct = __le16_to_cpu(usbdev->descriptor.idProduct);
- printk(KERN_INFO "glte: mux vid = 0x%04x pid = 0x%04x\n",
- idVendor, idProduct);
+ pr_info("mux vid = 0x%04x pid = 0x%04x\n", idVendor, idProduct);
if (bInterfaceNumber != 2) {
ret = -ENODEV;
rx = &mux_dev->rx;
if (mux_dev->usb_state != PM_NORMAL) {
- printk(KERN_ERR "glte: usb suspend - invalid state\n");
+ pr_err("usb suspend - invalid state\n");
return -1;
}
mux_dev = tty_dev->priv_dev;
if (mux_dev->usb_state != PM_SUSPEND) {
- printk(KERN_ERR "glte: usb resume - invalid state\n");
+ pr_err("usb resume - invalid state\n");
return -1;
}
mux_rx_wq = create_workqueue("mux_rx_wq");
if (mux_rx_wq == NULL) {
- printk(KERN_ERR "glte: work queue create fail");
+ pr_err("work queue create fail\n");
return -1;
}
* GNU General Public License for more details.
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/errno.h>
}
if (!tty_str) {
- printk(KERN_INFO "glte: no tty device\n");
+ pr_info("no tty device\n");
mutex_unlock(&open_mutex);
return -ENODEV;
}
int i;
if (!tty_str) {
- printk(KERN_INFO "glte: tty device already close\n");
+ pr_info("tty device already closed\n");
return;
}
for (i = 0; i < TTY_MAX_COUNT; i++) {
tty_driver = alloc_tty_driver(GDM_TTY_MINOR);
if (!tty_driver) {
- printk(KERN_ERR "glte: alloc_tty_driver fail\n");
+ pr_err("alloc_tty_driver fail\n");
return -ENOMEM;
}
* GNU General Public License for more details.
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h>
memcpy(mac_address, tlv->data, tlv->len);
if (register_lte_device(phy_dev, &udev->intf->dev, mac_address) < 0)
- printk(KERN_ERR "glte: register lte device failed\n");
+ pr_err("register lte device failed\n");
udev->request_mac_addr = 0;
KERNEL_THREAD);
if (ret == -EAGAIN)
- printk(KERN_ERR "glte: failed to send received data\n");
+ pr_err("failed to send received data\n");
}
break;
}
spin_unlock_irqrestore(&rx->to_host_lock, flags);
} else {
if (urb->status && udev->usb_state == PM_NORMAL)
- printk(KERN_ERR "glte: gdm_usb_rcv_complete urb status error %d\n", urb->status);
+ pr_err("%s: urb status error %d\n",
+ __func__, urb->status);
put_rx_struct(rx, r);
}
unsigned long flags;
if (!udev->usbdev) {
- printk(KERN_ERR "glte: invalid device\n");
+ pr_err("invalid device\n");
return -ENODEV;
}
r = get_rx_struct(rx, &no_spc);
if (!r) {
- printk(KERN_ERR "glte: Out of Memory\n");
+ pr_err("Out of Memory\n");
return -ENOMEM;
}
list_del(&r->rx_submit_list);
spin_unlock_irqrestore(&rx->submit_lock, flags);
- printk(KERN_ERR "glte: usb_submit_urb fail (%p)\n", r);
+ pr_err("usb_submit_urb failed (%p)\n", r);
put_rx_struct(rx, r);
}
unsigned long flags;
if (urb->status == -ECONNRESET) {
- printk(KERN_INFO "glte: CONNRESET\n");
+ pr_info("CONNRESET\n");
return;
}
ret = usb_submit_urb(t->urb, GFP_ATOMIC);
if (ret)
- printk(KERN_ERR "glte: usb_submit_urb fail %d\n", ret);
+ pr_err("usb_submit_urb failed: %d\n", ret);
usb_mark_last_busy(usbdev);
len = packet_aggregation(udev, t->buf);
if (send_tx_packet(usbdev, t, len)) {
- printk(KERN_ERR "glte: send_tx_packet fail\n");
+ pr_err("send_tx_packet failed\n");
t->callback = NULL;
gdm_usb_send_complete(t->urb);
}
u16 send_len;
if (!udev->usbdev) {
- printk(KERN_ERR "glte: sdu send - invalid device\n");
+ pr_err("sdu send - invalid device\n");
return TX_NO_DEV;
}
spin_unlock_irqrestore(&tx->lock, flags);
if (t_sdu == NULL) {
- printk(KERN_ERR "glte: sdu send - free list empty\n");
+ pr_err("sdu send - free list empty\n");
return TX_NO_SPC;
}
unsigned long flags;
if (!udev->usbdev) {
- printk(KERN_ERR "glte: hci send - invalid device\n");
+ pr_err("hci send - invalid device\n");
return -ENODEV;
}
t = alloc_tx_struct(len);
if (t == NULL) {
- printk(KERN_ERR "glte: hci_send - out of memory\n");
+ pr_err("hci_send - out of memory\n");
return -ENOMEM;
}
idVendor = __le16_to_cpu(usbdev->descriptor.idVendor);
idProduct = __le16_to_cpu(usbdev->descriptor.idProduct);
- printk(KERN_INFO "glte: net vid = 0x%04x pid = 0x%04x\n", idVendor, idProduct);
+ pr_info("net vid = 0x%04x pid = 0x%04x\n", idVendor, idProduct);
if (bInterfaceNumber > NETWORK_INTERFACE) {
- printk(KERN_INFO "glte: not a network device");
+ pr_info("not a network device\n");
return -1;
}
udev->usbdev = usbdev;
ret = init_usb(udev);
if (ret < 0) {
- printk(KERN_ERR "glte: init_usb func fail\n");
+ pr_err("init_usb func failed\n");
goto out;
}
udev->intf = intf;
ret = request_mac_address(udev);
if (ret < 0) {
- printk(KERN_ERR "glte: request Mac address failed\n");
+ pr_err("request Mac address failed\n");
goto out;
}
udev = phy_dev->priv_dev;
rx = &udev->rx;
if (udev->usb_state != PM_NORMAL) {
- printk(KERN_ERR "glte: usb suspend - invalid state");
+ pr_err("usb suspend - invalid state\n");
return -1;
}
rx = &udev->rx;
if (udev->usb_state != PM_SUSPEND) {
- printk(KERN_ERR "glte: usb resume - invalid state");
+ pr_err("usb resume - invalid state\n");
return -1;
}
udev->usb_state = PM_NORMAL;
static int __init gdm_usb_lte_init(void)
{
if (gdm_lte_event_init() < 0) {
- printk(KERN_ERR "glte: error creating event\n");
+ pr_err("error creating event\n");
return -1;
}
* GNU General Public License for more details.
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/version.h>
#include <linux/export.h>
#include <linux/etherdevice.h>
int ifindex;
if (!rcv_cb) {
- printk(KERN_ERR "glte: nl cb - unregistered\n");
+ pr_err("nl cb - unregistered\n");
return;
}
if (skb->len < NLMSG_SPACE(0)) {
- printk(KERN_ERR "glte: nl cb - invalid skb length\n");
+ pr_err("nl cb - invalid skb length\n");
return;
}
nlh = (struct nlmsghdr *)skb->data;
if (skb->len < nlh->nlmsg_len || nlh->nlmsg_len > ND_MAX_MSG_LEN) {
- printk(KERN_ERR "glte: nl cb - invalid length (%d,%d)\n",
+ pr_err("nl cb - invalid length (%d,%d)\n",
skb->len, nlh->nlmsg_len);
return;
}
rcv_cb(dev, nlh->nlmsg_type, msg, mlen);
dev_put(dev);
} else {
- printk(KERN_ERR "glte: nl cb - dev (%d) not found\n", ifindex);
+ pr_err("nl cb - dev (%d) not found\n", ifindex);
}
}
return len;
if (ret != -ESRCH)
- printk(KERN_ERR "glte: nl broadcast g=%d, t=%d, l=%d, r=%d\n",
+ pr_err("nl broadcast g=%d, t=%d, l=%d, r=%d\n",
group, type, len, ret);
else if (netlink_has_listeners(sock, group+1))
return -EAGAIN;