Thread (3 messages) 3 messages, 2 authors, 2021-01-27

Re: [PATCH v4] fbtft: add tearing signal detect

From: carlis <hidden>
Date: 2021-01-27 03:52:52
Also in: dri-devel, lkml

On Tue, 26 Jan 2021 20:51:41 +0300
Dan Carpenter [off-list ref] wrote:
On Tue, Jan 26, 2021 at 08:40:35PM +0800, Carlis wrote:
quoted
@@ -82,6 +111,29 @@ enum st7789v_command {
  */
 static int init_display(struct fbtft_par *par)
 {
+	int rc;
+	struct device *dev = par->info->device;
+
+	par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0,
GPIOD_IN);
+	if (par->gpio.te) {  
I explained in my earlier review that devm_gpiod_get_index_optional()
can return error pointers...  There was quite a bit of detail about
how to handle this correctly in my earlier review, but I think you
might not have noticed it.  Please read it again.
quoted
+		init_completion(&spi_panel_te);
+		mutex_init(&te_mutex);
+		rc = devm_request_irq(dev,
+				      gpiod_to_irq(par->gpio.te),
+				     spi_panel_te_handler,
IRQF_TRIGGER_RISING,
+				     "TE_GPIO", par);
+		if (rc) {
+			pr_err("TE request_irq failed.\n");
+			devm_gpiod_put(dev, par->gpio.te);
+			par->gpio.te = NULL;
+		} else {
+
disable_irq_nosync(gpiod_to_irq(par->gpio.te));
+			pr_info("TE request_irq completion.\n");
+		}
+	} else {
+		pr_err("%s:%d, TE gpio not specified\n",
+		       __func__, __LINE__);
+	}  
regards,
dan carpenter
Thank you for your correction,i will change pr_err to pr_info in next
patch v5

regards,
dan carpenter
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help