[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200918012358.GC13851@yilunxu-OptiPlex-7050>
Date: Fri, 18 Sep 2020 09:23:58 +0800
From: Xu Yilun <yilun.xu@...el.com>
To: Moritz Fischer <mdf@...nel.org>
Cc: Tom Rix <trix@...hat.com>,
Russ Weight <russell.h.weight@...el.com>,
linux-fpga@...r.kernel.org, linux-kernel@...r.kernel.org,
lgoncalv@...hat.com, hao.wu@...el.com, matthew.gerlach@...el.com,
yilun.xu@...el.com
Subject: Re: [PATCH v2 1/1] fpga: dfl: afu: harden port enable logic
> > > /**
> > > * __afu_port_enable - enable a port by clear reset
> > > * @pdev: port platform device.
> > > @@ -32,7 +35,7 @@
> > > *
> > > * The caller needs to hold lock for protection.
> > > */
> > > -void __afu_port_enable(struct platform_device *pdev)
> > > +int __afu_port_enable(struct platform_device *pdev)
> > > {
> > > struct dfl_feature_platform_data *pdata = dev_get_platdata(&pdev->dev);
> > > void __iomem *base;
> > > @@ -41,7 +44,7 @@ void __afu_port_enable(struct platform_device *pdev)
> > > WARN_ON(!pdata->disable_count);
> > >
> > > if (--pdata->disable_count != 0)
> > > - return;
> > > + return 0;
> > Is this really a success ? Maybe -EBUSY ?
> Seems like if it's severe enough for a warning you'd probably want to
> return an error.
This code is to handle the port enable/disable request from multiple
users. This is a voting mechanism, the port would not be physically
enabled if there is still an disable vote. The --diable_count != 0 works
for this purpose. So I think it should be OK here since the voting
mechanism is working as expected.
Thanks,
Yilun
Powered by blists - more mailing lists