diff mbox series

[v2,2/2] PCI: endpoint: pci-epf-test: Use 'msix_capable' flag directly in pci_epf_test_alloc_space()

Message ID 20240418-pci-epf-test-fix-v2-2-eacd54831444@linaro.org (mailing list archive)
State Awaiting Upstream
Delegated to: Krzysztof WilczyƄski
Headers show
Series PCI: endpoint: pci-epf-test: Cleanup the usage of 'pci_epf_test::epc_features' | expand

Commit Message

Manivannan Sadhasivam April 18, 2024, 7:59 a.m. UTC
Instead of using a local variable to cache the 'msix_capable' flag, use it
directly to simplify the code.

Suggested-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/endpoint/functions/pci-epf-test.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Niklas Cassel April 18, 2024, 8:29 a.m. UTC | #1
On Thu, Apr 18, 2024 at 01:29:59PM +0530, Manivannan Sadhasivam wrote:
> Instead of using a local variable to cache the 'msix_capable' flag, use it
> directly to simplify the code.
> 
> Suggested-by: Niklas Cassel <cassel@kernel.org>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---

Reviewed-by: Niklas Cassel <cassel@kernel.org>
Frank Li April 18, 2024, 1:49 p.m. UTC | #2
On Thu, Apr 18, 2024 at 01:29:59PM +0530, Manivannan Sadhasivam wrote:
> Instead of using a local variable to cache the 'msix_capable' flag, use it
> directly to simplify the code.

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> 
> Suggested-by: Niklas Cassel <cassel@kernel.org>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>  drivers/pci/endpoint/functions/pci-epf-test.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
> index 546d2a27955c..3de18a601e7b 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> @@ -802,19 +802,15 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf)
>  	size_t msix_table_size = 0;
>  	size_t test_reg_bar_size;
>  	size_t pba_size = 0;
> -	bool msix_capable;
>  	void *base;
>  	enum pci_barno test_reg_bar = epf_test->test_reg_bar;
>  	enum pci_barno bar;
> -	const struct pci_epc_features *epc_features;
> +	const struct pci_epc_features *epc_features = epf_test->epc_features;
>  	size_t test_reg_size;
>  
> -	epc_features = epf_test->epc_features;
> -
>  	test_reg_bar_size = ALIGN(sizeof(struct pci_epf_test_reg), 128);
>  
> -	msix_capable = epc_features->msix_capable;
> -	if (msix_capable) {
> +	if (epc_features->msix_capable) {
>  		msix_table_size = PCI_MSIX_ENTRY_SIZE * epf->msix_interrupts;
>  		epf_test->msix_table_offset = test_reg_bar_size;
>  		/* Align to QWORD or 8 Bytes */
> 
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index 546d2a27955c..3de18a601e7b 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -802,19 +802,15 @@  static int pci_epf_test_alloc_space(struct pci_epf *epf)
 	size_t msix_table_size = 0;
 	size_t test_reg_bar_size;
 	size_t pba_size = 0;
-	bool msix_capable;
 	void *base;
 	enum pci_barno test_reg_bar = epf_test->test_reg_bar;
 	enum pci_barno bar;
-	const struct pci_epc_features *epc_features;
+	const struct pci_epc_features *epc_features = epf_test->epc_features;
 	size_t test_reg_size;
 
-	epc_features = epf_test->epc_features;
-
 	test_reg_bar_size = ALIGN(sizeof(struct pci_epf_test_reg), 128);
 
-	msix_capable = epc_features->msix_capable;
-	if (msix_capable) {
+	if (epc_features->msix_capable) {
 		msix_table_size = PCI_MSIX_ENTRY_SIZE * epf->msix_interrupts;
 		epf_test->msix_table_offset = test_reg_bar_size;
 		/* Align to QWORD or 8 Bytes */