Re: [PATCH] typec: fusb302: Use dev_err during probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/23/2017 01:41 PM, Mats Karrman wrote:
If probe fails, fusb302_debugfs_exit is called making it impossible
to view any logs so use normal dev_err for any error messages during
probe.

Signed-off-by: Mats Karrman <mats.dev.list@xxxxxxxxx>
---
  drivers/staging/typec/fusb302/fusb302.c | 21 +++++++++++----------
  1 file changed, 11 insertions(+), 10 deletions(-)


The driver is now out of staging.

diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c
index fc6a3cf..a9903a2 100644
--- a/drivers/staging/typec/fusb302/fusb302.c
+++ b/drivers/staging/typec/fusb302/fusb302.c
@@ -1737,27 +1737,27 @@ static int init_gpio(struct fusb302_chip *chip)
  	int ret = 0;
node = chip->dev->of_node;
-	chip->gpio_int_n = of_get_named_gpio(node, "fcs,int_n", 0);
+	chip->gpio_int_n = of_get_named_gpio(node, "fcs,int_n-gpios", 0);
  	if (!gpio_is_valid(chip->gpio_int_n)) {
  		ret = chip->gpio_int_n;
-		fusb302_log(chip, "cannot get named GPIO Int_N, ret=%d", ret);
+		dev_err(chip->dev, "cannot get named GPIO Int_N, ret=%d", ret);
  		return ret;
  	}
  	ret = devm_gpio_request(chip->dev, chip->gpio_int_n, "fcs,int_n");
  	if (ret < 0) {
-		fusb302_log(chip, "cannot request GPIO Int_N, ret=%d", ret);
+		dev_err(chip->dev, "cannot request GPIO Int_N, ret=%d", ret);
  		return ret;
  	}
  	ret = gpio_direction_input(chip->gpio_int_n);
  	if (ret < 0) {
-		fusb302_log(chip,
-			    "cannot set GPIO Int_N to input, ret=%d", ret);
+		dev_err(chip->dev,
+			"cannot set GPIO Int_N to input, ret=%d", ret);
  		return ret;
  	}
  	ret = gpio_to_irq(chip->gpio_int_n);
  	if (ret < 0) {
-		fusb302_log(chip,
-			    "cannot request IRQ for GPIO Int_N, ret=%d", ret);
+		dev_err(chip->dev,
+			"cannot request IRQ for GPIO Int_N, ret=%d", ret);
  		return ret;
  	}
  	chip->gpio_int_n_irq = ret;
@@ -1854,7 +1854,8 @@ static int fusb302_probe(struct i2c_client *client,
  	chip->tcpm_port = tcpm_register_port(&client->dev, &chip->tcpc_dev);
  	if (IS_ERR(chip->tcpm_port)) {
  		ret = PTR_ERR(chip->tcpm_port);
-		fusb302_log(chip, "cannot register tcpm port, ret=%d", ret);
+		dev_err(&client->dev,
+			"cannot register tcpm port, ret=%d", ret);
  		goto destroy_workqueue;
  	}
@@ -1863,8 +1864,8 @@ static int fusb302_probe(struct i2c_client *client,
  					IRQF_ONESHOT | IRQF_TRIGGER_LOW,
  					"fsc_interrupt_int_n", chip);
  	if (ret < 0) {
-		fusb302_log(chip,
-			    "cannot request IRQ for GPIO Int_N, ret=%d", ret);
+		dev_err(&client->dev,
+			"cannot request IRQ for GPIO Int_N, ret=%d", ret);

You can use the 'dev' variable in the probe function.

  		goto tcpm_unregister_port;
  	}
  	enable_irq_wake(chip->gpio_int_n_irq);


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux