I briefly tested the patch with 7 different working controllers and the...
packet callback seems to complete() always before the arbitrarily
chosen timeout of 10ms plus rounding.
void fw_send_phy_config(struct fw_card *card,...
int node_id, int generation, int gap_count)
{
- struct fw_phy_packet p;
+ struct fw_phy_packet *p;
+ long timeout = DIV_ROUND_UP(HZ, 100);
u32 data = PHY_IDENTIFIER(PHY_PACKET_CONFIG) |
+ card->driver->send_request(card, &p->packet);
+ timeout = wait_for_completion_timeout(&p->done, timeout);
+ kref_put(&p->kref, phy_packet_release);
- card->driver->send_request(card, &p.packet);
- wait_for_completion(&p.done);
+ /* will leak p if the callback is never executed */
+ WARN_ON(timeout == 0);
}