Skip to contentSkip to conversation

Fujitsu panel update

PATCH New Stephen Hemminger 1 participant 5 messages Dec 3, 2007

Subsystems (2)
lore
Share & tools
lore
#3 lore raw

PATCH 3/4 apanel: detach on shutdown

In reply to Stephen Hemminger

Need to stop any device polling on shutdown. Without this, the laptop can sometimes not turn off.

drivers/input/misc/apanel.c +6 -0
@@ -193,12 +193,18 @@ static int apanel_attach_adapter(struct 
 	return i2c_probe(adap, &addr_data, apanel_probe);
 }
 
+static void apanel_shutdown(struct i2c_client *client)
+{
+	apanel_detach_client(client);
+}
+
 static struct i2c_driver apanel_driver = {
 	.driver = {
 		.name = APANEL,
 	},
 	.attach_adapter = &apanel_attach_adapter,
 	.detach_client  = &apanel_detach_client,
+	.shutdown	= &apanel_shutdown,
 };
 
 static struct apanel apanel = {
#2 lore raw

PATCH 2/4 apanel: change name of LED

In reply to Stephen Hemminger

Make name of LED match the current usage precedent in wistron buttons.
Note: If the LED developers want a different convention, they can just change both drivers.

drivers/input/misc/apanel.c +1 -1
@@ -219,7 +219,7 @@ static struct apanel apanel = {
 
 	},
 	.mail_led = {
-		.name = APANEL ":mail",
+		.name = "mail:blue",
 		.brightness_set = mail_led_set,
 	},
 };
#1 lore raw

PATCH 1/4 apanel: free input device on close

Fix memory leak.

drivers/input/misc/apanel.c +1 -0
@@ -176,6 +176,7 @@ static int apanel_detach_client(struct i
 
 	input_unregister_polled_device(ap->ipdev);
 	i2c_detach_client(&ap->client);
+	input_free_polled_device(ap->ipdev);
 
 	return 0;
 }
#4 lore raw

PATCH 4/4 apanel: use generic keycode routines

In reply to Stephen Hemminger

Don't need driver specific keymap routines, generic keycode routines will work fine.

drivers/input/misc/apanel.c +2 -29
@@ -120,33 +120,6 @@ static void apanel_poll(struct input_pol
 			report_key(idev, ap->keymap[i]);
 }
 
-static int apanel_getkeycode(struct input_dev *idev, int scancode, int *keycode)
-{
-	struct apanel *ap = idev->private;
-
-	if (scancode < 0 || scancode >= MAX_PANEL_KEYS)
-		return -EINVAL;
-
-	*keycode = ap->keymap[scancode];
-	return 0;
-}
-
-static int apanel_setkeycode(struct input_dev *idev, int scancode, int keycode)
-{
-	struct apanel *ap = idev->private;
-
-	if (keycode < 0 || keycode > KEY_MAX)
-		return -EINVAL;
-
-	if (scancode < 0 || scancode >= MAX_PANEL_KEYS)
-		return -EINVAL;
-
-	clear_bit(ap->keymap[scancode], idev->keybit);
-	ap->keymap[scancode] = keycode;
-	set_bit(keycode, idev->keybit);
-	return 0;
-}
-
 /* Track state changes of LED */
 static void led_update(struct work_struct *work)
 {
@@ -274,11 +247,11 @@ static int apanel_probe(struct i2c_adapt
 	idev->phys = "apanel/input0";
 	idev->id.bustype = BUS_HOST;
 	idev->dev.parent = &ap->client.dev;
-	idev->getkeycode = apanel_getkeycode;
-	idev->setkeycode = apanel_setkeycode;
 
 	set_bit(EV_KEY, idev->evbit);
 
+	idev->keycode = ap->keymap;
+	idev->keycodesize = sizeof(ap->keymap[0]);
 	idev->keycodemax = (device_chip[APANEL_DEV_CDBTN] != CHIP_NONE) ? 12 : 4;
 
 	for (i = 0; i < idev->keycodemax; i++)