diff options
Diffstat (limited to 'drivers/scsi/megaraid/megaraid_mm.c')
-rw-r--r-- | drivers/scsi/megaraid/megaraid_mm.c | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c index d85b9a8f1b8d..c1ff20c4747d 100644 --- a/drivers/scsi/megaraid/megaraid_mm.c +++ b/drivers/scsi/megaraid/megaraid_mm.c | |||
@@ -78,10 +78,10 @@ static struct file_operations lsi_fops = { | |||
78 | 78 | ||
79 | /** | 79 | /** |
80 | * mraid_mm_open - open routine for char node interface | 80 | * mraid_mm_open - open routine for char node interface |
81 | * @inod : unused | 81 | * @inode : unused |
82 | * @filep : unused | 82 | * @filep : unused |
83 | * | 83 | * |
84 | * allow ioctl operations by apps only if they superuser privilege | 84 | * Allow ioctl operations by apps only if they have superuser privilege. |
85 | */ | 85 | */ |
86 | static int | 86 | static int |
87 | mraid_mm_open(struct inode *inode, struct file *filep) | 87 | mraid_mm_open(struct inode *inode, struct file *filep) |
@@ -214,7 +214,9 @@ mraid_mm_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, | |||
214 | /** | 214 | /** |
215 | * mraid_mm_get_adapter - Returns corresponding adapters for the mimd packet | 215 | * mraid_mm_get_adapter - Returns corresponding adapters for the mimd packet |
216 | * @umimd : User space mimd_t ioctl packet | 216 | * @umimd : User space mimd_t ioctl packet |
217 | * @adapter : pointer to the adapter (OUT) | 217 | * @rval : returned success/error status |
218 | * | ||
219 | * The function return value is a pointer to the located @adapter. | ||
218 | */ | 220 | */ |
219 | static mraid_mmadp_t * | 221 | static mraid_mmadp_t * |
220 | mraid_mm_get_adapter(mimd_t __user *umimd, int *rval) | 222 | mraid_mm_get_adapter(mimd_t __user *umimd, int *rval) |
@@ -252,11 +254,11 @@ mraid_mm_get_adapter(mimd_t __user *umimd, int *rval) | |||
252 | return adapter; | 254 | return adapter; |
253 | } | 255 | } |
254 | 256 | ||
255 | /* | 257 | /** |
256 | * handle_drvrcmd - This routine checks if the opcode is a driver | 258 | * handle_drvrcmd - Checks if the opcode is a driver cmd and if it is, handles it. |
257 | * cmd and if it is, handles it. | ||
258 | * @arg : packet sent by the user app | 259 | * @arg : packet sent by the user app |
259 | * @old_ioctl : mimd if 1; uioc otherwise | 260 | * @old_ioctl : mimd if 1; uioc otherwise |
261 | * @rval : pointer for command's returned value (not function status) | ||
260 | */ | 262 | */ |
261 | static int | 263 | static int |
262 | handle_drvrcmd(void __user *arg, uint8_t old_ioctl, int *rval) | 264 | handle_drvrcmd(void __user *arg, uint8_t old_ioctl, int *rval) |
@@ -322,8 +324,8 @@ old_packet: | |||
322 | 324 | ||
323 | /** | 325 | /** |
324 | * mimd_to_kioc - Converter from old to new ioctl format | 326 | * mimd_to_kioc - Converter from old to new ioctl format |
325 | * | ||
326 | * @umimd : user space old MIMD IOCTL | 327 | * @umimd : user space old MIMD IOCTL |
328 | * @adp : adapter softstate | ||
327 | * @kioc : kernel space new format IOCTL | 329 | * @kioc : kernel space new format IOCTL |
328 | * | 330 | * |
329 | * Routine to convert MIMD interface IOCTL to new interface IOCTL packet. The | 331 | * Routine to convert MIMD interface IOCTL to new interface IOCTL packet. The |
@@ -474,7 +476,6 @@ mimd_to_kioc(mimd_t __user *umimd, mraid_mmadp_t *adp, uioc_t *kioc) | |||
474 | 476 | ||
475 | /** | 477 | /** |
476 | * mraid_mm_attch_buf - Attach a free dma buffer for required size | 478 | * mraid_mm_attch_buf - Attach a free dma buffer for required size |
477 | * | ||
478 | * @adp : Adapter softstate | 479 | * @adp : Adapter softstate |
479 | * @kioc : kioc that the buffer needs to be attached to | 480 | * @kioc : kioc that the buffer needs to be attached to |
480 | * @xferlen : required length for buffer | 481 | * @xferlen : required length for buffer |
@@ -607,7 +608,6 @@ mraid_mm_alloc_kioc(mraid_mmadp_t *adp) | |||
607 | 608 | ||
608 | /** | 609 | /** |
609 | * mraid_mm_dealloc_kioc - Return kioc to free pool | 610 | * mraid_mm_dealloc_kioc - Return kioc to free pool |
610 | * | ||
611 | * @adp : Adapter softstate | 611 | * @adp : Adapter softstate |
612 | * @kioc : uioc_t node to be returned to free pool | 612 | * @kioc : uioc_t node to be returned to free pool |
613 | */ | 613 | */ |
@@ -652,7 +652,6 @@ mraid_mm_dealloc_kioc(mraid_mmadp_t *adp, uioc_t *kioc) | |||
652 | 652 | ||
653 | /** | 653 | /** |
654 | * lld_ioctl - Routine to issue ioctl to low level drvr | 654 | * lld_ioctl - Routine to issue ioctl to low level drvr |
655 | * | ||
656 | * @adp : The adapter handle | 655 | * @adp : The adapter handle |
657 | * @kioc : The ioctl packet with kernel addresses | 656 | * @kioc : The ioctl packet with kernel addresses |
658 | */ | 657 | */ |
@@ -705,7 +704,6 @@ lld_ioctl(mraid_mmadp_t *adp, uioc_t *kioc) | |||
705 | 704 | ||
706 | /** | 705 | /** |
707 | * ioctl_done - callback from the low level driver | 706 | * ioctl_done - callback from the low level driver |
708 | * | ||
709 | * @kioc : completed ioctl packet | 707 | * @kioc : completed ioctl packet |
710 | */ | 708 | */ |
711 | static void | 709 | static void |
@@ -756,9 +754,8 @@ ioctl_done(uioc_t *kioc) | |||
756 | } | 754 | } |
757 | 755 | ||
758 | 756 | ||
759 | /* | 757 | /** |
760 | * lld_timedout : callback from the expired timer | 758 | * lld_timedout - callback from the expired timer |
761 | * | ||
762 | * @ptr : ioctl packet that timed out | 759 | * @ptr : ioctl packet that timed out |
763 | */ | 760 | */ |
764 | static void | 761 | static void |
@@ -776,8 +773,7 @@ lld_timedout(unsigned long ptr) | |||
776 | 773 | ||
777 | 774 | ||
778 | /** | 775 | /** |
779 | * kioc_to_mimd : Converter from new back to old format | 776 | * kioc_to_mimd - Converter from new back to old format |
780 | * | ||
781 | * @kioc : Kernel space IOCTL packet (successfully issued) | 777 | * @kioc : Kernel space IOCTL packet (successfully issued) |
782 | * @mimd : User space MIMD packet | 778 | * @mimd : User space MIMD packet |
783 | */ | 779 | */ |
@@ -855,7 +851,6 @@ kioc_to_mimd(uioc_t *kioc, mimd_t __user *mimd) | |||
855 | 851 | ||
856 | /** | 852 | /** |
857 | * hinfo_to_cinfo - Convert new format hba info into old format | 853 | * hinfo_to_cinfo - Convert new format hba info into old format |
858 | * | ||
859 | * @hinfo : New format, more comprehensive adapter info | 854 | * @hinfo : New format, more comprehensive adapter info |
860 | * @cinfo : Old format adapter info to support mimd_t apps | 855 | * @cinfo : Old format adapter info to support mimd_t apps |
861 | */ | 856 | */ |
@@ -878,10 +873,9 @@ hinfo_to_cinfo(mraid_hba_info_t *hinfo, mcontroller_t *cinfo) | |||
878 | } | 873 | } |
879 | 874 | ||
880 | 875 | ||
881 | /* | 876 | /** |
882 | * mraid_mm_register_adp - Registration routine for low level drvrs | 877 | * mraid_mm_register_adp - Registration routine for low level drivers |
883 | * | 878 | * @lld_adp : Adapter objejct |
884 | * @adp : Adapter objejct | ||
885 | */ | 879 | */ |
886 | int | 880 | int |
887 | mraid_mm_register_adp(mraid_mmadp_t *lld_adp) | 881 | mraid_mm_register_adp(mraid_mmadp_t *lld_adp) |
@@ -1007,15 +1001,14 @@ memalloc_error: | |||
1007 | 1001 | ||
1008 | /** | 1002 | /** |
1009 | * mraid_mm_adapter_app_handle - return the application handle for this adapter | 1003 | * mraid_mm_adapter_app_handle - return the application handle for this adapter |
1004 | * @unique_id : adapter unique identifier | ||
1010 | * | 1005 | * |
1011 | * For the given driver data, locate the adadpter in our global list and | 1006 | * For the given driver data, locate the adapter in our global list and |
1012 | * return the corresponding handle, which is also used by applications to | 1007 | * return the corresponding handle, which is also used by applications to |
1013 | * uniquely identify an adapter. | 1008 | * uniquely identify an adapter. |
1014 | * | 1009 | * |
1015 | * @param unique_id : adapter unique identifier | 1010 | * Return adapter handle if found in the list. |
1016 | * | 1011 | * Return 0 if adapter could not be located, should never happen though. |
1017 | * @return adapter handle if found in the list | ||
1018 | * @return 0 if adapter could not be located, should never happen though | ||
1019 | */ | 1012 | */ |
1020 | uint32_t | 1013 | uint32_t |
1021 | mraid_mm_adapter_app_handle(uint32_t unique_id) | 1014 | mraid_mm_adapter_app_handle(uint32_t unique_id) |
@@ -1040,7 +1033,6 @@ mraid_mm_adapter_app_handle(uint32_t unique_id) | |||
1040 | 1033 | ||
1041 | /** | 1034 | /** |
1042 | * mraid_mm_setup_dma_pools - Set up dma buffer pools per adapter | 1035 | * mraid_mm_setup_dma_pools - Set up dma buffer pools per adapter |
1043 | * | ||
1044 | * @adp : Adapter softstate | 1036 | * @adp : Adapter softstate |
1045 | * | 1037 | * |
1046 | * We maintain a pool of dma buffers per each adapter. Each pool has one | 1038 | * We maintain a pool of dma buffers per each adapter. Each pool has one |
@@ -1093,11 +1085,11 @@ dma_pool_setup_error: | |||
1093 | } | 1085 | } |
1094 | 1086 | ||
1095 | 1087 | ||
1096 | /* | 1088 | /** |
1097 | * mraid_mm_unregister_adp - Unregister routine for low level drivers | 1089 | * mraid_mm_unregister_adp - Unregister routine for low level drivers |
1098 | * Assume no outstanding ioctls to llds. | ||
1099 | * | ||
1100 | * @unique_id : UID of the adpater | 1090 | * @unique_id : UID of the adpater |
1091 | * | ||
1092 | * Assumes no outstanding ioctls to llds. | ||
1101 | */ | 1093 | */ |
1102 | int | 1094 | int |
1103 | mraid_mm_unregister_adp(uint32_t unique_id) | 1095 | mraid_mm_unregister_adp(uint32_t unique_id) |
@@ -1131,7 +1123,6 @@ mraid_mm_unregister_adp(uint32_t unique_id) | |||
1131 | 1123 | ||
1132 | /** | 1124 | /** |
1133 | * mraid_mm_free_adp_resources - Free adapter softstate | 1125 | * mraid_mm_free_adp_resources - Free adapter softstate |
1134 | * | ||
1135 | * @adp : Adapter softstate | 1126 | * @adp : Adapter softstate |
1136 | */ | 1127 | */ |
1137 | static void | 1128 | static void |
@@ -1162,7 +1153,6 @@ mraid_mm_free_adp_resources(mraid_mmadp_t *adp) | |||
1162 | 1153 | ||
1163 | /** | 1154 | /** |
1164 | * mraid_mm_teardown_dma_pools - Free all per adapter dma buffers | 1155 | * mraid_mm_teardown_dma_pools - Free all per adapter dma buffers |
1165 | * | ||
1166 | * @adp : Adapter softstate | 1156 | * @adp : Adapter softstate |
1167 | */ | 1157 | */ |
1168 | static void | 1158 | static void |
@@ -1190,7 +1180,7 @@ mraid_mm_teardown_dma_pools(mraid_mmadp_t *adp) | |||
1190 | } | 1180 | } |
1191 | 1181 | ||
1192 | /** | 1182 | /** |
1193 | * mraid_mm_init : Module entry point | 1183 | * mraid_mm_init - Module entry point |
1194 | */ | 1184 | */ |
1195 | static int __init | 1185 | static int __init |
1196 | mraid_mm_init(void) | 1186 | mraid_mm_init(void) |
@@ -1214,10 +1204,13 @@ mraid_mm_init(void) | |||
1214 | } | 1204 | } |
1215 | 1205 | ||
1216 | 1206 | ||
1207 | #ifdef CONFIG_COMPAT | ||
1217 | /** | 1208 | /** |
1218 | * mraid_mm_compat_ioctl : 32bit to 64bit ioctl conversion routine | 1209 | * mraid_mm_compat_ioctl - 32bit to 64bit ioctl conversion routine |
1210 | * @filep : file operations pointer (ignored) | ||
1211 | * @cmd : ioctl command | ||
1212 | * @arg : user ioctl packet | ||
1219 | */ | 1213 | */ |
1220 | #ifdef CONFIG_COMPAT | ||
1221 | static long | 1214 | static long |
1222 | mraid_mm_compat_ioctl(struct file *filep, unsigned int cmd, | 1215 | mraid_mm_compat_ioctl(struct file *filep, unsigned int cmd, |
1223 | unsigned long arg) | 1216 | unsigned long arg) |
@@ -1231,7 +1224,7 @@ mraid_mm_compat_ioctl(struct file *filep, unsigned int cmd, | |||
1231 | #endif | 1224 | #endif |
1232 | 1225 | ||
1233 | /** | 1226 | /** |
1234 | * mraid_mm_exit : Module exit point | 1227 | * mraid_mm_exit - Module exit point |
1235 | */ | 1228 | */ |
1236 | static void __exit | 1229 | static void __exit |
1237 | mraid_mm_exit(void) | 1230 | mraid_mm_exit(void) |