* 2 of the License, or (at your option) any later version.
*
* FILE : megaraid_mm.c
- * Version : v2.20.2.3 (Dec 09 2004)
+ * Version : v2.20.2.6 (Mar 7 2005)
*
* Common management module
*/
static void mraid_mm_teardown_dma_pools(mraid_mmadp_t *);
#ifdef CONFIG_COMPAT
-static int mraid_mm_compat_ioctl(unsigned int, unsigned int, unsigned long,
- struct file *);
+static long mraid_mm_compat_ioctl(struct file *, unsigned int, unsigned long);
#endif
MODULE_AUTHOR("LSI Logic Corporation");
EXPORT_SYMBOL(mraid_mm_register_adp);
EXPORT_SYMBOL(mraid_mm_unregister_adp);
+EXPORT_SYMBOL(mraid_mm_adapter_app_handle);
static int majorno;
-static uint32_t drvr_ver = 0x02200201;
+static uint32_t drvr_ver = 0x02200206;
static int adapters_count_g;
static struct list_head adapters_list_g;
-wait_queue_head_t wait_q;
+static wait_queue_head_t wait_q;
static struct file_operations lsi_fops = {
.open = mraid_mm_open,
.ioctl = mraid_mm_ioctl,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = mraid_mm_compat_ioctl,
+#endif
.owner = THIS_MODULE,
};
memalloc_error:
- if (adapter->kioc_list)
- kfree(adapter->kioc_list);
-
- if (adapter->mbox_list)
- kfree(adapter->mbox_list);
+ kfree(adapter->kioc_list);
+ kfree(adapter->mbox_list);
if (adapter->pthru_dma_pool)
pci_pool_destroy(adapter->pthru_dma_pool);
- if (adapter)
- kfree(adapter);
+ kfree(adapter);
return rval;
}
+
+/**
+ * mraid_mm_adapter_app_handle - return the application handle for this adapter
+ *
+ * For the given driver data, locate the adadpter in our global list and
+ * return the corresponding handle, which is also used by applications to
+ * uniquely identify an adapter.
+ *
+ * @param unique_id : adapter unique identifier
+ *
+ * @return adapter handle if found in the list
+ * @return 0 if adapter could not be located, should never happen though
+ */
+uint32_t
+mraid_mm_adapter_app_handle(uint32_t unique_id)
+{
+ mraid_mmadp_t *adapter;
+ mraid_mmadp_t *tmp;
+ int index = 0;
+
+ list_for_each_entry_safe(adapter, tmp, &adapters_list_g, list) {
+
+ if (adapter->unique_id == unique_id) {
+
+ return MKADAP(index);
+ }
+
+ index++;
+ }
+
+ return 0;
+}
+
+
/**
* mraid_mm_setup_dma_pools - Set up dma buffer pools per adapter
*
}
kfree(adp->kioc_list);
-
kfree(adp->mbox_list);
pci_pool_destroy(adp->pthru_dma_pool);
INIT_LIST_HEAD(&adapters_list_g);
- register_ioctl32_conversion(MEGAIOCCMD, mraid_mm_compat_ioctl);
-
return 0;
}
* mraid_mm_compat_ioctl : 32bit to 64bit ioctl conversion routine
*/
#ifdef CONFIG_COMPAT
-static int
-mraid_mm_compat_ioctl(unsigned int fd, unsigned int cmd,
- unsigned long arg, struct file *filep)
+static long
+mraid_mm_compat_ioctl(struct file *filep, unsigned int cmd,
+ unsigned long arg)
{
- struct inode *inode = filep->f_dentry->d_inode;
+ int err;
+
+ err = mraid_mm_ioctl(NULL, filep, cmd, arg);
- return mraid_mm_ioctl(inode, filep, cmd, arg);
+ return err;
}
#endif
con_log(CL_DLEVEL1 , ("exiting common mod\n"));
unregister_chrdev(majorno, "megadev");
- unregister_ioctl32_conversion(MEGAIOCCMD);
}
module_init(mraid_mm_init);