All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] staging: olpc_dcon: olpc_dcon_xo_1.c: Switch to the gpio descriptor interface
@ 2018-11-03 11:08 Nishad Kamdar
  2018-11-04  1:23 ` kbuild test robot
  2018-11-04  4:36 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Nishad Kamdar @ 2018-11-03 11:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jens Frederich, Daniel Drake, Jon Nettleton, devel, linux-kernel

Use the gpiod interface instead of the deprecated old non-descriptor
interface in olpc_dcon_xo_1.c.
---
Changes in v2:
 - Resolve a few compilation errors.
 - Add a level of indirection to read and write gpios.
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
---
 drivers/staging/olpc_dcon/olpc_dcon_xo_1.c | 89 +++++++++++-----------
 1 file changed, 46 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
index ff145d493e1b..29b93897ccae 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
@@ -11,35 +11,50 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/cs5535.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/delay.h>
 #include <asm/olpc.h>
 
 #include "olpc_dcon.h"
 
+enum dcon_gpios {
+	DCON_STAT0,
+	DCON_STAT1,
+	DCON_IRQ,
+	DCON_LOAD,
+	DCON_BLANK,
+};
+
+struct dcon_gpio {
+	const char *name;
+	unsigned long flags;
+};
+
+static const struct dcon_gpio gpios_asis[] = {
+	[DCON_STAT0] = { .name = "dcon_stat0", .flags = GPIO_ASIS },
+	[DCON_STAT1] = { .name = "dcon_stat1", .flags = GPIO_ASIS },
+	[DCON_IRQ] = { .name = "dcon_irq", .flags = GPIO_ASIS },
+	[DCON_LOAD] = { .name = "dcon_load", .flags = GPIO_ASIS },
+	[DCON_BLANK] = { .name = "dcon_blank", .flag = GPIO_ASIS },
+};
+
+struct gpio_desc *gpios[5];
+
 static int dcon_init_xo_1(struct dcon_priv *dcon)
 {
 	unsigned char lob;
-
-	if (gpio_request(OLPC_GPIO_DCON_STAT0, "OLPC-DCON")) {
-		pr_err("failed to request STAT0 GPIO\n");
-		return -EIO;
-	}
-	if (gpio_request(OLPC_GPIO_DCON_STAT1, "OLPC-DCON")) {
-		pr_err("failed to request STAT1 GPIO\n");
-		goto err_gp_stat1;
-	}
-	if (gpio_request(OLPC_GPIO_DCON_IRQ, "OLPC-DCON")) {
-		pr_err("failed to request IRQ GPIO\n");
-		goto err_gp_irq;
-	}
-	if (gpio_request(OLPC_GPIO_DCON_LOAD, "OLPC-DCON")) {
-		pr_err("failed to request LOAD GPIO\n");
-		goto err_gp_load;
-	}
-	if (gpio_request(OLPC_GPIO_DCON_BLANK, "OLPC-DCON")) {
-		pr_err("failed to request BLANK GPIO\n");
-		goto err_gp_blank;
+	int ret, i;
+	struct dcon_gpio *pin = &gpios_asis[0];
+
+	for (i = 0; i < ARRAY_SIZE(gpios_asis); i++) {
+		gpios[i] = devm_gpiod_get(&dcon->client->dev, pin[i]->name,
+					  pin[i]->flags);
+		if (IS_ERR(gpios[i])) {
+			ret = PTR_ERR(gpios[i]);
+			pr_err("failed to request %s GPIO: %d\n", pin[i]->name,
+			       ret);
+			return ret;
+		}
 	}
 
 	/* Turn off the event enable for GPIO7 just to be safe */
@@ -61,12 +76,12 @@ static int dcon_init_xo_1(struct dcon_priv *dcon)
 	dcon->pending_src = dcon->curr_src;
 
 	/* Set the directions for the GPIO pins */
-	gpio_direction_input(OLPC_GPIO_DCON_STAT0);
-	gpio_direction_input(OLPC_GPIO_DCON_STAT1);
-	gpio_direction_input(OLPC_GPIO_DCON_IRQ);
-	gpio_direction_input(OLPC_GPIO_DCON_BLANK);
-	gpio_direction_output(OLPC_GPIO_DCON_LOAD,
-			      dcon->curr_src == DCON_SOURCE_CPU);
+	gpiod_direction_input(gpios[DCON_STAT0]);
+	gpiod_direction_input(gpios[DCON_STAT1]);
+	gpiod_direction_input(gpios[DCON_IRQ]);
+	gpiod_direction_input(gpios[DCON_BLANK]);
+	gpiod_direction_output(gpios[DCON_LOAD],
+			       dcon->curr_src == DCON_SOURCE_CPU);
 
 	/* Set up the interrupt mappings */
 
@@ -84,7 +99,7 @@ static int dcon_init_xo_1(struct dcon_priv *dcon)
 	/* Register the interrupt handler */
 	if (request_irq(DCON_IRQ, &dcon_interrupt, 0, "DCON", dcon)) {
 		pr_err("failed to request DCON's irq\n");
-		goto err_req_irq;
+		return -EIO;
 	}
 
 	/* Clear INV_EN for GPIO7 (DCONIRQ) */
@@ -125,18 +140,6 @@ static int dcon_init_xo_1(struct dcon_priv *dcon)
 	cs5535_gpio_set(OLPC_GPIO_DCON_BLANK, GPIO_EVENTS_ENABLE);
 
 	return 0;
-
-err_req_irq:
-	gpio_free(OLPC_GPIO_DCON_BLANK);
-err_gp_blank:
-	gpio_free(OLPC_GPIO_DCON_LOAD);
-err_gp_load:
-	gpio_free(OLPC_GPIO_DCON_IRQ);
-err_gp_irq:
-	gpio_free(OLPC_GPIO_DCON_STAT1);
-err_gp_stat1:
-	gpio_free(OLPC_GPIO_DCON_STAT0);
-	return -EIO;
 }
 
 static void dcon_wiggle_xo_1(void)
@@ -180,13 +183,13 @@ static void dcon_wiggle_xo_1(void)
 
 static void dcon_set_dconload_1(int val)
 {
-	gpio_set_value(OLPC_GPIO_DCON_LOAD, val);
+	gpiod_set_value(gpios[DCON_LOAD], val);
 }
 
 static int dcon_read_status_xo_1(u8 *status)
 {
-	*status = gpio_get_value(OLPC_GPIO_DCON_STAT0);
-	*status |= gpio_get_value(OLPC_GPIO_DCON_STAT1) << 1;
+	*status = gpiod_get_value(gpios[DCON_STAT0]);
+	*status |= gpiod_get_value(gpios[DCON_STAT1]) << 1;
 
 	/* Clear the negative edge status for GPIO7 */
 	cs5535_gpio_set(OLPC_GPIO_DCON_IRQ, GPIO_NEGATIVE_EDGE_STS);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] staging: olpc_dcon: olpc_dcon_xo_1.c: Switch to the gpio descriptor interface
  2018-11-03 11:08 [PATCH v2] staging: olpc_dcon: olpc_dcon_xo_1.c: Switch to the gpio descriptor interface Nishad Kamdar
@ 2018-11-04  1:23 ` kbuild test robot
  2018-11-04  4:36 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2018-11-04  1:23 UTC (permalink / raw)
  To: Nishad Kamdar
  Cc: kbuild-all, Greg Kroah-Hartman, devel, linux-kernel,
	Jon Nettleton, Daniel Drake, Jens Frederich

[-- Attachment #1: Type: text/plain, Size: 9599 bytes --]

Hi Nishad,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.19 next-20181102]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Nishad-Kamdar/staging-olpc_dcon-olpc_dcon_xo_1-c-Switch-to-the-gpio-descriptor-interface/20181104-041335
config: i386-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   In file included from drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:18:0:
>> drivers/staging/olpc_dcon/olpc_dcon.h:58:33: error: expected identifier before numeric constant
    #define DCON_IRQ                6
                                    ^
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:23:2: note: in expansion of macro 'DCON_IRQ'
     DCON_IRQ,
     ^~~~~~~~
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:34:50: error: 'GPIO_ASIS' undeclared here (not in a function); did you mean 'GPIOD_ASIS'?
     [DCON_STAT0] = { .name = "dcon_stat0", .flags = GPIO_ASIS },
                                                     ^~~~~~~~~
                                                     GPIOD_ASIS
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:37:3: error: 'DCON_LOAD' undeclared here (not in a function); did you mean 'DCON_STAT1'?
     [DCON_LOAD] = { .name = "dcon_load", .flags = GPIO_ASIS },
      ^~~~~~~~~
      DCON_STAT1
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:37:3: error: array index in initializer not of integer type
   drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:37:3: note: (near initialization for 'gpios_asis')
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:38:3: error: 'DCON_BLANK' undeclared here (not in a function); did you mean 'DCON_LOAD'?
     [DCON_BLANK] = { .name = "dcon_blank", .flag = GPIO_ASIS },
      ^~~~~~~~~~
      DCON_LOAD
   drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:38:3: error: array index in initializer not of integer type
   drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:38:3: note: (near initialization for 'gpios_asis')
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:38:42: error: 'const struct dcon_gpio' has no member named 'flag'; did you mean 'flags'?
     [DCON_BLANK] = { .name = "dcon_blank", .flag = GPIO_ASIS },
                                             ^~~~
                                             flags
   drivers/staging/olpc_dcon/olpc_dcon_xo_1.c: In function 'dcon_init_xo_1':
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:47:26: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     struct dcon_gpio *pin = &gpios_asis[0];
                             ^
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:50:42: error: dereferencing pointer to incomplete type 'struct i2c_client'
      gpios[i] = devm_gpiod_get(&dcon->client->dev, pin[i]->name,
                                             ^~
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:50:42: error: request for member 'dev' in something not a structure or union
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:50:55: error: invalid type argument of '->' (have 'struct dcon_gpio')
      gpios[i] = devm_gpiod_get(&dcon->client->dev, pin[i]->name,
                                                          ^~
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:50:55: error: request for member 'name' in something not a structure or union
   drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:51:14: error: invalid type argument of '->' (have 'struct dcon_gpio')
           pin[i]->flags);
                 ^~
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:51:14: error: request for member 'flags' in something not a structure or union
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:50:29: error: passing argument 1 of 'devm_gpiod_get' from incompatible pointer type [-Werror=incompatible-pointer-types]
      gpios[i] = devm_gpiod_get(&dcon->client->dev, pin[i]->name,
                                ^
   In file included from drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:14:0:
   include/linux/gpio/consumer.h:87:32: note: expected 'struct device *' but argument is of type 'const struct dcon_gpio (*)[1]'
    struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
                                   ^~~~~~~~~~~~~~
   drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:50:49: error: passing argument 2 of 'devm_gpiod_get' from incompatible pointer type [-Werror=incompatible-pointer-types]
      gpios[i] = devm_gpiod_get(&dcon->client->dev, pin[i]->name,
                                                    ^~~
   In file included from drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:14:0:
   include/linux/gpio/consumer.h:87:32: note: expected 'const char *' but argument is of type 'const struct dcon_gpio *'
    struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
                                   ^~~~~~~~~~~~~~
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:51:8: error: incompatible type for argument 3 of 'devm_gpiod_get'
           pin[i]->flags);
           ^~~
   In file included from drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:14:0:
   include/linux/gpio/consumer.h:87:32: note: expected 'enum gpiod_flags' but argument is of type 'const struct dcon_gpio *'
    struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
                                   ^~~~~~~~~~~~~~
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:50:12: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
      gpios[i] = devm_gpiod_get(&dcon->client->dev, pin[i]->name,
               ^
   In file included from include/linux/kernel.h:14:0,
                    from include/linux/cpumask.h:10,
                    from arch/x86/include/asm/cpumask.h:5,
                    from arch/x86/include/asm/msr.h:11,
                    from include/linux/cs5535.h:14,
                    from drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:13:
   drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:54:52: error: invalid type argument of '->' (have 'struct dcon_gpio')
       pr_err("failed to request %s GPIO: %d\n", pin[i]->name,
                                                       ^
   include/linux/printk.h:308:33: note: in definition of macro 'pr_err'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                                    ^~~~~~~~~~~
   drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:54:52: error: request for member 'name' in something not a structure or union
       pr_err("failed to request %s GPIO: %d\n", pin[i]->name,
                                                       ^
   include/linux/printk.h:308:33: note: in definition of macro 'pr_err'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                                    ^~~~~~~~~~~
   In file included from include/linux/printk.h:7:0,
                    from include/linux/kernel.h:14,
                    from include/linux/cpumask.h:10,
                    from arch/x86/include/asm/cpumask.h:5,
                    from arch/x86/include/asm/msr.h:11,
                    from include/linux/cs5535.h:14,
                    from drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:13:
>> include/linux/kern_levels.h:5:18: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'const struct dcon_gpio *' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH'
    #define KERN_ERR KERN_SOH "3" /* error conditions */
                     ^~~~~~~~
   include/linux/printk.h:308:9: note: in expansion of macro 'KERN_ERR'
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
            ^~~~~~~~
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:54:4: note: in expansion of macro 'pr_err'
       pr_err("failed to request %s GPIO: %d\n", pin[i]->name,
       ^~~~~~
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:82:29: error: array subscript is not an integer
     gpiod_direction_input(gpios[DCON_BLANK]);
                                ^
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:82:24: error: passing argument 1 of 'gpiod_direction_input' from incompatible pointer type [-Werror=incompatible-pointer-types]
     gpiod_direction_input(gpios[DCON_BLANK]);
                           ^~~~~
   In file included from drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:14:0:
   include/linux/gpio/consumer.h:110:5: note: expected 'struct gpio_desc *' but argument is of type 'const struct dcon_gpio *'
    int gpiod_direction_input(struct gpio_desc *desc);
        ^~~~~~~~~~~~~~~~~~~~~
   drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:83:30: error: array subscript is not an integer
     gpiod_direction_output(gpios[DCON_LOAD],
                                 ^

vim +58 drivers/staging/olpc_dcon/olpc_dcon.h

53c43c5ca Greg Kroah-Hartman 2016-04-04  56  
53c43c5ca Greg Kroah-Hartman 2016-04-04  57  /* Interrupt */
53c43c5ca Greg Kroah-Hartman 2016-04-04 @58  #define DCON_IRQ                6
53c43c5ca Greg Kroah-Hartman 2016-04-04  59  

:::::: The code at line 58 was first introduced by commit
:::::: 53c43c5ca13328ac8f415aa2251791b441a12b51 Revert "Staging: olpc_dcon: Remove obsolete driver"

:::::: TO: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 65877 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] staging: olpc_dcon: olpc_dcon_xo_1.c: Switch to the gpio descriptor interface
  2018-11-03 11:08 [PATCH v2] staging: olpc_dcon: olpc_dcon_xo_1.c: Switch to the gpio descriptor interface Nishad Kamdar
  2018-11-04  1:23 ` kbuild test robot
@ 2018-11-04  4:36 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2018-11-04  4:36 UTC (permalink / raw)
  To: Nishad Kamdar
  Cc: kbuild-all, Greg Kroah-Hartman, devel, linux-kernel,
	Jon Nettleton, Daniel Drake, Jens Frederich

[-- Attachment #1: Type: text/plain, Size: 13625 bytes --]

Hi Nishad,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.19 next-20181102]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Nishad-Kamdar/staging-olpc_dcon-olpc_dcon_xo_1-c-Switch-to-the-gpio-descriptor-interface/20181104-041335
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

>> drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:23:2: error: expected identifier before numeric constant
     DCON_IRQ,
     ^
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:34:50: error: 'GPIO_ASIS' undeclared here (not in a function); did you mean 'GPIOD_ASIS'?
     [DCON_STAT0] = { .name = "dcon_stat0", .flags = GPIO_ASIS },
                                                     ^~~~~~~~~
                                                     GPIOD_ASIS
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:37:3: error: 'DCON_LOAD' undeclared here (not in a function); did you mean 'DCON_STAT1'?
     [DCON_LOAD] = { .name = "dcon_load", .flags = GPIO_ASIS },
      ^~~~~~~~~
      DCON_STAT1
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:37:3: error: array index in initializer not of integer type
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:37:3: note: (near initialization for 'gpios_asis')
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:38:3: error: 'DCON_BLANK' undeclared here (not in a function); did you mean 'DCON_LOAD'?
     [DCON_BLANK] = { .name = "dcon_blank", .flag = GPIO_ASIS },
      ^~~~~~~~~~
      DCON_LOAD
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:38:3: error: array index in initializer not of integer type
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:38:3: note: (near initialization for 'gpios_asis')
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:38:42: error: 'const struct dcon_gpio' has no member named 'flag'; did you mean 'flags'?
     [DCON_BLANK] = { .name = "dcon_blank", .flag = GPIO_ASIS },
                                             ^~~~
                                             flags
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c: In function 'dcon_init_xo_1':
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:47:26: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     struct dcon_gpio *pin = &gpios_asis[0];
                             ^
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:50:42: error: dereferencing pointer to incomplete type 'struct i2c_client'
      gpios[i] = devm_gpiod_get(&dcon->client->dev, pin[i]->name,
                                             ^~
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:50:42: error: request for member 'dev' in something not a structure or union
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:50:55: error: invalid type argument of '->' (have 'struct dcon_gpio')
      gpios[i] = devm_gpiod_get(&dcon->client->dev, pin[i]->name,
                                                          ^~
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:50:55: error: request for member 'name' in something not a structure or union
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:51:14: error: invalid type argument of '->' (have 'struct dcon_gpio')
           pin[i]->flags);
                 ^~
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:51:14: error: request for member 'flags' in something not a structure or union
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:50:29: error: passing argument 1 of 'devm_gpiod_get' from incompatible pointer type [-Werror=incompatible-pointer-types]
      gpios[i] = devm_gpiod_get(&dcon->client->dev, pin[i]->name,
                                ^
   In file included from drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:14:0:
   include/linux/gpio/consumer.h:87:55: note: expected 'struct device *' but argument is of type 'const struct dcon_gpio (*)[1]'
    struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
                                                          ^~~~~~~~~~~   
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:50:49: error: passing argument 2 of 'devm_gpiod_get' from incompatible pointer type [-Werror=incompatible-pointer-types]
      gpios[i] = devm_gpiod_get(&dcon->client->dev, pin[i]->name,
                                                    ^~~
   In file included from drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:14:0:
   include/linux/gpio/consumer.h:87:55: note: expected 'const char *' but argument is of type 'const struct dcon_gpio *'
    struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
                                                          ^~~~~~~~~~~   
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:51:8: error: incompatible type for argument 3 of 'devm_gpiod_get'
           pin[i]->flags);
           ^~~
   In file included from drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:14:0:
   include/linux/gpio/consumer.h:87:55: note: expected 'enum gpiod_flags' but argument is of type 'const struct dcon_gpio *'
    struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
                                                          ^~~~~~~~~~~   
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:50:12: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
      gpios[i] = devm_gpiod_get(&dcon->client->dev, pin[i]->name,
               ^
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:54:80: error: invalid type argument of '->' (have 'struct dcon_gpio')
       pr_err("failed to request %s GPIO: %d\n", pin[i]->name,
                                                                                   ^ 
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:54:80: error: request for member 'name' in something not a structure or union
>> drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:54:11: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'const struct dcon_gpio *' [-Wformat=]
       pr_err("failed to request %s GPIO: %d\n", pin[i]->name,
              ^~~~~~                                                            
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:82:29: error: array subscript is not an integer
     gpiod_direction_input(gpios[DCON_BLANK]);
                                ^
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:82:24: error: passing argument 1 of 'gpiod_direction_input' from incompatible pointer type [-Werror=incompatible-pointer-types]
     gpiod_direction_input(gpios[DCON_BLANK]);
                           ^~~~~
   In file included from drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:14:0:
   include/linux/gpio/consumer.h:110:5: note: expected 'struct gpio_desc *' but argument is of type 'const struct dcon_gpio *'
    int gpiod_direction_input(struct gpio_desc *desc);
        ^~~~~~~~~~~~~~~~~~~~~
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:83:30: error: array subscript is not an integer
     gpiod_direction_output(gpios[DCON_LOAD],
                                 ^
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:83:25: error: passing argument 1 of 'gpiod_direction_output' from incompatible pointer type [-Werror=incompatible-pointer-types]
     gpiod_direction_output(gpios[DCON_LOAD],
                            ^~~~~
   In file included from drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:14:0:
   include/linux/gpio/consumer.h:111:5: note: expected 'struct gpio_desc *' but argument is of type 'const struct dcon_gpio *'
    int gpiod_direction_output(struct gpio_desc *desc, int value);
        ^~~~~~~~~~~~~~~~~~~~~~
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c: In function 'dcon_set_dconload_1':
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:186:23: error: array subscript is not an integer
     gpiod_set_value(gpios[DCON_LOAD], val);
                          ^
   drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:186:18: error: passing argument 1 of 'gpiod_set_value' from incompatible pointer type [-Werror=incompatible-pointer-types]
     gpiod_set_value(gpios[DCON_LOAD], val);
                     ^~~~~
   In file included from drivers/staging//olpc_dcon/olpc_dcon_xo_1.c:14:0:
   include/linux/gpio/consumer.h:120:6: note: expected 'struct gpio_desc *' but argument is of type 'const struct dcon_gpio *'
    void gpiod_set_value(struct gpio_desc *desc, int value);
         ^~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +54 drivers/staging//olpc_dcon/olpc_dcon_xo_1.c

    19	
    20	enum dcon_gpios {
    21		DCON_STAT0,
    22		DCON_STAT1,
  > 23		DCON_IRQ,
    24		DCON_LOAD,
    25		DCON_BLANK,
    26	};
    27	
    28	struct dcon_gpio {
    29		const char *name;
    30		unsigned long flags;
    31	};
    32	
    33	static const struct dcon_gpio gpios_asis[] = {
    34		[DCON_STAT0] = { .name = "dcon_stat0", .flags = GPIO_ASIS },
    35		[DCON_STAT1] = { .name = "dcon_stat1", .flags = GPIO_ASIS },
    36		[DCON_IRQ] = { .name = "dcon_irq", .flags = GPIO_ASIS },
    37		[DCON_LOAD] = { .name = "dcon_load", .flags = GPIO_ASIS },
    38		[DCON_BLANK] = { .name = "dcon_blank", .flag = GPIO_ASIS },
    39	};
    40	
    41	struct gpio_desc *gpios[5];
    42	
    43	static int dcon_init_xo_1(struct dcon_priv *dcon)
    44	{
    45		unsigned char lob;
    46		int ret, i;
    47		struct dcon_gpio *pin = &gpios_asis[0];
    48	
    49		for (i = 0; i < ARRAY_SIZE(gpios_asis); i++) {
  > 50			gpios[i] = devm_gpiod_get(&dcon->client->dev, pin[i]->name,
    51						  pin[i]->flags);
    52			if (IS_ERR(gpios[i])) {
    53				ret = PTR_ERR(gpios[i]);
  > 54				pr_err("failed to request %s GPIO: %d\n", pin[i]->name,
    55				       ret);
    56				return ret;
    57			}
    58		}
    59	
    60		/* Turn off the event enable for GPIO7 just to be safe */
    61		cs5535_gpio_clear(OLPC_GPIO_DCON_IRQ, GPIO_EVENTS_ENABLE);
    62	
    63		/*
    64		 * Determine the current state by reading the GPIO bit; earlier
    65		 * stages of the boot process have established the state.
    66		 *
    67		 * Note that we read GPIO_OUTPUT_VAL rather than GPIO_READ_BACK here;
    68		 * this is because OFW will disable input for the pin and set a value..
    69		 * READ_BACK will only contain a valid value if input is enabled and
    70		 * then a value is set.  So, future readings of the pin can use
    71		 * READ_BACK, but the first one cannot.  Awesome, huh?
    72		 */
    73		dcon->curr_src = cs5535_gpio_isset(OLPC_GPIO_DCON_LOAD, GPIO_OUTPUT_VAL)
    74			? DCON_SOURCE_CPU
    75			: DCON_SOURCE_DCON;
    76		dcon->pending_src = dcon->curr_src;
    77	
    78		/* Set the directions for the GPIO pins */
    79		gpiod_direction_input(gpios[DCON_STAT0]);
    80		gpiod_direction_input(gpios[DCON_STAT1]);
    81		gpiod_direction_input(gpios[DCON_IRQ]);
    82		gpiod_direction_input(gpios[DCON_BLANK]);
    83		gpiod_direction_output(gpios[DCON_LOAD],
    84				       dcon->curr_src == DCON_SOURCE_CPU);
    85	
    86		/* Set up the interrupt mappings */
    87	
    88		/* Set the IRQ to pair 2 */
    89		cs5535_gpio_setup_event(OLPC_GPIO_DCON_IRQ, 2, 0);
    90	
    91		/* Enable group 2 to trigger the DCON interrupt */
    92		cs5535_gpio_set_irq(2, DCON_IRQ);
    93	
    94		/* Select edge level for interrupt (in PIC) */
    95		lob = inb(0x4d0);
    96		lob &= ~(1 << DCON_IRQ);
    97		outb(lob, 0x4d0);
    98	
    99		/* Register the interrupt handler */
   100		if (request_irq(DCON_IRQ, &dcon_interrupt, 0, "DCON", dcon)) {
   101			pr_err("failed to request DCON's irq\n");
   102			return -EIO;
   103		}
   104	
   105		/* Clear INV_EN for GPIO7 (DCONIRQ) */
   106		cs5535_gpio_clear(OLPC_GPIO_DCON_IRQ, GPIO_INPUT_INVERT);
   107	
   108		/* Enable filter for GPIO12 (DCONBLANK) */
   109		cs5535_gpio_set(OLPC_GPIO_DCON_BLANK, GPIO_INPUT_FILTER);
   110	
   111		/* Disable filter for GPIO7 */
   112		cs5535_gpio_clear(OLPC_GPIO_DCON_IRQ, GPIO_INPUT_FILTER);
   113	
   114		/* Disable event counter for GPIO7 (DCONIRQ) and GPIO12 (DCONBLANK) */
   115		cs5535_gpio_clear(OLPC_GPIO_DCON_IRQ, GPIO_INPUT_EVENT_COUNT);
   116		cs5535_gpio_clear(OLPC_GPIO_DCON_BLANK, GPIO_INPUT_EVENT_COUNT);
   117	
   118		/* Add GPIO12 to the Filter Event Pair #7 */
   119		cs5535_gpio_set(OLPC_GPIO_DCON_BLANK, GPIO_FE7_SEL);
   120	
   121		/* Turn off negative Edge Enable for GPIO12 */
   122		cs5535_gpio_clear(OLPC_GPIO_DCON_BLANK, GPIO_NEGATIVE_EDGE_EN);
   123	
   124		/* Enable negative Edge Enable for GPIO7 */
   125		cs5535_gpio_set(OLPC_GPIO_DCON_IRQ, GPIO_NEGATIVE_EDGE_EN);
   126	
   127		/* Zero the filter amount for Filter Event Pair #7 */
   128		cs5535_gpio_set(0, GPIO_FLTR7_AMOUNT);
   129	
   130		/* Clear the negative edge status for GPIO7 and GPIO12 */
   131		cs5535_gpio_set(OLPC_GPIO_DCON_IRQ, GPIO_NEGATIVE_EDGE_STS);
   132		cs5535_gpio_set(OLPC_GPIO_DCON_BLANK, GPIO_NEGATIVE_EDGE_STS);
   133	
   134		/* FIXME:  Clear the positive status as well, just to be sure */
   135		cs5535_gpio_set(OLPC_GPIO_DCON_IRQ, GPIO_POSITIVE_EDGE_STS);
   136		cs5535_gpio_set(OLPC_GPIO_DCON_BLANK, GPIO_POSITIVE_EDGE_STS);
   137	
   138		/* Enable events for GPIO7 (DCONIRQ) and GPIO12 (DCONBLANK) */
   139		cs5535_gpio_set(OLPC_GPIO_DCON_IRQ, GPIO_EVENTS_ENABLE);
   140		cs5535_gpio_set(OLPC_GPIO_DCON_BLANK, GPIO_EVENTS_ENABLE);
   141	
   142		return 0;
   143	}
   144	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 65190 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-04  4:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-03 11:08 [PATCH v2] staging: olpc_dcon: olpc_dcon_xo_1.c: Switch to the gpio descriptor interface Nishad Kamdar
2018-11-04  1:23 ` kbuild test robot
2018-11-04  4:36 ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.