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

2015-12-02 Thread Johannes Thumshirn
Hi Raghava,
On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote:
> From: Raghava Aditya Renukunta 
> 
> 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 

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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-12-02 Thread Raghava Aditya Renukunta
Hello Johannes,

> -Original Message-
> From: Johannes Thumshirn [mailto:jthumsh...@suse.de]
> Sent: Wednesday, December 2, 2015 2:14 AM
> To: Raghava Aditya Renukunta; jbottom...@parallels.com; linux-
> s...@vger.kernel.org
> Cc: Mahesh Rajashekhara; Murthy Bhat; Santosh Akula; Gana Sridaran;
> aacr...@pmc-sierra.com; Rich Bono
> Subject: Re: [PATCH 09/10] aacraid: Fix character device re-initialization
> 
> Hi Raghava,
> 
> On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote:
> > From: Raghava Aditya Renukunta <raghavaaditya.renuku...@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.renuku...@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", _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(_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.

Thank you for pointing that out, I will make
the necessary changes in the next iteration.

> 
> >     }
> >  }
> >
> > @@ -1697,11 +1707,8 @@ static int __init aac_init(void)
> >     if (error < 0)
> >     return error;
> >
> > -   aac_cfg_major = register_chrdev( 0, "aac", _cfg_fops);
> > -   if (aac_cfg_major < 0) {
> > -   printk(KERN_WARNING
> > -   "aacraid: unable to register \"aac\" device.\n");
> > -   }
> > +   aac_init_char();
> > +
> >
> >     return 0;
> >  }

Regards,
Raghava Aditya
N�r��yb�X��ǧv�^�)޺{.n�+{���"�{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�mzZ+�ݢj"��!�i

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

2015-12-02 Thread Johannes Thumshirn
Hi Raghava,

On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote:
> From: Raghava Aditya Renukunta 
> 
> 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 
> ---
>  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", _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(_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", _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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-12-02 Thread Raghava Aditya Renukunta

Hello Johannes,

> Hi Raghava,
> On Tue, 2015-12-01 at 04:39 -0800, Raghava Aditya Renukunta wrote:
> > From: Raghava Aditya Renukunta 
> >
> > 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
> > 
> 
> This one is duplicate, isn't it?

Yes this one is a duplicate.
N�r��yb�X��ǧv�^�)޺{.n�+{���"�{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�mzZ+�ݢj"��!�i

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

2015-12-01 Thread Raghava Aditya Renukunta
From: Raghava Aditya Renukunta 

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 
---
 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 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", _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(_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", _cfg_fops);
-   if (aac_cfg_major < 0) {
-   printk(KERN_WARNING
-   "aacraid: unable to register \"aac\" device.\n");
-   }
+   aac_init_char();
+
 
return 0;
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-12-01 Thread Raghava Aditya Renukunta
From: Raghava Aditya Renukunta 

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 
---
 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", _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(_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", _cfg_fops);
-   if (aac_cfg_major < 0) {
-   printk(KERN_WARNING
-   "aacraid: unable to register \"aac\" device.\n");
-   }
+   aac_init_char();
+
 
return 0;
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html