diff mbox series

[1/3] powernv/pci: Use pnv_phb as the private data for debugfs entries

Message ID 20190912052945.12589-1-oohall@gmail.com (mailing list archive)
State Accepted
Commit 22ba7289079be12c85895fee41602139e9553c93
Headers show
Series [1/3] powernv/pci: Use pnv_phb as the private data for debugfs entries | 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, 28 lines checked

Commit Message

Oliver O'Halloran Sept. 12, 2019, 5:29 a.m. UTC
Use the pnv_phb structure as the private data pointer for the debugfs
files.  This lets us delete some code and an open-coded use of
hose->private_data.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 arch/powerpc/platforms/powernv/pci-ioda.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

Comments

Alexey Kardashevskiy Sept. 23, 2019, 8:08 a.m. UTC | #1
On 12/09/2019 15:29, Oliver O'Halloran wrote:
> Use the pnv_phb structure as the private data pointer for the debugfs
> files.  This lets us delete some code and an open-coded use of
> hose->private_data.
> 
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>


Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>



> ---
>  arch/powerpc/platforms/powernv/pci-ioda.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> index 2f650e1..b24339b 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -3044,19 +3044,12 @@ static void pnv_ioda_setup_pe_seg(struct pnv_ioda_pe *pe)
>  #ifdef CONFIG_DEBUG_FS
>  static int pnv_pci_diag_data_set(void *data, u64 val)
>  {
> -	struct pci_controller *hose;
> -	struct pnv_phb *phb;
> +	struct pnv_phb *phb = data;
>  	s64 ret;
>  
>  	if (val != 1ULL)
>  		return -EINVAL;
>  
> -	hose = (struct pci_controller *)data;
> -	if (!hose || !hose->private_data)
> -		return -ENODEV;
> -
> -	phb = hose->private_data;
> -
>  	/* Retrieve the diag data from firmware */
>  	ret = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag_data,
>  					  phb->diag_data_size);
> @@ -3094,7 +3087,7 @@ static void pnv_pci_ioda_create_dbgfs(void)
>  			continue;
>  		}
>  
> -		debugfs_create_file("dump_diag_regs", 0200, phb->dbgfs, hose,
> +		debugfs_create_file("dump_diag_regs", 0200, phb->dbgfs, phb,
>  				    &pnv_pci_diag_data_fops);
>  	}
>  #endif /* CONFIG_DEBUG_FS */
>
Michael Ellerman Jan. 29, 2020, 5:17 a.m. UTC | #2
On Thu, 2019-09-12 at 05:29:43 UTC, Oliver O'Halloran wrote:
> Use the pnv_phb structure as the private data pointer for the debugfs
> files.  This lets us delete some code and an open-coded use of
> hose->private_data.
> 
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/22ba7289079be12c85895fee41602139e9553c93

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 2f650e1..b24339b 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -3044,19 +3044,12 @@  static void pnv_ioda_setup_pe_seg(struct pnv_ioda_pe *pe)
 #ifdef CONFIG_DEBUG_FS
 static int pnv_pci_diag_data_set(void *data, u64 val)
 {
-	struct pci_controller *hose;
-	struct pnv_phb *phb;
+	struct pnv_phb *phb = data;
 	s64 ret;
 
 	if (val != 1ULL)
 		return -EINVAL;
 
-	hose = (struct pci_controller *)data;
-	if (!hose || !hose->private_data)
-		return -ENODEV;
-
-	phb = hose->private_data;
-
 	/* Retrieve the diag data from firmware */
 	ret = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag_data,
 					  phb->diag_data_size);
@@ -3094,7 +3087,7 @@  static void pnv_pci_ioda_create_dbgfs(void)
 			continue;
 		}
 
-		debugfs_create_file("dump_diag_regs", 0200, phb->dbgfs, hose,
+		debugfs_create_file("dump_diag_regs", 0200, phb->dbgfs, phb,
 				    &pnv_pci_diag_data_fops);
 	}
 #endif /* CONFIG_DEBUG_FS */