Re: [PATCH v2 7/7] USB: serial: ftdi_sio: Fill c_*speed fields with real baud rate

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

 



On Thu, Aug 18, 2022 at 04:17:38PM +0200, Pali Rohár wrote:
> On Sunday 24 July 2022 14:41:19 Johan Hovold wrote:
> > On Tue, Jul 12, 2022 at 01:53:06PM +0200, Marek Behún wrote:
> > > From: Pali Rohár <pali@xxxxxxxxxx>
> > > 
> > > Calculate baud rate value in c_*speed fields to the real values which were
> > > set on hardware. For this operation, add a new set of methods
> > > *_divisor_to_baud() for each chip and use them for calculating the real
> > > baud rate values.
> > > 
> > > Each *_divisor_to_baud() method is constructed as an inverse function of
> > > its corresponding *_baud_to_divisor() method.
> > > 
> > > Signed-off-by: Pali Rohár <pali@xxxxxxxxxx>
> > > Tested-by: Marek Behún <kabel@xxxxxxxxxx>
> > > Signed-off-by: Marek Behún <kabel@xxxxxxxxxx>
> > > ---
> > >  drivers/usb/serial/ftdi_sio.c | 83 +++++++++++++++++++++++++++++++++++
> > >  1 file changed, 83 insertions(+)

> > >  static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base)
> > >  {
> > >  	unsigned short int divisor;
> > > @@ -1189,15 +1206,33 @@ static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base)
> > >  	return divisor;
> > >  }
> > >  
> > > +static int ftdi_232am_divisor_base_to_baud(unsigned short int divisor, int base)
> > 
> > I believe "base" was used as a function name suffix in the inverse
> > function (due to the additional base argument).
> 
> Yes, in the same way as it used in name of ftdi_232am_baud_base_to_divisor.

No, you used "base" as an infix here.

Johan



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux