.. | .. |
---|
757 | 757 | |
---|
758 | 758 | struct atto_hba_get_adapter_info *gai = |
---|
759 | 759 | &hi->data.get_adap_info; |
---|
760 | | - int pcie_cap_reg; |
---|
761 | 760 | |
---|
762 | 761 | if (hi->flags & HBAF_TUNNEL) { |
---|
763 | 762 | hi->status = ATTO_STS_UNSUPPORTED; |
---|
.. | .. |
---|
784 | 783 | gai->pci.dev_num = PCI_SLOT(a->pcid->devfn); |
---|
785 | 784 | gai->pci.func_num = PCI_FUNC(a->pcid->devfn); |
---|
786 | 785 | |
---|
787 | | - pcie_cap_reg = pci_find_capability(a->pcid, PCI_CAP_ID_EXP); |
---|
788 | | - if (pcie_cap_reg) { |
---|
| 786 | + if (pci_is_pcie(a->pcid)) { |
---|
789 | 787 | u16 stat; |
---|
790 | 788 | u32 caps; |
---|
791 | 789 | |
---|
792 | | - pci_read_config_word(a->pcid, |
---|
793 | | - pcie_cap_reg + PCI_EXP_LNKSTA, |
---|
794 | | - &stat); |
---|
795 | | - pci_read_config_dword(a->pcid, |
---|
796 | | - pcie_cap_reg + PCI_EXP_LNKCAP, |
---|
797 | | - &caps); |
---|
| 790 | + pcie_capability_read_word(a->pcid, PCI_EXP_LNKSTA, |
---|
| 791 | + &stat); |
---|
| 792 | + pcie_capability_read_dword(a->pcid, PCI_EXP_LNKCAP, |
---|
| 793 | + &caps); |
---|
798 | 794 | |
---|
799 | 795 | gai->pci.link_speed_curr = |
---|
800 | 796 | (u8)(stat & PCI_EXP_LNKSTA_CLS); |
---|
.. | .. |
---|
1274 | 1270 | |
---|
1275 | 1271 | |
---|
1276 | 1272 | /* This function only cares about ATTO-specific ioctls (atto_express_ioctl) */ |
---|
1277 | | -int esas2r_ioctl_handler(void *hostdata, int cmd, void __user *arg) |
---|
| 1273 | +int esas2r_ioctl_handler(void *hostdata, unsigned int cmd, void __user *arg) |
---|
1278 | 1274 | { |
---|
1279 | 1275 | struct atto_express_ioctl *ioctl = NULL; |
---|
1280 | 1276 | struct esas2r_adapter *a; |
---|
.. | .. |
---|
1292 | 1288 | ioctl = memdup_user(arg, sizeof(struct atto_express_ioctl)); |
---|
1293 | 1289 | if (IS_ERR(ioctl)) { |
---|
1294 | 1290 | esas2r_log(ESAS2R_LOG_WARN, |
---|
1295 | | - "ioctl_handler access_ok failed for cmd %d, " |
---|
1296 | | - "address %p", cmd, |
---|
1297 | | - arg); |
---|
| 1291 | + "ioctl_handler access_ok failed for cmd %u, address %p", |
---|
| 1292 | + cmd, arg); |
---|
1298 | 1293 | return PTR_ERR(ioctl); |
---|
1299 | 1294 | } |
---|
1300 | 1295 | |
---|
.. | .. |
---|
1493 | 1488 | ioctl_done: |
---|
1494 | 1489 | |
---|
1495 | 1490 | if (err < 0) { |
---|
1496 | | - esas2r_log(ESAS2R_LOG_WARN, "err %d on ioctl cmd %d", err, |
---|
| 1491 | + esas2r_log(ESAS2R_LOG_WARN, "err %d on ioctl cmd %u", err, |
---|
1497 | 1492 | cmd); |
---|
1498 | 1493 | |
---|
1499 | 1494 | switch (err) { |
---|
.. | .. |
---|
1515 | 1510 | } |
---|
1516 | 1511 | |
---|
1517 | 1512 | /* Always copy the buffer back, if only to pick up the status */ |
---|
1518 | | - err = __copy_to_user(arg, ioctl, sizeof(struct atto_express_ioctl)); |
---|
| 1513 | + err = copy_to_user(arg, ioctl, sizeof(struct atto_express_ioctl)); |
---|
1519 | 1514 | if (err != 0) { |
---|
1520 | 1515 | esas2r_log(ESAS2R_LOG_WARN, |
---|
1521 | | - "ioctl_handler copy_to_user didn't copy " |
---|
1522 | | - "everything (err %d, cmd %d)", err, |
---|
1523 | | - cmd); |
---|
| 1516 | + "ioctl_handler copy_to_user didn't copy everything (err %d, cmd %u)", |
---|
| 1517 | + err, cmd); |
---|
1524 | 1518 | kfree(ioctl); |
---|
1525 | 1519 | |
---|
1526 | 1520 | return -EFAULT; |
---|
.. | .. |
---|
1531 | 1525 | return 0; |
---|
1532 | 1526 | } |
---|
1533 | 1527 | |
---|
1534 | | -int esas2r_ioctl(struct scsi_device *sd, int cmd, void __user *arg) |
---|
| 1528 | +int esas2r_ioctl(struct scsi_device *sd, unsigned int cmd, void __user *arg) |
---|
1535 | 1529 | { |
---|
1536 | 1530 | return esas2r_ioctl_handler(sd->host->hostdata, cmd, arg); |
---|
1537 | 1531 | } |
---|
.. | .. |
---|
1554 | 1548 | |
---|
1555 | 1549 | a->firmware.orig_len = length; |
---|
1556 | 1550 | |
---|
1557 | | - a->firmware.data = (u8 *)dma_alloc_coherent(&a->pcid->dev, |
---|
1558 | | - (size_t)length, |
---|
1559 | | - (dma_addr_t *)&a->firmware. |
---|
1560 | | - phys, |
---|
1561 | | - GFP_KERNEL); |
---|
| 1551 | + a->firmware.data = dma_alloc_coherent(&a->pcid->dev, |
---|
| 1552 | + (size_t)length, |
---|
| 1553 | + (dma_addr_t *)&a->firmware.phys, |
---|
| 1554 | + GFP_KERNEL); |
---|
1562 | 1555 | |
---|
1563 | 1556 | if (!a->firmware.data) { |
---|
1564 | 1557 | esas2r_debug("buffer alloc failed!"); |
---|
.. | .. |
---|
1901 | 1894 | |
---|
1902 | 1895 | if (!a->vda_buffer) { |
---|
1903 | 1896 | dma_addr_t dma_addr; |
---|
1904 | | - a->vda_buffer = (u8 *)dma_alloc_coherent(&a->pcid->dev, |
---|
1905 | | - (size_t) |
---|
1906 | | - VDA_MAX_BUFFER_SIZE, |
---|
1907 | | - &dma_addr, |
---|
1908 | | - GFP_KERNEL); |
---|
| 1897 | + a->vda_buffer = dma_alloc_coherent(&a->pcid->dev, |
---|
| 1898 | + (size_t) |
---|
| 1899 | + VDA_MAX_BUFFER_SIZE, |
---|
| 1900 | + &dma_addr, |
---|
| 1901 | + GFP_KERNEL); |
---|
1909 | 1902 | |
---|
1910 | 1903 | a->ppvda_buffer = dma_addr; |
---|
1911 | 1904 | } |
---|
.. | .. |
---|
2070 | 2063 | re_allocate_buffer: |
---|
2071 | 2064 | a->fs_api_buffer_size = length; |
---|
2072 | 2065 | |
---|
2073 | | - a->fs_api_buffer = (u8 *)dma_alloc_coherent( |
---|
2074 | | - &a->pcid->dev, |
---|
2075 | | - (size_t)a->fs_api_buffer_size, |
---|
2076 | | - (dma_addr_t *)&a->ppfs_api_buffer, |
---|
2077 | | - GFP_KERNEL); |
---|
| 2066 | + a->fs_api_buffer = dma_alloc_coherent(&a->pcid->dev, |
---|
| 2067 | + (size_t)a->fs_api_buffer_size, |
---|
| 2068 | + (dma_addr_t *)&a->ppfs_api_buffer, |
---|
| 2069 | + GFP_KERNEL); |
---|
2078 | 2070 | } |
---|
2079 | 2071 | } |
---|
2080 | 2072 | |
---|