lkml.org 
[lkml]   [2020]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2020-09-18 03:29    [W:1.044 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site