diff mbox

[09/10] aacraid: Fix character device re initialization

Message ID 1448973589-9216-11-git-send-email-RaghavaAditya.Renukunta@pmcs.com (mailing list archive)
State New, archived
Headers show

Commit Message

Raghava Aditya Renukunta Dec. 1, 2015, 12:39 p.m. UTC
From: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>

During EEH PCI hotplug activity kernel unloads and loads the driver,
causing character device to be unregistered(aac_remove_one).When the
driver is loaded back using aac_probe_one the character device needs
to be registered again for the AIF management tools to work.

Fixed by adding code to register character device in aac_probe_one if
it is unregistered in aac_remove_one.

Signed-off-by: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>
---
 drivers/scsi/aacraid/linit.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

Comments

Johannes Thumshirn Dec. 2, 2015, 9:18 a.m. UTC | #1
Hi Raghava,
On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote:
> From: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>
> 
> During EEH PCI hotplug activity kernel unloads and loads the driver,
> causing character device to be unregistered(aac_remove_one).When the
> driver is loaded back using aac_probe_one the character device needs
> to be registered again for the AIF management tools to work.
> 
> Fixed by adding code to register character device in aac_probe_one if
> it is unregistered in aac_remove_one.
> 
> Signed-off-by: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>

This one is duplicate, isn't it?
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Raghava Aditya Renukunta Dec. 2, 2015, 9:59 p.m. UTC | #2
DQpIZWxsbyBKb2hhbm5lcywNCg0KPiBIacKgUmFnaGF2YSwNCj4gT24gVHVlLCAyMDE1LTEyLTAx
IGF0IDA0OjM5IC0wODAwLCBSYWdoYXZhIEFkaXR5YSBSZW51a3VudGEgd3JvdGU6DQo+ID4gRnJv
bTogUmFnaGF2YSBBZGl0eWEgUmVudWt1bnRhIDxyYWdoYXZhYWRpdHlhLnJlbnVrdW50YUBwbWNz
LmNvbT4NCj4gPg0KPiA+IER1cmluZyBFRUggUENJIGhvdHBsdWcgYWN0aXZpdHkga2VybmVsIHVu
bG9hZHMgYW5kIGxvYWRzIHRoZSBkcml2ZXIsDQo+ID4gY2F1c2luZyBjaGFyYWN0ZXIgZGV2aWNl
IHRvIGJlIHVucmVnaXN0ZXJlZChhYWNfcmVtb3ZlX29uZSkuV2hlbiB0aGUNCj4gPiBkcml2ZXIg
aXMgbG9hZGVkIGJhY2sgdXNpbmcgYWFjX3Byb2JlX29uZSB0aGUgY2hhcmFjdGVyIGRldmljZSBu
ZWVkcw0KPiA+IHRvIGJlIHJlZ2lzdGVyZWQgYWdhaW4gZm9yIHRoZSBBSUYgbWFuYWdlbWVudCB0
b29scyB0byB3b3JrLg0KPiA+DQo+ID4gRml4ZWQgYnkgYWRkaW5nIGNvZGUgdG8gcmVnaXN0ZXIg
Y2hhcmFjdGVyIGRldmljZSBpbiBhYWNfcHJvYmVfb25lIGlmDQo+ID4gaXQgaXMgdW5yZWdpc3Rl
cmVkIGluIGFhY19yZW1vdmVfb25lLg0KPiA+DQo+ID4gU2lnbmVkLW9mZi1ieTogUmFnaGF2YSBB
ZGl0eWEgUmVudWt1bnRhDQo+ID4gPHJhZ2hhdmFhZGl0eWEucmVudWt1bnRhQHBtY3MuY29tPg0K
PiANCj4gVGhpcyBvbmUgaXMgZHVwbGljYXRlLCBpc24ndCBpdD8NCg0KWWVzIHRoaXMgb25lIGlz
IGEgZHVwbGljYXRlLg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 9076a95..e8c3606 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1123,6 +1123,13 @@  static void __aac_shutdown(struct aac_dev * aac)
 	else if (aac->max_msix > 1)
 		pci_disable_msix(aac->pdev);
 }
+static void aac_init_char(void)
+{
+	aac_cfg_major = register_chrdev(0, "aac", &aac_cfg_fops);
+	if (aac_cfg_major < 0) {
+		pr_err("aacraid: unable to register \"aac\" device.\n");
+	}
+}
 
 static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 {
@@ -1185,6 +1192,9 @@  static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	shost->max_cmd_len = 16;
 	shost->use_cmd_list = 1;
 
+	if (aac_cfg_major == -2)
+		aac_init_char();
+
 	aac = (struct aac_dev *)shost->hostdata;
 	aac->base_start = pci_resource_start(pdev, 0);
 	aac->scsi_host_ptr = shost;
@@ -1534,7 +1544,7 @@  static void aac_remove_one(struct pci_dev *pdev)
 	pci_disable_device(pdev);
 	if (list_empty(&aac_devices)) {
 		unregister_chrdev(aac_cfg_major, "aac");
-		aac_cfg_major = -1;
+		aac_cfg_major = -2;
 	}
 }
 
@@ -1695,11 +1705,8 @@  static int __init aac_init(void)
 	if (error < 0)
 		return error;
 
-	aac_cfg_major = register_chrdev( 0, "aac", &aac_cfg_fops);
-	if (aac_cfg_major < 0) {
-		printk(KERN_WARNING
-			"aacraid: unable to register \"aac\" device.\n");
-	}
+	aac_init_char();
+
 
 	return 0;
 }