hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
....@@ -974,8 +974,7 @@
974974 return -ENODEV;
975975 DBGINFO(("%s ioctl() cmd=%08X\n", info->device_name, cmd));
976976
977
- if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
978
- (cmd != TIOCMIWAIT)) {
977
+ if (cmd != TIOCMIWAIT) {
979978 if (tty_io_error(tty))
980979 return -EIO;
981980 }
....@@ -1341,14 +1340,14 @@
13411340 #if SYNCLINK_GENERIC_HDLC
13421341
13431342 /**
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
13461347 *
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.
13501349 *
1351
- * returns 0 if success, otherwise error code
1350
+ * Return: 0 if success, otherwise error code
13521351 */
13531352 static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
13541353 unsigned short parity)
....@@ -1392,10 +1391,9 @@
13921391 }
13931392
13941393 /**
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
13991397 */
14001398 static netdev_tx_t hdlcdev_xmit(struct sk_buff *skb,
14011399 struct net_device *dev)
....@@ -1429,12 +1427,12 @@
14291427 }
14301428
14311429 /**
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
14341432 *
1435
- * dev pointer to network device structure
1433
+ * Claim resources and initialize hardware.
14361434 *
1437
- * returns 0 if success, otherwise error code
1435
+ * Return: 0 if success, otherwise error code
14381436 */
14391437 static int hdlcdev_open(struct net_device *dev)
14401438 {
....@@ -1490,12 +1488,12 @@
14901488 }
14911489
14921490 /**
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
14951493 *
1496
- * dev pointer to network device structure
1494
+ * Shutdown hardware and release resources.
14971495 *
1498
- * returns 0 if success, otherwise error code
1496
+ * Return: 0 if success, otherwise error code
14991497 */
15001498 static int hdlcdev_close(struct net_device *dev)
15011499 {
....@@ -1520,13 +1518,12 @@
15201518 }
15211519
15221520 /**
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
15241525 *
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
15301527 */
15311528 static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
15321529 {
....@@ -1624,11 +1621,10 @@
16241621 }
16251622
16261623 /**
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
16301626 */
1631
-static void hdlcdev_tx_timeout(struct net_device *dev)
1627
+static void hdlcdev_tx_timeout(struct net_device *dev, unsigned int txqueue)
16321628 {
16331629 struct slgt_info *info = dev_to_port(dev);
16341630 unsigned long flags;
....@@ -1646,10 +1642,10 @@
16461642 }
16471643
16481644 /**
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
16511647 *
1652
- * info pointer to device instance information
1648
+ * Reenable network layer transmit if stopped.
16531649 */
16541650 static void hdlcdev_tx_done(struct slgt_info *info)
16551651 {
....@@ -1658,12 +1654,12 @@
16581654 }
16591655
16601656 /**
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
16631661 *
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.
16671663 */
16681664 static void hdlcdev_rx(struct slgt_info *info, char *buf, int size)
16691665 {
....@@ -1697,12 +1693,12 @@
16971693 };
16981694
16991695 /**
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
17021698 *
1703
- * info pointer to device instance information
1699
+ * Do generic HDLC initialization.
17041700 *
1705
- * returns 0 if success, otherwise error code
1701
+ * Return: 0 if success, otherwise error code
17061702 */
17071703 static int hdlcdev_init(struct slgt_info *info)
17081704 {
....@@ -1746,13 +1742,15 @@
17461742 }
17471743
17481744 /**
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
17511747 *
1752
- * info pointer to device instance information
1748
+ * Do generic HDLC cleanup.
17531749 */
17541750 static void hdlcdev_exit(struct slgt_info *info)
17551751 {
1752
+ if (!info->netdev)
1753
+ return;
17561754 unregister_hdlc_device(info->netdev);
17571755 free_netdev(info->netdev);
17581756 info->netdev = NULL;
....@@ -2044,7 +2042,7 @@
20442042 if (desc_complete(info->rbufs[i])) {
20452043 /* all buffers full */
20462044 rx_stop(info);
2047
- info->rx_restart = 1;
2045
+ info->rx_restart = true;
20482046 continue;
20492047 }
20502048 info->rbufs[i].buf[count++] = (unsigned char)reg;
....@@ -3287,8 +3285,8 @@
32873285 unsigned int pbufs;
32883286
32893287 /* 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);
32923290 if (info->bufs == NULL)
32933291 return -ENOMEM;
32943292
....@@ -3330,7 +3328,8 @@
33303328 static void free_desc(struct slgt_info *info)
33313329 {
33323330 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);
33343333 info->bufs = NULL;
33353334 info->rbufs = NULL;
33363335 info->tbufs = NULL;
....@@ -3341,7 +3340,9 @@
33413340 {
33423341 int i;
33433342 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)
33453346 return -ENOMEM;
33463347 bufs[i].pbuf = cpu_to_le32((unsigned int)bufs[i].buf_dma_addr);
33473348 }
....@@ -3354,7 +3355,8 @@
33543355 for (i=0; i < count; i++) {
33553356 if (bufs[i].buf == NULL)
33563357 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);
33583360 bufs[i].buf = NULL;
33593361 }
33603362 }
....@@ -3396,7 +3398,7 @@
33963398 else
33973399 info->reg_addr_requested = true;
33983400
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);
34003402 if (!info->reg_addr) {
34013403 DBGERR(("%s can't map device registers, addr=%08X\n",
34023404 info->device_name, info->phys_reg_addr));