staging: typec: fusb302: refactor resume retry mechanism
authorRui Miguel Silva <rmfrfs@gmail.com>
Fri, 12 May 2017 20:16:15 +0000 (21:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 May 2017 12:23:31 +0000 (14:23 +0200)
commit50b7c322cfc8b44a36b1373dab2177db23e3282c
treecca951e511cf8d6c1f229c0a938adb390a738c19
parentf0d39a179b9cd38c739acfc4f92720a0c79e1d66
staging: typec: fusb302: refactor resume retry mechanism

The i2c functions need to test the pm_suspend state and do, if needed, some
retry before i2c operations. This code was repeated 4x.

To isolate this, create a new function to check suspend state and call it in
every need place.

As at it, move the error message from pr_err to dev_err.

Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Acked-by: Yueyao Zhu <yueyao.zhu@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/typec/fusb302/fusb302.c