AW: [PATCH 06/12] kern_tc.c: Replace FREEBSD event mechanism by adding pointers to function

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Apr 7 11:52:06 UTC 2022


On 07/04/2022 11:57, Gabriel.Moyano at dlr.de wrote:
>> On 07/04/2022 10:36, Gabriel Moyano wrote:
>>> +#else /* __rtems__ */
>>> +            if (pps->wait_event != NULL)
>>> +                err = (*pps->wait_event)(pps, fapi->timeout);
>>> +            else
>>> +                err = EAGAIN;
>>> +#endif /* __rtems__ */
>>>    			if (err == EWOULDBLOCK) {
>>>    				if (fapi->timeout.tv_sec == -1) {
>>>    					continue;
>>> @@ -2227,7 +2240,12 @@ pps_event(struct pps_state *pps, int event)
>>>    #endif
>>>
>>>    	/* Wakeup anyone sleeping in pps_fetch().  */
>>> +#ifndef __rtems__
>>>    	wakeup(pps);
>>> +#else /* __rtems__ */
>>> +    if (pps->wakeup != NULL)
>>> +        (*pps->wakeup)(pps);
>>> +#endif /* __rtems__ */
>> I would not allow a NULL pointer here. The driver shall provide callbacks.
> Do you mean to add an assert?

Yes, an _Assert() doesn't hurt.

Check for non-NULL in pps_init()? Since this function has no return 
code, you need a fatal error. Alternatively, you could add an 
RTEMS-specific API for PPS device drivers. It should not use a file 
descriptor, just struct pps_state (maybe embedded in an RTEMS-specific 
structure).

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list