.. | .. |
---|
974 | 974 | return -ENODEV; |
---|
975 | 975 | DBGINFO(("%s ioctl() cmd=%08X\n", info->device_name, cmd)); |
---|
976 | 976 | |
---|
977 | | - if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && |
---|
978 | | - (cmd != TIOCMIWAIT)) { |
---|
| 977 | + if (cmd != TIOCMIWAIT) { |
---|
979 | 978 | if (tty_io_error(tty)) |
---|
980 | 979 | return -EIO; |
---|
981 | 980 | } |
---|
.. | .. |
---|
1341 | 1340 | #if SYNCLINK_GENERIC_HDLC |
---|
1342 | 1341 | |
---|
1343 | 1342 | /** |
---|
1344 | | - * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) |
---|
1345 | | - * set encoding and frame check sequence (FCS) options |
---|
| 1343 | + * hdlcdev_attach - called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) |
---|
| 1344 | + * @dev: pointer to network device structure |
---|
| 1345 | + * @encoding: serial encoding setting |
---|
| 1346 | + * @parity: FCS setting |
---|
1346 | 1347 | * |
---|
1347 | | - * dev pointer to network device structure |
---|
1348 | | - * encoding serial encoding setting |
---|
1349 | | - * parity FCS setting |
---|
| 1348 | + * Set encoding and frame check sequence (FCS) options. |
---|
1350 | 1349 | * |
---|
1351 | | - * returns 0 if success, otherwise error code |
---|
| 1350 | + * Return: 0 if success, otherwise error code |
---|
1352 | 1351 | */ |
---|
1353 | 1352 | static int hdlcdev_attach(struct net_device *dev, unsigned short encoding, |
---|
1354 | 1353 | unsigned short parity) |
---|
.. | .. |
---|
1392 | 1391 | } |
---|
1393 | 1392 | |
---|
1394 | 1393 | /** |
---|
1395 | | - * called by generic HDLC layer to send frame |
---|
1396 | | - * |
---|
1397 | | - * skb socket buffer containing HDLC frame |
---|
1398 | | - * dev pointer to network device structure |
---|
| 1394 | + * hdlcdev_xmit - called by generic HDLC layer to send a frame |
---|
| 1395 | + * @skb: socket buffer containing HDLC frame |
---|
| 1396 | + * @dev: pointer to network device structure |
---|
1399 | 1397 | */ |
---|
1400 | 1398 | static netdev_tx_t hdlcdev_xmit(struct sk_buff *skb, |
---|
1401 | 1399 | struct net_device *dev) |
---|
.. | .. |
---|
1429 | 1427 | } |
---|
1430 | 1428 | |
---|
1431 | 1429 | /** |
---|
1432 | | - * called by network layer when interface enabled |
---|
1433 | | - * claim resources and initialize hardware |
---|
| 1430 | + * hdlcdev_open - called by network layer when interface enabled |
---|
| 1431 | + * @dev: pointer to network device structure |
---|
1434 | 1432 | * |
---|
1435 | | - * dev pointer to network device structure |
---|
| 1433 | + * Claim resources and initialize hardware. |
---|
1436 | 1434 | * |
---|
1437 | | - * returns 0 if success, otherwise error code |
---|
| 1435 | + * Return: 0 if success, otherwise error code |
---|
1438 | 1436 | */ |
---|
1439 | 1437 | static int hdlcdev_open(struct net_device *dev) |
---|
1440 | 1438 | { |
---|
.. | .. |
---|
1490 | 1488 | } |
---|
1491 | 1489 | |
---|
1492 | 1490 | /** |
---|
1493 | | - * called by network layer when interface is disabled |
---|
1494 | | - * shutdown hardware and release resources |
---|
| 1491 | + * hdlcdev_close - called by network layer when interface is disabled |
---|
| 1492 | + * @dev: pointer to network device structure |
---|
1495 | 1493 | * |
---|
1496 | | - * dev pointer to network device structure |
---|
| 1494 | + * Shutdown hardware and release resources. |
---|
1497 | 1495 | * |
---|
1498 | | - * returns 0 if success, otherwise error code |
---|
| 1496 | + * Return: 0 if success, otherwise error code |
---|
1499 | 1497 | */ |
---|
1500 | 1498 | static int hdlcdev_close(struct net_device *dev) |
---|
1501 | 1499 | { |
---|
.. | .. |
---|
1520 | 1518 | } |
---|
1521 | 1519 | |
---|
1522 | 1520 | /** |
---|
1523 | | - * called by network layer to process IOCTL call to network device |
---|
| 1521 | + * hdlcdev_ioctl - called by network layer to process IOCTL call to network device |
---|
| 1522 | + * @dev: pointer to network device structure |
---|
| 1523 | + * @ifr: pointer to network interface request structure |
---|
| 1524 | + * @cmd: IOCTL command code |
---|
1524 | 1525 | * |
---|
1525 | | - * dev pointer to network device structure |
---|
1526 | | - * ifr pointer to network interface request structure |
---|
1527 | | - * cmd IOCTL command code |
---|
1528 | | - * |
---|
1529 | | - * returns 0 if success, otherwise error code |
---|
| 1526 | + * Return: 0 if success, otherwise error code |
---|
1530 | 1527 | */ |
---|
1531 | 1528 | static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
---|
1532 | 1529 | { |
---|
.. | .. |
---|
1624 | 1621 | } |
---|
1625 | 1622 | |
---|
1626 | 1623 | /** |
---|
1627 | | - * called by network layer when transmit timeout is detected |
---|
1628 | | - * |
---|
1629 | | - * dev pointer to network device structure |
---|
| 1624 | + * hdlcdev_tx_timeout - called by network layer when transmit timeout is detected |
---|
| 1625 | + * @dev: pointer to network device structure |
---|
1630 | 1626 | */ |
---|
1631 | | -static void hdlcdev_tx_timeout(struct net_device *dev) |
---|
| 1627 | +static void hdlcdev_tx_timeout(struct net_device *dev, unsigned int txqueue) |
---|
1632 | 1628 | { |
---|
1633 | 1629 | struct slgt_info *info = dev_to_port(dev); |
---|
1634 | 1630 | unsigned long flags; |
---|
.. | .. |
---|
1646 | 1642 | } |
---|
1647 | 1643 | |
---|
1648 | 1644 | /** |
---|
1649 | | - * called by device driver when transmit completes |
---|
1650 | | - * reenable network layer transmit if stopped |
---|
| 1645 | + * hdlcdev_tx_done - called by device driver when transmit completes |
---|
| 1646 | + * @info: pointer to device instance information |
---|
1651 | 1647 | * |
---|
1652 | | - * info pointer to device instance information |
---|
| 1648 | + * Reenable network layer transmit if stopped. |
---|
1653 | 1649 | */ |
---|
1654 | 1650 | static void hdlcdev_tx_done(struct slgt_info *info) |
---|
1655 | 1651 | { |
---|
.. | .. |
---|
1658 | 1654 | } |
---|
1659 | 1655 | |
---|
1660 | 1656 | /** |
---|
1661 | | - * called by device driver when frame received |
---|
1662 | | - * pass frame to network layer |
---|
| 1657 | + * hdlcdev_rx - called by device driver when frame received |
---|
| 1658 | + * @info: pointer to device instance information |
---|
| 1659 | + * @buf: pointer to buffer contianing frame data |
---|
| 1660 | + * @size: count of data bytes in buf |
---|
1663 | 1661 | * |
---|
1664 | | - * info pointer to device instance information |
---|
1665 | | - * buf pointer to buffer contianing frame data |
---|
1666 | | - * size count of data bytes in buf |
---|
| 1662 | + * Pass frame to network layer. |
---|
1667 | 1663 | */ |
---|
1668 | 1664 | static void hdlcdev_rx(struct slgt_info *info, char *buf, int size) |
---|
1669 | 1665 | { |
---|
.. | .. |
---|
1697 | 1693 | }; |
---|
1698 | 1694 | |
---|
1699 | 1695 | /** |
---|
1700 | | - * called by device driver when adding device instance |
---|
1701 | | - * do generic HDLC initialization |
---|
| 1696 | + * hdlcdev_init - called by device driver when adding device instance |
---|
| 1697 | + * @info: pointer to device instance information |
---|
1702 | 1698 | * |
---|
1703 | | - * info pointer to device instance information |
---|
| 1699 | + * Do generic HDLC initialization. |
---|
1704 | 1700 | * |
---|
1705 | | - * returns 0 if success, otherwise error code |
---|
| 1701 | + * Return: 0 if success, otherwise error code |
---|
1706 | 1702 | */ |
---|
1707 | 1703 | static int hdlcdev_init(struct slgt_info *info) |
---|
1708 | 1704 | { |
---|
.. | .. |
---|
1746 | 1742 | } |
---|
1747 | 1743 | |
---|
1748 | 1744 | /** |
---|
1749 | | - * called by device driver when removing device instance |
---|
1750 | | - * do generic HDLC cleanup |
---|
| 1745 | + * hdlcdev_exit - called by device driver when removing device instance |
---|
| 1746 | + * @info: pointer to device instance information |
---|
1751 | 1747 | * |
---|
1752 | | - * info pointer to device instance information |
---|
| 1748 | + * Do generic HDLC cleanup. |
---|
1753 | 1749 | */ |
---|
1754 | 1750 | static void hdlcdev_exit(struct slgt_info *info) |
---|
1755 | 1751 | { |
---|
| 1752 | + if (!info->netdev) |
---|
| 1753 | + return; |
---|
1756 | 1754 | unregister_hdlc_device(info->netdev); |
---|
1757 | 1755 | free_netdev(info->netdev); |
---|
1758 | 1756 | info->netdev = NULL; |
---|
.. | .. |
---|
2044 | 2042 | if (desc_complete(info->rbufs[i])) { |
---|
2045 | 2043 | /* all buffers full */ |
---|
2046 | 2044 | rx_stop(info); |
---|
2047 | | - info->rx_restart = 1; |
---|
| 2045 | + info->rx_restart = true; |
---|
2048 | 2046 | continue; |
---|
2049 | 2047 | } |
---|
2050 | 2048 | info->rbufs[i].buf[count++] = (unsigned char)reg; |
---|
.. | .. |
---|
3287 | 3285 | unsigned int pbufs; |
---|
3288 | 3286 | |
---|
3289 | 3287 | /* allocate memory to hold descriptor lists */ |
---|
3290 | | - info->bufs = pci_zalloc_consistent(info->pdev, DESC_LIST_SIZE, |
---|
3291 | | - &info->bufs_dma_addr); |
---|
| 3288 | + info->bufs = dma_alloc_coherent(&info->pdev->dev, DESC_LIST_SIZE, |
---|
| 3289 | + &info->bufs_dma_addr, GFP_KERNEL); |
---|
3292 | 3290 | if (info->bufs == NULL) |
---|
3293 | 3291 | return -ENOMEM; |
---|
3294 | 3292 | |
---|
.. | .. |
---|
3330 | 3328 | static void free_desc(struct slgt_info *info) |
---|
3331 | 3329 | { |
---|
3332 | 3330 | if (info->bufs != NULL) { |
---|
3333 | | - pci_free_consistent(info->pdev, DESC_LIST_SIZE, info->bufs, info->bufs_dma_addr); |
---|
| 3331 | + dma_free_coherent(&info->pdev->dev, DESC_LIST_SIZE, |
---|
| 3332 | + info->bufs, info->bufs_dma_addr); |
---|
3334 | 3333 | info->bufs = NULL; |
---|
3335 | 3334 | info->rbufs = NULL; |
---|
3336 | 3335 | info->tbufs = NULL; |
---|
.. | .. |
---|
3341 | 3340 | { |
---|
3342 | 3341 | int i; |
---|
3343 | 3342 | for (i=0; i < count; i++) { |
---|
3344 | | - if ((bufs[i].buf = pci_alloc_consistent(info->pdev, DMABUFSIZE, &bufs[i].buf_dma_addr)) == NULL) |
---|
| 3343 | + bufs[i].buf = dma_alloc_coherent(&info->pdev->dev, DMABUFSIZE, |
---|
| 3344 | + &bufs[i].buf_dma_addr, GFP_KERNEL); |
---|
| 3345 | + if (!bufs[i].buf) |
---|
3345 | 3346 | return -ENOMEM; |
---|
3346 | 3347 | bufs[i].pbuf = cpu_to_le32((unsigned int)bufs[i].buf_dma_addr); |
---|
3347 | 3348 | } |
---|
.. | .. |
---|
3354 | 3355 | for (i=0; i < count; i++) { |
---|
3355 | 3356 | if (bufs[i].buf == NULL) |
---|
3356 | 3357 | continue; |
---|
3357 | | - pci_free_consistent(info->pdev, DMABUFSIZE, bufs[i].buf, bufs[i].buf_dma_addr); |
---|
| 3358 | + dma_free_coherent(&info->pdev->dev, DMABUFSIZE, bufs[i].buf, |
---|
| 3359 | + bufs[i].buf_dma_addr); |
---|
3358 | 3360 | bufs[i].buf = NULL; |
---|
3359 | 3361 | } |
---|
3360 | 3362 | } |
---|
.. | .. |
---|
3396 | 3398 | else |
---|
3397 | 3399 | info->reg_addr_requested = true; |
---|
3398 | 3400 | |
---|
3399 | | - info->reg_addr = ioremap_nocache(info->phys_reg_addr, SLGT_REG_SIZE); |
---|
| 3401 | + info->reg_addr = ioremap(info->phys_reg_addr, SLGT_REG_SIZE); |
---|
3400 | 3402 | if (!info->reg_addr) { |
---|
3401 | 3403 | DBGERR(("%s can't map device registers, addr=%08X\n", |
---|
3402 | 3404 | info->device_name, info->phys_reg_addr)); |
---|