diff options
Diffstat (limited to 'drivers/block/mtip32xx')
-rw-r--r-- | drivers/block/mtip32xx/mtip32xx.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 847b8ff7b8c2..1cf2b0443571 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -85,6 +85,7 @@ int mtip_major; | |||
85 | static DEFINE_SPINLOCK(rssd_index_lock); | 85 | static DEFINE_SPINLOCK(rssd_index_lock); |
86 | static DEFINE_IDA(rssd_index_ida); | 86 | static DEFINE_IDA(rssd_index_ida); |
87 | 87 | ||
88 | #ifdef CONFIG_COMPAT | ||
88 | struct mtip_compat_ide_task_request_s { | 89 | struct mtip_compat_ide_task_request_s { |
89 | __u8 io_ports[8]; | 90 | __u8 io_ports[8]; |
90 | __u8 hob_ports[8]; | 91 | __u8 hob_ports[8]; |
@@ -95,6 +96,7 @@ struct mtip_compat_ide_task_request_s { | |||
95 | compat_ulong_t out_size; | 96 | compat_ulong_t out_size; |
96 | compat_ulong_t in_size; | 97 | compat_ulong_t in_size; |
97 | }; | 98 | }; |
99 | #endif | ||
98 | 100 | ||
99 | static int mtip_exec_internal_command(struct mtip_port *port, | 101 | static int mtip_exec_internal_command(struct mtip_port *port, |
100 | void *fis, | 102 | void *fis, |
@@ -1628,9 +1630,9 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
1628 | ide_task_request_t *req_task; | 1630 | ide_task_request_t *req_task; |
1629 | u8 *outbuf = NULL; | 1631 | u8 *outbuf = NULL; |
1630 | u8 *inbuf = NULL; | 1632 | u8 *inbuf = NULL; |
1631 | dma_addr_t outbuf_dma = (dma_addr_t)NULL; | 1633 | dma_addr_t outbuf_dma = 0; |
1632 | dma_addr_t inbuf_dma = (dma_addr_t)NULL; | 1634 | dma_addr_t inbuf_dma = 0; |
1633 | dma_addr_t dma_buffer = (dma_addr_t)NULL; | 1635 | dma_addr_t dma_buffer = 0; |
1634 | int err = 0; | 1636 | int err = 0; |
1635 | int tasksize = sizeof(struct ide_task_request_s); | 1637 | int tasksize = sizeof(struct ide_task_request_s); |
1636 | unsigned int taskin = 0; | 1638 | unsigned int taskin = 0; |
@@ -1642,14 +1644,18 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
1642 | unsigned int transfer_size; | 1644 | unsigned int transfer_size; |
1643 | unsigned long task_file_data; | 1645 | unsigned long task_file_data; |
1644 | int intotal, outtotal; | 1646 | int intotal, outtotal; |
1647 | #ifdef CONFIG_COMPAT | ||
1645 | struct mtip_compat_ide_task_request_s *compat_req_task = NULL; | 1648 | struct mtip_compat_ide_task_request_s *compat_req_task = NULL; |
1646 | int compat_tasksize = sizeof(struct mtip_compat_ide_task_request_s); | 1649 | int compat_tasksize = sizeof(struct mtip_compat_ide_task_request_s); |
1650 | #endif | ||
1651 | |||
1647 | 1652 | ||
1648 | req_task = kzalloc(tasksize, GFP_KERNEL); | 1653 | req_task = kzalloc(tasksize, GFP_KERNEL); |
1649 | if (req_task == NULL) | 1654 | if (req_task == NULL) |
1650 | return -ENOMEM; | 1655 | return -ENOMEM; |
1651 | 1656 | ||
1652 | if (compat == 1) { | 1657 | if (compat == 1) { |
1658 | #ifdef CONFIG_COMPAT | ||
1653 | compat_req_task = | 1659 | compat_req_task = |
1654 | (struct mtip_compat_ide_task_request_s __user *) arg; | 1660 | (struct mtip_compat_ide_task_request_s __user *) arg; |
1655 | 1661 | ||
@@ -1672,6 +1678,10 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
1672 | 1678 | ||
1673 | outtotal = compat_tasksize; | 1679 | outtotal = compat_tasksize; |
1674 | intotal = compat_tasksize + req_task->out_size; | 1680 | intotal = compat_tasksize + req_task->out_size; |
1681 | #else | ||
1682 | outtotal = 0; | ||
1683 | intotal = 0; | ||
1684 | #endif | ||
1675 | } else { | 1685 | } else { |
1676 | if (copy_from_user(req_task, buf, tasksize)) { | 1686 | if (copy_from_user(req_task, buf, tasksize)) { |
1677 | kfree(req_task); | 1687 | kfree(req_task); |
@@ -1705,7 +1715,7 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
1705 | outbuf, | 1715 | outbuf, |
1706 | taskout, | 1716 | taskout, |
1707 | DMA_TO_DEVICE); | 1717 | DMA_TO_DEVICE); |
1708 | if (outbuf_dma == (dma_addr_t)NULL) { | 1718 | if (outbuf_dma == 0) { |
1709 | err = -ENOMEM; | 1719 | err = -ENOMEM; |
1710 | goto abort; | 1720 | goto abort; |
1711 | } | 1721 | } |
@@ -1726,7 +1736,7 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
1726 | inbuf_dma = pci_map_single(dd->pdev, | 1736 | inbuf_dma = pci_map_single(dd->pdev, |
1727 | inbuf, | 1737 | inbuf, |
1728 | taskin, DMA_FROM_DEVICE); | 1738 | taskin, DMA_FROM_DEVICE); |
1729 | if (inbuf_dma == (dma_addr_t)NULL) { | 1739 | if (inbuf_dma == 0) { |
1730 | err = -ENOMEM; | 1740 | err = -ENOMEM; |
1731 | goto abort; | 1741 | goto abort; |
1732 | } | 1742 | } |
@@ -1868,8 +1878,8 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
1868 | if (outbuf_dma) | 1878 | if (outbuf_dma) |
1869 | pci_unmap_single(dd->pdev, outbuf_dma, | 1879 | pci_unmap_single(dd->pdev, outbuf_dma, |
1870 | taskout, DMA_TO_DEVICE); | 1880 | taskout, DMA_TO_DEVICE); |
1871 | inbuf_dma = (dma_addr_t) NULL; | 1881 | inbuf_dma = 0; |
1872 | outbuf_dma = (dma_addr_t) NULL; | 1882 | outbuf_dma = 0; |
1873 | 1883 | ||
1874 | /* return the ATA registers to the caller.*/ | 1884 | /* return the ATA registers to the caller.*/ |
1875 | req_task->io_ports[1] = reply->features; | 1885 | req_task->io_ports[1] = reply->features; |
@@ -1913,6 +1923,7 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
1913 | up_write(&dd->internal_sem); | 1923 | up_write(&dd->internal_sem); |
1914 | 1924 | ||
1915 | if (compat == 1) { | 1925 | if (compat == 1) { |
1926 | #ifdef CONFIG_COMPAT | ||
1916 | if (copy_to_user(buf, req_task, | 1927 | if (copy_to_user(buf, req_task, |
1917 | compat_tasksize - | 1928 | compat_tasksize - |
1918 | (2 * sizeof(compat_long_t)))) { | 1929 | (2 * sizeof(compat_long_t)))) { |
@@ -1928,6 +1939,7 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
1928 | err = -EFAULT; | 1939 | err = -EFAULT; |
1929 | goto abort; | 1940 | goto abort; |
1930 | } | 1941 | } |
1942 | #endif | ||
1931 | } else { | 1943 | } else { |
1932 | if (copy_to_user(buf, req_task, tasksize)) { | 1944 | if (copy_to_user(buf, req_task, tasksize)) { |
1933 | err = -EFAULT; | 1945 | err = -EFAULT; |
@@ -2873,6 +2885,7 @@ static int mtip_block_ioctl(struct block_device *dev, | |||
2873 | } | 2885 | } |
2874 | } | 2886 | } |
2875 | 2887 | ||
2888 | #ifdef CONFIG_COMPAT | ||
2876 | /* | 2889 | /* |
2877 | * Block layer compat IOCTL handler. | 2890 | * Block layer compat IOCTL handler. |
2878 | * | 2891 | * |
@@ -2906,6 +2919,7 @@ static int mtip_block_compat_ioctl(struct block_device *dev, | |||
2906 | return mtip_hw_ioctl(dd, cmd, arg, 1); | 2919 | return mtip_hw_ioctl(dd, cmd, arg, 1); |
2907 | } | 2920 | } |
2908 | } | 2921 | } |
2922 | #endif | ||
2909 | 2923 | ||
2910 | /* | 2924 | /* |
2911 | * Obtain the geometry of the device. | 2925 | * Obtain the geometry of the device. |
@@ -2959,7 +2973,9 @@ static int mtip_block_getgeo(struct block_device *dev, | |||
2959 | */ | 2973 | */ |
2960 | static const struct block_device_operations mtip_block_ops = { | 2974 | static const struct block_device_operations mtip_block_ops = { |
2961 | .ioctl = mtip_block_ioctl, | 2975 | .ioctl = mtip_block_ioctl, |
2976 | #ifdef CONFIG_COMPAT | ||
2962 | .compat_ioctl = mtip_block_compat_ioctl, | 2977 | .compat_ioctl = mtip_block_compat_ioctl, |
2978 | #endif | ||
2963 | .getgeo = mtip_block_getgeo, | 2979 | .getgeo = mtip_block_getgeo, |
2964 | .owner = THIS_MODULE | 2980 | .owner = THIS_MODULE |
2965 | }; | 2981 | }; |