Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104189
b: refs/heads/master
c: 2ff9814
h: refs/heads/master
i:
  104187: aaa5fe5
v: v3
  • Loading branch information
Andres Salomon authored and Dmitry Torokhov committed May 16, 2008
1 parent 6849d87 commit ab01623
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e9542dff390668f85dc8dca0ca019b27e4396f97
refs/heads/master: 2ff98147847de3d27d7aa174d58467d21fe372aa
37 changes: 26 additions & 11 deletions trunk/drivers/input/mouse/hil_ptr.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,24 @@ static void hil_ptr_disconnect(struct serio *serio)

static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
{
struct hil_ptr *ptr;
const char *txt;
unsigned int i, naxsets, btntype;
uint8_t did, *idd;

if (!(ptr = kzalloc(sizeof(struct hil_ptr), GFP_KERNEL)))
struct hil_ptr *ptr;
const char *txt;
unsigned int i, naxsets, btntype;
uint8_t did, *idd;
int error;

ptr = kzalloc(sizeof(struct hil_ptr), GFP_KERNEL);
if (!ptr)
return -ENOMEM;

ptr->dev = input_allocate_device();
if (!ptr->dev)
if (!ptr->dev) {
error = -ENOMEM;
goto bail0;
}

if (serio_open(serio, driver))
error = serio_open(serio, driver);
if (error)
goto bail1;

serio_set_drvdata(serio, ptr);
Expand Down Expand Up @@ -297,6 +302,7 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
did = ptr->idd[0];
idd = ptr->idd + 1;
txt = "unknown";

if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_REL) {
ptr->dev->evbit[0] = BIT_MASK(EV_REL);
txt = "relative";
Expand All @@ -306,8 +312,11 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
ptr->dev->evbit[0] = BIT_MASK(EV_ABS);
txt = "absolute";
}
if (!ptr->dev->evbit[0])

if (!ptr->dev->evbit[0]) {
error = -ENODEV;
goto bail2;
}

ptr->nbtn = HIL_IDD_NUM_BUTTONS(idd);
if (ptr->nbtn)
Expand Down Expand Up @@ -380,21 +389,27 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
ptr->dev->id.version = 0x0100; /* TODO: get from ptr->rsc */
ptr->dev->dev.parent = &serio->dev;

input_register_device(ptr->dev);
error = input_register_device(ptr->dev);
if (error) {
printk(KERN_INFO PREFIX "Unable to register input device\n");
goto bail2;
}

printk(KERN_INFO "input: %s (%s), ID: %d\n",
ptr->dev->name,
(btntype == BTN_MOUSE) ? "HIL mouse":"HIL tablet or touchpad",
did);

return 0;

bail2:
serio_close(serio);
bail1:
input_free_device(ptr->dev);
bail0:
kfree(ptr);
serio_set_drvdata(serio, NULL);
return -ENODEV;
return error;
}

static struct serio_device_id hil_ptr_ids[] = {
Expand Down

0 comments on commit ab01623

Please sign in to comment.