Skip to contentSkip to conversation

ibm-acpi patches for 2.6.21

GIT PULL Applied Henrique de Moraes Holschuh 2 participants 5 messages Feb 6, 2007 – Feb 9, 2007 ACPI

lore
Share & tools
lore
#0 lore raw

Please pull from git://repo.or.cz/linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git
branch for-upstream/acpi-release

To receive the following patches:

Henrique de Moraes Holschuh (1):
ACPI: ibm-acpi: cleanup init and exit paths

Theodore Ts'o (1):
ACPI: ibm-acpi: add Ultrabay support for the T60p ThinkPad

Please schedule these patches to be merged in mainline 2.6.21.

The patches are also going to be sent as replies to this email, for your convenience.

Signature · 4 lines
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
#1 lore raw

PATCH 1/2 ACPI: ibm-acpi: add Ultrabay support for the T60p ThinkPad

From: Theodore Ts'o <[email protected]>

The following patch adds support for obtaining the status and ejecting Ultrabay devices for the T60p Thinkpad; my guess is that it probably works on T60 Thinkpads and probably more recent Lenovo latops as well.

With the 2.03 BIOS I have been able to eject a SATA drive in an Ultrabay carrier by using the command:

"echo 1 > /sys/class/scsi_device/1:0:0:0/device/delete"

and upon re-inserting the it back into the device and issuing the command:

"echo 0 0 0 > /sys/class/scsi_host/host1/scan"

have the device appear again. (With the 1.02 BIOS the device does not function when re-inserted, even after a warm boot; a cold reboot is required to store the Ultrabay device's functionality.)

More complicated Ultrabay eject and insert scripts can be found on the ThinkWiki, although it's important to comment out the "hdparm -Y" as it apparently doesn't work or do anything, and causes the eject process to hang for about a minute.

---
 drivers/acpi/ibm_acpi.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/acpi/ibm_acpi.c +2 -1
index c6144ca..5c0f1b8 100644
@@ -159,7 +159,8 @@ IBM_HANDLE(dock, root, "\\_SB.GDCK",	/* X30, X31, X40 */
 #endif
 IBM_HANDLE(bay, root, "\\_SB.PCI.IDE.SECN.MAST",	/* 570 */
 	   "\\_SB.PCI0.IDE0.IDES.IDSM",	/* 600e/x, 770e, 770x */
-	   "\\_SB.PCI0.SATA.SCND.MSTR",	/* T60, X60, Z60 */ 
+	   "\\_SB.PCI0.SATA.SCND.MSTR",	/* T60, X60, Z60, SATA mode? */
+	   "\\_SB.PCI0.IDE0.PRIM.MSTR", /* T60p, IDE mode? */
 	   "\\_SB.PCI0.IDE0.SCND.MSTR",	/* all others */
     );				/* A21e, R30, R31 */
 
Signature · 1 line
1.4.4.4
#2 lore raw

PATCH 2/2 ACPI: ibm-acpi: cleanup init and exit paths

This patch fixes a small memory leak on module removal, and does other assorted minor cleanups on the module init codepath.

---
 drivers/acpi/ibm_acpi.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
drivers/acpi/ibm_acpi.c +8 -5
index 5c0f1b8..20cbde5 100644
@@ -497,6 +497,10 @@ static int ibm_acpi_driver_init(void)
 	printk(IBM_INFO "%s v%s\n", IBM_DESC, IBM_VERSION);
 	printk(IBM_INFO "%s\n", IBM_URL);
 
+	if (ibm_thinkpad_ec_found)
+		printk(IBM_INFO "ThinkPad EC firmware %s\n",
+		       ibm_thinkpad_ec_found);
+
 	return 0;
 }
 
@@ -2618,7 +2622,7 @@ static void __init ibm_handle_init(char *name,
 	ibm_handle_init(#object, &object##_handle, *object##_parent,	\
 		object##_paths, ARRAY_SIZE(object##_paths), &object##_path)
 
-static int set_ibm_param(const char *val, struct kernel_param *kp)
+static int __init set_ibm_param(const char *val, struct kernel_param *kp)
 {
 	unsigned int i;
 
@@ -2660,7 +2664,8 @@ static void acpi_ibm_exit(void)
 	for (i = ARRAY_SIZE(ibms) - 1; i >= 0; i--)
 		ibm_exit(&ibms[i]);
 
-	remove_proc_entry(IBM_DIR, acpi_root_dir);
+	if (proc_dir)
+		remove_proc_entry(IBM_DIR, acpi_root_dir);
 
 	if (ibm_thinkpad_ec_found)
 		kfree(ibm_thinkpad_ec_found);
@@ -2711,9 +2716,6 @@ static int __init acpi_ibm_init(void)
 
 	/* Models with newer firmware report the EC in DMI */
 	ibm_thinkpad_ec_found = check_dmi_for_ec();
-	if (ibm_thinkpad_ec_found)
-		printk(IBM_INFO "ThinkPad EC firmware %s\n",
-		       ibm_thinkpad_ec_found);
 
 	/* these handles are not required */
 	IBM_HANDLE_INIT(vid);
@@ -2743,6 +2745,7 @@ static int __init acpi_ibm_init(void)
 	proc_dir = proc_mkdir(IBM_DIR, acpi_root_dir);
 	if (!proc_dir) {
 		printk(IBM_ERR "unable to create proc dir %s", IBM_DIR);
+		acpi_ibm_exit();
 		return -ENODEV;
 	}
 	proc_dir->owner = THIS_MODULE;
Signature · 1 line
1.4.4.4
reviewer Applied
#3 lore raw

Re: [PATCH 2/2] ACPI: ibm-acpi: cleanup init and exit paths

Applied.

thanks,
-Len

Quoted 60 lines · Henrique de Moraes Holschuh

This patch fixes a small memory leak on module removal, and does other assorted minor cleanups on the module init codepath.

---
 drivers/acpi/ibm_acpi.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
drivers/acpi/ibm_acpi.c +8 -5
index 5c0f1b8..20cbde5 100644
@@ -497,6 +497,10 @@ static int ibm_acpi_driver_init(void)
 	printk(IBM_INFO "%s v%s\n", IBM_DESC, IBM_VERSION);
 	printk(IBM_INFO "%s\n", IBM_URL);
 
+	if (ibm_thinkpad_ec_found)
+		printk(IBM_INFO "ThinkPad EC firmware %s\n",
+		       ibm_thinkpad_ec_found);
+
 	return 0;
 }
 
@@ -2618,7 +2622,7 @@ static void __init ibm_handle_init(char *name,
 	ibm_handle_init(#object, &object##_handle, *object##_parent,	\
 		object##_paths, ARRAY_SIZE(object##_paths), &object##_path)
 
-static int set_ibm_param(const char *val, struct kernel_param *kp)
+static int __init set_ibm_param(const char *val, struct kernel_param *kp)
 {
 	unsigned int i;
 
@@ -2660,7 +2664,8 @@ static void acpi_ibm_exit(void)
 	for (i = ARRAY_SIZE(ibms) - 1; i >= 0; i--)
 		ibm_exit(&ibms[i]);
 
-	remove_proc_entry(IBM_DIR, acpi_root_dir);
+	if (proc_dir)
+		remove_proc_entry(IBM_DIR, acpi_root_dir);
 
 	if (ibm_thinkpad_ec_found)
 		kfree(ibm_thinkpad_ec_found);
@@ -2711,9 +2716,6 @@ static int __init acpi_ibm_init(void)
 
 	/* Models with newer firmware report the EC in DMI */
 	ibm_thinkpad_ec_found = check_dmi_for_ec();
-	if (ibm_thinkpad_ec_found)
-		printk(IBM_INFO "ThinkPad EC firmware %s\n",
-		       ibm_thinkpad_ec_found);
 
 	/* these handles are not required */
 	IBM_HANDLE_INIT(vid);
@@ -2743,6 +2745,7 @@ static int __init acpi_ibm_init(void)
 	proc_dir = proc_mkdir(IBM_DIR, acpi_root_dir);
 	if (!proc_dir) {
 		printk(IBM_ERR "unable to create proc dir %s", IBM_DIR);
+		acpi_ibm_exit();
 		return -ENODEV;
 	}
 	proc_dir->owner = THIS_MODULE;
#4 lore raw

Re: [PATCH 1/2] ACPI: ibm-acpi: add Ultrabay support for the T60p ThinkPad

In reply to Henrique de Moraes Holschuh

drivers/acpi/ibm_acpi.c IBM_HANDLE(dock, root, "\\_SB.GDCK", /* X30, X31, X40 */ · line 165

Quoted 7 lines · Henrique de Moraes Holschuh

IBM_HANDLE(bay, root, "\\_SB.PCI.IDE.SECN.MAST", /* 570 */

drivers/acpi/ibm_acpi.c +2 -1
 	   "\\_SB.PCI0.IDE0.IDES.IDSM",	/* 600e/x, 770e, 770x */
-	   "\\_SB.PCI0.SATA.SCND.MSTR",	/* T60, X60, Z60 */ 
+	   "\\_SB.PCI0.SATA.SCND.MSTR",	/* T60, X60, Z60, SATA mode? */
+	   "\\_SB.PCI0.IDE0.PRIM.MSTR", /* T60p, IDE mode? */
 	   "\\_SB.PCI0.IDE0.SCND.MSTR",	/* all others */
     );				/* A21e, R30, R31 */

Unfortunately, a bad design bug makes earlier entries in this list that happen to exist shadow any later entries, which is completely unaceptable behaviour for the bay support as earlier entries *will* exist in some models, no matter how you order the list.

Len, if you have not pulled this one yet, please hold the pull request. I will not revert the patch, but rather work on a proper fix to ibm-acpi's bay_init().

Signature · 4 lines
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh