Re: Call for testers: New acpi_ibm driver

Ruslan Ermilov <[email protected]>
Newsgroups gmane.os.freebsd.devel.mobile,gmane.os.freebsd.devel.acpi
Message-ID <[email protected]>
Hi Markus,

On Fri, Jun 10, 2005 at 01:31:03AM +0200, Markus Brueffer wrote:
> thanks to everyone who has sent me the DSDT and/or tested the driver.
> I have just committed the driver and manpage along with a port of tpb,a 
> utility that makes use of it:
> 
The attached patch fixes two bugs in the updated acpi_ibm(4) driver
for my ThinkPad 600X, you have my ASL:

- it doesn't have ThinkLight, so there's no real benefit from having
  /dev/led/thinklight;

- it doesn't have "cmos_handle", so acpi_ibm_sysctl_set() was using
  uninitialized values of "val_ec" in ACPI_IBM_METHOD_VOLUME and
  ACPI_IBM_METHOD_MUTE handlers, which resulted in volume to be
  programmed incorrectly, and muting/unmuting would screw the
  volume.


Cheers,
-- 
Ruslan Ermilov
[email protected]
FreeBSD committer
p (text/plain, 1.9 KB)
Index: acpi_ibm.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/acpi_support/acpi_ibm.c,v
retrieving revision 1.5
diff -u -p -r1.5 acpi_ibm.c
--- acpi_ibm.c	9 Jun 2005 20:17:32 -0000	1.5
+++ acpi_ibm.c	10 Jun 2005 06:57:48 -0000
@@ -376,7 +376,8 @@ acpi_ibm_attach(device_t dev)
 	    acpi_ibm_notify, dev);
 
 	/* Hook up light to led(4) */
-	sc->led_dev = led_create(ibm_led, sc, "thinklight");
+	if (sc->light_get_supported || sc->light_set_supported)
+		sc->led_dev = led_create(ibm_led, sc, "thinklight");
 
 	return (0);
 }
@@ -396,7 +397,8 @@ acpi_ibm_detach(device_t dev)
 
 	AcpiRemoveNotifyHandler(sc->handle, ACPI_DEVICE_NOTIFY, acpi_ibm_notify);
 
-	led_destroy(sc->led_dev);
+	if (sc->led_dev != NULL)
+		led_destroy(sc->led_dev);
 	return (0);
 }
 
@@ -522,7 +524,7 @@ acpi_ibm_sysctl_get(struct acpi_ibm_soft
 
 	case ACPI_IBM_METHOD_VOLUME:
 		ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1);
-		val = val_ec &IBM_EC_MASK_VOL;
+		val = val_ec & IBM_EC_MASK_VOL;
 		break;
 
 	case ACPI_IBM_METHOD_MUTE:
@@ -632,10 +634,10 @@ acpi_ibm_sysctl_set(struct acpi_ibm_soft
 		if (arg < 0 || arg > 14)
 			return (EINVAL);
 
+		status = ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1);
+		if (ACPI_FAILURE(status))
+			return (status);
 		if (sc->cmos_handle) {
-			status = ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1);
-			if (ACPI_FAILURE(status))
-				return (status);
 			val = val_ec & IBM_EC_MASK_VOL;
 
 			Args.Count = 1;
@@ -657,10 +659,10 @@ acpi_ibm_sysctl_set(struct acpi_ibm_soft
 		if (arg < 0 || arg > 1)
 			return (EINVAL);
 
+		status = ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1);
+		if (ACPI_FAILURE(status))
+			return (status);
 		if (sc->cmos_handle) {
-			status = ACPI_EC_READ(sc->ec_dev, IBM_EC_VOLUME, &val_ec, 1);
-			if (ACPI_FAILURE(status))
-				return (status);
 			val = val_ec & IBM_EC_MASK_VOL;
 
 			Args.Count = 1;
signature.asc (application/pgp-signature, 187 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)

iD8DBQFCqUG3qRfpzJluFF4RAtYwAJ0edBkHyXFsl9GMgIVh9MIB+tL24wCeObNY
ouRXunr0yhB8NasOQafwMCY=
=httP
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.