diff mbox series

[08/11] pci/hotplug/pnv-php: Register opencapi slots

Message ID 20190909154600.19917-9-fbarrat@linux.ibm.com (mailing list archive)
State Superseded
Headers show
Series opencapi: enable card reset and link retraining | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch next (c317052c95bef1f977b023158e5aa929215f443d)
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 17 lines checked

Commit Message

Frederic Barrat Sept. 9, 2019, 3:45 p.m. UTC
Add the opencapi PHBs to the list of PHBs being scanned to look for
slots.

Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
---
 drivers/pci/hotplug/pnv_php.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Alastair D'Silva Sept. 10, 2019, 1 a.m. UTC | #1
On Mon, 2019-09-09 at 17:45 +0200, Frederic Barrat wrote:
> Add the opencapi PHBs to the list of PHBs being scanned to look for
> slots.
> 
> Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
> ---
>  drivers/pci/hotplug/pnv_php.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/hotplug/pnv_php.c
> b/drivers/pci/hotplug/pnv_php.c
> index 304bdbcdb77c..f0a7360154e7 100644
> --- a/drivers/pci/hotplug/pnv_php.c
> +++ b/drivers/pci/hotplug/pnv_php.c
> @@ -954,7 +954,8 @@ static int __init pnv_php_init(void)
>  	pr_info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
>  	for_each_compatible_node(dn, NULL, "ibm,ioda2-phb")
>  		pnv_php_register(dn);
> -
> +	for_each_compatible_node(dn, NULL, "ibm,ioda2-npu2-opencapi-
> phb")
> +		pnv_php_register_one(dn);
>  	return 0;
>  }
>  
> @@ -964,6 +965,8 @@ static void __exit pnv_php_exit(void)
>  
>  	for_each_compatible_node(dn, NULL, "ibm,ioda2-phb")
>  		pnv_php_unregister(dn);
> +	for_each_compatible_node(dn, NULL, "ibm,ioda2-npu2-opencapi-
> phb")
> +		pnv_php_unregister(dn);
>  }
>  
>  module_init(pnv_php_init);

Reviewed-by: Alastair D'Silva <alastair@d-silva.org>
Andrew Donnellan Nov. 19, 2019, 5:18 a.m. UTC | #2
On 10/9/19 1:45 am, Frederic Barrat wrote:
> Add the opencapi PHBs to the list of PHBs being scanned to look for
> slots.
> 
> Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
> ---
>   drivers/pci/hotplug/pnv_php.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
> index 304bdbcdb77c..f0a7360154e7 100644
> --- a/drivers/pci/hotplug/pnv_php.c
> +++ b/drivers/pci/hotplug/pnv_php.c
> @@ -954,7 +954,8 @@ static int __init pnv_php_init(void)
>   	pr_info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
>   	for_each_compatible_node(dn, NULL, "ibm,ioda2-phb")
>   		pnv_php_register(dn);
> -
> +	for_each_compatible_node(dn, NULL, "ibm,ioda2-npu2-opencapi-phb")
> +		pnv_php_register_one(dn);
>   	return 0;
>   }
>   
> @@ -964,6 +965,8 @@ static void __exit pnv_php_exit(void)
>   
>   	for_each_compatible_node(dn, NULL, "ibm,ioda2-phb")
>   		pnv_php_unregister(dn);
> +	for_each_compatible_node(dn, NULL, "ibm,ioda2-npu2-opencapi-phb")
> +		pnv_php_unregister(dn);
>   }


Why do we use register_one to register and unregister rather than 
unregister_one to unregister?
Frederic Barrat Nov. 19, 2019, 3:15 p.m. UTC | #3
Le 19/11/2019 à 06:18, Andrew Donnellan a écrit :
> On 10/9/19 1:45 am, Frederic Barrat wrote:
>> Add the opencapi PHBs to the list of PHBs being scanned to look for
>> slots.
>>
>> Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
>> ---
>>   drivers/pci/hotplug/pnv_php.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/hotplug/pnv_php.c 
>> b/drivers/pci/hotplug/pnv_php.c
>> index 304bdbcdb77c..f0a7360154e7 100644
>> --- a/drivers/pci/hotplug/pnv_php.c
>> +++ b/drivers/pci/hotplug/pnv_php.c
>> @@ -954,7 +954,8 @@ static int __init pnv_php_init(void)
>>       pr_info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
>>       for_each_compatible_node(dn, NULL, "ibm,ioda2-phb")
>>           pnv_php_register(dn);
>> -
>> +    for_each_compatible_node(dn, NULL, "ibm,ioda2-npu2-opencapi-phb")
>> +        pnv_php_register_one(dn);
>>       return 0;
>>   }
>> @@ -964,6 +965,8 @@ static void __exit pnv_php_exit(void)
>>       for_each_compatible_node(dn, NULL, "ibm,ioda2-phb")
>>           pnv_php_unregister(dn);
>> +    for_each_compatible_node(dn, NULL, "ibm,ioda2-npu2-opencapi-phb")
>> +        pnv_php_unregister(dn);
>>   }
> 
> 
> Why do we use register_one to register and unregister rather than 
> unregister_one to unregister?


Good catch! With the above, the slot was not removed. 
pnv_php_unregister() looks at the children only and was missing the 
opencapi slot, since it's directly under the PHB.

   Fred
diff mbox series

Patch

diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
index 304bdbcdb77c..f0a7360154e7 100644
--- a/drivers/pci/hotplug/pnv_php.c
+++ b/drivers/pci/hotplug/pnv_php.c
@@ -954,7 +954,8 @@  static int __init pnv_php_init(void)
 	pr_info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
 	for_each_compatible_node(dn, NULL, "ibm,ioda2-phb")
 		pnv_php_register(dn);
-
+	for_each_compatible_node(dn, NULL, "ibm,ioda2-npu2-opencapi-phb")
+		pnv_php_register_one(dn);
 	return 0;
 }
 
@@ -964,6 +965,8 @@  static void __exit pnv_php_exit(void)
 
 	for_each_compatible_node(dn, NULL, "ibm,ioda2-phb")
 		pnv_php_unregister(dn);
+	for_each_compatible_node(dn, NULL, "ibm,ioda2-npu2-opencapi-phb")
+		pnv_php_unregister(dn);
 }
 
 module_init(pnv_php_init);