On Fri, Mar 15, 2024 at 11:12:55AM +0530, Manivannan Sadhasivam wrote: > On Wed, Mar 13, 2024 at 11:57:58AM +0100, Niklas Cassel wrote: > > Clean up pci_epf_test_unbind() by using a continue if we did not allocate > > memory for the BAR index. This reduces the indentation level by one. > > > > This makes pci_epf_test_unbind() more similar to pci_epf_test_set_bar(). > > > > I've proposed to move the clear_bar and free_space code to separate helper > functions in my series [1]. If this series gets merged first (it really makes > sense), then this patch can be dropped now. I've been a bit busy this week, hopefully I will have time to review your two outstanding series before the end of the week. I do think that this series is smaller and less complex than your two series, so if you ask me, I think it would make sense if this series (the respin of this series) goes first. Kind regards, Niklas > > - Mani > > > Signed-off-by: Niklas Cassel <cassel@xxxxxxxxxx> > > --- > > drivers/pci/endpoint/functions/pci-epf-test.c | 14 ++++++-------- > > 1 file changed, 6 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c > > index 91bbfcb1b3ed..fbe14c7232c7 100644 > > --- a/drivers/pci/endpoint/functions/pci-epf-test.c > > +++ b/drivers/pci/endpoint/functions/pci-epf-test.c > > @@ -690,20 +690,18 @@ static void pci_epf_test_unbind(struct pci_epf *epf) > > { > > struct pci_epf_test *epf_test = epf_get_drvdata(epf); > > struct pci_epc *epc = epf->epc; > > - struct pci_epf_bar *epf_bar; > > int bar; > > > > cancel_delayed_work(&epf_test->cmd_handler); > > pci_epf_test_clean_dma_chan(epf_test); > > for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) { > > - epf_bar = &epf->bar[bar]; > > + if (!epf_test->reg[bar]) > > + continue; > > > > - if (epf_test->reg[bar]) { > > - pci_epc_clear_bar(epc, epf->func_no, epf->vfunc_no, > > - epf_bar); > > - pci_epf_free_space(epf, epf_test->reg[bar], bar, > > - PRIMARY_INTERFACE); > > - } > > + pci_epc_clear_bar(epc, epf->func_no, epf->vfunc_no, > > + &epf->bar[bar]); > > + pci_epf_free_space(epf, epf_test->reg[bar], bar, > > + PRIMARY_INTERFACE); > > } > > } > > > > -- > > 2.44.0 > > > > -- > மணிவண்ணன் சதாசிவம்