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 Tuesday 13 September 2022 17:02:39 Johan Hovold wrote:
> 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

Yes, of course, it is "in the middle" because I said I used it in the
same way as in ftdi_232am_baud_base_to_divisor.

ftdi_232am_baud_base_to_divisor converts input "baud" and input "base"
to return "divisor". Hence baud_base_to_divisor.

And so ftdi_232am_divisor_base_to_baud converts input "divisor" and
input "base" to return value "baud". Hence divisor_base_to_baud.

So what is the problem? I still have not caught.



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

  Powered by Linux