Re: [PATCH v2 1/1] fpga: dfl: afu: harden port enable logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > >  /**
> > >   * __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



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux