svn commit: r358725 - head/sys/powerpc/powermac

Andreas Tobler andreast at FreeBSD.org
Fri Mar 6 23:01:50 UTC 2020


Author: andreast
Date: Fri Mar  6 23:01:49 2020
New Revision: 358725
URL: https://svnweb.freebsd.org/changeset/base/358725

Log:
  Revert

Modified:
  head/sys/powerpc/powermac/fcu.c

Modified: head/sys/powerpc/powermac/fcu.c
==============================================================================
--- head/sys/powerpc/powermac/fcu.c	Fri Mar  6 21:51:28 2020	(r358724)
+++ head/sys/powerpc/powermac/fcu.c	Fri Mar  6 23:01:49 2020	(r358725)
@@ -2,6 +2,7 @@
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2010 Andreas Tobler
+ * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -151,7 +152,7 @@ fcu_write(device_t dev, uint32_t addr, uint8_t reg, ui
 
 	for (;;)
 	{
-		if (iicbus_transfer(dev, msg, nitems(msg)) == 0)
+		if (iicbus_transfer(dev, msg, 1) == 0)
 			return (0);
 
 		if (++try > 5) {
@@ -175,7 +176,7 @@ fcu_read_1(device_t dev, uint32_t addr, uint8_t reg, u
 
 	for (;;)
 	{
-		  err = iicbus_transfer(dev, msg, nitems(msg));
+		  err = iicbus_transfer(dev, msg, 2);
 		  if (err != 0)
 			  goto retry;
 
@@ -249,8 +250,8 @@ fcu_start(void *xdev)
 	sc = device_get_softc(dev);
 
 	/* Start the fcu device. */
-	fcu_write(sc->sc_dev, sc->sc_addr, 0xe, buf, sizeof(buf));
-	fcu_write(sc->sc_dev, sc->sc_addr, 0x2e, buf, sizeof(buf));
+	fcu_write(sc->sc_dev, sc->sc_addr, 0xe, buf, 1);
+	fcu_write(sc->sc_dev, sc->sc_addr, 0x2e, buf, 1);
 	fcu_read_1(sc->sc_dev, sc->sc_addr, 0, buf);
 	fcu_rpm_shift = (buf[0] == 1) ? 2 : 3;
 
@@ -289,7 +290,7 @@ fcu_fan_set_rpm(struct fcu_fan *fan, int rpm)
 	buf[0] = rpm >> (8 - fcu_rpm_shift);
 	buf[1] = rpm << fcu_rpm_shift;
 
-	if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, sizeof(buf)) < 0)
+	if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 2) < 0)
 		return (EIO);
 
 	return (0);
@@ -322,7 +323,7 @@ fcu_fan_get_rpm(struct fcu_fan *fan)
 			return (-1);
 		if ((fail & (1 << fan->id)) != 0) {
 			device_printf(fan->dev,
-			    "RPM Fan failed ID: %d %#x\n", fan->id, fail);
+			    "RPM Fan failed ID: %d\n", fan->id);
 			return (-1);
 		}
 		/* Check if fan is active. */
@@ -355,7 +356,7 @@ fcu_fan_set_pwm(struct fcu_fan *fan, int pwm)
 {
 	uint8_t reg;
 	struct fcu_softc *sc;
-	uint8_t buf[1];
+	uint8_t buf[2];
 
 	sc = device_get_softc(fan->dev);
 
@@ -377,7 +378,7 @@ fcu_fan_set_pwm(struct fcu_fan *fan, int pwm)
 
 	buf[0] = (pwm * 2550) / 1000;
 
-	if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, sizeof(buf)) < 0)
+	if (fcu_write(sc->sc_dev, sc->sc_addr, reg, buf, 1) < 0)
 		return (EIO);
 	return (0);
 }
@@ -631,9 +632,8 @@ fcu_attach_fans(device_t dev)
 				       "Maximum allowed RPM");
 			/* I use i to pass the fan id. */
 			SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
-					"rpm", CTLTYPE_INT | CTLFLAG_RW |
-					CTLFLAG_MPSAFE, dev, i,
-					fcu_fanrpm_sysctl, "I", "Fan RPM");
+			    "rpm", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
+			    dev, i, fcu_fanrpm_sysctl, "I", "Fan RPM");
 		} else {
 			fcu_fan_get_pwm(dev, &sc->sc_fans[i],
 					&sc->sc_fans[i].setpoint,
@@ -654,14 +654,13 @@ fcu_attach_fans(device_t dev)
 			 * of info I want to display/modify.
 			 */
 			SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
-					"pwm", CTLTYPE_INT | CTLFLAG_RW |
-					CTLFLAG_MPSAFE, dev,
-					FCU_PWM_SYSCTL_PWM | i,
-					fcu_fanrpm_sysctl, "I", "Fan PWM in %");
-					"rpm", CTLTYPE_INT | CTLFLAG_RD |
-					CTLFLAG_MPSAFE, dev,
-					FCU_PWM_SYSCTL_RPM | i,
-					fcu_fanrpm_sysctl, "I", "Fan RPM");
+			    "pwm", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
+			    dev, FCU_PWM_SYSCTL_PWM | i, fcu_fanrpm_sysctl, "I",
+			    "Fan PWM in %");
+			SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO,
+			    "rpm", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT,
+			    dev, FCU_PWM_SYSCTL_RPM | i, fcu_fanrpm_sysctl, "I",
+			    "Fan RPM");
 		}
 	}
 


More information about the svn-src-head mailing list