This retry and the above code to deactivate any active data calls are the only differences between this and the core rilmodem gprs atom.

What do you think about creating an extern function in rilmodem/gprs.c that could be called by this function?  You could add a parameter which would control whether the data call deactivation occurs.