Message ID | 1448973589-9216-10-git-send-email-RaghavaAditya.Renukunta@pmcs.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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> > --- > drivers/scsi/aacraid/linit.c | 19 +++++++++++++------ > 1 file changed, 13 insertions(+), 6 deletions(-) > > diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c > index 2094842..7142578 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; > @@ -1536,7 +1546,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; Please add something like #define AAC_CHARDEV_UNREGISTERED -1 #define AAC_CHARDEV_NEEDS_REINIT -2 so it's obvious what you're doing. > } > } > > @@ -1697,11 +1707,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; > } -- 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
SGVsbG8gSm9oYW5uZXMsDQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTog Sm9oYW5uZXMgVGh1bXNoaXJuIFttYWlsdG86anRodW1zaGlybkBzdXNlLmRlXQ0KPiBTZW50OiBX ZWRuZXNkYXksIERlY2VtYmVyIDIsIDIwMTUgMjoxNCBBTQ0KPiBUbzogUmFnaGF2YSBBZGl0eWEg UmVudWt1bnRhOyBKQm90dG9tbGV5QFBhcmFsbGVscy5jb207IGxpbnV4LQ0KPiBzY3NpQHZnZXIu a2VybmVsLm9yZw0KPiBDYzogTWFoZXNoIFJhamFzaGVraGFyYTsgTXVydGh5IEJoYXQ7IFNhbnRv c2ggQWt1bGE7IEdhbmEgU3JpZGFyYW47DQo+IGFhY3JhaWRAcG1jLXNpZXJyYS5jb207IFJpY2gg Qm9ubw0KPiBTdWJqZWN0OiBSZTogW1BBVENIIDA5LzEwXSBhYWNyYWlkOiBGaXggY2hhcmFjdGVy IGRldmljZSByZS1pbml0aWFsaXphdGlvbg0KPiANCj4gSGkgUmFnaGF2YSwNCj4gDQo+IE9uIFR1 ZSwgMjAxNS0xMi0wMSBhdCAwNDozOSAtMDgwMCwgUmFnaGF2YSBBZGl0eWEgUmVudWt1bnRhIHdy b3RlOg0KPiA+IEZyb206IFJhZ2hhdmEgQWRpdHlhIFJlbnVrdW50YSA8cmFnaGF2YWFkaXR5YS5y ZW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gwqAJCXJldHVybiBlcnJvcjsNCj4gPg0KPiA+IC0JYWFjX2Nm Z19tYWpvciA9IHJlZ2lzdGVyX2NocmRldiggMCwgImFhYyIsICZhYWNfY2ZnX2ZvcHMpOw0KPiA+ IC0JaWYgKGFhY19jZmdfbWFqb3IgPCAwKSB7DQo+ID4gLQkJcHJpbnRrKEtFUk5fV0FSTklORw0K PiA+IC0JCQkiYWFjcmFpZDogdW5hYmxlIHRvIHJlZ2lzdGVyIFwiYWFjXCIgZGV2aWNlLlxuIik7 DQo+ID4gLQl9DQo+ID4gKwlhYWNfaW5pdF9jaGFyKCk7DQo+ID4gKw0KPiA+DQo+ID4gwqAJcmV0 dXJuIDA7DQo+ID4gwqB9DQoNClJlZ2FyZHMsDQpSYWdoYXZhIEFkaXR5YQ0K -- 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 --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 2094842..7142578 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; @@ -1536,7 +1546,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; } } @@ -1697,11 +1707,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; }