Hello! On 13.02.2019 19:36, Heikki Krogerus wrote:
To prevent loading of the driver when the PD controller is still in some operational mode that the driver does not support, checking the mode in driver probe callback function. TI PD controllers may be in undefined mode of operation for example when the application code (firmware) is completely missing. Signed-off-by: Heikki Krogerus <[email protected]> --- drivers/usb/typec/tps6598x.c | 53 +++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/drivers/usb/typec/tps6598x.c b/drivers/usb/typec/tps6598x.c index 1c0033ad8738..9947c87d2a1e 100644 --- a/drivers/usb/typec/tps6598x.c +++ b/drivers/usb/typec/tps6598x.c
[...]
@@ -384,6 +400,32 @@ static irqreturn_t tps6598x_interrupt(int irq, void *data) return IRQ_HANDLED; }+static int tps6598x_check_mode(struct tps6598x *tps)+{ + char mode[5] = { }; + int ret; + + ret = tps6598x_read32(tps, TPS_REG_MODE, (void *)mode);
Casting pointers to 'void *' happens automagically, doesn't i? [...] MBR, Sergei
