Skip to content

Commit 9176205

Browse files
xiwgregkh
authored andcommitted
staging: olpc_dcon: ->read_status() API change
Change ->read_status() by separating the error handling and the status bits. This also fixes a signedness bug in dcon_interrupt() that would break the error handling. Signed-off-by: Xi Wang <xi.wang@gmail.com> Acked-by: Andres Salomon <dilinger@queued.net> Cc: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent fb92728 commit 9176205

4 files changed

Lines changed: 11 additions & 15 deletions

File tree

‎drivers/staging/olpc_dcon/olpc_dcon.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,9 +755,9 @@ static int dcon_resume(struct i2c_client *client)
755755
irqreturn_t dcon_interrupt(int irq, void *id)
756756
{
757757
struct dcon_priv *dcon = id;
758-
int status = pdata->read_status();
758+
u8 status;
759759

760-
if (status == -1)
760+
if (pdata->read_status(&status))
761761
return IRQ_NONE;
762762

763763
switch (status & 3) {

‎drivers/staging/olpc_dcon/olpc_dcon.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ struct dcon_platform_data {
8484
int (*init)(struct dcon_priv *);
8585
void (*bus_stabilize_wiggle)(void);
8686
void (*set_dconload)(int);
87-
u8 (*read_status)(void);
87+
int (*read_status)(u8 *);
8888
};
8989

9090
#include <linux/interrupt.h>

‎drivers/staging/olpc_dcon/olpc_dcon_xo_1.c‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,15 @@ static void dcon_set_dconload_1(int val)
183183
gpio_set_value(OLPC_GPIO_DCON_LOAD, val);
184184
}
185185

186-
static u8 dcon_read_status_xo_1(void)
186+
static int dcon_read_status_xo_1(u8 *status)
187187
{
188-
u8 status;
189-
190-
status = gpio_get_value(OLPC_GPIO_DCON_STAT0);
191-
status |= gpio_get_value(OLPC_GPIO_DCON_STAT1) << 1;
188+
*status = gpio_get_value(OLPC_GPIO_DCON_STAT0);
189+
*status |= gpio_get_value(OLPC_GPIO_DCON_STAT1) << 1;
192190

193191
/* Clear the negative edge status for GPIO7 */
194192
cs5535_gpio_set(OLPC_GPIO_DCON_IRQ, GPIO_NEGATIVE_EDGE_STS);
195193

196-
return status;
194+
return 0;
197195
}
198196

199197
struct dcon_platform_data dcon_pdata_xo_1 = {

‎drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,20 +167,18 @@ static void dcon_set_dconload_xo_1_5(int val)
167167
gpio_set_value(VX855_GPIO(1), val);
168168
}
169169

170-
static u8 dcon_read_status_xo_1_5(void)
170+
static int dcon_read_status_xo_1_5(u8 *status)
171171
{
172-
u8 status;
173-
174172
if (!dcon_was_irq())
175173
return -1;
176174

177175
/* i believe this is the same as "inb(0x44b) & 3" */
178-
status = gpio_get_value(VX855_GPI(10));
179-
status |= gpio_get_value(VX855_GPI(11)) << 1;
176+
*status = gpio_get_value(VX855_GPI(10));
177+
*status |= gpio_get_value(VX855_GPI(11)) << 1;
180178

181179
dcon_clear_irq();
182180

183-
return status;
181+
return 0;
184182
}
185183

186184
struct dcon_platform_data dcon_pdata_xo_1_5 = {

0 commit comments

Comments
 (0)