public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ideapad: Use define for cfg bits
@ 2011-06-02  9:22 Ike Panhc
  2011-06-02  9:24 ` [PATCH 2/3] ideapad: Add nodes in sysfs Ike Panhc
  2011-06-02  9:24 ` [PATCH 3/3] ideapad: Show negative when no camera Ike Panhc
  0 siblings, 2 replies; 9+ messages in thread
From: Ike Panhc @ 2011-06-02  9:22 UTC (permalink / raw)
  To: platform-driver-x86, linux-kernel; +Cc: Matthew Garrett

instead of hard code the number.

Signed-off-by: Ike Panhc <ike.pan@canonical.com>
---
 drivers/platform/x86/ideapad-laptop.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index bfdda33..a5c0efa 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -35,10 +35,15 @@
 
 #define IDEAPAD_RFKILL_DEV_NUM	(3)
 
+#define CFG_BT_BIT	(16)
+#define CFG_3G_BIT	(17)
+#define CFG_WIFI_BIT	(18)
+
 struct ideapad_private {
 	struct rfkill *rfk[IDEAPAD_RFKILL_DEV_NUM];
 	struct platform_device *platform_device;
 	struct input_dev *inputdev;
+	unsigned long	cfg;
 };
 
 static acpi_handle ideapad_handle;
@@ -197,9 +202,9 @@ struct ideapad_rfk_data {
 };
 
 const struct ideapad_rfk_data ideapad_rfk_data[] = {
-	{ "ideapad_wlan",	18, 0x15, RFKILL_TYPE_WLAN },
-	{ "ideapad_bluetooth",	16, 0x17, RFKILL_TYPE_BLUETOOTH },
-	{ "ideapad_3g",		17, 0x20, RFKILL_TYPE_WWAN },
+	{ "ideapad_wlan",	CFG_WIFI_BIT,	0x15, RFKILL_TYPE_WLAN },
+	{ "ideapad_bluetooth",	CFG_BT_BIT,	0x17, RFKILL_TYPE_BLUETOOTH },
+	{ "ideapad_3g",		CFG_3G_BIT,	0x20, RFKILL_TYPE_WWAN },
 };
 
 static int ideapad_rfk_set(void *data, bool blocked)
@@ -393,10 +398,11 @@ MODULE_DEVICE_TABLE(acpi, ideapad_device_ids);
 
 static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
 {
-	int ret, i, cfg;
+	int ret, i;
+	unsigned long cfg;
 	struct ideapad_private *priv;
 
-	if (read_method_int(adevice->handle, "_CFG", &cfg))
+	if (read_method_int(adevice->handle, "_CFG", (int *)&cfg))
 		return -ENODEV;
 
 	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
@@ -404,6 +410,7 @@ static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
 		return -ENOMEM;
 	dev_set_drvdata(&adevice->dev, priv);
 	ideapad_handle = adevice->handle;
+	priv->cfg = cfg;
 
 	ret = ideapad_platform_init(priv);
 	if (ret)
@@ -414,7 +421,7 @@ static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
 		goto input_failed;
 
 	for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) {
-		if (test_bit(ideapad_rfk_data[i].cfgbit, (unsigned long *)&cfg))
+		if (test_bit(ideapad_rfk_data[i].cfgbit, &cfg))
 			ideapad_register_rfkill(adevice, i);
 		else
 			priv->rfk[i] = NULL;
-- 
1.7.4.1


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

end of thread, other threads:[~2011-06-03 20:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-02  9:22 [PATCH 1/3] ideapad: Use define for cfg bits Ike Panhc
2011-06-02  9:24 ` [PATCH 2/3] ideapad: Add nodes in sysfs Ike Panhc
2011-06-02  9:48   ` Corentin Chary
2011-06-02 10:14     ` Ike Panhc
2011-06-02 11:22       ` Corentin Chary
2011-06-03 20:21   ` Dmitry Torokhov
2011-06-02  9:24 ` [PATCH 3/3] ideapad: Show negative when no camera Ike Panhc
2011-06-02  9:43   ` Corentin Chary
2011-06-02 10:17     ` Ike Panhc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox