Dmitry Eremin-Solenikov wrote: > Thanks for the patch. Is it based on real issue, or just clear thought?
Just on - hopefully clear - thought :) What I'm after is trimming struct at86rf230_local before splitting the driver into the AT86RF230-specific part and communication (SPI, USB, etc.) specific parts. The spinlock doesn't seem to accomplish much. In at86rf230_xmit you're protected from many things by the pib_lock mutex in mac802154_xmit_worker. The only write-write conflict could be with at86rf230_irqwork, but you don't even need to write there. By moving the setting of is_tx past the transition to TX_ON/PLL_ON, I eliminate the read-write conflict (in the unlikely case is_tx could not be set or tested atomically) as well. Setting is_tx before changing into TX_ON/PLL_ON opened the driver to races between an incoming packet and the completion of the transition. We also need to synchronize with the interrupt (in case we're on SMP) and then the worker before setting is_tx. Otherwise, the worker would be invoked for a received frame, find is_tx set, and instead of receiving the frame, acknowledge the transmission, desynchronizing driver and transceiver. Thinking of it, I was wrong about the risk of getting a BUG_ON. That couldn't happen. Last but not least, when the wait_for_completion_interruptible is actually interrupted, you tried to transition to RX_ON with STATE_RX_ON, which - according to the data sheet - would be allowed in TX_ON/PLL_ON but not in BUSY_TX, where the transceiver may still be at that time. I'm not sure if it really makes sense to even allow interruption here, but I didn't want to change the functionality. - Werner ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ Linux-zigbee-devel mailing list Linux-zigbee-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel