Re: [PATCH v4 04/11] tty: serdev: Add method to enable break flags

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

 



On Fri, 2024-05-10 at 17:21 +0300, Ilpo Järvinen wrote:
> On Thu, 9 May 2024, Christoph Fritz wrote:
...
> > diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
> > index 613cb356b918d..23a1e76cb553b 100644
> > --- a/drivers/tty/serdev/core.c
> > +++ b/drivers/tty/serdev/core.c
> > @@ -339,6 +339,17 @@ unsigned int serdev_device_set_baudrate(struct serdev_device *serdev, unsigned i
> >  }
> >  EXPORT_SYMBOL_GPL(serdev_device_set_baudrate);
> >  
> > +void serdev_device_set_break_detection(struct serdev_device *serdev, bool enable)
> > +{
> > +	struct serdev_controller *ctrl = serdev->ctrl;
> > +
> > +	if (!ctrl || !ctrl->ops->set_break_detection)
> > +		return;
> 
> Why you need to test for !ctrl?

In our case we don't, it's an extra check like all the other functions
here:

https://elixir.bootlin.com/linux/v6.9-rc7/source/drivers/tty/serdev/core.c#L330

> 
> > +	ctrl->ops->set_break_detection(ctrl, enable);
> 
> I'd use positive logic here:
> 
> 	if (ctrl->ops->set_break_detection)
> 		ctrl->ops->set_break_detection(ctrl, enable);






[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux