Re: [PATCH] staging: olpc_dcon: olpc_dcon_xo_1.c: Switch to the gpio descriptor interface

From: kbuild test robot
Date: Sun Oct 28 2018 - 03:14:18 EST


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-20181019]
[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/20181028-124517
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 errors (new ones prefixed by >>):

drivers/staging/olpc_dcon/olpc_dcon_xo_1.c: In function 'dcon_init_xo_1':
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:37:43: error: dereferencing pointer to incomplete type 'struct backlight_device'
*pin->ptr = devm_gpiod_get(&dcon->bl_dev->dev, pin->name,
^~
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:41:4: error: implicit declaration of function 'dev_err'; did you mean 'pr_err'? [-Werror=implicit-function-declaration]
dev_err(&dcon->bl_dev->dev,
^~~~~~~
pr_err
>> drivers/staging/olpc_dcon/olpc_dcon_xo_1.c:89:3: error: label 'err_req_irq' used but not defined
goto err_req_irq;
^~~~
cc1: some warnings being treated as errors

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

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

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

Attachment: .config.gz
Description: application/gzip