aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_init.c
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2012-01-18 16:23:48 -0500
committerJames Bottomley <JBottomley@Parallels.com>2012-02-19 09:08:52 -0500
commit3ef6d24cd9f473518dd7941e86cc2a5f8992eed0 (patch)
tree0ba650da57b6187e7d635a89d849e064ef58f885 /drivers/scsi/lpfc/lpfc_init.c
parent5954d7380f627371c4d8d7c59c08f9596aa2c674 (diff)
[SCSI] lpfc 8.3.29: BSG and User interface fixes
BSG and User interface fixes: - Fix driver processing an els command using 16Gb FC Adapter (126345) - Change SLI4 FC port internal loopback to inner internal (126409) - Fix bug with driver dump command type 4 using 16Gb FC Adapter (126406) - Create character device to take a reference on the driver (126082) Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com> Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index dfea2dada02c..d670b1c410ec 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -32,6 +32,7 @@
32#include <linux/aer.h> 32#include <linux/aer.h>
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/firmware.h> 34#include <linux/firmware.h>
35#include <linux/miscdevice.h>
35 36
36#include <scsi/scsi.h> 37#include <scsi/scsi.h>
37#include <scsi/scsi_device.h> 38#include <scsi/scsi_device.h>
@@ -10012,6 +10013,36 @@ lpfc_io_resume(struct pci_dev *pdev)
10012 return; 10013 return;
10013} 10014}
10014 10015
10016/**
10017 * lpfc_mgmt_open - method called when 'lpfcmgmt' is opened from userspace
10018 * @inode: pointer to the inode representing the lpfcmgmt device
10019 * @filep: pointer to the file representing the open lpfcmgmt device
10020 *
10021 * This routine puts a reference count on the lpfc module whenever the
10022 * character device is opened
10023 **/
10024static int
10025lpfc_mgmt_open(struct inode *inode, struct file *filep)
10026{
10027 try_module_get(THIS_MODULE);
10028 return 0;
10029}
10030
10031/**
10032 * lpfc_mgmt_release - method called when 'lpfcmgmt' is closed in userspace
10033 * @inode: pointer to the inode representing the lpfcmgmt device
10034 * @filep: pointer to the file representing the open lpfcmgmt device
10035 *
10036 * This routine removes a reference count from the lpfc module when the
10037 * character device is closed
10038 **/
10039static int
10040lpfc_mgmt_release(struct inode *inode, struct file *filep)
10041{
10042 module_put(THIS_MODULE);
10043 return 0;
10044}
10045
10015static struct pci_device_id lpfc_id_table[] = { 10046static struct pci_device_id lpfc_id_table[] = {
10016 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_VIPER, 10047 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_VIPER,
10017 PCI_ANY_ID, PCI_ANY_ID, }, 10048 PCI_ANY_ID, PCI_ANY_ID, },
@@ -10124,6 +10155,17 @@ static struct pci_driver lpfc_driver = {
10124 .err_handler = &lpfc_err_handler, 10155 .err_handler = &lpfc_err_handler,
10125}; 10156};
10126 10157
10158static const struct file_operations lpfc_mgmt_fop = {
10159 .open = lpfc_mgmt_open,
10160 .release = lpfc_mgmt_release,
10161};
10162
10163static struct miscdevice lpfc_mgmt_dev = {
10164 .minor = MISC_DYNAMIC_MINOR,
10165 .name = "lpfcmgmt",
10166 .fops = &lpfc_mgmt_fop,
10167};
10168
10127/** 10169/**
10128 * lpfc_init - lpfc module initialization routine 10170 * lpfc_init - lpfc module initialization routine
10129 * 10171 *
@@ -10144,6 +10186,11 @@ lpfc_init(void)
10144 printk(LPFC_MODULE_DESC "\n"); 10186 printk(LPFC_MODULE_DESC "\n");
10145 printk(LPFC_COPYRIGHT "\n"); 10187 printk(LPFC_COPYRIGHT "\n");
10146 10188
10189 error = misc_register(&lpfc_mgmt_dev);
10190 if (error)
10191 printk(KERN_ERR "Could not register lpfcmgmt device, "
10192 "misc_register returned with status %d", error);
10193
10147 if (lpfc_enable_npiv) { 10194 if (lpfc_enable_npiv) {
10148 lpfc_transport_functions.vport_create = lpfc_vport_create; 10195 lpfc_transport_functions.vport_create = lpfc_vport_create;
10149 lpfc_transport_functions.vport_delete = lpfc_vport_delete; 10196 lpfc_transport_functions.vport_delete = lpfc_vport_delete;
@@ -10180,6 +10227,7 @@ lpfc_init(void)
10180static void __exit 10227static void __exit
10181lpfc_exit(void) 10228lpfc_exit(void)
10182{ 10229{
10230 misc_deregister(&lpfc_mgmt_dev);
10183 pci_unregister_driver(&lpfc_driver); 10231 pci_unregister_driver(&lpfc_driver);
10184 fc_release_transport(lpfc_transport_template); 10232 fc_release_transport(lpfc_transport_template);
10185 if (lpfc_enable_npiv) 10233 if (lpfc_enable_npiv)