Skip to contentSkip to conversation

add superio-locks to

RFC PATCH New jimc 1 participant 1 message Jun 14, 2007 Hardware monitoring

lore
Share & tools
lore

jimc

author
#0 lore raw

RFC PATCH 1/4 add superio-locks to

01 - adds superio_locks -

drivers needing superio access register, and get a 'slot' with port-id
info and a mutex,multiple drivers share the same 'slot', and coordinate access with its mutex.

superio_find() - finds and reserves the slot, returned as ptr or null superio_release() - relinguishes the slot (ref-counted)

Once theyve got the reservation in struct superio * gate (as done in patches 2,3,4) they *may* use

superio_lock(gate)
superio_inb(gate, addr),
superio_outb(gate, addr, val)

---

[jimc@harpo mylocks]$ diffstat diff.locks-superio

 drivers/hwmon/Kconfig         |   10 ++
 drivers/hwmon/Makefile        |    1
 drivers/hwmon/superio_locks.c |  210 
++++++++++++++++++++++++++++++++++++++++++
 include/linux/superio-locks.h |   71 ++++++++++++++
 4 files changed, 292 insertions(+)
drivers/hwmon/Kconfig +10 -0
diff -ruNp -X exclude-diffs locks-0/drivers/hwmon/Kconfig locks-1/drivers/hwmon/Kconfig
@@ -342,6 +342,7 @@ config SENSORS_LM85
 	tristate "National Semiconductor LM85 and compatibles"
 	depends on I2C && EXPERIMENTAL
 	select HWMON_VID
+	select SUPERIO_LOCKS
 	help
 	  If you say yes here you get support for National Semiconductor LM85
 	  sensor chips and clones: ADT7463, EMC6D100, EMC6D102 and ADM1027.
@@ -649,4 +650,13 @@ config HWMON_DEBUG_CHIP
 	  a problem with I2C support and want to see more of what is going
 	  on.
 
+config SUPERIO_LOCKS
+	tristate "Super-IO port sharing"
+	default n
+	help
+	  this module provides locks for use by drivers which need to
+	  share access to a multi-function device via its superio port, 
+	  and which register that port.
+
 endif # HWMON
+
drivers/hwmon/Makefile +1 -0
diff -ruNp -X exclude-diffs locks-0/drivers/hwmon/Makefile locks-1/drivers/hwmon/Makefile
@@ -63,3 +63,4 @@ ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
 EXTRA_CFLAGS += -DDEBUG
 endif
 
+obj-$(CONFIG_SUPERIO_LOCKS)	+= superio_locks.o
\ No newline at end of file
drivers/hwmon/superio_locks.c +210 -0

210 lines not on this page · raw message

include/linux/superio-locks.h +71 -0

71 lines not on this page · raw message

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors