staging: fbtft: Fixing GPIO handling issues
Subsystems (3)
v3 cover staging: fbtft: Fixing GPIO handling issues
This series fixes a number of GPIO handling issues after converting this driver to use descriptors.
The series has been tested on HX8347d display with parallel interface. Without first patch it's not working.
In v3:
- added staging prefix (Fabio)
- slightly amended commit message in the patch 1
- added Rb tag (Phil)
- dropped Fixes tag from the patch 2 (Greg)
Andy Shevchenko (4):
staging: fbtft: Rectify GPIO handling
staging: fbtft: Replace custom ->reset() with generic one
staging: fbtft: Don't spam logs when probe is deferred
staging: fbtft: Update TODO
drivers/staging/fbtft/TODO | 5 ----- drivers/staging/fbtft/fb_agm1264k-fl.c | 30 +++++++------------------- drivers/staging/fbtft/fb_bd663474.c | 4 ---- drivers/staging/fbtft/fb_ili9163.c | 4 ---- drivers/staging/fbtft/fb_ili9320.c | 1 - drivers/staging/fbtft/fb_ili9325.c | 4 ---- drivers/staging/fbtft/fb_ili9340.c | 1 - drivers/staging/fbtft/fb_s6d1121.c | 4 ---- drivers/staging/fbtft/fb_sh1106.c | 1 - drivers/staging/fbtft/fb_ssd1289.c | 4 ---- drivers/staging/fbtft/fb_ssd1325.c | 2 -- drivers/staging/fbtft/fb_ssd1331.c | 6 ++---- drivers/staging/fbtft/fb_ssd1351.c | 1 - drivers/staging/fbtft/fb_upd161704.c | 4 ---- drivers/staging/fbtft/fb_watterott.c | 1 - drivers/staging/fbtft/fbtft-bus.c | 3 +-- drivers/staging/fbtft/fbtft-core.c | 25 +++++++++------------ drivers/staging/fbtft/fbtft-io.c | 12 +++++------ 18 files changed, 27 insertions(+), 85 deletions(-)
Signature · 1 line
2.30.2
PATCH v3 1/4 staging: fbtft: Rectify GPIO handling
The infamous commit c440eee1a7a1 ("Staging: staging: fbtft: Switch to the GPIO descriptor interface") broke GPIO handling completely. It has already four commits to rectify and it seems not enough. In order to fix the mess here we:
1) Set default to "inactive" for all requested pins
2) Fix CS#, RD#, and WR# pins polarity since it's active low and GPIO descriptor interface takes it into consideration from the Device Tree or ACPI
3) Consolidate chip activation (CS# assertion) under default
->reset() callback
To summarize the expectations about polarity for GPIOs:
RD# Low
WR# Low
CS# Low
RESET# Low
DC or RS High
RW High
Data 0 .. 15 High
See also Adafruit learning course [1] for the example of the schematics.
While at it, drop unneeded NULL checks, since GPIO API is tolerant to that.
[1]: https://learn.adafruit.com/adafruit-2-8-and-3-2-color-tft-touchscreen-breakout-v2/downloads
--- drivers/staging/fbtft/fb_agm1264k-fl.c | 20 ++++++++++---------- drivers/staging/fbtft/fb_bd663474.c | 4 ---- drivers/staging/fbtft/fb_ili9163.c | 4 ---- drivers/staging/fbtft/fb_ili9320.c | 1 - drivers/staging/fbtft/fb_ili9325.c | 4 ---- drivers/staging/fbtft/fb_ili9340.c | 1 - drivers/staging/fbtft/fb_s6d1121.c | 4 ---- drivers/staging/fbtft/fb_sh1106.c | 1 - drivers/staging/fbtft/fb_ssd1289.c | 4 ---- drivers/staging/fbtft/fb_ssd1325.c | 2 -- drivers/staging/fbtft/fb_ssd1331.c | 6 ++---- drivers/staging/fbtft/fb_ssd1351.c | 1 - drivers/staging/fbtft/fb_upd161704.c | 4 ---- drivers/staging/fbtft/fb_watterott.c | 1 - drivers/staging/fbtft/fbtft-bus.c | 3 +-- drivers/staging/fbtft/fbtft-core.c | 13 ++++++------- drivers/staging/fbtft/fbtft-io.c | 12 ++++++------ 17 files changed, 25 insertions(+), 60 deletions(-)
drivers/staging/fbtft/fb_agm1264k-fl.c +10 -10
@@ -84,9 +84,9 @@ static void reset(struct fbtft_par *par)dev_dbg (par->info->device,"%s()\n" , __func__); -gpiod_set_value (par->gpio.reset,0 ); -udelay (20 );gpiod_set_value (par->gpio.reset,1 ); +udelay (20 ); +gpiod_set_value (par->gpio.reset,0 );mdelay (120 ); }
@@ -194,12 +194,12 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)/* select chip */ if (*buf) {/* cs1 */ -gpiod_set_value (par->CS0,1 ); -gpiod_set_value (par->CS1,0 ); - }else { -/* cs0 */ gpiod_set_value (par->CS0,0 );gpiod_set_value (par->CS1,1 ); + }else { +/* cs0 */ +gpiod_set_value (par->CS0,1 ); +gpiod_set_value (par->CS1,0 ); }gpiod_set_value (par->RS,0 );/* RS->0 (command mode) */
@@ -397,8 +397,8 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) }kfree (convert_buf); -gpiod_set_value (par->CS0,1 ); -gpiod_set_value (par->CS1,1 ); +gpiod_set_value (par->CS0,0 ); +gpiod_set_value (par->CS1,0 );return ret; }
@@ -419,10 +419,10 @@ static int write(struct fbtft_par *par, void *buf, size_t len)for (i =0 ; i <8 ; ++i)gpiod_set_value (par->gpio.db[i], data & (1 << i));/* set E */ -gpiod_set_value (par->EPIN,1 ); +gpiod_set_value (par->EPIN,0 );udelay (5 );/* unset E - write */ -gpiod_set_value (par->EPIN,0 ); +gpiod_set_value (par->EPIN,1 );udelay (1 ); }
drivers/staging/fbtft/fb_bd663474.c +0 -4
@@ -12,7 +12,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
@@ -24,9 +23,6 @@static int init_display (struct fbtft_par *par) { -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ - par->fbtftops.reset (par);/* Initialization sequence from Lib_UTFT */
drivers/staging/fbtft/fb_ili9163.c +0 -4
@@ -11,7 +11,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include <video/mipi_display.h>
@@ -77,9 +76,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ -write_reg (par,MIPI_DCS_SOFT_RESET );/* software reset */ mdelay (500 );write_reg (par,MIPI_DCS_EXIT_SLEEP_MODE );/* exit sleep */
drivers/staging/fbtft/fb_ili9320.c +0 -1
@@ -8,7 +8,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/spi/spi.h> #include <linux/delay.h>
drivers/staging/fbtft/fb_ili9325.c +0 -4
@@ -10,7 +10,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
@@ -85,9 +84,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ - bt &=0x07 ; vc &=0x07 ; vrh &=0x0f ;
drivers/staging/fbtft/fb_ili9340.c +0 -1
@@ -8,7 +8,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include <video/mipi_display.h>
drivers/staging/fbtft/fb_s6d1121.c +0 -4
@@ -12,7 +12,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
@@ -29,9 +28,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ -/* Initialization sequence from Lib_UTFT */ write_reg (par,0x0011 ,0x2004 );
drivers/staging/fbtft/fb_sh1106.c +0 -1
@@ -9,7 +9,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
drivers/staging/fbtft/fb_ssd1289.c +0 -4
@@ -10,7 +10,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include "fbtft.h"
@@ -28,9 +27,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ -write_reg (par,0x00 ,0x0001 );write_reg (par,0x03 ,0xA8A4 );write_reg (par,0x0C ,0x0000 );
drivers/staging/fbtft/fb_ssd1325.c +0 -2
@@ -35,8 +35,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -gpiod_set_value (par->gpio.cs,0 ); -write_reg (par,0xb3 );write_reg (par,0xf0 );write_reg (par,0xae );
drivers/staging/fbtft/fb_ssd1331.c +2 -4
@@ -81,8 +81,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)va_start (args, len); *buf = (u8)va_arg(args, unsigned int); -if (par->gpio.dc) -gpiod_set_value (par->gpio.dc,0 ); +gpiod_set_value (par->gpio.dc,0 ); ret = par->fbtftops.write (par, par->buf,sizeof (u8));if (ret <0 ) {va_end (args);
@@ -104,8 +103,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)return ; } } -if (par->gpio.dc) -gpiod_set_value (par->gpio.dc,1 ); +gpiod_set_value (par->gpio.dc,1 );va_end (args); }
drivers/staging/fbtft/fb_ssd1351.c +0 -1
@@ -2,7 +2,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/spi/spi.h> #include <linux/delay.h>
drivers/staging/fbtft/fb_upd161704.c +0 -4
@@ -12,7 +12,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
@@ -26,9 +25,6 @@ static int init_display(struct fbtft_par *par) { par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ -/* Initialization sequence from Lib_UTFT */ /* register reset */
drivers/staging/fbtft/fb_watterott.c +0 -1
@@ -8,7 +8,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio/consumer.h> #include <linux/delay.h> #include "fbtft.h"
drivers/staging/fbtft/fbtft-bus.c +1 -2
@@ -135,8 +135,7 @@ int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len) remain = len /2 ; vmem16 = (u16 *)(par->info->screen_buffer + offset); -if (par->gpio.dc) -gpiod_set_value (par->gpio.dc,1 ); +gpiod_set_value (par->gpio.dc,1 );/* non buffered write */ if (!par->txbuf.buf)
drivers/staging/fbtft/fbtft-core.c +6 -7
@@ -38,8 +38,7 @@ int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, size_t len, int dc) {int ret; -if (par->gpio.dc) -gpiod_set_value (par->gpio.dc, dc); +gpiod_set_value (par->gpio.dc, dc); ret = par->fbtftops.write (par, buf, len);if (ret <0 )
@@ -79,7 +78,7 @@ static int fbtft_request_one_gpio(struct fbtft_par *par,int ret =0 ; *gpiop =devm_gpiod_get_index_optional (dev, name, index, -GPIOD_OUT_HIGH ); +GPIOD_OUT_LOW );if (IS_ERR (*gpiop)) { ret =PTR_ERR (*gpiop); dev_err(dev,
@@ -226,11 +225,15 @@ static void fbtft_reset(struct fbtft_par *par) {if (!par->gpio.reset)return ; +fbtft_par_dbg (DEBUG_RESET , par,"%s()\n" , __func__); +gpiod_set_value_cansleep (par->gpio.reset,1 );usleep_range (20 ,40 );gpiod_set_value_cansleep (par->gpio.reset,0 );msleep (120 ); + +gpiod_set_value_cansleep (par->gpio.cs,1 );/* Activate chip */ } static void fbtft_update_display(struct fbtft_par *par, unsigned int start_line,
@@ -922,8 +925,6 @@ static int fbtft_init_display_from_property(struct fbtft_par *par) goto out_free; par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ index =-1 ; val = values[++index];
@@ -1018,8 +1019,6 @@ int fbtft_init_display(struct fbtft_par *par) } par->fbtftops.reset (par); -if (par->gpio.cs) -gpiod_set_value (par->gpio.cs,0 );/* Activate chip */ i =0 ;while (i <FBTFT_MAX_INIT_SEQUENCE ) {
drivers/staging/fbtft/fbtft-io.c +6 -6
@@ -142,12 +142,12 @@ int fbtft_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len) data = *(u8 *)buf;/* Start writing by pulling down /WR */ -gpiod_set_value (par->gpio.wr,0 ); +gpiod_set_value (par->gpio.wr,1 );/* Set data */ #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO if (data == prev_data) { -gpiod_set_value (par->gpio.wr,0 );/* used as delay */ +gpiod_set_value (par->gpio.wr,1 );/* used as delay */ }else {for (i =0 ; i <8 ; i++) {if ((data &1 ) != (prev_data &1 ))
@@ -165,7 +165,7 @@ int fbtft_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len)#endif /* Pullup /WR */ -gpiod_set_value (par->gpio.wr,1 ); +gpiod_set_value (par->gpio.wr,0 );#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO prev_data = *(u8 *)buf;
@@ -192,12 +192,12 @@ int fbtft_write_gpio16_wr(struct fbtft_par *par, void *buf, size_t len) data = *(u16 *)buf;/* Start writing by pulling down /WR */ -gpiod_set_value (par->gpio.wr,0 ); +gpiod_set_value (par->gpio.wr,1 );/* Set data */ #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO if (data == prev_data) { -gpiod_set_value (par->gpio.wr,0 );/* used as delay */ +gpiod_set_value (par->gpio.wr,1 );/* used as delay */ }else {for (i =0 ; i <16 ; i++) {if ((data &1 ) != (prev_data &1 ))
@@ -215,7 +215,7 @@ int fbtft_write_gpio16_wr(struct fbtft_par *par, void *buf, size_t len)#endif /* Pullup /WR */ -gpiod_set_value (par->gpio.wr,1 ); +gpiod_set_value (par->gpio.wr,0 );#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO prev_data = *(u16 *)buf;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerRe: [PATCH v3 1/4] staging: fbtft: Rectify GPIO handling
Quoted 26 lines · Andy Shevchenko
The infamous commit
c440eee1a7a1("Staging: staging: fbtft: Switch to the GPIO descriptor interface") broke GPIO handling completely. It has already four commits to rectify and it seems not enough. In order to fix the mess here we:1) Set default to "inactive" for all requested pins
2) Fix CS#, RD#, and WR# pins polarity since it's active low and GPIO descriptor interface takes it into consideration from the Device Tree or ACPI
3) Consolidate chip activation (CS# assertion) under default
->reset() callbackTo summarize the expectations about polarity for GPIOs:
RD# Low WR# Low CS# Low RESET# Low DC or RS High RW High Data 0 .. 15 HighSee also Adafruit learning course [1] for the example of the schematics.
Quoted 8 lines
While at it, drop unneeded NULL checks, since GPIO API is tolerant to that.
[1]: https://learn.adafruit.com/adafruit-2-8-and-3-2-color-tft-touchscreen-breakout-v2/downloads
Fixes 92e3e884887c ("Staging: staging: fbtft: Fix GPIO handling")Fixes b918d1c27066 ("Staging: staging: fbtft: Fix reset assertion when using gpio descriptor")Fixes dbc4f989c878 ("Staging: staging: fbtft: Fix probing of gpio descriptor")Fixes c440eee1a7a1 ("Staging: staging: fbtft: Switch to the gpio descriptor interface")
I get the following error when trying to apply this:
Fixes tag: Fixes: 92e3e884887c ("Staging: staging: fbtft: Fix GPIO handling")
Has these problem(s):
- Subject does not match target commit subject
Just use
git log -1 --format='Fixes: %h ("%s")'
Fixes tag: Fixes: b918d1c27066 ("Staging: staging: fbtft: Fix reset assertion when using gpio descriptor") Has these problem(s):
- Subject does not match target commit subject
Just use
git log -1 --format='Fixes: %h ("%s")'
Fixes tag: Fixes: dbc4f989c878 ("Staging: staging: fbtft: Fix probing of gpio descriptor") Has these problem(s):
- Subject does not match target commit subject
Just use
git log -1 --format='Fixes: %h ("%s")'
Fixes tag: Fixes: c440eee1a7a1 ("Staging: staging: fbtft: Switch to the gpio descriptor interface") Has these problem(s):
- Subject does not match target commit subject
Just use
git log -1 --format='Fixes: %h ("%s")'
Please fix up for your next version of this series.
thanks,
greg k-h
Re: [PATCH v3 1/4] staging: fbtft: Rectify GPIO handling
Quoted 8 lines · Greg Kroah-Hartman
Quoted 4 lines · Andy Shevchenko
Fixes 92e3e884887c ("Staging: staging: fbtft: Fix GPIO handling")Fixes b918d1c27066 ("Staging: staging: fbtft: Fix reset assertion when using gpio descriptor")Fixes dbc4f989c878 ("Staging: staging: fbtft: Fix probing of gpio descriptor")Fixes c440eee1a7a1 ("Staging: staging: fbtft: Switch to the gpio descriptor interface")I get the following error when trying to apply this:
Argh, i replaced over all commit messages when added staging prefix. Thanks for catching this!
Quoted 1 line
Please fix up for your next version of this series.
Will do!
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v3 2/4 staging: fbtft: Replace custom ->reset() with generic one
In reply to Andy ShevchenkoThe custom ->reset() repeats the generic one, replace it.
Note, in newer kernels the context of the function is a sleeping one, it's fine to switch over to the sleeping functions. Keeping the reset line asserted longer than 20 microseconds is also okay, it's an idling state of the hardware.
--- drivers/staging/fbtft/fb_agm1264k-fl.c | 14 -------------- 1 file changed, 14 deletions(-)
drivers/staging/fbtft/fb_agm1264k-fl.c +0 -14
@@ -77,19 +77,6 @@ static int init_display(struct fbtft_par *par)return 0 ; } -static void reset (struct fbtft_par *par) -{ -if (!par->gpio.reset) -return ; - -dev_dbg (par->info->device,"%s()\n" , __func__); - -gpiod_set_value (par->gpio.reset,1 ); -udelay (20 ); -gpiod_set_value (par->gpio.reset,0 ); -mdelay (120 ); -} -/* Check if all necessary GPIOS defined */ static int verify_gpios (struct fbtft_par *par) {
@@ -439,7 +426,6 @@ static struct fbtft_display display = { .set_addr_win = set_addr_win, .verify_gpios = verify_gpios, .request_gpios_match = request_gpios_match, - .reset = reset, .write = write, .write_register = write_reg8_bus8, .write_vmem = write_vmem,
Signature · 1 line
2.30.2
PATCH v3 3/4 staging: fbtft: Don't spam logs when probe is deferred
In reply to Andy ShevchenkoWhen requesting GPIO line the probe can be deferred. In such case don't spam logs with an error message. This can be achieved by switching to dev_err_probe().
--- drivers/staging/fbtft/fbtft-core.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/staging/fbtft/fbtft-core.c +4 -8
@@ -75,20 +75,16 @@ static int fbtft_request_one_gpio(struct fbtft_par *par, struct gpio_desc **gpiop) {struct device *dev = par->info->device; -int ret =0 ; *gpiop =devm_gpiod_get_index_optional (dev, name, index,GPIOD_OUT_LOW ); -if (IS_ERR (*gpiop)) { - ret =PTR_ERR (*gpiop); -dev_err (dev, -"Failed to request %s GPIO: %d\n" , name, ret); -return ret; - } +if (IS_ERR (*gpiop)) +dev_err_probe (dev,PTR_ERR (*gpiop),"Failed to request %s GPIO\n" , name); +fbtft_par_dbg (DEBUG_REQUEST_GPIOS , par,"%s: '%s' GPIO\n" , __func__, name); -return ret; +return 0 ; }static int fbtft_request_gpios (struct fbtft_par *par)
Signature · 1 line
2.30.2
Re: [PATCH v3 3/4] staging: fbtft: Don't spam logs when probe is deferred
Quoted 6 lines · Andy Shevchenko
drivers/staging/fbtft/fbtft-core.c +0
-1@@ -75,20 +75,16 @@ static int fbtft_request_one_gpio(struct fbtft_par *par, struct gpio_desc **gpiop) {struct device *dev = par->info->device; -int ret =0 ;
drivers/staging/fbtft/fbtft-core.c static int fbtft_request_one_gpio(struct fbtft_par *par, · line 82
Quoted 10 lines
drivers/staging/fbtft/fbtft-core.c +2
-6*gpiop =devm_gpiod_get_index_optional (dev, name, index,GPIOD_OUT_LOW ); -if (IS_ERR (*gpiop)) { - ret =PTR_ERR (*gpiop); -dev_err (dev, -"Failed to request %s GPIO: %d\n" , name, ret); -return ret; - } +if (IS_ERR (*gpiop)) +dev_err_probe (dev,PTR_ERR (*gpiop),"Failed to request %s GPIO\n" , name);
This should be a return statement:
return dev_err_probe(dev, PTR_ERR(*gpiop), "Failed to request %s GPIO\n", name);
drivers/staging/fbtft/fbtft-core.c static int fbtft_request_one_gpio(struct fbtft_par *par, · line 88
Quoted 7 lines
drivers/staging/fbtft/fbtft-core.c +2
-1+fbtft_par_dbg (DEBUG_REQUEST_GPIOS , par,"%s: '%s' GPIO\n" , __func__, name); -return ret; +return 0 ; }
regards,
dan carpenter
Re: [PATCH v3 3/4] staging: fbtft: Don't spam logs when probe is deferred
Quoted 20 lines · Dan Carpenter
Quoted 6 lines · Andy Shevchenko
drivers/staging/fbtft/fbtft-core.c +0
-1@@ -75,20 +75,16 @@ static int fbtft_request_one_gpio(struct fbtft_par *par, struct gpio_desc **gpiop) {struct device *dev = par->info->device; -int ret =0 ;drivers/staging/fbtft/fbtft-core.c static int fbtft_request_one_gpio(struct fbtft_par *par, · line 82
Quoted 10 lines
drivers/staging/fbtft/fbtft-core.c +2
-6*gpiop =devm_gpiod_get_index_optional (dev, name, index,GPIOD_OUT_LOW ); -if (IS_ERR (*gpiop)) { - ret =PTR_ERR (*gpiop); -dev_err (dev, -"Failed to request %s GPIO: %d\n" , name, ret); -return ret; - } +if (IS_ERR (*gpiop)) +dev_err_probe (dev,PTR_ERR (*gpiop),"Failed to request %s GPIO\n" , name);This should be a return statement:
Quoted 2 lines
return dev_err_probe(dev, PTR_ERR(*gpiop), "Failed to request %s GPIO\n", name);
I've created a new Smatch check for these:
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c:2890 mcp251xfd_probe() warn: pointer error 'PTR_ERR(clk)' not handled
There aren't that many bugs... Anyway, I'm running a test now and I guess we'll see tomorrow how it goes.
regards,
dan carpenter
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 3/4] staging: fbtft: Don't spam logs when probe is deferred
In reply to Dan CarpenterQuoted 8 lines · Dan Carpenter
drivers/staging/fbtft/fbtft-core.c static int fbtft_request_one_gpio(struct fbtft_par *par, · line 82
Quoted 2 lines · Andy Shevchenko
drivers/staging/fbtft/fbtft-core.c +2
-0+if (IS_ERR (*gpiop)) +dev_err_probe (dev,PTR_ERR (*gpiop),"Failed to request %s GPIO\n" , name);This should be a return statement:
return dev_err_probe(dev, PTR_ERR(*gpiop), "Failed to request %s GPIO\n", name);
Thanks!
Funny that I have trapped to this and my patch that adds __must_check to avoid exactly this situations had been reverted :-(
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v3 4/4 staging: fbtft: Update TODO
In reply to Andy ShevchenkoNow, after a few fixes we may consider the conversion to the GPIO descriptor API is done.
--- drivers/staging/fbtft/TODO | 5 ----- 1 file changed, 5 deletions(-)
drivers/staging/fbtft/TODO +0 -5
@@ -1,8 +1,3 @@ -* convert all uses of the old GPIO API from <linux/gpio.h> to the - GPIO descriptor API in <linux/gpio/consumer.h> and look up GPIO - lines from device tree, ACPI or board files, board files should - use <linux/gpio/machine.h> - * convert all these over to drm_simple_display_pipe and submit for inclusion into the DRM subsystem under drivers/gpu/drm - fbdev doesn't take any new drivers anymore.
Signature · 1 line
2.30.2