Re: [RFC PATCHv4 4/7] HSI: hsi_char: Add HSI char device driver

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alan Cox
Date: Tuesday, December 14, 2010 - 4:56 am

> +#define HSI_CHST_RD(c)		((c)->state & HSI_CHST_RD_MASK)


These sort of macros just hide detail - eg the lack of internal locking,
which can lead to problems later, plus they reference their arguments
multiple times so may have weird side effects.

They should probably be inline functions so they at least type check and
behave sanely, and their locking rules defintiely need documenting




-EIO is the traditional response in this case if the channel has been
closed by the other end - ENODEV indicates there is no physical device
present - not sure which is right here from the code.



What locks this lot against races (ditto some of the other ioctl code)


You seem to construct a lot of clever stuff using atomic_inc_return and
friends where it looks like test_and_set_bit - or even a mutex over
open/close would be far easier to understand ?


What happens here if a second open passes the first, the attached will
stay zero and other stuff will be in strange states but the open flag
will be set ?



How will this integrate with hot discovery of SSI supporting devices ?

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC PATCHv4 0/7] HSI framework and drivers, Carlos Chinea, (Tue Dec 14, 3:09 am)
[RFC PATCHv4 1/7] HSI: hsi: Introducing HSI framework, Carlos Chinea, (Tue Dec 14, 3:09 am)
[RFC PATCHv4 6/7] HSI: Add HSI API documentation, Carlos Chinea, (Tue Dec 14, 3:09 am)
[RFC PATCHv4 7/7] HSI: hsi_char: Update ioctl-number.txt, Carlos Chinea, (Tue Dec 14, 3:09 am)
Re: [RFC PATCHv4 4/7] HSI: hsi_char: Add HSI char device d ..., Alan Cox, (Tue Dec 14, 4:56 am)